diff options
author | Rene Stoeckel <[email protected]> | 2005-02-06 18:51:36 +0000 |
---|---|---|
committer | Rene Stoeckel <[email protected]> | 2005-02-06 18:51:36 +0000 |
commit | d93d442eb03ec88a0c6e34ef681046d34576f00a (patch) | |
tree | 0b596832a0996bae69d7c154351b5ab2fa69d6cf /src/jake2/game/monsters | |
parent | 6e43da175094dc667c9f03ee4c901c3405a99627 (diff) |
part of refactoring the monster files
Diffstat (limited to 'src/jake2/game/monsters')
24 files changed, 26737 insertions, 0 deletions
diff --git a/src/jake2/game/monsters/M_Actor.java b/src/jake2/game/monsters/M_Actor.java new file mode 100644 index 0000000..d6c3fc9 --- /dev/null +++ b/src/jake2/game/monsters/M_Actor.java @@ -0,0 +1,1598 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 11.11.2003 by RST. +// $Id: M_Actor.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.EntTouchAdapter; +import jake2.game.EntUseAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.cplane_t; +import jake2.game.csurface_t; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Actor { + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_attak01 = 0; + + public final static int FRAME_attak02 = 1; + + public final static int FRAME_attak03 = 2; + + public final static int FRAME_attak04 = 3; + + public final static int FRAME_death101 = 4; + + public final static int FRAME_death102 = 5; + + public final static int FRAME_death103 = 6; + + public final static int FRAME_death104 = 7; + + public final static int FRAME_death105 = 8; + + public final static int FRAME_death106 = 9; + + public final static int FRAME_death107 = 10; + + public final static int FRAME_death201 = 11; + + public final static int FRAME_death202 = 12; + + public final static int FRAME_death203 = 13; + + public final static int FRAME_death204 = 14; + + public final static int FRAME_death205 = 15; + + public final static int FRAME_death206 = 16; + + public final static int FRAME_death207 = 17; + + public final static int FRAME_death208 = 18; + + public final static int FRAME_death209 = 19; + + public final static int FRAME_death210 = 20; + + public final static int FRAME_death211 = 21; + + public final static int FRAME_death212 = 22; + + public final static int FRAME_death213 = 23; + + public final static int FRAME_death301 = 24; + + public final static int FRAME_death302 = 25; + + public final static int FRAME_death303 = 26; + + public final static int FRAME_death304 = 27; + + public final static int FRAME_death305 = 28; + + public final static int FRAME_death306 = 29; + + public final static int FRAME_death307 = 30; + + public final static int FRAME_death308 = 31; + + public final static int FRAME_death309 = 32; + + public final static int FRAME_death310 = 33; + + public final static int FRAME_death311 = 34; + + public final static int FRAME_death312 = 35; + + public final static int FRAME_death313 = 36; + + public final static int FRAME_death314 = 37; + + public final static int FRAME_death315 = 38; + + public final static int FRAME_flip01 = 39; + + public final static int FRAME_flip02 = 40; + + public final static int FRAME_flip03 = 41; + + public final static int FRAME_flip04 = 42; + + public final static int FRAME_flip05 = 43; + + public final static int FRAME_flip06 = 44; + + public final static int FRAME_flip07 = 45; + + public final static int FRAME_flip08 = 46; + + public final static int FRAME_flip09 = 47; + + public final static int FRAME_flip10 = 48; + + public final static int FRAME_flip11 = 49; + + public final static int FRAME_flip12 = 50; + + public final static int FRAME_flip13 = 51; + + public final static int FRAME_flip14 = 52; + + public final static int FRAME_grenad01 = 53; + + public final static int FRAME_grenad02 = 54; + + public final static int FRAME_grenad03 = 55; + + public final static int FRAME_grenad04 = 56; + + public final static int FRAME_grenad05 = 57; + + public final static int FRAME_grenad06 = 58; + + public final static int FRAME_grenad07 = 59; + + public final static int FRAME_grenad08 = 60; + + public final static int FRAME_grenad09 = 61; + + public final static int FRAME_grenad10 = 62; + + public final static int FRAME_grenad11 = 63; + + public final static int FRAME_grenad12 = 64; + + public final static int FRAME_grenad13 = 65; + + public final static int FRAME_grenad14 = 66; + + public final static int FRAME_grenad15 = 67; + + public final static int FRAME_jump01 = 68; + + public final static int FRAME_jump02 = 69; + + public final static int FRAME_jump03 = 70; + + public final static int FRAME_jump04 = 71; + + public final static int FRAME_jump05 = 72; + + public final static int FRAME_jump06 = 73; + + public final static int FRAME_pain101 = 74; + + public final static int FRAME_pain102 = 75; + + public final static int FRAME_pain103 = 76; + + public final static int FRAME_pain201 = 77; + + public final static int FRAME_pain202 = 78; + + public final static int FRAME_pain203 = 79; + + public final static int FRAME_pain301 = 80; + + public final static int FRAME_pain302 = 81; + + public final static int FRAME_pain303 = 82; + + public final static int FRAME_push01 = 83; + + public final static int FRAME_push02 = 84; + + public final static int FRAME_push03 = 85; + + public final static int FRAME_push04 = 86; + + public final static int FRAME_push05 = 87; + + public final static int FRAME_push06 = 88; + + public final static int FRAME_push07 = 89; + + public final static int FRAME_push08 = 90; + + public final static int FRAME_push09 = 91; + + public final static int FRAME_run01 = 92; + + public final static int FRAME_run02 = 93; + + public final static int FRAME_run03 = 94; + + public final static int FRAME_run04 = 95; + + public final static int FRAME_run05 = 96; + + public final static int FRAME_run06 = 97; + + public final static int FRAME_run07 = 98; + + public final static int FRAME_run08 = 99; + + public final static int FRAME_run09 = 100; + + public final static int FRAME_run10 = 101; + + public final static int FRAME_run11 = 102; + + public final static int FRAME_run12 = 103; + + public final static int FRAME_runs01 = 104; + + public final static int FRAME_runs02 = 105; + + public final static int FRAME_runs03 = 106; + + public final static int FRAME_runs04 = 107; + + public final static int FRAME_runs05 = 108; + + public final static int FRAME_runs06 = 109; + + public final static int FRAME_runs07 = 110; + + public final static int FRAME_runs08 = 111; + + public final static int FRAME_runs09 = 112; + + public final static int FRAME_runs10 = 113; + + public final static int FRAME_runs11 = 114; + + public final static int FRAME_runs12 = 115; + + public final static int FRAME_salute01 = 116; + + public final static int FRAME_salute02 = 117; + + public final static int FRAME_salute03 = 118; + + public final static int FRAME_salute04 = 119; + + public final static int FRAME_salute05 = 120; + + public final static int FRAME_salute06 = 121; + + public final static int FRAME_salute07 = 122; + + public final static int FRAME_salute08 = 123; + + public final static int FRAME_salute09 = 124; + + public final static int FRAME_salute10 = 125; + + public final static int FRAME_salute11 = 126; + + public final static int FRAME_salute12 = 127; + + public final static int FRAME_stand101 = 128; + + public final static int FRAME_stand102 = 129; + + public final static int FRAME_stand103 = 130; + + public final static int FRAME_stand104 = 131; + + public final static int FRAME_stand105 = 132; + + public final static int FRAME_stand106 = 133; + + public final static int FRAME_stand107 = 134; + + public final static int FRAME_stand108 = 135; + + public final static int FRAME_stand109 = 136; + + public final static int FRAME_stand110 = 137; + + public final static int FRAME_stand111 = 138; + + public final static int FRAME_stand112 = 139; + + public final static int FRAME_stand113 = 140; + + public final static int FRAME_stand114 = 141; + + public final static int FRAME_stand115 = 142; + + public final static int FRAME_stand116 = 143; + + public final static int FRAME_stand117 = 144; + + public final static int FRAME_stand118 = 145; + + public final static int FRAME_stand119 = 146; + + public final static int FRAME_stand120 = 147; + + public final static int FRAME_stand121 = 148; + + public final static int FRAME_stand122 = 149; + + public final static int FRAME_stand123 = 150; + + public final static int FRAME_stand124 = 151; + + public final static int FRAME_stand125 = 152; + + public final static int FRAME_stand126 = 153; + + public final static int FRAME_stand127 = 154; + + public final static int FRAME_stand128 = 155; + + public final static int FRAME_stand129 = 156; + + public final static int FRAME_stand130 = 157; + + public final static int FRAME_stand131 = 158; + + public final static int FRAME_stand132 = 159; + + public final static int FRAME_stand133 = 160; + + public final static int FRAME_stand134 = 161; + + public final static int FRAME_stand135 = 162; + + public final static int FRAME_stand136 = 163; + + public final static int FRAME_stand137 = 164; + + public final static int FRAME_stand138 = 165; + + public final static int FRAME_stand139 = 166; + + public final static int FRAME_stand140 = 167; + + public final static int FRAME_stand201 = 168; + + public final static int FRAME_stand202 = 169; + + public final static int FRAME_stand203 = 170; + + public final static int FRAME_stand204 = 171; + + public final static int FRAME_stand205 = 172; + + public final static int FRAME_stand206 = 173; + + public final static int FRAME_stand207 = 174; + + public final static int FRAME_stand208 = 175; + + public final static int FRAME_stand209 = 176; + + public final static int FRAME_stand210 = 177; + + public final static int FRAME_stand211 = 178; + + public final static int FRAME_stand212 = 179; + + public final static int FRAME_stand213 = 180; + + public final static int FRAME_stand214 = 181; + + public final static int FRAME_stand215 = 182; + + public final static int FRAME_stand216 = 183; + + public final static int FRAME_stand217 = 184; + + public final static int FRAME_stand218 = 185; + + public final static int FRAME_stand219 = 186; + + public final static int FRAME_stand220 = 187; + + public final static int FRAME_stand221 = 188; + + public final static int FRAME_stand222 = 189; + + public final static int FRAME_stand223 = 190; + + public final static int FRAME_swim01 = 191; + + public final static int FRAME_swim02 = 192; + + public final static int FRAME_swim03 = 193; + + public final static int FRAME_swim04 = 194; + + public final static int FRAME_swim05 = 195; + + public final static int FRAME_swim06 = 196; + + public final static int FRAME_swim07 = 197; + + public final static int FRAME_swim08 = 198; + + public final static int FRAME_swim09 = 199; + + public final static int FRAME_swim10 = 200; + + public final static int FRAME_swim11 = 201; + + public final static int FRAME_swim12 = 202; + + public final static int FRAME_sw_atk01 = 203; + + public final static int FRAME_sw_atk02 = 204; + + public final static int FRAME_sw_atk03 = 205; + + public final static int FRAME_sw_atk04 = 206; + + public final static int FRAME_sw_atk05 = 207; + + public final static int FRAME_sw_atk06 = 208; + + public final static int FRAME_sw_pan01 = 209; + + public final static int FRAME_sw_pan02 = 210; + + public final static int FRAME_sw_pan03 = 211; + + public final static int FRAME_sw_pan04 = 212; + + public final static int FRAME_sw_pan05 = 213; + + public final static int FRAME_sw_std01 = 214; + + public final static int FRAME_sw_std02 = 215; + + public final static int FRAME_sw_std03 = 216; + + public final static int FRAME_sw_std04 = 217; + + public final static int FRAME_sw_std05 = 218; + + public final static int FRAME_sw_std06 = 219; + + public final static int FRAME_sw_std07 = 220; + + public final static int FRAME_sw_std08 = 221; + + public final static int FRAME_sw_std09 = 222; + + public final static int FRAME_sw_std10 = 223; + + public final static int FRAME_sw_std11 = 224; + + public final static int FRAME_sw_std12 = 225; + + public final static int FRAME_sw_std13 = 226; + + public final static int FRAME_sw_std14 = 227; + + public final static int FRAME_sw_std15 = 228; + + public final static int FRAME_sw_std16 = 229; + + public final static int FRAME_sw_std17 = 230; + + public final static int FRAME_sw_std18 = 231; + + public final static int FRAME_sw_std19 = 232; + + public final static int FRAME_sw_std20 = 233; + + public final static int FRAME_taunt01 = 234; + + public final static int FRAME_taunt02 = 235; + + public final static int FRAME_taunt03 = 236; + + public final static int FRAME_taunt04 = 237; + + public final static int FRAME_taunt05 = 238; + + public final static int FRAME_taunt06 = 239; + + public final static int FRAME_taunt07 = 240; + + public final static int FRAME_taunt08 = 241; + + public final static int FRAME_taunt09 = 242; + + public final static int FRAME_taunt10 = 243; + + public final static int FRAME_taunt11 = 244; + + public final static int FRAME_taunt12 = 245; + + public final static int FRAME_taunt13 = 246; + + public final static int FRAME_taunt14 = 247; + + public final static int FRAME_taunt15 = 248; + + public final static int FRAME_taunt16 = 249; + + public final static int FRAME_taunt17 = 250; + + public final static int FRAME_walk01 = 251; + + public final static int FRAME_walk02 = 252; + + public final static int FRAME_walk03 = 253; + + public final static int FRAME_walk04 = 254; + + public final static int FRAME_walk05 = 255; + + public final static int FRAME_walk06 = 256; + + public final static int FRAME_walk07 = 257; + + public final static int FRAME_walk08 = 258; + + public final static int FRAME_walk09 = 259; + + public final static int FRAME_walk10 = 260; + + public final static int FRAME_walk11 = 261; + + public final static int FRAME_wave01 = 262; + + public final static int FRAME_wave02 = 263; + + public final static int FRAME_wave03 = 264; + + public final static int FRAME_wave04 = 265; + + public final static int FRAME_wave05 = 266; + + public final static int FRAME_wave06 = 267; + + public final static int FRAME_wave07 = 268; + + public final static int FRAME_wave08 = 269; + + public final static int FRAME_wave09 = 270; + + public final static int FRAME_wave10 = 271; + + public final static int FRAME_wave11 = 272; + + public final static int FRAME_wave12 = 273; + + public final static int FRAME_wave13 = 274; + + public final static int FRAME_wave14 = 275; + + public final static int FRAME_wave15 = 276; + + public final static int FRAME_wave16 = 277; + + public final static int FRAME_wave17 = 278; + + public final static int FRAME_wave18 = 279; + + public final static int FRAME_wave19 = 280; + + public final static int FRAME_wave20 = 281; + + public final static int FRAME_wave21 = 282; + + public final static int FRAME_bl_atk01 = 283; + + public final static int FRAME_bl_atk02 = 284; + + public final static int FRAME_bl_atk03 = 285; + + public final static int FRAME_bl_atk04 = 286; + + public final static int FRAME_bl_atk05 = 287; + + public final static int FRAME_bl_atk06 = 288; + + public final static int FRAME_bl_flp01 = 289; + + public final static int FRAME_bl_flp02 = 290; + + public final static int FRAME_bl_flp13 = 291; + + public final static int FRAME_bl_flp14 = 292; + + public final static int FRAME_bl_flp15 = 293; + + public final static int FRAME_bl_jmp01 = 294; + + public final static int FRAME_bl_jmp02 = 295; + + public final static int FRAME_bl_jmp03 = 296; + + public final static int FRAME_bl_jmp04 = 297; + + public final static int FRAME_bl_jmp05 = 298; + + public final static int FRAME_bl_jmp06 = 299; + + public final static int FRAME_bl_pn101 = 300; + + public final static int FRAME_bl_pn102 = 301; + + public final static int FRAME_bl_pn103 = 302; + + public final static int FRAME_bl_pn201 = 303; + + public final static int FRAME_bl_pn202 = 304; + + public final static int FRAME_bl_pn203 = 305; + + public final static int FRAME_bl_pn301 = 306; + + public final static int FRAME_bl_pn302 = 307; + + public final static int FRAME_bl_pn303 = 308; + + public final static int FRAME_bl_psh08 = 309; + + public final static int FRAME_bl_psh09 = 310; + + public final static int FRAME_bl_run01 = 311; + + public final static int FRAME_bl_run02 = 312; + + public final static int FRAME_bl_run03 = 313; + + public final static int FRAME_bl_run04 = 314; + + public final static int FRAME_bl_run05 = 315; + + public final static int FRAME_bl_run06 = 316; + + public final static int FRAME_bl_run07 = 317; + + public final static int FRAME_bl_run08 = 318; + + public final static int FRAME_bl_run09 = 319; + + public final static int FRAME_bl_run10 = 320; + + public final static int FRAME_bl_run11 = 321; + + public final static int FRAME_bl_run12 = 322; + + public final static int FRAME_bl_rns03 = 323; + + public final static int FRAME_bl_rns04 = 324; + + public final static int FRAME_bl_rns05 = 325; + + public final static int FRAME_bl_rns06 = 326; + + public final static int FRAME_bl_rns07 = 327; + + public final static int FRAME_bl_rns08 = 328; + + public final static int FRAME_bl_rns09 = 329; + + public final static int FRAME_bl_sal10 = 330; + + public final static int FRAME_bl_sal11 = 331; + + public final static int FRAME_bl_sal12 = 332; + + public final static int FRAME_bl_std01 = 333; + + public final static int FRAME_bl_std02 = 334; + + public final static int FRAME_bl_std03 = 335; + + public final static int FRAME_bl_std04 = 336; + + public final static int FRAME_bl_std05 = 337; + + public final static int FRAME_bl_std06 = 338; + + public final static int FRAME_bl_std07 = 339; + + public final static int FRAME_bl_std08 = 340; + + public final static int FRAME_bl_std09 = 341; + + public final static int FRAME_bl_std10 = 342; + + public final static int FRAME_bl_std11 = 343; + + public final static int FRAME_bl_std12 = 344; + + public final static int FRAME_bl_std13 = 345; + + public final static int FRAME_bl_std14 = 346; + + public final static int FRAME_bl_std15 = 347; + + public final static int FRAME_bl_std16 = 348; + + public final static int FRAME_bl_std17 = 349; + + public final static int FRAME_bl_std18 = 350; + + public final static int FRAME_bl_std19 = 351; + + public final static int FRAME_bl_std20 = 352; + + public final static int FRAME_bl_std21 = 353; + + public final static int FRAME_bl_std22 = 354; + + public final static int FRAME_bl_std23 = 355; + + public final static int FRAME_bl_std24 = 356; + + public final static int FRAME_bl_std25 = 357; + + public final static int FRAME_bl_std26 = 358; + + public final static int FRAME_bl_std27 = 359; + + public final static int FRAME_bl_std28 = 360; + + public final static int FRAME_bl_std29 = 361; + + public final static int FRAME_bl_std30 = 362; + + public final static int FRAME_bl_std31 = 363; + + public final static int FRAME_bl_std32 = 364; + + public final static int FRAME_bl_std33 = 365; + + public final static int FRAME_bl_std34 = 366; + + public final static int FRAME_bl_std35 = 367; + + public final static int FRAME_bl_std36 = 368; + + public final static int FRAME_bl_std37 = 369; + + public final static int FRAME_bl_std38 = 370; + + public final static int FRAME_bl_std39 = 371; + + public final static int FRAME_bl_std40 = 372; + + public final static int FRAME_bl_swm01 = 373; + + public final static int FRAME_bl_swm02 = 374; + + public final static int FRAME_bl_swm03 = 375; + + public final static int FRAME_bl_swm04 = 376; + + public final static int FRAME_bl_swm05 = 377; + + public final static int FRAME_bl_swm06 = 378; + + public final static int FRAME_bl_swm07 = 379; + + public final static int FRAME_bl_swm08 = 380; + + public final static int FRAME_bl_swm09 = 381; + + public final static int FRAME_bl_swm10 = 382; + + public final static int FRAME_bl_swm11 = 383; + + public final static int FRAME_bl_swm12 = 384; + + public final static int FRAME_bl_swk01 = 385; + + public final static int FRAME_bl_swk02 = 386; + + public final static int FRAME_bl_swk03 = 387; + + public final static int FRAME_bl_swk04 = 388; + + public final static int FRAME_bl_swk05 = 389; + + public final static int FRAME_bl_swk06 = 390; + + public final static int FRAME_bl_swp01 = 391; + + public final static int FRAME_bl_swp02 = 392; + + public final static int FRAME_bl_swp03 = 393; + + public final static int FRAME_bl_swp04 = 394; + + public final static int FRAME_bl_swp05 = 395; + + public final static int FRAME_bl_sws01 = 396; + + public final static int FRAME_bl_sws02 = 397; + + public final static int FRAME_bl_sws03 = 398; + + public final static int FRAME_bl_sws04 = 399; + + public final static int FRAME_bl_sws05 = 400; + + public final static int FRAME_bl_sws06 = 401; + + public final static int FRAME_bl_sws07 = 402; + + public final static int FRAME_bl_sws08 = 403; + + public final static int FRAME_bl_sws09 = 404; + + public final static int FRAME_bl_sws10 = 405; + + public final static int FRAME_bl_sws11 = 406; + + public final static int FRAME_bl_sws12 = 407; + + public final static int FRAME_bl_sws13 = 408; + + public final static int FRAME_bl_sws14 = 409; + + public final static int FRAME_bl_tau14 = 410; + + public final static int FRAME_bl_tau15 = 411; + + public final static int FRAME_bl_tau16 = 412; + + public final static int FRAME_bl_tau17 = 413; + + public final static int FRAME_bl_wlk01 = 414; + + public final static int FRAME_bl_wlk02 = 415; + + public final static int FRAME_bl_wlk03 = 416; + + public final static int FRAME_bl_wlk04 = 417; + + public final static int FRAME_bl_wlk05 = 418; + + public final static int FRAME_bl_wlk06 = 419; + + public final static int FRAME_bl_wlk07 = 420; + + public final static int FRAME_bl_wlk08 = 421; + + public final static int FRAME_bl_wlk09 = 422; + + public final static int FRAME_bl_wlk10 = 423; + + public final static int FRAME_bl_wlk11 = 424; + + public final static int FRAME_bl_wav19 = 425; + + public final static int FRAME_bl_wav20 = 426; + + public final static int FRAME_bl_wav21 = 427; + + public final static int FRAME_cr_atk01 = 428; + + public final static int FRAME_cr_atk02 = 429; + + public final static int FRAME_cr_atk03 = 430; + + public final static int FRAME_cr_atk04 = 431; + + public final static int FRAME_cr_atk05 = 432; + + public final static int FRAME_cr_atk06 = 433; + + public final static int FRAME_cr_atk07 = 434; + + public final static int FRAME_cr_atk08 = 435; + + public final static int FRAME_cr_pan01 = 436; + + public final static int FRAME_cr_pan02 = 437; + + public final static int FRAME_cr_pan03 = 438; + + public final static int FRAME_cr_pan04 = 439; + + public final static int FRAME_cr_std01 = 440; + + public final static int FRAME_cr_std02 = 441; + + public final static int FRAME_cr_std03 = 442; + + public final static int FRAME_cr_std04 = 443; + + public final static int FRAME_cr_std05 = 444; + + public final static int FRAME_cr_std06 = 445; + + public final static int FRAME_cr_std07 = 446; + + public final static int FRAME_cr_std08 = 447; + + public final static int FRAME_cr_wlk01 = 448; + + public final static int FRAME_cr_wlk02 = 449; + + public final static int FRAME_cr_wlk03 = 450; + + public final static int FRAME_cr_wlk04 = 451; + + public final static int FRAME_cr_wlk05 = 452; + + public final static int FRAME_cr_wlk06 = 453; + + public final static int FRAME_cr_wlk07 = 454; + + public final static int FRAME_crbl_a01 = 455; + + public final static int FRAME_crbl_a02 = 456; + + public final static int FRAME_crbl_a03 = 457; + + public final static int FRAME_crbl_a04 = 458; + + public final static int FRAME_crbl_a05 = 459; + + public final static int FRAME_crbl_a06 = 460; + + public final static int FRAME_crbl_a07 = 461; + + public final static int FRAME_crbl_p01 = 462; + + public final static int FRAME_crbl_p02 = 463; + + public final static int FRAME_crbl_p03 = 464; + + public final static int FRAME_crbl_p04 = 465; + + public final static int FRAME_crbl_s01 = 466; + + public final static int FRAME_crbl_s02 = 467; + + public final static int FRAME_crbl_s03 = 468; + + public final static int FRAME_crbl_s04 = 469; + + public final static int FRAME_crbl_s05 = 470; + + public final static int FRAME_crbl_s06 = 471; + + public final static int FRAME_crbl_s07 = 472; + + public final static int FRAME_crbl_s08 = 473; + + public final static int FRAME_crbl_w01 = 474; + + public final static int FRAME_crbl_w02 = 475; + + public final static int FRAME_crbl_w03 = 476; + + public final static int FRAME_crbl_w04 = 477; + + public final static int FRAME_crbl_w05 = 478; + + public final static int FRAME_crbl_w06 = 479; + + public final static int FRAME_crbl_w07 = 480; + + public final static float MODEL_SCALE = 1.000000f; + + public final static int MAX_ACTOR_NAMES = 8; + + static String actor_names[] = { "Hellrot", "Tokay", "Killme", "Disruptor", + "Adrianator", "Rambear", "Titus", "Bitterman" }; + + static EntThinkAdapter actor_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = actor_move_stand; + + // randomize on startup + if (GameBase.level.time < 1.0) + self.s.frame = self.monsterinfo.currentmove.firstframe + + (Lib.rand() % (self.monsterinfo.currentmove.lastframe + - self.monsterinfo.currentmove.firstframe + 1)); + return true; + } + }; + + static mframe_t actor_frames_stand[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null), + new mframe_t(GameAI.ai_stand, 0f, null) }; + + static mmove_t actor_move_stand = new mmove_t(FRAME_stand101, + FRAME_stand140, actor_frames_stand, null); + + static mframe_t actor_frames_walk[] = { + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null) }; + + static mmove_t actor_move_walk = new mmove_t(FRAME_walk01, FRAME_walk08, + actor_frames_walk, null); + + static EntThinkAdapter actor_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = actor_move_walk; + return true; + } + }; + + static mframe_t actor_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 4, null), + new mframe_t(GameAI.ai_run, 15, null), + new mframe_t(GameAI.ai_run, 15, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 20, null), + new mframe_t(GameAI.ai_run, 15, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 17, null), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, -2, null), + new mframe_t(GameAI.ai_run, -2, null), + new mframe_t(GameAI.ai_run, -1, null) }; + + static mmove_t actor_move_run = new mmove_t(FRAME_run02, FRAME_run07, + actor_frames_run, null); + + static EntThinkAdapter actor_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((GameBase.level.time < self.pain_debounce_time) + && (self.enemy == null)) { + if (self.movetarget != null) + actor_walk.think(self); + else + actor_stand.think(self); + return true; + } + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + actor_stand.think(self); + return true; + } + + self.monsterinfo.currentmove = actor_move_run; + return true; + + } + }; + + static mframe_t actor_frames_pain1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t actor_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain103, + actor_frames_pain1, actor_run); + + static mframe_t actor_frames_pain2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t actor_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain203, + actor_frames_pain2, actor_run); + + static mframe_t actor_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t actor_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain303, + actor_frames_pain3, actor_run); + + static mframe_t actor_frames_flipoff[] = new mframe_t[] { + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null) }; + + static mmove_t actor_move_flipoff = new mmove_t(FRAME_flip01, FRAME_flip14, + actor_frames_flipoff, actor_run); + + static mframe_t actor_frames_taunt[] = new mframe_t[] { + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null), + new mframe_t(GameAI.ai_turn, 0, null) }; + + static mmove_t actor_move_taunt = new mmove_t(FRAME_taunt01, FRAME_taunt17, + actor_frames_taunt, actor_run); + + static String messages[] = { "Watch it", "#$@*&", "Idiot", + "Check your targets" }; + + static EntPainAdapter actor_pain = new EntPainAdapter() { + 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; + //GameBase.gi.sound (self, CHAN_VOICE, actor.sound_pain, 1, + // ATTN_NORM, 0); + + if ((other.client != null) && (Lib.random() < 0.4)) { + float v[] = { 0, 0, 0 }; + + String name; + + Math3D.VectorSubtract(other.s.origin, self.s.origin, v); + self.ideal_yaw = Math3D.vectoyaw(v); + if (Lib.random() < 0.5f) + self.monsterinfo.currentmove = actor_move_flipoff; + else + self.monsterinfo.currentmove = actor_move_taunt; + + // FIXME: does the ent-id work out ? + name = actor_names[(self.index) % MAX_ACTOR_NAMES]; + + GameBase.gi.cprintf(other, Defines.PRINT_CHAT, name + ": " + + messages[Lib.rand() % 3] + "!\n"); + return; + } + + n = Lib.rand() % 3; + if (n == 0) + self.monsterinfo.currentmove = actor_move_pain1; + else if (n == 1) + self.monsterinfo.currentmove = actor_move_pain2; + else + self.monsterinfo.currentmove = actor_move_pain3; + } + }; + + static EntThinkAdapter actor_dead = new EntThinkAdapter() { + 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 actor_frames_death1[] = 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, -13, null), + new mframe_t(GameAI.ai_move, 14, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t actor_move_death1 = new mmove_t(FRAME_death101, + FRAME_death107, actor_frames_death1, actor_dead); + + static mframe_t actor_frames_death2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 7, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -9, null), + new mframe_t(GameAI.ai_move, -13, null), + new mframe_t(GameAI.ai_move, -13, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t actor_move_death2 = new mmove_t(FRAME_death201, + FRAME_death213, actor_frames_death2, actor_dead); + + static EntDieAdapter actor_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + int n; + + // check for gib + if (self.health <= -80) { + // gi.sound (self, CHAN_VOICE, actor.sound_gib, 1, ATTN_NORM, + // 0); + for (n = 0; n < 2; n++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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 + // gi.sound (self, CHAN_VOICE, actor.sound_die, 1, ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + n = Lib.rand() % 2; + if (n == 0) + self.monsterinfo.currentmove = actor_move_death1; + else + self.monsterinfo.currentmove = actor_move_death2; + } + }; + + static EntThinkAdapter actor_fire = new EntThinkAdapter() { + public boolean think(edict_t self) { + actorMachineGun(self); + + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + + return true; + } + }; + + static mframe_t actor_frames_attack[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, -2, actor_fire), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 2, null) }; + + static mmove_t actor_move_attack = new mmove_t(FRAME_attak01, + FRAME_attak04, actor_frames_attack, actor_run); + + static EntThinkAdapter actor_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + int n; + + self.monsterinfo.currentmove = actor_move_attack; + n = (Lib.rand() & 15) + 3 + 7; + self.monsterinfo.pausetime = GameBase.level.time + n + * Defines.FRAMETIME; + + return true; + } + }; + + static EntUseAdapter actor_use = new EntUseAdapter() { + public void use(edict_t self, edict_t other, edict_t activator) { + float v[] = { 0, 0, 0 }; + + self.goalentity = self.movetarget = GameBase + .G_PickTarget(self.target); + if ((null == self.movetarget) + || (Lib.strcmp(self.movetarget.classname, "target_actor") != 0)) { + GameBase.gi + .dprintf(self.classname + " has bad target " + + self.target + " at " + + Lib.vtos(self.s.origin) + "\n"); + self.target = null; + self.monsterinfo.pausetime = 100000000; + self.monsterinfo.stand.think(self); + return; + } + + Math3D.VectorSubtract(self.goalentity.s.origin, self.s.origin, v); + self.ideal_yaw = self.s.angles[Defines.YAW] = Math3D.vectoyaw(v); + self.monsterinfo.walk.think(self); + self.target = null; + } + }; + + /* + * QUAKED target_actor (.5 .3 0) (-8 -8 -8) (8 8 8) JUMP SHOOT ATTACK x HOLD + * BRUTAL JUMP jump in set direction upon reaching this target SHOOT take a + * single shot at the pathtarget ATTACK attack pathtarget until it or actor + * is dead + * + * "target" next target_actor "pathtarget" target of any action to be taken + * at this point "wait" amount of time actor should pause at this point + * "message" actor will "say" this to the player + * + * for JUMP only: "speed" speed thrown forward (default 200) "height" speed + * thrown upwards (default 200) + */ + + static EntTouchAdapter target_actor_touch = new EntTouchAdapter() { + public void touch(edict_t self, edict_t other, cplane_t plane, + csurface_t surf) { + float v[] = { 0, 0, 0 }; + + if (other.movetarget != self) + return; + + if (other.enemy != null) + return; + + other.goalentity = other.movetarget = null; + + if (self.message != null) { + int n; + edict_t ent; + + for (n = 1; n <= GameBase.game.maxclients; n++) { + ent = GameBase.g_edicts[n]; + if (!ent.inuse) + continue; + GameBase.gi.cprintf(ent, Defines.PRINT_CHAT, + actor_names[(other.index) % MAX_ACTOR_NAMES] + ": " + + self.message + "\n"); + } + } + + if ((self.spawnflags & 1) != 0) //jump + { + other.velocity[0] = self.movedir[0] * self.speed; + other.velocity[1] = self.movedir[1] * self.speed; + + if (other.groundentity != null) { + other.groundentity = null; + other.velocity[2] = self.movedir[2]; + GameBase.gi.sound(other, Defines.CHAN_VOICE, GameBase.gi + .soundindex("player/male/jump1.wav"), 1, + Defines.ATTN_NORM, 0); + } + } + + if ((self.spawnflags & 2) != 0) //shoot + { + } else if ((self.spawnflags & 4) != 0) //attack + { + other.enemy = GameBase.G_PickTarget(self.pathtarget); + if (other.enemy != null) { + other.goalentity = other.enemy; + if ((self.spawnflags & 32) != 0) + other.monsterinfo.aiflags |= Defines.AI_BRUTAL; + if ((self.spawnflags & 16) != 0) { + other.monsterinfo.aiflags |= Defines.AI_STAND_GROUND; + actor_stand.think(other); + } else { + actor_run.think(other); + } + } + } + + if (0 != (self.spawnflags & 6) && (self.pathtarget != null)) { + String savetarget; + + savetarget = self.target; + self.target = self.pathtarget; + GameUtil.G_UseTargets(self, other); + self.target = savetarget; + } + + other.movetarget = GameBase.G_PickTarget(self.target); + + if (other.goalentity == null) + other.goalentity = other.movetarget; + + if (null == other.movetarget && null == other.enemy) { + other.monsterinfo.pausetime = GameBase.level.time + 100000000; + other.monsterinfo.stand.think(other); + } else if (other.movetarget == other.goalentity) { + Math3D.VectorSubtract(other.movetarget.s.origin, + other.s.origin, v); + other.ideal_yaw = Math3D.vectoyaw(v); + } + } + }; + + static void actorMachineGun(edict_t self) { + float start[] = { 0, 0, 0 }, target[] = { 0, 0, 0 }; + + float forward[] = { 0, 0, 0 }, right[] = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_ACTOR_MACHINEGUN_1], + forward, right, start); + + if (self.enemy != null) { + if (self.enemy.health > 0) { + Math3D.VectorMA(self.enemy.s.origin, -0.2f, + self.enemy.velocity, target); + target[2] += self.enemy.viewheight; + } else { + Math3D.VectorCopy(self.enemy.absmin, target); + target[2] += (self.enemy.size[2] / 2); + } + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + } else { + Math3D.AngleVectors(self.s.angles, forward, null, null); + } + Monster.monster_fire_bullet(self, start, forward, 3, 4, + Defines.DEFAULT_BULLET_HSPREAD, Defines.DEFAULT_BULLET_VSPREAD, + Defines.MZ2_ACTOR_MACHINEGUN_1); + } + + /** + * QUAKED misc_actor (1 .5 0) (-16 -16 -24) (16 16 32) + */ + + public static void SP_misc_actor(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + if (self.targetname != null) { + GameBase.gi.dprintf("untargeted " + self.classname + " at " + + Lib.vtos(self.s.origin) + "\n"); + GameUtil.G_FreeEdict(self); + return; + } + + if (self.target != null) { + GameBase.gi.dprintf(self.classname + " with no target at " + + Lib.vtos(self.s.origin) + "\n"); + GameUtil.G_FreeEdict(self); + return; + } + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi.modelindex("players/male/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + + if (0 == self.health) + self.health = 100; + self.mass = 200; + + self.pain = actor_pain; + self.die = actor_die; + + self.monsterinfo.stand = actor_stand; + self.monsterinfo.walk = actor_walk; + self.monsterinfo.run = actor_run; + self.monsterinfo.attack = actor_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = null; + + self.monsterinfo.aiflags |= Defines.AI_GOOD_GUY; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = actor_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + + // actors always start in a dormant state, they *must* be used to get + // going + self.use = actor_use; + } + + public static void SP_target_actor(edict_t self) { + if (self.targetname != null) + GameBase.gi.dprintf(self.classname + " with no targetname at " + + Lib.vtos(self.s.origin) + " \n"); + + self.solid = Defines.SOLID_TRIGGER; + self.touch = target_actor_touch; + Math3D.VectorSet(self.mins, -8, -8, -8); + Math3D.VectorSet(self.maxs, 8, 8, 8); + self.svflags = Defines.SVF_NOCLIENT; + + if ((self.spawnflags & 1) != 0) { + if (0 == self.speed) + self.speed = 200; + if (0 == GameBase.st.height) + GameBase.st.height = 200; + if (self.s.angles[Defines.YAW] == 0) + self.s.angles[Defines.YAW] = 360; + GameBase.G_SetMovedir(self.s.angles, self.movedir); + self.movedir[2] = GameBase.st.height; + } + + GameBase.gi.linkentity(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Berserk.java b/src/jake2/game/monsters/M_Berserk.java new file mode 100644 index 0000000..2158a51 --- /dev/null +++ b/src/jake2/game/monsters/M_Berserk.java @@ -0,0 +1,986 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 11.11.2003 by RST +// $Id: M_Berserk.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Berserk { + + public final static int FRAME_stand1 = 0; + + public final static int FRAME_stand2 = 1; + + public final static int FRAME_stand3 = 2; + + public final static int FRAME_stand4 = 3; + + public final static int FRAME_stand5 = 4; + + public final static int FRAME_standb1 = 5; + + public final static int FRAME_standb2 = 6; + + public final static int FRAME_standb3 = 7; + + public final static int FRAME_standb4 = 8; + + public final static int FRAME_standb5 = 9; + + public final static int FRAME_standb6 = 10; + + public final static int FRAME_standb7 = 11; + + public final static int FRAME_standb8 = 12; + + public final static int FRAME_standb9 = 13; + + public final static int FRAME_standb10 = 14; + + public final static int FRAME_standb11 = 15; + + public final static int FRAME_standb12 = 16; + + public final static int FRAME_standb13 = 17; + + public final static int FRAME_standb14 = 18; + + public final static int FRAME_standb15 = 19; + + public final static int FRAME_standb16 = 20; + + public final static int FRAME_standb17 = 21; + + public final static int FRAME_standb18 = 22; + + public final static int FRAME_standb19 = 23; + + public final static int FRAME_standb20 = 24; + + public final static int FRAME_walkc1 = 25; + + public final static int FRAME_walkc2 = 26; + + public final static int FRAME_walkc3 = 27; + + public final static int FRAME_walkc4 = 28; + + public final static int FRAME_walkc5 = 29; + + public final static int FRAME_walkc6 = 30; + + public final static int FRAME_walkc7 = 31; + + public final static int FRAME_walkc8 = 32; + + public final static int FRAME_walkc9 = 33; + + public final static int FRAME_walkc10 = 34; + + public final static int FRAME_walkc11 = 35; + + public final static int FRAME_run1 = 36; + + public final static int FRAME_run2 = 37; + + public final static int FRAME_run3 = 38; + + public final static int FRAME_run4 = 39; + + public final static int FRAME_run5 = 40; + + public final static int FRAME_run6 = 41; + + public final static int FRAME_att_a1 = 42; + + public final static int FRAME_att_a2 = 43; + + public final static int FRAME_att_a3 = 44; + + public final static int FRAME_att_a4 = 45; + + public final static int FRAME_att_a5 = 46; + + public final static int FRAME_att_a6 = 47; + + public final static int FRAME_att_a7 = 48; + + public final static int FRAME_att_a8 = 49; + + public final static int FRAME_att_a9 = 50; + + public final static int FRAME_att_a10 = 51; + + public final static int FRAME_att_a11 = 52; + + public final static int FRAME_att_a12 = 53; + + public final static int FRAME_att_a13 = 54; + + public final static int FRAME_att_b1 = 55; + + public final static int FRAME_att_b2 = 56; + + public final static int FRAME_att_b3 = 57; + + public final static int FRAME_att_b4 = 58; + + public final static int FRAME_att_b5 = 59; + + public final static int FRAME_att_b6 = 60; + + public final static int FRAME_att_b7 = 61; + + public final static int FRAME_att_b8 = 62; + + public final static int FRAME_att_b9 = 63; + + public final static int FRAME_att_b10 = 64; + + public final static int FRAME_att_b11 = 65; + + public final static int FRAME_att_b12 = 66; + + public final static int FRAME_att_b13 = 67; + + public final static int FRAME_att_b14 = 68; + + public final static int FRAME_att_b15 = 69; + + public final static int FRAME_att_b16 = 70; + + public final static int FRAME_att_b17 = 71; + + public final static int FRAME_att_b18 = 72; + + public final static int FRAME_att_b19 = 73; + + public final static int FRAME_att_b20 = 74; + + public final static int FRAME_att_b21 = 75; + + public final static int FRAME_att_c1 = 76; + + public final static int FRAME_att_c2 = 77; + + public final static int FRAME_att_c3 = 78; + + public final static int FRAME_att_c4 = 79; + + public final static int FRAME_att_c5 = 80; + + public final static int FRAME_att_c6 = 81; + + public final static int FRAME_att_c7 = 82; + + public final static int FRAME_att_c8 = 83; + + public final static int FRAME_att_c9 = 84; + + public final static int FRAME_att_c10 = 85; + + public final static int FRAME_att_c11 = 86; + + public final static int FRAME_att_c12 = 87; + + public final static int FRAME_att_c13 = 88; + + public final static int FRAME_att_c14 = 89; + + public final static int FRAME_att_c15 = 90; + + public final static int FRAME_att_c16 = 91; + + public final static int FRAME_att_c17 = 92; + + public final static int FRAME_att_c18 = 93; + + public final static int FRAME_att_c19 = 94; + + public final static int FRAME_att_c20 = 95; + + public final static int FRAME_att_c21 = 96; + + public final static int FRAME_att_c22 = 97; + + public final static int FRAME_att_c23 = 98; + + public final static int FRAME_att_c24 = 99; + + public final static int FRAME_att_c25 = 100; + + public final static int FRAME_att_c26 = 101; + + public final static int FRAME_att_c27 = 102; + + public final static int FRAME_att_c28 = 103; + + public final static int FRAME_att_c29 = 104; + + public final static int FRAME_att_c30 = 105; + + public final static int FRAME_att_c31 = 106; + + public final static int FRAME_att_c32 = 107; + + public final static int FRAME_att_c33 = 108; + + public final static int FRAME_att_c34 = 109; + + public final static int FRAME_r_att1 = 110; + + public final static int FRAME_r_att2 = 111; + + public final static int FRAME_r_att3 = 112; + + public final static int FRAME_r_att4 = 113; + + public final static int FRAME_r_att5 = 114; + + public final static int FRAME_r_att6 = 115; + + public final static int FRAME_r_att7 = 116; + + public final static int FRAME_r_att8 = 117; + + public final static int FRAME_r_att9 = 118; + + public final static int FRAME_r_att10 = 119; + + public final static int FRAME_r_att11 = 120; + + public final static int FRAME_r_att12 = 121; + + public final static int FRAME_r_att13 = 122; + + public final static int FRAME_r_att14 = 123; + + public final static int FRAME_r_att15 = 124; + + public final static int FRAME_r_att16 = 125; + + public final static int FRAME_r_att17 = 126; + + public final static int FRAME_r_att18 = 127; + + public final static int FRAME_r_attb1 = 128; + + public final static int FRAME_r_attb2 = 129; + + public final static int FRAME_r_attb3 = 130; + + public final static int FRAME_r_attb4 = 131; + + public final static int FRAME_r_attb5 = 132; + + public final static int FRAME_r_attb6 = 133; + + public final static int FRAME_r_attb7 = 134; + + public final static int FRAME_r_attb8 = 135; + + public final static int FRAME_r_attb9 = 136; + + public final static int FRAME_r_attb10 = 137; + + public final static int FRAME_r_attb11 = 138; + + public final static int FRAME_r_attb12 = 139; + + public final static int FRAME_r_attb13 = 140; + + public final static int FRAME_r_attb14 = 141; + + public final static int FRAME_r_attb15 = 142; + + public final static int FRAME_r_attb16 = 143; + + public final static int FRAME_r_attb17 = 144; + + public final static int FRAME_r_attb18 = 145; + + public final static int FRAME_slam1 = 146; + + public final static int FRAME_slam2 = 147; + + public final static int FRAME_slam3 = 148; + + public final static int FRAME_slam4 = 149; + + public final static int FRAME_slam5 = 150; + + public final static int FRAME_slam6 = 151; + + public final static int FRAME_slam7 = 152; + + public final static int FRAME_slam8 = 153; + + public final static int FRAME_slam9 = 154; + + public final static int FRAME_slam10 = 155; + + public final static int FRAME_slam11 = 156; + + public final static int FRAME_slam12 = 157; + + public final static int FRAME_slam13 = 158; + + public final static int FRAME_slam14 = 159; + + public final static int FRAME_slam15 = 160; + + public final static int FRAME_slam16 = 161; + + public final static int FRAME_slam17 = 162; + + public final static int FRAME_slam18 = 163; + + public final static int FRAME_slam19 = 164; + + public final static int FRAME_slam20 = 165; + + public final static int FRAME_slam21 = 166; + + public final static int FRAME_slam22 = 167; + + public final static int FRAME_slam23 = 168; + + public final static int FRAME_duck1 = 169; + + public final static int FRAME_duck2 = 170; + + public final static int FRAME_duck3 = 171; + + public final static int FRAME_duck4 = 172; + + public final static int FRAME_duck5 = 173; + + public final static int FRAME_duck6 = 174; + + public final static int FRAME_duck7 = 175; + + public final static int FRAME_duck8 = 176; + + public final static int FRAME_duck9 = 177; + + public final static int FRAME_duck10 = 178; + + public final static int FRAME_fall1 = 179; + + public final static int FRAME_fall2 = 180; + + public final static int FRAME_fall3 = 181; + + public final static int FRAME_fall4 = 182; + + public final static int FRAME_fall5 = 183; + + public final static int FRAME_fall6 = 184; + + public final static int FRAME_fall7 = 185; + + public final static int FRAME_fall8 = 186; + + public final static int FRAME_fall9 = 187; + + public final static int FRAME_fall10 = 188; + + public final static int FRAME_fall11 = 189; + + public final static int FRAME_fall12 = 190; + + public final static int FRAME_fall13 = 191; + + public final static int FRAME_fall14 = 192; + + public final static int FRAME_fall15 = 193; + + public final static int FRAME_fall16 = 194; + + public final static int FRAME_fall17 = 195; + + public final static int FRAME_fall18 = 196; + + public final static int FRAME_fall19 = 197; + + public final static int FRAME_fall20 = 198; + + public final static int FRAME_painc1 = 199; + + public final static int FRAME_painc2 = 200; + + public final static int FRAME_painc3 = 201; + + public final static int FRAME_painc4 = 202; + + public final static int FRAME_painb1 = 203; + + public final static int FRAME_painb2 = 204; + + public final static int FRAME_painb3 = 205; + + public final static int FRAME_painb4 = 206; + + public final static int FRAME_painb5 = 207; + + public final static int FRAME_painb6 = 208; + + public final static int FRAME_painb7 = 209; + + public final static int FRAME_painb8 = 210; + + public final static int FRAME_painb9 = 211; + + public final static int FRAME_painb10 = 212; + + public final static int FRAME_painb11 = 213; + + public final static int FRAME_painb12 = 214; + + public final static int FRAME_painb13 = 215; + + public final static int FRAME_painb14 = 216; + + public final static int FRAME_painb15 = 217; + + public final static int FRAME_painb16 = 218; + + public final static int FRAME_painb17 = 219; + + public final static int FRAME_painb18 = 220; + + public final static int FRAME_painb19 = 221; + + public final static int FRAME_painb20 = 222; + + public final static int FRAME_death1 = 223; + + public final static int FRAME_death2 = 224; + + public final static int FRAME_death3 = 225; + + public final static int FRAME_death4 = 226; + + public final static int FRAME_death5 = 227; + + public final static int FRAME_death6 = 228; + + public final static int FRAME_death7 = 229; + + public final static int FRAME_death8 = 230; + + public final static int FRAME_death9 = 231; + + public final static int FRAME_death10 = 232; + + public final static int FRAME_death11 = 233; + + public final static int FRAME_death12 = 234; + + public final static int FRAME_death13 = 235; + + public final static int FRAME_deathc1 = 236; + + public final static int FRAME_deathc2 = 237; + + public final static int FRAME_deathc3 = 238; + + public final static int FRAME_deathc4 = 239; + + public final static int FRAME_deathc5 = 240; + + public final static int FRAME_deathc6 = 241; + + public final static int FRAME_deathc7 = 242; + + public final static int FRAME_deathc8 = 243; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain; + + static int sound_die; + + static int sound_idle; + + static int sound_punch; + + static int sound_sight; + + static int sound_search; + + static EntInteractAdapter berserk_sight = new EntInteractAdapter() { + 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 EntThinkAdapter berserk_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter berserk_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + return true; + + if (Lib.random() > 0.15f) + return true; + + self.monsterinfo.currentmove = berserk_move_stand_fidget; + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static mframe_t berserk_frames_stand[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, berserk_fidget), + 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 berserk_move_stand = new mmove_t(FRAME_stand1, FRAME_stand5, + berserk_frames_stand, null); + + static EntThinkAdapter berserk_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = berserk_move_stand; + return true; + } + }; + + static mframe_t berserk_frames_stand_fidget[] = 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) }; + + static mmove_t berserk_move_stand_fidget = new mmove_t(FRAME_standb1, + FRAME_standb20, berserk_frames_stand_fidget, berserk_stand); + + static mframe_t berserk_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 9.1f, null), + new mframe_t(GameAI.ai_walk, 6.3f, null), + new mframe_t(GameAI.ai_walk, 4.9f, null), + new mframe_t(GameAI.ai_walk, 6.7f, null), + new mframe_t(GameAI.ai_walk, 6.0f, null), + new mframe_t(GameAI.ai_walk, 8.2f, null), + new mframe_t(GameAI.ai_walk, 7.2f, null), + new mframe_t(GameAI.ai_walk, 6.1f, null), + new mframe_t(GameAI.ai_walk, 4.9f, null), + new mframe_t(GameAI.ai_walk, 4.7f, null), + new mframe_t(GameAI.ai_walk, 4.7f, null), + new mframe_t(GameAI.ai_walk, 4.8f, null) }; + + static mmove_t berserk_move_walk = new mmove_t(FRAME_walkc1, FRAME_walkc11, + berserk_frames_walk, null); + + static EntThinkAdapter berserk_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = berserk_move_walk; + return true; + } + }; + + /* + * + * **************************** SKIPPED THIS FOR NOW! + * **************************** + * + * Running . Arm raised in air + * + * void() berserk_runb1 =[ $r_att1 , berserk_runb2 ] {ai_run(21);}; void() + * berserk_runb2 =[ $r_att2 , berserk_runb3 ] {ai_run(11);}; void() + * berserk_runb3 =[ $r_att3 , berserk_runb4 ] {ai_run(21);}; void() + * berserk_runb4 =[ $r_att4 , berserk_runb5 ] {ai_run(25);}; void() + * berserk_runb5 =[ $r_att5 , berserk_runb6 ] {ai_run(18);}; void() + * berserk_runb6 =[ $r_att6 , berserk_runb7 ] {ai_run(19);}; // running with + * arm in air : start loop void() berserk_runb7 =[ $r_att7 , berserk_runb8 ] + * {ai_run(21);}; void() berserk_runb8 =[ $r_att8 , berserk_runb9 ] + * {ai_run(11);}; void() berserk_runb9 =[ $r_att9 , berserk_runb10 ] + * {ai_run(21);}; void() berserk_runb10 =[ $r_att10 , berserk_runb11 ] + * {ai_run(25);}; void() berserk_runb11 =[ $r_att11 , berserk_runb12 ] + * {ai_run(18);}; void() berserk_runb12 =[ $r_att12 , berserk_runb7 ] + * {ai_run(19);}; // running with arm in air : end loop + */ + + static mframe_t berserk_frames_run1[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 21, null), + new mframe_t(GameAI.ai_run, 11, null), + new mframe_t(GameAI.ai_run, 21, null), + new mframe_t(GameAI.ai_run, 25, null), + new mframe_t(GameAI.ai_run, 18, null), + new mframe_t(GameAI.ai_run, 19, null) }; + + static mmove_t berserk_move_run1 = new mmove_t(FRAME_run1, FRAME_run6, + berserk_frames_run1, null); + + static EntThinkAdapter berserk_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = berserk_move_stand; + else + self.monsterinfo.currentmove = berserk_move_run1; + return true; + } + }; + + static EntThinkAdapter berserk_attack_spike = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { Defines.MELEE_DISTANCE, 0f, -24f }; + + Fire.fire_hit(self, aim, (15 + (Lib.rand() % 6)), 400); + // Faster attack -- upwards and backwards + + return true; + } + }; + + static EntThinkAdapter berserk_swing = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t berserk_frames_attack_spike[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, berserk_swing), + new mframe_t(GameAI.ai_charge, 0, berserk_attack_spike), + 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) }; + + static mmove_t berserk_move_attack_spike = new mmove_t(FRAME_att_c1, + FRAME_att_c8, berserk_frames_attack_spike, berserk_run); + + static EntThinkAdapter berserk_attack_club = new EntThinkAdapter() { + public boolean think(edict_t self) { + float aim[] = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); + Fire.fire_hit(self, aim, (5 + (Lib.rand() % 6)), 400); // Slower + // attack + + return true; + } + }; + + static mframe_t berserk_frames_attack_club[] = new mframe_t[] { + 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, berserk_swing), + 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, berserk_attack_club), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t berserk_move_attack_club = new mmove_t(FRAME_att_c9, + FRAME_att_c20, berserk_frames_attack_club, berserk_run); + + static EntThinkAdapter berserk_strike = new EntThinkAdapter() { + public boolean think(edict_t self) { + return true; + } + }; + + static mframe_t berserk_frames_attack_strike[] = 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, berserk_swing), + 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, berserk_strike), + 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, 9.7f, null), + new mframe_t(GameAI.ai_move, 13.6f, null) }; + + static mmove_t berserk_move_attack_strike = new mmove_t(FRAME_att_c21, + FRAME_att_c34, berserk_frames_attack_strike, berserk_run); + + static EntThinkAdapter berserk_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((Lib.rand() % 2) == 0) + self.monsterinfo.currentmove = berserk_move_attack_spike; + else + self.monsterinfo.currentmove = berserk_move_attack_club; + return true; + } + }; + + /* + * void() berserk_atke1 =[ $r_attb1, berserk_atke2 ] {ai_run(9);}; void() + * berserk_atke2 =[ $r_attb2, berserk_atke3 ] {ai_run(6);}; void() + * berserk_atke3 =[ $r_attb3, berserk_atke4 ] {ai_run(18.4);}; void() + * berserk_atke4 =[ $r_attb4, berserk_atke5 ] {ai_run(25);}; void() + * berserk_atke5 =[ $r_attb5, berserk_atke6 ] {ai_run(14);}; void() + * berserk_atke6 =[ $r_attb6, berserk_atke7 ] {ai_run(20);}; void() + * berserk_atke7 =[ $r_attb7, berserk_atke8 ] {ai_run(8.5);}; void() + * berserk_atke8 =[ $r_attb8, berserk_atke9 ] {ai_run(3);}; void() + * berserk_atke9 =[ $r_attb9, berserk_atke10 ] {ai_run(17.5);}; void() + * berserk_atke10 =[ $r_attb10, berserk_atke11 ] {ai_run(17);}; void() + * berserk_atke11 =[ $r_attb11, berserk_atke12 ] {ai_run(9);}; void() + * berserk_atke12 =[ $r_attb12, berserk_atke13 ] {ai_run(25);}; void() + * berserk_atke13 =[ $r_attb13, berserk_atke14 ] {ai_run(3.7);}; void() + * berserk_atke14 =[ $r_attb14, berserk_atke15 ] {ai_run(2.6);}; void() + * berserk_atke15 =[ $r_attb15, berserk_atke16 ] {ai_run(19);}; void() + * berserk_atke16 =[ $r_attb16, berserk_atke17 ] {ai_run(25);}; void() + * berserk_atke17 =[ $r_attb17, berserk_atke18 ] {ai_run(19.6);}; void() + * berserk_atke18 =[ $r_attb18, berserk_run1 ] {ai_run(7.8);}; + */ + + static mframe_t berserk_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) }; + + static mmove_t berserk_move_pain1 = new mmove_t(FRAME_painc1, FRAME_painc4, + berserk_frames_pain1, berserk_run); + + static mframe_t berserk_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), + 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 berserk_move_pain2 = new mmove_t(FRAME_painb1, + FRAME_painb20, berserk_frames_pain2, berserk_run); + + static EntPainAdapter berserk_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + 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; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain, 1, + Defines.ATTN_NORM, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if ((damage < 20) || (Lib.random() < 0.5)) + self.monsterinfo.currentmove = berserk_move_pain1; + else + self.monsterinfo.currentmove = berserk_move_pain2; + } + }; + + static EntThinkAdapter berserk_dead = new EntThinkAdapter() { + 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 berserk_frames_death1[] = 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) }; + + static mmove_t berserk_move_death1 = new mmove_t(FRAME_death1, + FRAME_death13, berserk_frames_death1, berserk_dead); + + static mframe_t berserk_frames_death2[] = 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) }; + + static mmove_t berserk_move_death2 = new mmove_t(FRAME_deathc1, + FRAME_deathc8, berserk_frames_death2, berserk_dead); + + static EntDieAdapter berserk_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float point[]) { + int n; + + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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; + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + if (damage >= 50) + self.monsterinfo.currentmove = berserk_move_death1; + else + self.monsterinfo.currentmove = berserk_move_death2; + } + }; + + /* + * QUAKED monster_berserk (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_berserk(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + // pre-caches + sound_pain = GameBase.gi.soundindex("berserk/berpain2.wav"); + sound_die = GameBase.gi.soundindex("berserk/berdeth2.wav"); + sound_idle = GameBase.gi.soundindex("berserk/beridle1.wav"); + sound_punch = GameBase.gi.soundindex("berserk/attack.wav"); + sound_search = GameBase.gi.soundindex("berserk/bersrch1.wav"); + sound_sight = GameBase.gi.soundindex("berserk/sight.wav"); + + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/berserk/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + self.health = 240; + self.gib_health = -60; + self.mass = 250; + + self.pain = berserk_pain; + self.die = berserk_die; + + self.monsterinfo.stand = berserk_stand; + self.monsterinfo.walk = berserk_walk; + self.monsterinfo.run = berserk_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = null; + self.monsterinfo.melee = berserk_melee; + self.monsterinfo.sight = berserk_sight; + self.monsterinfo.search = berserk_search; + + self.monsterinfo.currentmove = berserk_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameBase.gi.linkentity(self); + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Boss2.java b/src/jake2/game/monsters/M_Boss2.java new file mode 100644 index 0000000..5730648 --- /dev/null +++ b/src/jake2/game/monsters/M_Boss2.java @@ -0,0 +1,1073 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Boss2.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.game.trace_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Boss2 { + + public final static int FRAME_stand30 = 0; + + public final static int FRAME_stand31 = 1; + + public final static int FRAME_stand32 = 2; + + public final static int FRAME_stand33 = 3; + + public final static int FRAME_stand34 = 4; + + public final static int FRAME_stand35 = 5; + + public final static int FRAME_stand36 = 6; + + public final static int FRAME_stand37 = 7; + + public final static int FRAME_stand38 = 8; + + public final static int FRAME_stand39 = 9; + + public final static int FRAME_stand40 = 10; + + public final static int FRAME_stand41 = 11; + + public final static int FRAME_stand42 = 12; + + public final static int FRAME_stand43 = 13; + + public final static int FRAME_stand44 = 14; + + public final static int FRAME_stand45 = 15; + + public final static int FRAME_stand46 = 16; + + public final static int FRAME_stand47 = 17; + + public final static int FRAME_stand48 = 18; + + public final static int FRAME_stand49 = 19; + + public final static int FRAME_stand50 = 20; + + public final static int FRAME_stand1 = 21; + + public final static int FRAME_stand2 = 22; + + public final static int FRAME_stand3 = 23; + + public final static int FRAME_stand4 = 24; + + public final static int FRAME_stand5 = 25; + + public final static int FRAME_stand6 = 26; + + public final static int FRAME_stand7 = 27; + + public final static int FRAME_stand8 = 28; + + public final static int FRAME_stand9 = 29; + + public final static int FRAME_stand10 = 30; + + public final static int FRAME_stand11 = 31; + + public final static int FRAME_stand12 = 32; + + public final static int FRAME_stand13 = 33; + + public final static int FRAME_stand14 = 34; + + public final static int FRAME_stand15 = 35; + + public final static int FRAME_stand16 = 36; + + public final static int FRAME_stand17 = 37; + + public final static int FRAME_stand18 = 38; + + public final static int FRAME_stand19 = 39; + + public final static int FRAME_stand20 = 40; + + public final static int FRAME_stand21 = 41; + + public final static int FRAME_stand22 = 42; + + public final static int FRAME_stand23 = 43; + + public final static int FRAME_stand24 = 44; + + public final static int FRAME_stand25 = 45; + + public final static int FRAME_stand26 = 46; + + public final static int FRAME_stand27 = 47; + + public final static int FRAME_stand28 = 48; + + public final static int FRAME_stand29 = 49; + + public final static int FRAME_walk1 = 50; + + public final static int FRAME_walk2 = 51; + + public final static int FRAME_walk3 = 52; + + public final static int FRAME_walk4 = 53; + + public final static int FRAME_walk5 = 54; + + public final static int FRAME_walk6 = 55; + + public final static int FRAME_walk7 = 56; + + public final static int FRAME_walk8 = 57; + + public final static int FRAME_walk9 = 58; + + public final static int FRAME_walk10 = 59; + + public final static int FRAME_walk11 = 60; + + public final static int FRAME_walk12 = 61; + + public final static int FRAME_walk13 = 62; + + public final static int FRAME_walk14 = 63; + + public final static int FRAME_walk15 = 64; + + public final static int FRAME_walk16 = 65; + + public final static int FRAME_walk17 = 66; + + public final static int FRAME_walk18 = 67; + + public final static int FRAME_walk19 = 68; + + public final static int FRAME_walk20 = 69; + + public final static int FRAME_attack1 = 70; + + public final static int FRAME_attack2 = 71; + + public final static int FRAME_attack3 = 72; + + public final static int FRAME_attack4 = 73; + + public final static int FRAME_attack5 = 74; + + public final static int FRAME_attack6 = 75; + + public final static int FRAME_attack7 = 76; + + public final static int FRAME_attack8 = 77; + + public final static int FRAME_attack9 = 78; + + public final static int FRAME_attack10 = 79; + + public final static int FRAME_attack11 = 80; + + public final static int FRAME_attack12 = 81; + + public final static int FRAME_attack13 = 82; + + public final static int FRAME_attack14 = 83; + + public final static int FRAME_attack15 = 84; + + public final static int FRAME_attack16 = 85; + + public final static int FRAME_attack17 = 86; + + public final static int FRAME_attack18 = 87; + + public final static int FRAME_attack19 = 88; + + public final static int FRAME_attack20 = 89; + + public final static int FRAME_attack21 = 90; + + public final static int FRAME_attack22 = 91; + + public final static int FRAME_attack23 = 92; + + public final static int FRAME_attack24 = 93; + + public final static int FRAME_attack25 = 94; + + public final static int FRAME_attack26 = 95; + + public final static int FRAME_attack27 = 96; + + public final static int FRAME_attack28 = 97; + + public final static int FRAME_attack29 = 98; + + public final static int FRAME_attack30 = 99; + + public final static int FRAME_attack31 = 100; + + public final static int FRAME_attack32 = 101; + + public final static int FRAME_attack33 = 102; + + public final static int FRAME_attack34 = 103; + + public final static int FRAME_attack35 = 104; + + public final static int FRAME_attack36 = 105; + + public final static int FRAME_attack37 = 106; + + public final static int FRAME_attack38 = 107; + + public final static int FRAME_attack39 = 108; + + public final static int FRAME_attack40 = 109; + + public final static int FRAME_pain2 = 110; + + public final static int FRAME_pain3 = 111; + + public final static int FRAME_pain4 = 112; + + public final static int FRAME_pain5 = 113; + + public final static int FRAME_pain6 = 114; + + public final static int FRAME_pain7 = 115; + + public final static int FRAME_pain8 = 116; + + public final static int FRAME_pain9 = 117; + + public final static int FRAME_pain10 = 118; + + public final static int FRAME_pain11 = 119; + + public final static int FRAME_pain12 = 120; + + public final static int FRAME_pain13 = 121; + + public final static int FRAME_pain14 = 122; + + public final static int FRAME_pain15 = 123; + + public final static int FRAME_pain16 = 124; + + public final static int FRAME_pain17 = 125; + + public final static int FRAME_pain18 = 126; + + public final static int FRAME_pain19 = 127; + + public final static int FRAME_pain20 = 128; + + public final static int FRAME_pain21 = 129; + + public final static int FRAME_pain22 = 130; + + public final static int FRAME_pain23 = 131; + + public final static int FRAME_death2 = 132; + + public final static int FRAME_death3 = 133; + + public final static int FRAME_death4 = 134; + + public final static int FRAME_death5 = 135; + + public final static int FRAME_death6 = 136; + + public final static int FRAME_death7 = 137; + + public final static int FRAME_death8 = 138; + + public final static int FRAME_death9 = 139; + + public final static int FRAME_death10 = 140; + + public final static int FRAME_death11 = 141; + + public final static int FRAME_death12 = 142; + + public final static int FRAME_death13 = 143; + + public final static int FRAME_death14 = 144; + + public final static int FRAME_death15 = 145; + + public final static int FRAME_death16 = 146; + + public final static int FRAME_death17 = 147; + + public final static int FRAME_death18 = 148; + + public final static int FRAME_death19 = 149; + + public final static int FRAME_death20 = 150; + + public final static int FRAME_death21 = 151; + + public final static int FRAME_death22 = 152; + + public final static int FRAME_death23 = 153; + + public final static int FRAME_death24 = 154; + + public final static int FRAME_death25 = 155; + + public final static int FRAME_death26 = 156; + + public final static int FRAME_death27 = 157; + + public final static int FRAME_death28 = 158; + + public final static int FRAME_death29 = 159; + + public final static int FRAME_death30 = 160; + + public final static int FRAME_death31 = 161; + + public final static int FRAME_death32 = 162; + + public final static int FRAME_death33 = 163; + + public final static int FRAME_death34 = 164; + + public final static int FRAME_death35 = 165; + + public final static int FRAME_death36 = 166; + + public final static int FRAME_death37 = 167; + + public final static int FRAME_death38 = 168; + + public final static int FRAME_death39 = 169; + + public final static int FRAME_death40 = 170; + + public final static int FRAME_death41 = 171; + + public final static int FRAME_death42 = 172; + + public final static int FRAME_death43 = 173; + + public final static int FRAME_death44 = 174; + + public final static int FRAME_death45 = 175; + + public final static int FRAME_death46 = 176; + + public final static int FRAME_death47 = 177; + + public final static int FRAME_death48 = 178; + + public final static int FRAME_death49 = 179; + + public final static int FRAME_death50 = 180; + + 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 EntThinkAdapter boss2_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = boss2_move_stand; + return true; + } + }; + + static EntThinkAdapter boss2_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = boss2_move_stand; + else + self.monsterinfo.currentmove = boss2_move_run; + return true; + } + }; + + static EntThinkAdapter boss2_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = boss2_move_stand; + + self.monsterinfo.currentmove = boss2_move_walk; + return true; + } + }; + + static EntThinkAdapter boss2_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] vec = { 0, 0, 0 }; + + float range; + + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); + range = Math3D.VectorLength(vec); + + if (range <= 125) { + self.monsterinfo.currentmove = boss2_move_attack_pre_mg; + } else { + if (Lib.random() <= 0.6) + self.monsterinfo.currentmove = boss2_move_attack_pre_mg; + else + self.monsterinfo.currentmove = boss2_move_attack_rocket; + } + return true; + } + }; + + static EntThinkAdapter boss2_attack_mg = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = boss2_move_attack_mg; + return true; + } + }; + + static EntThinkAdapter boss2_reattack_mg = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.infront(self, self.enemy)) + if (Lib.random() <= 0.7) + self.monsterinfo.currentmove = boss2_move_attack_mg; + else + self.monsterinfo.currentmove = boss2_move_attack_post_mg; + else + self.monsterinfo.currentmove = boss2_move_attack_post_mg; + return true; + } + }; + + static EntPainAdapter boss2_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + 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; + // American wanted these at no attenuation + if (damage < 10) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain3, 1, + Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = boss2_move_pain_light; + } else if (damage < 30) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = boss2_move_pain_light; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = boss2_move_pain_heavy; + } + } + }; + + static EntThinkAdapter boss2_dead = new EntThinkAdapter() { + public boolean think(edict_t self) { + Math3D.VectorSet(self.mins, -56, -56, 0); + Math3D.VectorSet(self.maxs, 56, 56, 80); + self.movetype = Defines.MOVETYPE_TOSS; + self.svflags |= Defines.SVF_DEADMONSTER; + self.nextthink = 0; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntDieAdapter boss2_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1, + Defines.ATTN_NONE, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_NO; + self.count = 0; + self.monsterinfo.currentmove = boss2_move_death; + + } + }; + + static EntThinkAdapter Boss2_CheckAttack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] spot1 = { 0, 0, 0 }, spot2 = { 0, 0, 0 }; + float[] temp = { 0, 0, 0 }; + float chance; + trace_t tr; + boolean enemy_infront; + int enemy_range; + float enemy_yaw; + + if (self.enemy.health > 0) { + // see if any entities are in the way of the shot + Math3D.VectorCopy(self.s.origin, spot1); + spot1[2] += self.viewheight; + Math3D.VectorCopy(self.enemy.s.origin, spot2); + spot2[2] += self.enemy.viewheight; + + tr = GameBase.gi.trace(spot1, null, null, spot2, self, + Defines.CONTENTS_SOLID | Defines.CONTENTS_MONSTER + | Defines.CONTENTS_SLIME + | Defines.CONTENTS_LAVA); + + // do we have a clear shot? + if (tr.ent != self.enemy) + return false; + } + + enemy_infront = GameUtil.infront(self, self.enemy); + enemy_range = GameUtil.range(self, self.enemy); + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, temp); + enemy_yaw = Math3D.vectoyaw(temp); + + self.ideal_yaw = enemy_yaw; + + // melee attack + if (enemy_range == Defines.RANGE_MELEE) { + if (self.monsterinfo.melee != null) + self.monsterinfo.attack_state = Defines.AS_MELEE; + else + self.monsterinfo.attack_state = Defines.AS_MISSILE; + return true; + } + + // missile attack + if (self.monsterinfo.attack == null) + return false; + + if (GameBase.level.time < self.monsterinfo.attack_finished) + return false; + + if (enemy_range == Defines.RANGE_FAR) + return false; + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + chance = 0.4f; + } else if (enemy_range == Defines.RANGE_MELEE) { + chance = 0.8f; + } else if (enemy_range == Defines.RANGE_NEAR) { + chance = 0.8f; + } else if (enemy_range == Defines.RANGE_MID) { + chance = 0.8f; + } else { + return false; + } + + if (Lib.random() < chance) { + self.monsterinfo.attack_state = Defines.AS_MISSILE; + self.monsterinfo.attack_finished = GameBase.level.time + 2 + * Lib.random(); + return true; + } + + if ((self.flags & Defines.FL_FLY) != 0) { + if (Lib.random() < 0.3) + self.monsterinfo.attack_state = Defines.AS_SLIDING; + else + self.monsterinfo.attack_state = Defines.AS_STRAIGHT; + } + + return false; + } + }; + + static EntThinkAdapter boss2_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search1, 1, + Defines.ATTN_NONE, 0); + return true; + } + }; + + static EntThinkAdapter Boss2Rocket = new EntThinkAdapter() { + 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 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + + // 1 + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_ROCKET_1], + 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, + Defines.MZ2_BOSS2_ROCKET_1); + + // 2 + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_ROCKET_2], + 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, + Defines.MZ2_BOSS2_ROCKET_2); + + // 3 + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_ROCKET_3], + 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, + Defines.MZ2_BOSS2_ROCKET_3); + + // 4 + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_ROCKET_4], + 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, + Defines.MZ2_BOSS2_ROCKET_4); + return true; + } + }; + + static EntThinkAdapter boss2_firebullet_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, target = { 0, + 0, 0 }; + float[] start = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D + .G_ProjectSource( + self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_MACHINEGUN_R1], + forward, right, start); + + Math3D.VectorMA(self.enemy.s.origin, -0.2f, self.enemy.velocity, + target); + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + + Monster.monster_fire_bullet(self, start, forward, 6, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MZ2_BOSS2_MACHINEGUN_R1); + + return true; + } + }; + + static EntThinkAdapter boss2_firebullet_left = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, target = { 0, + 0, 0 }; + float[] start = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D + .G_ProjectSource( + self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_BOSS2_MACHINEGUN_L1], + forward, right, start); + + Math3D.VectorMA(self.enemy.s.origin, -0.2f, self.enemy.velocity, + target); + + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + + Monster.monster_fire_bullet(self, start, forward, 6, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MZ2_BOSS2_MACHINEGUN_L1); + + return true; + } + }; + + static EntThinkAdapter Boss2MachineGun = new EntThinkAdapter() { + public boolean think(edict_t self) { + /* + * RST: this was disabled ! 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; + * + * AngleVectors (self.s.angles, forward, right, null); + * + * flash_number = MZ2_BOSS2_MACHINEGUN_1 + (self.s.frame - + * FRAME_attack10); G_ProjectSource (self.s.origin, + * monster_flash_offset[flash_number], forward, right, start); + * + * VectorCopy (self.enemy.s.origin, vec); vec[2] += + * self.enemy.viewheight; VectorSubtract (vec, start, dir); + * VectorNormalize (dir); monster_fire_bullet (self, start, dir, 3, + * 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number); + */ + boss2_firebullet_left.think(self); + boss2_firebullet_right.think(self); + return true; + } + }; + + static mframe_t boss2_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) }; + + static mmove_t boss2_move_stand = new mmove_t(FRAME_stand30, FRAME_stand50, + boss2_frames_stand, null); + + static mframe_t boss2_frames_fidget[] = 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) }; + + static mmove_t boss2_move_fidget = new mmove_t(FRAME_stand1, FRAME_stand30, + boss2_frames_fidget, null); + + static mframe_t boss2_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null) }; + + static mmove_t boss2_move_walk = new mmove_t(FRAME_walk1, FRAME_walk20, + boss2_frames_walk, null); + + static mframe_t boss2_frames_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, 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), + 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), + 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 boss2_move_run = new mmove_t(FRAME_walk1, FRAME_walk20, + boss2_frames_run, null); + + static mframe_t boss2_frames_attack_pre_mg[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, boss2_attack_mg) }; + + static mmove_t boss2_move_attack_pre_mg = new mmove_t(FRAME_attack1, + FRAME_attack9, boss2_frames_attack_pre_mg, null); + + // Loop this + static mframe_t boss2_frames_attack_mg[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAI.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAI.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAI.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAI.ai_charge, 1, Boss2MachineGun), + new mframe_t(GameAI.ai_charge, 1, boss2_reattack_mg) }; + + static mmove_t boss2_move_attack_mg = new mmove_t(FRAME_attack10, + FRAME_attack15, boss2_frames_attack_mg, null); + + static mframe_t boss2_frames_attack_post_mg[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null) }; + + static mmove_t boss2_move_attack_post_mg = new mmove_t(FRAME_attack16, + FRAME_attack19, boss2_frames_attack_post_mg, boss2_run); + + static mframe_t boss2_frames_attack_rocket[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_move, -20, Boss2Rocket), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null) }; + + static mmove_t boss2_move_attack_rocket = new mmove_t(FRAME_attack20, + FRAME_attack40, boss2_frames_attack_rocket, boss2_run); + + static mframe_t boss2_frames_pain_heavy[] = 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) }; + + static mmove_t boss2_move_pain_heavy = new mmove_t(FRAME_pain2, + FRAME_pain19, boss2_frames_pain_heavy, boss2_run); + + static mframe_t boss2_frames_pain_light[] = 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) }; + + static mmove_t boss2_move_pain_light = new mmove_t(FRAME_pain20, + FRAME_pain23, boss2_frames_pain_light, boss2_run); + + static mframe_t boss2_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, GameAI.BossExplode) }; + + /* + * static EntThinkAdapter xxx = new EntThinkAdapter() { public boolean + * think(edict_t self) { return true; } }; + */ + + static mmove_t boss2_move_death = new mmove_t(FRAME_death2, FRAME_death50, + boss2_frames_death, boss2_dead); + + /* + * QUAKED monster_boss2 (1 .5 0) (-56 -56 0) (56 56 80) Ambush Trigger_Spawn + * Sight + */ + public static void SP_monster_boss2(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_pain1 = GameBase.gi.soundindex("bosshovr/bhvpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("bosshovr/bhvpain2.wav"); + sound_pain3 = GameBase.gi.soundindex("bosshovr/bhvpain3.wav"); + sound_death = GameBase.gi.soundindex("bosshovr/bhvdeth1.wav"); + sound_search1 = GameBase.gi.soundindex("bosshovr/bhvunqv1.wav"); + + self.s.sound = GameBase.gi.soundindex("bosshovr/bhvengn1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/boss2/tris.md2"); + Math3D.VectorSet(self.mins, -56, -56, 0); + Math3D.VectorSet(self.maxs, 56, 56, 80); + + self.health = 2000; + self.gib_health = -200; + self.mass = 1000; + + self.flags |= Defines.FL_IMMUNE_LASER; + + self.pain = boss2_pain; + self.die = boss2_die; + + self.monsterinfo.stand = boss2_stand; + self.monsterinfo.walk = boss2_walk; + self.monsterinfo.run = boss2_run; + self.monsterinfo.attack = boss2_attack; + self.monsterinfo.search = boss2_search; + self.monsterinfo.checkattack = Boss2_CheckAttack; + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = boss2_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.flymonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Boss3.java b/src/jake2/game/monsters/M_Boss3.java new file mode 100644 index 0000000..3ae6f65 --- /dev/null +++ b/src/jake2/game/monsters/M_Boss3.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Boss3.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntThinkAdapter; +import jake2.game.EntUseAdapter; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.util.Math3D; + +public class M_Boss3 { + + static EntUseAdapter Use_Boss3 = new EntUseAdapter() { + public void use(edict_t ent, edict_t other, edict_t activator) { + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_BOSSTPORT); + GameBase.gi.WritePosition(ent.s.origin); + GameBase.gi.multicast(ent.s.origin, Defines.MULTICAST_PVS); + GameUtil.G_FreeEdict(ent); + } + }; + + static EntThinkAdapter Think_Boss3Stand = new EntThinkAdapter() { + public boolean think(edict_t ent) { + if (ent.s.frame == M_Boss32.FRAME_stand260) + ent.s.frame = M_Boss32.FRAME_stand201; + else + ent.s.frame++; + ent.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + + }; + + /* + * QUAKED monster_boss3_stand (1 .5 0) (-32 -32 0) (32 32 90) + * + * Just stands and cycles in one place until targeted, then teleports away. + */ + public static void SP_monster_boss3_stand(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.model = "models/monsters/boss3/rider/tris.md2"; + self.s.modelindex = GameBase.gi.modelindex(self.model); + self.s.frame = M_Boss32.FRAME_stand201; + + GameBase.gi.soundindex("misc/bigtele.wav"); + + Math3D.VectorSet(self.mins, -32, -32, 0); + Math3D.VectorSet(self.maxs, 32, 32, 90); + + self.use = Use_Boss3; + self.think = Think_Boss3Stand; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + GameBase.gi.linkentity(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Boss31.java b/src/jake2/game/monsters/M_Boss31.java new file mode 100644 index 0000000..e267dc2 --- /dev/null +++ b/src/jake2/game/monsters/M_Boss31.java @@ -0,0 +1,1197 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Boss31.java,v 1.2 2005-02-06 18:48:16 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.game.trace_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Boss31 { + + public final static int FRAME_attak101 = 0; + + public final static int FRAME_attak102 = 1; + + public final static int FRAME_attak103 = 2; + + public final static int FRAME_attak104 = 3; + + public final static int FRAME_attak105 = 4; + + public final static int FRAME_attak106 = 5; + + public final static int FRAME_attak107 = 6; + + public final static int FRAME_attak108 = 7; + + public final static int FRAME_attak109 = 8; + + public final static int FRAME_attak110 = 9; + + public final static int FRAME_attak111 = 10; + + public final static int FRAME_attak112 = 11; + + public final static int FRAME_attak113 = 12; + + public final static int FRAME_attak114 = 13; + + public final static int FRAME_attak115 = 14; + + public final static int FRAME_attak116 = 15; + + public final static int FRAME_attak117 = 16; + + public final static int FRAME_attak118 = 17; + + public final static int FRAME_attak201 = 18; + + public final static int FRAME_attak202 = 19; + + public final static int FRAME_attak203 = 20; + + public final static int FRAME_attak204 = 21; + + public final static int FRAME_attak205 = 22; + + public final static int FRAME_attak206 = 23; + + public final static int FRAME_attak207 = 24; + + public final static int FRAME_attak208 = 25; + + public final static int FRAME_attak209 = 26; + + public final static int FRAME_attak210 = 27; + + public final static int FRAME_attak211 = 28; + + public final static int FRAME_attak212 = 29; + + public final static int FRAME_attak213 = 30; + + public final static int FRAME_death01 = 31; + + public final static int FRAME_death02 = 32; + + public final static int FRAME_death03 = 33; + + public final static int FRAME_death04 = 34; + + public final static int FRAME_death05 = 35; + + public final static int FRAME_death06 = 36; + + public final static int FRAME_death07 = 37; + + public final static int FRAME_death08 = 38; + + public final static int FRAME_death09 = 39; + + public final static int FRAME_death10 = 40; + + public final static int FRAME_death11 = 41; + + public final static int FRAME_death12 = 42; + + public final static int FRAME_death13 = 43; + + public final static int FRAME_death14 = 44; + + public final static int FRAME_death15 = 45; + + public final static int FRAME_death16 = 46; + + public final static int FRAME_death17 = 47; + + public final static int FRAME_death18 = 48; + + public final static int FRAME_death19 = 49; + + public final static int FRAME_death20 = 50; + + public final static int FRAME_death21 = 51; + + public final static int FRAME_death22 = 52; + + public final static int FRAME_death23 = 53; + + public final static int FRAME_death24 = 54; + + public final static int FRAME_death25 = 55; + + public final static int FRAME_death26 = 56; + + public final static int FRAME_death27 = 57; + + public final static int FRAME_death28 = 58; + + public final static int FRAME_death29 = 59; + + public final static int FRAME_death30 = 60; + + public final static int FRAME_death31 = 61; + + public final static int FRAME_death32 = 62; + + public final static int FRAME_death33 = 63; + + public final static int FRAME_death34 = 64; + + public final static int FRAME_death35 = 65; + + public final static int FRAME_death36 = 66; + + public final static int FRAME_death37 = 67; + + public final static int FRAME_death38 = 68; + + public final static int FRAME_death39 = 69; + + public final static int FRAME_death40 = 70; + + public final static int FRAME_death41 = 71; + + public final static int FRAME_death42 = 72; + + public final static int FRAME_death43 = 73; + + public final static int FRAME_death44 = 74; + + public final static int FRAME_death45 = 75; + + public final static int FRAME_death46 = 76; + + public final static int FRAME_death47 = 77; + + public final static int FRAME_death48 = 78; + + public final static int FRAME_death49 = 79; + + public final static int FRAME_death50 = 80; + + public final static int FRAME_pain101 = 81; + + public final static int FRAME_pain102 = 82; + + public final static int FRAME_pain103 = 83; + + public final static int FRAME_pain201 = 84; + + public final static int FRAME_pain202 = 85; + + public final static int FRAME_pain203 = 86; + + public final static int FRAME_pain301 = 87; + + public final static int FRAME_pain302 = 88; + + public final static int FRAME_pain303 = 89; + + public final static int FRAME_pain304 = 90; + + public final static int FRAME_pain305 = 91; + + public final static int FRAME_pain306 = 92; + + public final static int FRAME_pain307 = 93; + + public final static int FRAME_pain308 = 94; + + public final static int FRAME_pain309 = 95; + + public final static int FRAME_pain310 = 96; + + public final static int FRAME_pain311 = 97; + + public final static int FRAME_pain312 = 98; + + public final static int FRAME_pain313 = 99; + + public final static int FRAME_pain314 = 100; + + public final static int FRAME_pain315 = 101; + + public final static int FRAME_pain316 = 102; + + public final static int FRAME_pain317 = 103; + + public final static int FRAME_pain318 = 104; + + public final static int FRAME_pain319 = 105; + + public final static int FRAME_pain320 = 106; + + public final static int FRAME_pain321 = 107; + + public final static int FRAME_pain322 = 108; + + public final static int FRAME_pain323 = 109; + + public final static int FRAME_pain324 = 110; + + public final static int FRAME_pain325 = 111; + + public final static int FRAME_stand01 = 112; + + public final static int FRAME_stand02 = 113; + + public final static int FRAME_stand03 = 114; + + public final static int FRAME_stand04 = 115; + + public final static int FRAME_stand05 = 116; + + public final static int FRAME_stand06 = 117; + + public final static int FRAME_stand07 = 118; + + public final static int FRAME_stand08 = 119; + + public final static int FRAME_stand09 = 120; + + public final static int FRAME_stand10 = 121; + + public final static int FRAME_stand11 = 122; + + public final static int FRAME_stand12 = 123; + + public final static int FRAME_stand13 = 124; + + public final static int FRAME_stand14 = 125; + + public final static int FRAME_stand15 = 126; + + public final static int FRAME_stand16 = 127; + + public final static int FRAME_stand17 = 128; + + public final static int FRAME_stand18 = 129; + + public final static int FRAME_stand19 = 130; + + public final static int FRAME_stand20 = 131; + + public final static int FRAME_stand21 = 132; + + public final static int FRAME_stand22 = 133; + + public final static int FRAME_stand23 = 134; + + public final static int FRAME_stand24 = 135; + + public final static int FRAME_stand25 = 136; + + public final static int FRAME_stand26 = 137; + + public final static int FRAME_stand27 = 138; + + public final static int FRAME_stand28 = 139; + + public final static int FRAME_stand29 = 140; + + public final static int FRAME_stand30 = 141; + + public final static int FRAME_stand31 = 142; + + public final static int FRAME_stand32 = 143; + + public final static int FRAME_stand33 = 144; + + public final static int FRAME_stand34 = 145; + + public final static int FRAME_stand35 = 146; + + public final static int FRAME_stand36 = 147; + + public final static int FRAME_stand37 = 148; + + public final static int FRAME_stand38 = 149; + + public final static int FRAME_stand39 = 150; + + public final static int FRAME_stand40 = 151; + + public final static int FRAME_stand41 = 152; + + public final static int FRAME_stand42 = 153; + + public final static int FRAME_stand43 = 154; + + public final static int FRAME_stand44 = 155; + + public final static int FRAME_stand45 = 156; + + public final static int FRAME_stand46 = 157; + + public final static int FRAME_stand47 = 158; + + public final static int FRAME_stand48 = 159; + + public final static int FRAME_stand49 = 160; + + public final static int FRAME_stand50 = 161; + + public final static int FRAME_stand51 = 162; + + public final static int FRAME_walk01 = 163; + + public final static int FRAME_walk02 = 164; + + public final static int FRAME_walk03 = 165; + + public final static int FRAME_walk04 = 166; + + public final static int FRAME_walk05 = 167; + + public final static int FRAME_walk06 = 168; + + public final static int FRAME_walk07 = 169; + + public final static int FRAME_walk08 = 170; + + public final static int FRAME_walk09 = 171; + + public final static int FRAME_walk10 = 172; + + public final static int FRAME_walk11 = 173; + + public final static int FRAME_walk12 = 174; + + public final static int FRAME_walk13 = 175; + + public final static int FRAME_walk14 = 176; + + public final static int FRAME_walk15 = 177; + + public final static int FRAME_walk16 = 178; + + public final static int FRAME_walk17 = 179; + + public final static int FRAME_walk18 = 180; + + public final static int FRAME_walk19 = 181; + + public final static int FRAME_walk20 = 182; + + public final static int FRAME_walk21 = 183; + + public final static int FRAME_walk22 = 184; + + public final static int FRAME_walk23 = 185; + + public final static int FRAME_walk24 = 186; + + public final static int FRAME_walk25 = 187; + + public final static float MODEL_SCALE = 1.000000f; + + /* + * ============================================================================== + * + * jorg + * + * ============================================================================== + */ + + static int sound_pain1; + + static int sound_pain2; + + static int sound_pain3; + + static int sound_idle; + + static int sound_death; + + static int sound_search1; + + static int sound_search2; + + static int sound_search3; + + static int sound_attack1; + + static int sound_attack2; + + static int sound_firegun; + + static int sound_step_left; + + static int sound_step_right; + + static int sound_death_hit; + + /* + * static EntThinkAdapter xxx = new EntThinkAdapter() { public boolean + * think(edict_t self) { return true; } }; + */ + + static EntThinkAdapter jorg_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + float r; + + r = Lib.random(); + + if (r <= 0.3) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search1, 1, + Defines.ATTN_NORM, 0); + else if (r <= 0.6) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search2, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search3, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter jorg_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter jorg_death_hit = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_death_hit, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter jorg_step_left = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_step_left, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter jorg_step_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_step_right, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter jorg_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = jorg_move_stand; + return true; + } + }; + + static EntThinkAdapter jorg_reattack1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() < 0.9) + self.monsterinfo.currentmove = jorg_move_attack1; + else { + self.s.sound = 0; + self.monsterinfo.currentmove = jorg_move_end_attack1; + } + else { + self.s.sound = 0; + self.monsterinfo.currentmove = jorg_move_end_attack1; + } + return true; + } + }; + + static EntThinkAdapter jorg_attack1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = jorg_move_attack1; + return true; + } + }; + + static EntPainAdapter jorg_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + if (self.health < (self.max_health / 2)) + self.s.skinnum = 1; + + self.s.sound = 0; + + if (GameBase.level.time < self.pain_debounce_time) + return; + + // Lessen the chance of him going into his pain frames if he takes + // little damage + if (damage <= 40) + if (Lib.random() <= 0.6) + return; + + /* + * If he's entering his attack1 or using attack1, lessen the chance + * of him going into pain + */ + + if ((self.s.frame >= FRAME_attak101) + && (self.s.frame <= FRAME_attak108)) + if (Lib.random() <= 0.005) + return; + + if ((self.s.frame >= FRAME_attak109) + && (self.s.frame <= FRAME_attak114)) + if (Lib.random() <= 0.00005) + return; + + if ((self.s.frame >= FRAME_attak201) + && (self.s.frame <= FRAME_attak208)) + if (Lib.random() <= 0.005) + return; + + self.pain_debounce_time = GameBase.level.time + 3; + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 50) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = jorg_move_pain1; + } else if (damage <= 100) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = jorg_move_pain2; + } else { + if (Lib.random() <= 0.3) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain3, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = jorg_move_pain3; + } + } + + } + }; + + static EntThinkAdapter jorgBFG = new EntThinkAdapter() { + 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 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_JORG_BFG_1], + forward, right, start); + + Math3D.VectorCopy(self.enemy.s.origin, vec); + vec[2] += self.enemy.viewheight; + Math3D.VectorSubtract(vec, start, dir); + Math3D.VectorNormalize(dir); + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_attack2, 1, + Defines.ATTN_NORM, 0); + /* + * void monster_fire_bfg (edict_t self, float [] start, float [] + * aimdir, int damage, int speed, int kick, float damage_radius, int + * flashtype) + */ + Monster.monster_fire_bfg(self, start, dir, 50, 300, 100, 200, + Defines.MZ2_JORG_BFG_1); + return true; + } + }; + + static EntThinkAdapter jorg_firebullet_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, target = { 0, + 0, 0 }; + float[] start = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D + .G_ProjectSource( + self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_JORG_MACHINEGUN_R1], + forward, right, start); + + Math3D.VectorMA(self.enemy.s.origin, -0.2f, self.enemy.velocity, + target); + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + + Monster.monster_fire_bullet(self, start, forward, 6, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MZ2_JORG_MACHINEGUN_R1); + return true; + } + }; + + static EntThinkAdapter jorg_firebullet_left = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, target = { 0, + 0, 0 }; + float[] start = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D + .G_ProjectSource( + self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_JORG_MACHINEGUN_L1], + forward, right, start); + + Math3D.VectorMA(self.enemy.s.origin, -0.2f, self.enemy.velocity, + target); + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + + Monster.monster_fire_bullet(self, start, forward, 6, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, + Defines.MZ2_JORG_MACHINEGUN_L1); + return true; + } + }; + + static EntThinkAdapter jorg_firebullet = new EntThinkAdapter() { + public boolean think(edict_t self) { + jorg_firebullet_left.think(self); + jorg_firebullet_right.think(self); + return true; + } + }; + + static EntThinkAdapter jorg_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] vec = { 0, 0, 0 }; + float range = 0; + + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); + range = Math3D.VectorLength(vec); + + if (Lib.random() <= 0.75) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_attack1, 1, + Defines.ATTN_NORM, 0); + self.s.sound = GameBase.gi.soundindex("boss3/w_loop.wav"); + self.monsterinfo.currentmove = jorg_move_start_attack1; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_attack2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = jorg_move_attack2; + } + return true; + } + }; + + /** Was disabled. RST. */ + static EntThinkAdapter jorg_dead = new EntThinkAdapter() { + public boolean think(edict_t self) { + /* + * edict_t tempent; + * + * //VectorSet (self.mins, -16, -16, -24); //VectorSet (self.maxs, + * 16, 16, -8); // Jorg is on modelindex2. Do not clear him. + * VectorSet( self.mins, -60, -60, 0); VectorSet(self.maxs, 60, 60, + * 72); self.movetype= MOVETYPE_TOSS; self.nextthink= 0; + * gi.linkentity(self); + * + * tempent= G_Spawn(); VectorCopy(self.s.origin, tempent.s.origin); + * VectorCopy(self.s.angles, tempent.s.angles); tempent.killtarget= + * self.killtarget; tempent.target= self.target; tempent.activator= + * self.enemy; self.killtarget= 0; self.target= 0; + * SP_monster_makron(tempent); + * + */ + return true; + } + }; + + static EntDieAdapter jorg_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_NO; + self.s.sound = 0; + self.count = 0; + self.monsterinfo.currentmove = jorg_move_death; + return; + } + }; + + static EntThinkAdapter Jorg_CheckAttack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] spot1 = { 0, 0, 0 }, spot2 = { 0, 0, 0 }; + float[] temp = { 0, 0, 0 }; + float chance; + trace_t tr; + boolean enemy_infront; + int enemy_range; + float enemy_yaw; + + if (self.enemy.health > 0) { + // see if any entities are in the way of the shot + Math3D.VectorCopy(self.s.origin, spot1); + spot1[2] += self.viewheight; + Math3D.VectorCopy(self.enemy.s.origin, spot2); + spot2[2] += self.enemy.viewheight; + + tr = GameBase.gi.trace(spot1, null, null, spot2, self, + Defines.CONTENTS_SOLID | Defines.CONTENTS_MONSTER + | Defines.CONTENTS_SLIME + | Defines.CONTENTS_LAVA); + + // do we have a clear shot? + if (tr.ent != self.enemy) + return false; + } + + enemy_infront = GameUtil.infront(self, self.enemy); + enemy_range = GameUtil.range(self, self.enemy); + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, temp); + enemy_yaw = Math3D.vectoyaw(temp); + + self.ideal_yaw = enemy_yaw; + + // melee attack + if (enemy_range == Defines.RANGE_MELEE) { + if (self.monsterinfo.melee != null) + self.monsterinfo.attack_state = Defines.AS_MELEE; + else + self.monsterinfo.attack_state = Defines.AS_MISSILE; + return true; + } + + // missile attack ? + if (self.monsterinfo.attack == null) + return false; + + if (GameBase.level.time < self.monsterinfo.attack_finished) + return false; + + if (enemy_range == Defines.RANGE_FAR) + return false; + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + chance = 0.4f; + } else if (enemy_range == Defines.RANGE_MELEE) { + chance = 0.8f; + } else if (enemy_range == Defines.RANGE_NEAR) { + chance = 0.4f; + } else if (enemy_range == Defines.RANGE_MID) { + chance = 0.2f; + } else { + return false; + } + + if (Lib.random() < chance) { + self.monsterinfo.attack_state = Defines.AS_MISSILE; + self.monsterinfo.attack_finished = GameBase.level.time + 2 + * Lib.random(); + return true; + } + + if ((self.flags & Defines.FL_FLY) != 0) { + if (Lib.random() < 0.3) + self.monsterinfo.attack_state = Defines.AS_SLIDING; + else + self.monsterinfo.attack_state = Defines.AS_STRAIGHT; + } + + return false; + } + }; + + // + // stand + // + + static mframe_t jorg_frames_stand[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, jorg_idle), + 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), + // 10 + 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), + // 20 + 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), + // 30 + 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, 19, null), + new mframe_t(GameAI.ai_stand, 11, jorg_step_left), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 6, null), + new mframe_t(GameAI.ai_stand, 9, jorg_step_right), + new mframe_t(GameAI.ai_stand, 0, null), + // 40 + 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, -2, null), + new mframe_t(GameAI.ai_stand, -17, jorg_step_left), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -12, null), + // 50 + new mframe_t(GameAI.ai_stand, -14, jorg_step_right) // 51 + }; + + static mmove_t jorg_move_stand = new mmove_t(FRAME_stand01, FRAME_stand51, + jorg_frames_stand, null); + + static mframe_t jorg_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 17, jorg_step_left), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 33, jorg_step_right), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 9, null) }; + + static mmove_t jorg_move_run = new mmove_t(FRAME_walk06, FRAME_walk19, + jorg_frames_run, null); + + // + // walk + // + + static mframe_t jorg_frames_start_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 15, null) }; + + static mmove_t jorg_move_start_walk = new mmove_t(FRAME_walk01, + FRAME_walk05, jorg_frames_start_walk, null); + + static mframe_t jorg_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 17, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 12, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 33, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 9, null) }; + + static mmove_t jorg_move_walk = new mmove_t(FRAME_walk06, FRAME_walk19, + jorg_frames_walk, null); + + static mframe_t jorg_frames_end_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 11, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, -8, null) }; + + static mmove_t jorg_move_end_walk = new mmove_t(FRAME_walk20, FRAME_walk25, + jorg_frames_end_walk, null); + + static EntThinkAdapter jorg_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = jorg_move_walk; + return true; + } + }; + + static EntThinkAdapter jorg_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = jorg_move_stand; + else + self.monsterinfo.currentmove = jorg_move_run; + return true; + } + }; + + static mframe_t jorg_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -28, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -3, jorg_step_left), + new mframe_t(GameAI.ai_move, -9, null), + new mframe_t(GameAI.ai_move, 0, jorg_step_right), + 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, -7, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, -11, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 10, null), + new mframe_t(GameAI.ai_move, 11, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 10, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 10, null), + new mframe_t(GameAI.ai_move, 7, jorg_step_left), + new mframe_t(GameAI.ai_move, 17, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, jorg_step_right) }; + + static mmove_t jorg_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain325, + jorg_frames_pain3, jorg_run); + + static mframe_t jorg_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) }; + + static mmove_t jorg_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain203, + jorg_frames_pain2, jorg_run); + + static mframe_t jorg_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) }; + + static mmove_t jorg_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain103, + jorg_frames_pain1, jorg_run); + + static mframe_t jorg_frames_death1[] = 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), + // 10 + 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), + // 20 + 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), + // 30 + 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), + // 40 + 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, M_Boss32.MakronToss), + new mframe_t(GameAI.ai_move, 0, GameAI.BossExplode) // 50 + }; + + static mmove_t jorg_move_death = new mmove_t(FRAME_death01, FRAME_death50, + jorg_frames_death1, jorg_dead); + + static mframe_t jorg_frames_attack2[] = new mframe_t[] { + 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, jorgBFG), + 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 jorg_move_attack2 = new mmove_t(FRAME_attak201, + FRAME_attak213, jorg_frames_attack2, jorg_run); + + static mframe_t jorg_frames_start_attack1[] = new mframe_t[] { + 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) }; + + static mmove_t jorg_move_start_attack1 = new mmove_t(FRAME_attak101, + FRAME_attak108, jorg_frames_start_attack1, jorg_attack1); + + static mframe_t jorg_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet), + new mframe_t(GameAI.ai_charge, 0, jorg_firebullet) }; + + static mmove_t jorg_move_attack1 = new mmove_t(FRAME_attak109, + FRAME_attak114, jorg_frames_attack1, jorg_reattack1); + + static mframe_t jorg_frames_end_attack1[] = 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) }; + + static mmove_t jorg_move_end_attack1 = new mmove_t(FRAME_attak115, + FRAME_attak118, jorg_frames_end_attack1, jorg_run); + + /* + * QUAKED monster_jorg (1 .5 0) (-80 -80 0) (90 90 140) Ambush Trigger_Spawn + * Sight + */ + public static void SP_monster_jorg(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_pain1 = GameBase.gi.soundindex("boss3/bs3pain1.wav"); + sound_pain2 = GameBase.gi.soundindex("boss3/bs3pain2.wav"); + sound_pain3 = GameBase.gi.soundindex("boss3/bs3pain3.wav"); + sound_death = GameBase.gi.soundindex("boss3/bs3deth1.wav"); + sound_attack1 = GameBase.gi.soundindex("boss3/bs3atck1.wav"); + sound_attack2 = GameBase.gi.soundindex("boss3/bs3atck2.wav"); + sound_search1 = GameBase.gi.soundindex("boss3/bs3srch1.wav"); + sound_search2 = GameBase.gi.soundindex("boss3/bs3srch2.wav"); + sound_search3 = GameBase.gi.soundindex("boss3/bs3srch3.wav"); + sound_idle = GameBase.gi.soundindex("boss3/bs3idle1.wav"); + sound_step_left = GameBase.gi.soundindex("boss3/step1.wav"); + sound_step_right = GameBase.gi.soundindex("boss3/step2.wav"); + sound_firegun = GameBase.gi.soundindex("boss3/xfire.wav"); + sound_death_hit = GameBase.gi.soundindex("boss3/d_hit.wav"); + + M_Boss32.MakronPrecache(); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/boss3/rider/tris.md2"); + self.s.modelindex2 = GameBase.gi + .modelindex("models/monsters/boss3/jorg/tris.md2"); + Math3D.VectorSet(self.mins, -80, -80, 0); + Math3D.VectorSet(self.maxs, 80, 80, 140); + + self.health = 3000; + self.gib_health = -2000; + self.mass = 1000; + + self.pain = jorg_pain; + self.die = jorg_die; + self.monsterinfo.stand = jorg_stand; + self.monsterinfo.walk = jorg_walk; + self.monsterinfo.run = jorg_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = jorg_attack; + self.monsterinfo.search = jorg_search; + self.monsterinfo.melee = null; + self.monsterinfo.sight = null; + self.monsterinfo.checkattack = Jorg_CheckAttack; + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = jorg_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Boss32.java b/src/jake2/game/monsters/M_Boss32.java new file mode 100644 index 0000000..abbe5ba --- /dev/null +++ b/src/jake2/game/monsters/M_Boss32.java @@ -0,0 +1,1988 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Boss32.java,v 1.2 2005-02-06 18:48:16 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.Globals; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.game.trace_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Boss32 { + + public final static int FRAME_attak101 = 0; + + public final static int FRAME_attak102 = 1; + + public final static int FRAME_attak103 = 2; + + public final static int FRAME_attak104 = 3; + + public final static int FRAME_attak105 = 4; + + public final static int FRAME_attak106 = 5; + + public final static int FRAME_attak107 = 6; + + public final static int FRAME_attak108 = 7; + + public final static int FRAME_attak109 = 8; + + public final static int FRAME_attak110 = 9; + + public final static int FRAME_attak111 = 10; + + public final static int FRAME_attak112 = 11; + + public final static int FRAME_attak113 = 12; + + public final static int FRAME_attak114 = 13; + + public final static int FRAME_attak115 = 14; + + public final static int FRAME_attak116 = 15; + + public final static int FRAME_attak117 = 16; + + public final static int FRAME_attak118 = 17; + + public final static int FRAME_attak201 = 18; + + public final static int FRAME_attak202 = 19; + + public final static int FRAME_attak203 = 20; + + public final static int FRAME_attak204 = 21; + + public final static int FRAME_attak205 = 22; + + public final static int FRAME_attak206 = 23; + + public final static int FRAME_attak207 = 24; + + public final static int FRAME_attak208 = 25; + + public final static int FRAME_attak209 = 26; + + public final static int FRAME_attak210 = 27; + + public final static int FRAME_attak211 = 28; + + public final static int FRAME_attak212 = 29; + + public final static int FRAME_attak213 = 30; + + public final static int FRAME_death01 = 31; + + public final static int FRAME_death02 = 32; + + public final static int FRAME_death03 = 33; + + public final static int FRAME_death04 = 34; + + public final static int FRAME_death05 = 35; + + public final static int FRAME_death06 = 36; + + public final static int FRAME_death07 = 37; + + public final static int FRAME_death08 = 38; + + public final static int FRAME_death09 = 39; + + public final static int FRAME_death10 = 40; + + public final static int FRAME_death11 = 41; + + public final static int FRAME_death12 = 42; + + public final static int FRAME_death13 = 43; + + public final static int FRAME_death14 = 44; + + public final static int FRAME_death15 = 45; + + public final static int FRAME_death16 = 46; + + public final static int FRAME_death17 = 47; + + public final static int FRAME_death18 = 48; + + public final static int FRAME_death19 = 49; + + public final static int FRAME_death20 = 50; + + public final static int FRAME_death21 = 51; + + public final static int FRAME_death22 = 52; + + public final static int FRAME_death23 = 53; + + public final static int FRAME_death24 = 54; + + public final static int FRAME_death25 = 55; + + public final static int FRAME_death26 = 56; + + public final static int FRAME_death27 = 57; + + public final static int FRAME_death28 = 58; + + public final static int FRAME_death29 = 59; + + public final static int FRAME_death30 = 60; + + public final static int FRAME_death31 = 61; + + public final static int FRAME_death32 = 62; + + public final static int FRAME_death33 = 63; + + public final static int FRAME_death34 = 64; + + public final static int FRAME_death35 = 65; + + public final static int FRAME_death36 = 66; + + public final static int FRAME_death37 = 67; + + public final static int FRAME_death38 = 68; + + public final static int FRAME_death39 = 69; + + public final static int FRAME_death40 = 70; + + public final static int FRAME_death41 = 71; + + public final static int FRAME_death42 = 72; + + public final static int FRAME_death43 = 73; + + public final static int FRAME_death44 = 74; + + public final static int FRAME_death45 = 75; + + public final static int FRAME_death46 = 76; + + public final static int FRAME_death47 = 77; + + public final static int FRAME_death48 = 78; + + public final static int FRAME_death49 = 79; + + public final static int FRAME_death50 = 80; + + public final static int FRAME_pain101 = 81; + + public final static int FRAME_pain102 = 82; + + public final static int FRAME_pain103 = 83; + + public final static int FRAME_pain201 = 84; + + public final static int FRAME_pain202 = 85; + + public final static int FRAME_pain203 = 86; + + public final static int FRAME_pain301 = 87; + + public final static int FRAME_pain302 = 88; + + public final static int FRAME_pain303 = 89; + + public final static int FRAME_pain304 = 90; + + public final static int FRAME_pain305 = 91; + + public final static int FRAME_pain306 = 92; + + public final static int FRAME_pain307 = 93; + + public final static int FRAME_pain308 = 94; + + public final static int FRAME_pain309 = 95; + + public final static int FRAME_pain310 = 96; + + public final static int FRAME_pain311 = 97; + + public final static int FRAME_pain312 = 98; + + public final static int FRAME_pain313 = 99; + + public final static int FRAME_pain314 = 100; + + public final static int FRAME_pain315 = 101; + + public final static int FRAME_pain316 = 102; + + public final static int FRAME_pain317 = 103; + + public final static int FRAME_pain318 = 104; + + public final static int FRAME_pain319 = 105; + + public final static int FRAME_pain320 = 106; + + public final static int FRAME_pain321 = 107; + + public final static int FRAME_pain322 = 108; + + public final static int FRAME_pain323 = 109; + + public final static int FRAME_pain324 = 110; + + public final static int FRAME_pain325 = 111; + + public final static int FRAME_stand01 = 112; + + public final static int FRAME_stand02 = 113; + + public final static int FRAME_stand03 = 114; + + public final static int FRAME_stand04 = 115; + + public final static int FRAME_stand05 = 116; + + public final static int FRAME_stand06 = 117; + + public final static int FRAME_stand07 = 118; + + public final static int FRAME_stand08 = 119; + + public final static int FRAME_stand09 = 120; + + public final static int FRAME_stand10 = 121; + + public final static int FRAME_stand11 = 122; + + public final static int FRAME_stand12 = 123; + + public final static int FRAME_stand13 = 124; + + public final static int FRAME_stand14 = 125; + + public final static int FRAME_stand15 = 126; + + public final static int FRAME_stand16 = 127; + + public final static int FRAME_stand17 = 128; + + public final static int FRAME_stand18 = 129; + + public final static int FRAME_stand19 = 130; + + public final static int FRAME_stand20 = 131; + + public final static int FRAME_stand21 = 132; + + public final static int FRAME_stand22 = 133; + + public final static int FRAME_stand23 = 134; + + public final static int FRAME_stand24 = 135; + + public final static int FRAME_stand25 = 136; + + public final static int FRAME_stand26 = 137; + + public final static int FRAME_stand27 = 138; + + public final static int FRAME_stand28 = 139; + + public final static int FRAME_stand29 = 140; + + public final static int FRAME_stand30 = 141; + + public final static int FRAME_stand31 = 142; + + public final static int FRAME_stand32 = 143; + + public final static int FRAME_stand33 = 144; + + public final static int FRAME_stand34 = 145; + + public final static int FRAME_stand35 = 146; + + public final static int FRAME_stand36 = 147; + + public final static int FRAME_stand37 = 148; + + public final static int FRAME_stand38 = 149; + + public final static int FRAME_stand39 = 150; + + public final static int FRAME_stand40 = 151; + + public final static int FRAME_stand41 = 152; + + public final static int FRAME_stand42 = 153; + + public final static int FRAME_stand43 = 154; + + public final static int FRAME_stand44 = 155; + + public final static int FRAME_stand45 = 156; + + public final static int FRAME_stand46 = 157; + + public final static int FRAME_stand47 = 158; + + public final static int FRAME_stand48 = 159; + + public final static int FRAME_stand49 = 160; + + public final static int FRAME_stand50 = 161; + + public final static int FRAME_stand51 = 162; + + public final static int FRAME_walk01 = 163; + + public final static int FRAME_walk02 = 164; + + public final static int FRAME_walk03 = 165; + + public final static int FRAME_walk04 = 166; + + public final static int FRAME_walk05 = 167; + + public final static int FRAME_walk06 = 168; + + public final static int FRAME_walk07 = 169; + + public final static int FRAME_walk08 = 170; + + public final static int FRAME_walk09 = 171; + + public final static int FRAME_walk10 = 172; + + public final static int FRAME_walk11 = 173; + + public final static int FRAME_walk12 = 174; + + public final static int FRAME_walk13 = 175; + + public final static int FRAME_walk14 = 176; + + public final static int FRAME_walk15 = 177; + + public final static int FRAME_walk16 = 178; + + public final static int FRAME_walk17 = 179; + + public final static int FRAME_walk18 = 180; + + public final static int FRAME_walk19 = 181; + + public final static int FRAME_walk20 = 182; + + public final static int FRAME_walk21 = 183; + + public final static int FRAME_walk22 = 184; + + public final static int FRAME_walk23 = 185; + + public final static int FRAME_walk24 = 186; + + public final static int FRAME_walk25 = 187; + + public final static int FRAME_active01 = 188; + + public final static int FRAME_active02 = 189; + + public final static int FRAME_active03 = 190; + + public final static int FRAME_active04 = 191; + + public final static int FRAME_active05 = 192; + + public final static int FRAME_active06 = 193; + + public final static int FRAME_active07 = 194; + + public final static int FRAME_active08 = 195; + + public final static int FRAME_active09 = 196; + + public final static int FRAME_active10 = 197; + + public final static int FRAME_active11 = 198; + + public final static int FRAME_active12 = 199; + + public final static int FRAME_active13 = 200; + + public final static int FRAME_attak301 = 201; + + public final static int FRAME_attak302 = 202; + + public final static int FRAME_attak303 = 203; + + public final static int FRAME_attak304 = 204; + + public final static int FRAME_attak305 = 205; + + public final static int FRAME_attak306 = 206; + + public final static int FRAME_attak307 = 207; + + public final static int FRAME_attak308 = 208; + + public final static int FRAME_attak401 = 209; + + public final static int FRAME_attak402 = 210; + + public final static int FRAME_attak403 = 211; + + public final static int FRAME_attak404 = 212; + + public final static int FRAME_attak405 = 213; + + public final static int FRAME_attak406 = 214; + + public final static int FRAME_attak407 = 215; + + public final static int FRAME_attak408 = 216; + + public final static int FRAME_attak409 = 217; + + public final static int FRAME_attak410 = 218; + + public final static int FRAME_attak411 = 219; + + public final static int FRAME_attak412 = 220; + + public final static int FRAME_attak413 = 221; + + public final static int FRAME_attak414 = 222; + + public final static int FRAME_attak415 = 223; + + public final static int FRAME_attak416 = 224; + + public final static int FRAME_attak417 = 225; + + public final static int FRAME_attak418 = 226; + + public final static int FRAME_attak419 = 227; + + public final static int FRAME_attak420 = 228; + + public final static int FRAME_attak421 = 229; + + public final static int FRAME_attak422 = 230; + + public final static int FRAME_attak423 = 231; + + public final static int FRAME_attak424 = 232; + + public final static int FRAME_attak425 = 233; + + public final static int FRAME_attak426 = 234; + + public final static int FRAME_attak501 = 235; + + public final static int FRAME_attak502 = 236; + + public final static int FRAME_attak503 = 237; + + public final static int FRAME_attak504 = 238; + + public final static int FRAME_attak505 = 239; + + public final static int FRAME_attak506 = 240; + + public final static int FRAME_attak507 = 241; + + public final static int FRAME_attak508 = 242; + + public final static int FRAME_attak509 = 243; + + public final static int FRAME_attak510 = 244; + + public final static int FRAME_attak511 = 245; + + public final static int FRAME_attak512 = 246; + + public final static int FRAME_attak513 = 247; + + public final static int FRAME_attak514 = 248; + + public final static int FRAME_attak515 = 249; + + public final static int FRAME_attak516 = 250; + + public final static int FRAME_death201 = 251; + + public final static int FRAME_death202 = 252; + + public final static int FRAME_death203 = 253; + + public final static int FRAME_death204 = 254; + + public final static int FRAME_death205 = 255; + + public final static int FRAME_death206 = 256; + + public final static int FRAME_death207 = 257; + + public final static int FRAME_death208 = 258; + + public final static int FRAME_death209 = 259; + + public final static int FRAME_death210 = 260; + + public final static int FRAME_death211 = 261; + + public final static int FRAME_death212 = 262; + + public final static int FRAME_death213 = 263; + + public final static int FRAME_death214 = 264; + + public final static int FRAME_death215 = 265; + + public final static int FRAME_death216 = 266; + + public final static int FRAME_death217 = 267; + + public final static int FRAME_death218 = 268; + + public final static int FRAME_death219 = 269; + + public final static int FRAME_death220 = 270; + + public final static int FRAME_death221 = 271; + + public final static int FRAME_death222 = 272; + + public final static int FRAME_death223 = 273; + + public final static int FRAME_death224 = 274; + + public final static int FRAME_death225 = 275; + + public final static int FRAME_death226 = 276; + + public final static int FRAME_death227 = 277; + + public final static int FRAME_death228 = 278; + + public final static int FRAME_death229 = 279; + + public final static int FRAME_death230 = 280; + + public final static int FRAME_death231 = 281; + + public final static int FRAME_death232 = 282; + + public final static int FRAME_death233 = 283; + + public final static int FRAME_death234 = 284; + + public final static int FRAME_death235 = 285; + + public final static int FRAME_death236 = 286; + + public final static int FRAME_death237 = 287; + + public final static int FRAME_death238 = 288; + + public final static int FRAME_death239 = 289; + + public final static int FRAME_death240 = 290; + + public final static int FRAME_death241 = 291; + + public final static int FRAME_death242 = 292; + + public final static int FRAME_death243 = 293; + + public final static int FRAME_death244 = 294; + + public final static int FRAME_death245 = 295; + + public final static int FRAME_death246 = 296; + + public final static int FRAME_death247 = 297; + + public final static int FRAME_death248 = 298; + + public final static int FRAME_death249 = 299; + + public final static int FRAME_death250 = 300; + + public final static int FRAME_death251 = 301; + + public final static int FRAME_death252 = 302; + + public final static int FRAME_death253 = 303; + + public final static int FRAME_death254 = 304; + + public final static int FRAME_death255 = 305; + + public final static int FRAME_death256 = 306; + + public final static int FRAME_death257 = 307; + + public final static int FRAME_death258 = 308; + + public final static int FRAME_death259 = 309; + + public final static int FRAME_death260 = 310; + + public final static int FRAME_death261 = 311; + + public final static int FRAME_death262 = 312; + + public final static int FRAME_death263 = 313; + + public final static int FRAME_death264 = 314; + + public final static int FRAME_death265 = 315; + + public final static int FRAME_death266 = 316; + + public final static int FRAME_death267 = 317; + + public final static int FRAME_death268 = 318; + + public final static int FRAME_death269 = 319; + + public final static int FRAME_death270 = 320; + + public final static int FRAME_death271 = 321; + + public final static int FRAME_death272 = 322; + + public final static int FRAME_death273 = 323; + + public final static int FRAME_death274 = 324; + + public final static int FRAME_death275 = 325; + + public final static int FRAME_death276 = 326; + + public final static int FRAME_death277 = 327; + + public final static int FRAME_death278 = 328; + + public final static int FRAME_death279 = 329; + + public final static int FRAME_death280 = 330; + + public final static int FRAME_death281 = 331; + + public final static int FRAME_death282 = 332; + + public final static int FRAME_death283 = 333; + + public final static int FRAME_death284 = 334; + + public final static int FRAME_death285 = 335; + + public final static int FRAME_death286 = 336; + + public final static int FRAME_death287 = 337; + + public final static int FRAME_death288 = 338; + + public final static int FRAME_death289 = 339; + + public final static int FRAME_death290 = 340; + + public final static int FRAME_death291 = 341; + + public final static int FRAME_death292 = 342; + + public final static int FRAME_death293 = 343; + + public final static int FRAME_death294 = 344; + + public final static int FRAME_death295 = 345; + + public final static int FRAME_death301 = 346; + + public final static int FRAME_death302 = 347; + + public final static int FRAME_death303 = 348; + + public final static int FRAME_death304 = 349; + + public final static int FRAME_death305 = 350; + + public final static int FRAME_death306 = 351; + + public final static int FRAME_death307 = 352; + + public final static int FRAME_death308 = 353; + + public final static int FRAME_death309 = 354; + + public final static int FRAME_death310 = 355; + + public final static int FRAME_death311 = 356; + + public final static int FRAME_death312 = 357; + + public final static int FRAME_death313 = 358; + + public final static int FRAME_death314 = 359; + + public final static int FRAME_death315 = 360; + + public final static int FRAME_death316 = 361; + + public final static int FRAME_death317 = 362; + + public final static int FRAME_death318 = 363; + + public final static int FRAME_death319 = 364; + + public final static int FRAME_death320 = 365; + + public final static int FRAME_jump01 = 366; + + public final static int FRAME_jump02 = 367; + + public final static int FRAME_jump03 = 368; + + public final static int FRAME_jump04 = 369; + + public final static int FRAME_jump05 = 370; + + public final static int FRAME_jump06 = 371; + + public final static int FRAME_jump07 = 372; + + public final static int FRAME_jump08 = 373; + + public final static int FRAME_jump09 = 374; + + public final static int FRAME_jump10 = 375; + + public final static int FRAME_jump11 = 376; + + public final static int FRAME_jump12 = 377; + + public final static int FRAME_jump13 = 378; + + public final static int FRAME_pain401 = 379; + + public final static int FRAME_pain402 = 380; + + public final static int FRAME_pain403 = 381; + + public final static int FRAME_pain404 = 382; + + public final static int FRAME_pain501 = 383; + + public final static int FRAME_pain502 = 384; + + public final static int FRAME_pain503 = 385; + + public final static int FRAME_pain504 = 386; + + public final static int FRAME_pain601 = 387; + + public final static int FRAME_pain602 = 388; + + public final static int FRAME_pain603 = 389; + + public final static int FRAME_pain604 = 390; + + public final static int FRAME_pain605 = 391; + + public final static int FRAME_pain606 = 392; + + public final static int FRAME_pain607 = 393; + + public final static int FRAME_pain608 = 394; + + public final static int FRAME_pain609 = 395; + + public final static int FRAME_pain610 = 396; + + public final static int FRAME_pain611 = 397; + + public final static int FRAME_pain612 = 398; + + public final static int FRAME_pain613 = 399; + + public final static int FRAME_pain614 = 400; + + public final static int FRAME_pain615 = 401; + + public final static int FRAME_pain616 = 402; + + public final static int FRAME_pain617 = 403; + + public final static int FRAME_pain618 = 404; + + public final static int FRAME_pain619 = 405; + + public final static int FRAME_pain620 = 406; + + public final static int FRAME_pain621 = 407; + + public final static int FRAME_pain622 = 408; + + public final static int FRAME_pain623 = 409; + + public final static int FRAME_pain624 = 410; + + public final static int FRAME_pain625 = 411; + + public final static int FRAME_pain626 = 412; + + public final static int FRAME_pain627 = 413; + + public final static int FRAME_stand201 = 414; + + public final static int FRAME_stand202 = 415; + + public final static int FRAME_stand203 = 416; + + public final static int FRAME_stand204 = 417; + + public final static int FRAME_stand205 = 418; + + public final static int FRAME_stand206 = 419; + + public final static int FRAME_stand207 = 420; + + public final static int FRAME_stand208 = 421; + + public final static int FRAME_stand209 = 422; + + public final static int FRAME_stand210 = 423; + + public final static int FRAME_stand211 = 424; + + public final static int FRAME_stand212 = 425; + + public final static int FRAME_stand213 = 426; + + public final static int FRAME_stand214 = 427; + + public final static int FRAME_stand215 = 428; + + public final static int FRAME_stand216 = 429; + + public final static int FRAME_stand217 = 430; + + public final static int FRAME_stand218 = 431; + + public final static int FRAME_stand219 = 432; + + public final static int FRAME_stand220 = 433; + + public final static int FRAME_stand221 = 434; + + public final static int FRAME_stand222 = 435; + + public final static int FRAME_stand223 = 436; + + public final static int FRAME_stand224 = 437; + + public final static int FRAME_stand225 = 438; + + public final static int FRAME_stand226 = 439; + + public final static int FRAME_stand227 = 440; + + public final static int FRAME_stand228 = 441; + + public final static int FRAME_stand229 = 442; + + public final static int FRAME_stand230 = 443; + + public final static int FRAME_stand231 = 444; + + public final static int FRAME_stand232 = 445; + + public final static int FRAME_stand233 = 446; + + public final static int FRAME_stand234 = 447; + + public final static int FRAME_stand235 = 448; + + public final static int FRAME_stand236 = 449; + + public final static int FRAME_stand237 = 450; + + public final static int FRAME_stand238 = 451; + + public final static int FRAME_stand239 = 452; + + public final static int FRAME_stand240 = 453; + + public final static int FRAME_stand241 = 454; + + public final static int FRAME_stand242 = 455; + + public final static int FRAME_stand243 = 456; + + public final static int FRAME_stand244 = 457; + + public final static int FRAME_stand245 = 458; + + public final static int FRAME_stand246 = 459; + + public final static int FRAME_stand247 = 460; + + public final static int FRAME_stand248 = 461; + + public final static int FRAME_stand249 = 462; + + public final static int FRAME_stand250 = 463; + + public final static int FRAME_stand251 = 464; + + public final static int FRAME_stand252 = 465; + + public final static int FRAME_stand253 = 466; + + public final static int FRAME_stand254 = 467; + + public final static int FRAME_stand255 = 468; + + public final static int FRAME_stand256 = 469; + + public final static int FRAME_stand257 = 470; + + public final static int FRAME_stand258 = 471; + + public final static int FRAME_stand259 = 472; + + public final static int FRAME_stand260 = 473; + + public final static int FRAME_walk201 = 474; + + public final static int FRAME_walk202 = 475; + + public final static int FRAME_walk203 = 476; + + public final static int FRAME_walk204 = 477; + + public final static int FRAME_walk205 = 478; + + public final static int FRAME_walk206 = 479; + + public final static int FRAME_walk207 = 480; + + public final static int FRAME_walk208 = 481; + + public final static int FRAME_walk209 = 482; + + public final static int FRAME_walk210 = 483; + + public final static int FRAME_walk211 = 484; + + public final static int FRAME_walk212 = 485; + + public final static int FRAME_walk213 = 486; + + public final static int FRAME_walk214 = 487; + + public final static int FRAME_walk215 = 488; + + public final static int FRAME_walk216 = 489; + + public final static int FRAME_walk217 = 490; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain4; + + static int sound_pain5; + + static int sound_pain6; + + static int sound_death; + + static int sound_step_left; + + static int sound_step_right; + + static int sound_attack_bfg; + + static int sound_brainsplorch; + + static int sound_prerailgun; + + static int sound_popup; + + static int sound_taunt1; + + static int sound_taunt2; + + static int sound_taunt3; + + static int sound_hit; + + static EntThinkAdapter makron_taunt = new EntThinkAdapter() { + public boolean think(edict_t self) { + float r; + + r = Lib.random(); + if (r <= 0.3) + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_taunt1, 1, + Defines.ATTN_NONE, 0); + else if (r <= 0.6) + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_taunt2, 1, + Defines.ATTN_NONE, 0); + else + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_taunt3, 1, + Defines.ATTN_NONE, 0); + return true; + } + }; + + // + // stand + // + static EntThinkAdapter makron_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = makron_move_stand; + return true; + } + }; + + /* + * static EntThinkAdapter xxx = new EntThinkAdapter() { public boolean + * think(edict_t self) { return true; } }; + */ + + static EntThinkAdapter makron_hit = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_hit, 1, + Defines.ATTN_NONE, 0); + return true; + } + }; + + static EntThinkAdapter makron_popup = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_popup, 1, + Defines.ATTN_NONE, 0); + return true; + } + }; + + static EntThinkAdapter makron_step_left = new EntThinkAdapter() { + + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_step_left, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter makron_step_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_step_right, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter makron_brainsplorch = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_brainsplorch, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter makron_prerailgun = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_prerailgun, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t makron_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), + // 10 + 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), + // 20 + 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), + // 30 + 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), + // 40 + 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), + // 50 + 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) // 60 + }; + + static mmove_t makron_move_stand = new mmove_t(FRAME_stand201, + FRAME_stand260, makron_frames_stand, null); + + static mframe_t makron_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 3, makron_step_left), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 8, makron_step_right), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 12, null) }; + + static mmove_t makron_move_run = new mmove_t(FRAME_walk204, FRAME_walk213, + makron_frames_run, null); + + static mframe_t makron_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 3, makron_step_left), + new mframe_t(GameAI.ai_walk, 12, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 8, makron_step_right), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 12, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 12, null) }; + + static mmove_t makron_move_walk = new mmove_t(FRAME_walk204, FRAME_walk213, + makron_frames_run, null); + + // + // death + // + static EntThinkAdapter makron_dead = new EntThinkAdapter() { + 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 makron_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = makron_move_walk; + return true; + } + }; + + static EntThinkAdapter makron_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = makron_move_stand; + else + self.monsterinfo.currentmove = makron_move_run; + return true; + } + }; + + static mframe_t makron_frames_pain6[] = 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), + // 10 + 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, makron_popup), + 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), + // 20 + 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, makron_taunt), + 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 makron_move_pain6 = new mmove_t(FRAME_pain601, + FRAME_pain627, makron_frames_pain6, makron_run); + + static mframe_t makron_frames_pain5[] = 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) }; + + static mmove_t makron_move_pain5 = new mmove_t(FRAME_pain501, + FRAME_pain504, makron_frames_pain5, makron_run); + + static mframe_t makron_frames_pain4[] = 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) }; + + static mmove_t makron_move_pain4 = new mmove_t(FRAME_pain401, + FRAME_pain404, makron_frames_pain4, makron_run); + + static mframe_t makron_frames_death2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -15, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, -12, null), + new mframe_t(GameAI.ai_move, 0, makron_step_left), + 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), + // 10 + 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, 11, null), + new mframe_t(GameAI.ai_move, 12, null), + new mframe_t(GameAI.ai_move, 11, makron_step_right), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + // 20 + 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), + // 30 + 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, 5, null), + new mframe_t(GameAI.ai_move, 7, null), + new mframe_t(GameAI.ai_move, 6, makron_step_left), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 2, null), + // 40 + 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), + // 50 + 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, -6, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -6, makron_step_right), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -4, makron_step_left), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + // 60 + 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, -5, null), + new mframe_t(GameAI.ai_move, -3, makron_step_right), + new mframe_t(GameAI.ai_move, -8, null), + new mframe_t(GameAI.ai_move, -3, makron_step_left), + new mframe_t(GameAI.ai_move, -7, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -4, makron_step_right), + // 70 + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -7, null), + new mframe_t(GameAI.ai_move, 0, makron_step_left), + 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), + // 80 + 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, 0, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 0, null), + // 90 + new mframe_t(GameAI.ai_move, 27, makron_hit), + new mframe_t(GameAI.ai_move, 26, null), + new mframe_t(GameAI.ai_move, 0, makron_brainsplorch), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null) // 95 + }; + + static mmove_t makron_move_death2 = new mmove_t(FRAME_death201, + FRAME_death295, makron_frames_death2, makron_dead); + + static mframe_t makron_frames_death3[] = 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) }; + + static mmove_t makron_move_death3 = new mmove_t(FRAME_death301, + FRAME_death320, makron_frames_death3, null); + + static mframe_t makron_frames_sight[] = 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) }; + + static mmove_t makron_move_sight = new mmove_t(FRAME_active01, + FRAME_active13, makron_frames_sight, makron_run); + + static EntThinkAdapter makronBFG = new EntThinkAdapter() { + 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 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_MAKRON_BFG], + forward, right, start); + + Math3D.VectorCopy(self.enemy.s.origin, vec); + vec[2] += self.enemy.viewheight; + Math3D.VectorSubtract(vec, start, dir); + Math3D.VectorNormalize(dir); + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_attack_bfg, 1, + Defines.ATTN_NORM, 0); + Monster.monster_fire_bfg(self, start, dir, 50, 300, 100, 300, + Defines.MZ2_MAKRON_BFG); + return true; + } + }; + + static EntThinkAdapter MakronSaveloc = new EntThinkAdapter() { + public boolean think(edict_t self) { + Math3D.VectorCopy(self.enemy.s.origin, self.pos1); //save for + // aiming the + // shot + self.pos1[2] += self.enemy.viewheight; + return true; + } + }; + + // FIXME: He's not firing from the proper Z + + static EntThinkAdapter MakronRailgun = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_MAKRON_RAILGUN_1], + forward, right, start); + + // calc direction to where we targted + Math3D.VectorSubtract(self.pos1, start, dir); + Math3D.VectorNormalize(dir); + + Monster.monster_fire_railgun(self, start, dir, 50, 100, + Defines.MZ2_MAKRON_RAILGUN_1); + + return true; + } + }; + + // FIXME: This is all wrong. He's not firing at the proper angles. + + static EntThinkAdapter MakronHyperblaster = new EntThinkAdapter() { + 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_MAKRON_BLASTER_1 + + (self.s.frame - FRAME_attak405); + + Math3D.AngleVectors(self.s.angles, 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); + vec[2] += self.enemy.viewheight; + Math3D.VectorSubtract(vec, start, vec); + Math3D.vectoangles(vec, vec); + dir[0] = vec[0]; + } else { + dir[0] = 0; + } + if (self.s.frame <= FRAME_attak413) + dir[1] = self.s.angles[1] - 10 + * (self.s.frame - FRAME_attak413); + else + dir[1] = self.s.angles[1] + 10 + * (self.s.frame - FRAME_attak421); + dir[2] = 0; + + Math3D.AngleVectors(dir, forward, null, null); + + Monster.monster_fire_blaster(self, start, forward, 15, 1000, + Defines.MZ2_MAKRON_BLASTER_1, Defines.EF_BLASTER); + + return true; + } + }; + + static EntPainAdapter makron_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + + if (self.health < (self.max_health / 2)) + self.s.skinnum = 1; + + if (GameBase.level.time < self.pain_debounce_time) + return; + + // Lessen the chance of him going into his pain frames + if (damage <= 25) + if (Lib.random() < 0.2) + return; + + self.pain_debounce_time = GameBase.level.time + 3; + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 40) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain4, 1, + Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = makron_move_pain4; + } else if (damage <= 110) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain5, 1, + Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = makron_move_pain5; + } else { + if (damage <= 150) + if (Lib.random() <= 0.45) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, + sound_pain6, 1, Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = makron_move_pain6; + } else if (Lib.random() <= 0.35) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, + sound_pain6, 1, Defines.ATTN_NONE, 0); + self.monsterinfo.currentmove = makron_move_pain6; + } + } + } + + }; + + static EntInteractAdapter makron_sight = new EntInteractAdapter() { + public boolean interact(edict_t self, edict_t other) { + self.monsterinfo.currentmove = makron_move_sight; + return true; + } + }; + + static EntThinkAdapter makron_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] vec = { 0, 0, 0 }; + float range; + float r; + + r = Lib.random(); + + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); + range = Math3D.VectorLength(vec); + + if (r <= 0.3) + self.monsterinfo.currentmove = makron_move_attack3; + else if (r <= 0.6) + self.monsterinfo.currentmove = makron_move_attack4; + else + self.monsterinfo.currentmove = makron_move_attack5; + + return true; + } + }; + + /* + * --- Makron Torso. This needs to be spawned in --- + */ + + static EntThinkAdapter makron_torso_think = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (++self.s.frame < 365) + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + else { + self.s.frame = 346; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + } + return true; + } + }; + + static EntThinkAdapter makron_torso = new EntThinkAdapter() { + public boolean think(edict_t ent) { + ent.movetype = Defines.MOVETYPE_NONE; + ent.solid = Defines.SOLID_NOT; + Math3D.VectorSet(ent.mins, -8, -8, 0); + Math3D.VectorSet(ent.maxs, 8, 8, 8); + ent.s.frame = 346; + ent.s.modelindex = GameBase.gi + .modelindex("models/monsters/boss3/rider/tris.md2"); + ent.think = makron_torso_think; + ent.nextthink = GameBase.level.time + 2 * Defines.FRAMETIME; + ent.s.sound = GameBase.gi.soundindex("makron/spine.wav"); + GameBase.gi.linkentity(ent); + return true; + } + }; + + static EntDieAdapter makron_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + edict_t tempent; + + int n; + + self.s.sound = 0; + // 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 < 1 /* 4 */; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_metal/tris.md2", damage, + Defines.GIB_METALLIC); + GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", + damage, Defines.GIB_METALLIC); + 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_NONE, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + tempent = GameUtil.G_Spawn(); + Math3D.VectorCopy(self.s.origin, tempent.s.origin); + Math3D.VectorCopy(self.s.angles, tempent.s.angles); + tempent.s.origin[1] -= 84; + makron_torso.think(tempent); + + self.monsterinfo.currentmove = makron_move_death2; + } + }; + + static EntThinkAdapter Makron_CheckAttack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] spot1 = { 0, 0, 0 }, spot2 = { 0, 0, 0 }; + float[] temp = { 0, 0, 0 }; + float chance; + trace_t tr; + boolean enemy_infront; + int enemy_range; + float enemy_yaw; + + if (self.enemy.health > 0) { + // see if any entities are in the way of the shot + Math3D.VectorCopy(self.s.origin, spot1); + spot1[2] += self.viewheight; + Math3D.VectorCopy(self.enemy.s.origin, spot2); + spot2[2] += self.enemy.viewheight; + + tr = GameBase.gi.trace(spot1, null, null, spot2, self, + Defines.CONTENTS_SOLID | Defines.CONTENTS_MONSTER + | Defines.CONTENTS_SLIME + | Defines.CONTENTS_LAVA); + + // do we have a clear shot? + if (tr.ent != self.enemy) + return false; + } + + enemy_infront = GameUtil.infront(self, self.enemy); + enemy_range = GameUtil.range(self, self.enemy); + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, temp); + enemy_yaw = Math3D.vectoyaw(temp); + + self.ideal_yaw = enemy_yaw; + + // melee attack + if (enemy_range == Defines.RANGE_MELEE) { + if (self.monsterinfo.melee != null) + self.monsterinfo.attack_state = Defines.AS_MELEE; + else + self.monsterinfo.attack_state = Defines.AS_MISSILE; + return true; + } + + // missile attack + if (null != self.monsterinfo.attack) + return false; + + if (GameBase.level.time < self.monsterinfo.attack_finished) + return false; + + if (enemy_range == Defines.RANGE_FAR) + return false; + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + chance = 0.4f; + } else if (enemy_range == Defines.RANGE_MELEE) { + chance = 0.8f; + } else if (enemy_range == Defines.RANGE_NEAR) { + chance = 0.4f; + } else if (enemy_range == Defines.RANGE_MID) { + chance = 0.2f; + } else { + return false; + } + + if (Lib.random() < chance) { + self.monsterinfo.attack_state = Defines.AS_MISSILE; + self.monsterinfo.attack_finished = GameBase.level.time + 2 + * Lib.random(); + return true; + } + + if ((self.flags & Defines.FL_FLY) != 0) { + if (Lib.random() < 0.3) + self.monsterinfo.attack_state = Defines.AS_SLIDING; + else + self.monsterinfo.attack_state = Defines.AS_STRAIGHT; + } + + return false; + } + }; + + static mframe_t makron_frames_attack3[] = new mframe_t[] { + 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, makronBFG), + // FIXME: BFG Attack here + 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 makron_move_attack3 = new mmove_t(FRAME_attak301, + FRAME_attak308, makron_frames_attack3, makron_run); + + static mframe_t makron_frames_attack4[] = new mframe_t[] { + 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_move, 0, MakronHyperblaster), + // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + new mframe_t(GameAI.ai_move, 0, MakronHyperblaster), // fire + 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 makron_move_attack4 = new mmove_t(FRAME_attak401, + FRAME_attak426, makron_frames_attack4, makron_run); + + static mframe_t makron_frames_attack5[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, makron_prerailgun), + 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, MakronSaveloc), + new mframe_t(GameAI.ai_move, 0, MakronRailgun), + // Fire railgun + 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 makron_move_attack5 = new mmove_t(FRAME_attak501, + FRAME_attak516, makron_frames_attack5, makron_run); + + /* + * ================= MakronSpawn + * + * ================= + */ + static EntThinkAdapter MakronSpawn = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] vec = { 0, 0, 0 }; + + edict_t player; + + SP_monster_makron(self); + + // jump at player + player = GameBase.level.sight_client; + if (player == null) + return true; + + Math3D.VectorSubtract(player.s.origin, self.s.origin, vec); + self.s.angles[Defines.YAW] = Math3D.vectoyaw(vec); + Math3D.VectorNormalize(vec); + Math3D.VectorMA(Globals.vec3_origin, 400, vec, self.velocity); + self.velocity[2] = 200; + self.groundentity = null; + + return true; + } + }; + + static EntThinkAdapter MakronToss = new EntThinkAdapter() { + public boolean think(edict_t self) { + edict_t ent; + + ent = GameUtil.G_Spawn(); + ent.nextthink = GameBase.level.time + 0.8f; + ent.think = MakronSpawn; + ent.target = self.target; + Math3D.VectorCopy(self.s.origin, ent.s.origin); + return true; + } + }; + + // + // monster_makron + // + + static void MakronPrecache() { + sound_pain4 = GameBase.gi.soundindex("makron/pain3.wav"); + sound_pain5 = GameBase.gi.soundindex("makron/pain2.wav"); + sound_pain6 = GameBase.gi.soundindex("makron/pain1.wav"); + sound_death = GameBase.gi.soundindex("makron/death.wav"); + sound_step_left = GameBase.gi.soundindex("makron/step1.wav"); + sound_step_right = GameBase.gi.soundindex("makron/step2.wav"); + sound_attack_bfg = GameBase.gi.soundindex("makron/bfg_fire.wav"); + sound_brainsplorch = GameBase.gi.soundindex("makron/brain1.wav"); + sound_prerailgun = GameBase.gi.soundindex("makron/rail_up.wav"); + sound_popup = GameBase.gi.soundindex("makron/popup.wav"); + sound_taunt1 = GameBase.gi.soundindex("makron/voice4.wav"); + sound_taunt2 = GameBase.gi.soundindex("makron/voice3.wav"); + sound_taunt3 = GameBase.gi.soundindex("makron/voice.wav"); + sound_hit = GameBase.gi.soundindex("makron/bhit.wav"); + + GameBase.gi.modelindex("models/monsters/boss3/rider/tris.md2"); + } + + /* + * QUAKED monster_makron (1 .5 0) (-30 -30 0) (30 30 90) Ambush + * Trigger_Spawn Sight + */ + static void SP_monster_makron(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + MakronPrecache(); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/boss3/rider/tris.md2"); + Math3D.VectorSet(self.mins, -30, -30, 0); + Math3D.VectorSet(self.maxs, 30, 30, 90); + + self.health = 3000; + self.gib_health = -2000; + self.mass = 500; + + self.pain = makron_pain; + self.die = makron_die; + self.monsterinfo.stand = makron_stand; + self.monsterinfo.walk = makron_walk; + self.monsterinfo.run = makron_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = makron_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = makron_sight; + self.monsterinfo.checkattack = Makron_CheckAttack; + + GameBase.gi.linkentity(self); + + // self.monsterinfo.currentmove = &makron_move_stand; + self.monsterinfo.currentmove = makron_move_sight; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Brain.java b/src/jake2/game/monsters/M_Brain.java new file mode 100644 index 0000000..1339ed2 --- /dev/null +++ b/src/jake2/game/monsters/M_Brain.java @@ -0,0 +1,1164 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Brain.java,v 1.2 2005-02-06 18:48:14 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Brain { + + public final static int FRAME_walk101 = 0; + + public final static int FRAME_walk102 = 1; + + public final static int FRAME_walk103 = 2; + + public final static int FRAME_walk104 = 3; + + public final static int FRAME_walk105 = 4; + + public final static int FRAME_walk106 = 5; + + public final static int FRAME_walk107 = 6; + + public final static int FRAME_walk108 = 7; + + public final static int FRAME_walk109 = 8; + + public final static int FRAME_walk110 = 9; + + public final static int FRAME_walk111 = 10; + + public final static int FRAME_walk112 = 11; + + public final static int FRAME_walk113 = 12; + + public final static int FRAME_walk201 = 13; + + public final static int FRAME_walk202 = 14; + + public final static int FRAME_walk203 = 15; + + public final static int FRAME_walk204 = 16; + + public final static int FRAME_walk205 = 17; + + public final static int FRAME_walk206 = 18; + + public final static int FRAME_walk207 = 19; + + public final static int FRAME_walk208 = 20; + + public final static int FRAME_walk209 = 21; + + public final static int FRAME_walk210 = 22; + + public final static int FRAME_walk211 = 23; + + public final static int FRAME_walk212 = 24; + + public final static int FRAME_walk213 = 25; + + public final static int FRAME_walk214 = 26; + + public final static int FRAME_walk215 = 27; + + public final static int FRAME_walk216 = 28; + + public final static int FRAME_walk217 = 29; + + public final static int FRAME_walk218 = 30; + + public final static int FRAME_walk219 = 31; + + public final static int FRAME_walk220 = 32; + + public final static int FRAME_walk221 = 33; + + public final static int FRAME_walk222 = 34; + + public final static int FRAME_walk223 = 35; + + public final static int FRAME_walk224 = 36; + + public final static int FRAME_walk225 = 37; + + public final static int FRAME_walk226 = 38; + + public final static int FRAME_walk227 = 39; + + public final static int FRAME_walk228 = 40; + + public final static int FRAME_walk229 = 41; + + public final static int FRAME_walk230 = 42; + + public final static int FRAME_walk231 = 43; + + public final static int FRAME_walk232 = 44; + + public final static int FRAME_walk233 = 45; + + public final static int FRAME_walk234 = 46; + + public final static int FRAME_walk235 = 47; + + public final static int FRAME_walk236 = 48; + + public final static int FRAME_walk237 = 49; + + public final static int FRAME_walk238 = 50; + + public final static int FRAME_walk239 = 51; + + public final static int FRAME_walk240 = 52; + + public final static int FRAME_attak101 = 53; + + public final static int FRAME_attak102 = 54; + + public final static int FRAME_attak103 = 55; + + public final static int FRAME_attak104 = 56; + + public final static int FRAME_attak105 = 57; + + public final static int FRAME_attak106 = 58; + + public final static int FRAME_attak107 = 59; + + public final static int FRAME_attak108 = 60; + + public final static int FRAME_attak109 = 61; + + public final static int FRAME_attak110 = 62; + + public final static int FRAME_attak111 = 63; + + public final static int FRAME_attak112 = 64; + + public final static int FRAME_attak113 = 65; + + public final static int FRAME_attak114 = 66; + + public final static int FRAME_attak115 = 67; + + public final static int FRAME_attak116 = 68; + + public final static int FRAME_attak117 = 69; + + public final static int FRAME_attak118 = 70; + + public final static int FRAME_attak201 = 71; + + public final static int FRAME_attak202 = 72; + + public final static int FRAME_attak203 = 73; + + public final static int FRAME_attak204 = 74; + + public final static int FRAME_attak205 = 75; + + public final static int FRAME_attak206 = 76; + + public final static int FRAME_attak207 = 77; + + public final static int FRAME_attak208 = 78; + + public final static int FRAME_attak209 = 79; + + public final static int FRAME_attak210 = 80; + + public final static int FRAME_attak211 = 81; + + public final static int FRAME_attak212 = 82; + + public final static int FRAME_attak213 = 83; + + public final static int FRAME_attak214 = 84; + + public final static int FRAME_attak215 = 85; + + public final static int FRAME_attak216 = 86; + + public final static int FRAME_attak217 = 87; + + public final static int FRAME_pain101 = 88; + + public final static int FRAME_pain102 = 89; + + public final static int FRAME_pain103 = 90; + + public final static int FRAME_pain104 = 91; + + public final static int FRAME_pain105 = 92; + + public final static int FRAME_pain106 = 93; + + public final static int FRAME_pain107 = 94; + + public final static int FRAME_pain108 = 95; + + public final static int FRAME_pain109 = 96; + + public final static int FRAME_pain110 = 97; + + public final static int FRAME_pain111 = 98; + + public final static int FRAME_pain112 = 99; + + public final static int FRAME_pain113 = 100; + + public final static int FRAME_pain114 = 101; + + public final static int FRAME_pain115 = 102; + + public final static int FRAME_pain116 = 103; + + public final static int FRAME_pain117 = 104; + + public final static int FRAME_pain118 = 105; + + public final static int FRAME_pain119 = 106; + + public final static int FRAME_pain120 = 107; + + public final static int FRAME_pain121 = 108; + + public final static int FRAME_pain201 = 109; + + public final static int FRAME_pain202 = 110; + + public final static int FRAME_pain203 = 111; + + public final static int FRAME_pain204 = 112; + + public final static int FRAME_pain205 = 113; + + public final static int FRAME_pain206 = 114; + + public final static int FRAME_pain207 = 115; + + public final static int FRAME_pain208 = 116; + + public final static int FRAME_pain301 = 117; + + public final static int FRAME_pain302 = 118; + + public final static int FRAME_pain303 = 119; + + public final static int FRAME_pain304 = 120; + + public final static int FRAME_pain305 = 121; + + public final static int FRAME_pain306 = 122; + + public final static int FRAME_death101 = 123; + + public final static int FRAME_death102 = 124; + + public final static int FRAME_death103 = 125; + + public final static int FRAME_death104 = 126; + + public final static int FRAME_death105 = 127; + + public final static int FRAME_death106 = 128; + + public final static int FRAME_death107 = 129; + + public final static int FRAME_death108 = 130; + + public final static int FRAME_death109 = 131; + + public final static int FRAME_death110 = 132; + + public final static int FRAME_death111 = 133; + + public final static int FRAME_death112 = 134; + + public final static int FRAME_death113 = 135; + + public final static int FRAME_death114 = 136; + + public final static int FRAME_death115 = 137; + + public final static int FRAME_death116 = 138; + + public final static int FRAME_death117 = 139; + + public final static int FRAME_death118 = 140; + + public final static int FRAME_death201 = 141; + + public final static int FRAME_death202 = 142; + + public final static int FRAME_death203 = 143; + + public final static int FRAME_death204 = 144; + + public final static int FRAME_death205 = 145; + + public final static int FRAME_duck01 = 146; + + public final static int FRAME_duck02 = 147; + + public final static int FRAME_duck03 = 148; + + public final static int FRAME_duck04 = 149; + + public final static int FRAME_duck05 = 150; + + public final static int FRAME_duck06 = 151; + + public final static int FRAME_duck07 = 152; + + public final static int FRAME_duck08 = 153; + + public final static int FRAME_defens01 = 154; + + public final static int FRAME_defens02 = 155; + + public final static int FRAME_defens03 = 156; + + public final static int FRAME_defens04 = 157; + + public final static int FRAME_defens05 = 158; + + public final static int FRAME_defens06 = 159; + + public final static int FRAME_defens07 = 160; + + public final static int FRAME_defens08 = 161; + + public final static int FRAME_stand01 = 162; + + public final static int FRAME_stand02 = 163; + + public final static int FRAME_stand03 = 164; + + public final static int FRAME_stand04 = 165; + + public final static int FRAME_stand05 = 166; + + public final static int FRAME_stand06 = 167; + + public final static int FRAME_stand07 = 168; + + public final static int FRAME_stand08 = 169; + + public final static int FRAME_stand09 = 170; + + public final static int FRAME_stand10 = 171; + + public final static int FRAME_stand11 = 172; + + public final static int FRAME_stand12 = 173; + + public final static int FRAME_stand13 = 174; + + public final static int FRAME_stand14 = 175; + + public final static int FRAME_stand15 = 176; + + public final static int FRAME_stand16 = 177; + + public final static int FRAME_stand17 = 178; + + public final static int FRAME_stand18 = 179; + + public final static int FRAME_stand19 = 180; + + public final static int FRAME_stand20 = 181; + + public final static int FRAME_stand21 = 182; + + public final static int FRAME_stand22 = 183; + + public final static int FRAME_stand23 = 184; + + public final static int FRAME_stand24 = 185; + + public final static int FRAME_stand25 = 186; + + public final static int FRAME_stand26 = 187; + + public final static int FRAME_stand27 = 188; + + public final static int FRAME_stand28 = 189; + + public final static int FRAME_stand29 = 190; + + public final static int FRAME_stand30 = 191; + + public final static int FRAME_stand31 = 192; + + public final static int FRAME_stand32 = 193; + + public final static int FRAME_stand33 = 194; + + public final static int FRAME_stand34 = 195; + + public final static int FRAME_stand35 = 196; + + public final static int FRAME_stand36 = 197; + + public final static int FRAME_stand37 = 198; + + public final static int FRAME_stand38 = 199; + + public final static int FRAME_stand39 = 200; + + public final static int FRAME_stand40 = 201; + + public final static int FRAME_stand41 = 202; + + public final static int FRAME_stand42 = 203; + + public final static int FRAME_stand43 = 204; + + public final static int FRAME_stand44 = 205; + + public final static int FRAME_stand45 = 206; + + public final static int FRAME_stand46 = 207; + + public final static int FRAME_stand47 = 208; + + public final static int FRAME_stand48 = 209; + + public final static int FRAME_stand49 = 210; + + public final static int FRAME_stand50 = 211; + + public final static int FRAME_stand51 = 212; + + public final static int FRAME_stand52 = 213; + + public final static int FRAME_stand53 = 214; + + public final static int FRAME_stand54 = 215; + + public final static int FRAME_stand55 = 216; + + public final static int FRAME_stand56 = 217; + + public final static int FRAME_stand57 = 218; + + public final static int FRAME_stand58 = 219; + + public final static int FRAME_stand59 = 220; + + public final static int FRAME_stand60 = 221; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_chest_open; + + static int sound_tentacles_extend; + + static int sound_tentacles_retract; + + static int sound_death; + + static int sound_idle1; + + static int sound_idle2; + + static int sound_idle3; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_sight; + + static int sound_search; + + static int sound_melee1; + + static int sound_melee2; + + static int sound_melee3; + + static EntInteractAdapter brain_sight = new EntInteractAdapter() { + 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 EntThinkAdapter brain_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + // + // STAND + // + + static mframe_t brain_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) }; + + static mmove_t brain_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, + brain_frames_stand, null); + + static EntThinkAdapter brain_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = brain_move_stand; + return true; + } + }; + + // + // IDLE + // + + static mframe_t brain_frames_idle[] = 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) }; + + static mmove_t brain_move_idle = new mmove_t(FRAME_stand31, FRAME_stand60, + brain_frames_idle, brain_stand); + + static EntThinkAdapter brain_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_idle3, 1, + Defines.ATTN_IDLE, 0); + self.monsterinfo.currentmove = brain_move_idle; + return true; + } + }; + + // + // WALK + // + static mframe_t brain_frames_walk1[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, -4, null), + new mframe_t(GameAI.ai_walk, -1, null), + new mframe_t(GameAI.ai_walk, 2, null) }; + + static mmove_t brain_move_walk1 = new mmove_t(FRAME_walk101, FRAME_walk111, + brain_frames_walk1, null); + + // walk2 is FUBAR, do not use + /* + * # if 0 void brain_walk2_cycle(edict_t self) { if (random() > 0.1) + * self.monsterinfo.nextframe= FRAME_walk220; } + * + * static mframe_t brain_frames_walk2[]= new mframe_t[] { new + * mframe_t(ai_walk, 3, null), new mframe_t(ai_walk, -2, null), new + * mframe_t(ai_walk, -4, null), new mframe_t(ai_walk, -3, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 1, null), new + * mframe_t(ai_walk, 12, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, -3, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, -2, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 1, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 10, null, // Cycle + * Start) + * + * new mframe_t(ai_walk, -1, null), new mframe_t(ai_walk, 7, null), new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 3, null), new + * mframe_t(ai_walk, -3, null), new mframe_t(ai_walk, 2, null), new + * mframe_t(ai_walk, 4, null), new mframe_t(ai_walk, -3, null), new + * mframe_t(ai_walk, 2, null), new mframe_t(ai_walk, 0, null), new + * mframe_t(ai_walk, 4, brain_walk2_cycle), new mframe_t(ai_walk, -1, null), + * new mframe_t(ai_walk, -1, null), new mframe_t(ai_walk, -8, null,) new + * mframe_t(ai_walk, 0, null), new mframe_t(ai_walk, 1, null), new + * mframe_t(ai_walk, 5, null), new mframe_t(ai_walk, 2, null), new + * mframe_t(ai_walk, -1, null), new mframe_t(ai_walk, -5, null)}; static + * mmove_t brain_move_walk2= new mmove_t(FRAME_walk201, FRAME_walk240, + * brain_frames_walk2, null); + * # endif + */ + static EntThinkAdapter brain_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + // if (random() <= 0.5) + self.monsterinfo.currentmove = brain_move_walk1; + // else + // self.monsterinfo.currentmove = &brain_move_walk2; + return true; + } + }; + + // + // DUCK + // + + static EntThinkAdapter brain_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter brain_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static EntThinkAdapter brain_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntDodgeAdapter brain_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + if (Lib.random() > 0.25) + return; + + if (self.enemy == null) + self.enemy = attacker; + + self.monsterinfo.pausetime = GameBase.level.time + eta + 0.5f; + self.monsterinfo.currentmove = brain_move_duck; + return; + } + }; + + static mframe_t brain_frames_death2[] = 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, 9, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static EntThinkAdapter brain_dead = new EntThinkAdapter() { + 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 mmove_t brain_move_death2 = new mmove_t(FRAME_death201, + FRAME_death205, brain_frames_death2, brain_dead); + + static mframe_t brain_frames_death1[] = 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, -2, null), + new mframe_t(GameAI.ai_move, 9, 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 brain_move_death1 = new mmove_t(FRAME_death101, + FRAME_death118, brain_frames_death1, brain_dead); + + // + // MELEE + // + + static EntThinkAdapter brain_swing_right = new EntThinkAdapter() { + 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 boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); + if (Fire.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 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 boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); + if (Fire.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 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 boolean think(edict_t self) { + + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 8); + if (Fire.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 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 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 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 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 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Chick.java b/src/jake2/game/monsters/M_Chick.java new file mode 100644 index 0000000..32e3c07 --- /dev/null +++ b/src/jake2/game/monsters/M_Chick.java @@ -0,0 +1,1315 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Chick.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Chick { + + public final static int FRAME_attak101 = 0; + + public final static int FRAME_attak102 = 1; + + public final static int FRAME_attak103 = 2; + + public final static int FRAME_attak104 = 3; + + public final static int FRAME_attak105 = 4; + + public final static int FRAME_attak106 = 5; + + public final static int FRAME_attak107 = 6; + + public final static int FRAME_attak108 = 7; + + public final static int FRAME_attak109 = 8; + + public final static int FRAME_attak110 = 9; + + public final static int FRAME_attak111 = 10; + + public final static int FRAME_attak112 = 11; + + public final static int FRAME_attak113 = 12; + + public final static int FRAME_attak114 = 13; + + public final static int FRAME_attak115 = 14; + + public final static int FRAME_attak116 = 15; + + public final static int FRAME_attak117 = 16; + + public final static int FRAME_attak118 = 17; + + public final static int FRAME_attak119 = 18; + + public final static int FRAME_attak120 = 19; + + public final static int FRAME_attak121 = 20; + + public final static int FRAME_attak122 = 21; + + public final static int FRAME_attak123 = 22; + + public final static int FRAME_attak124 = 23; + + public final static int FRAME_attak125 = 24; + + public final static int FRAME_attak126 = 25; + + public final static int FRAME_attak127 = 26; + + public final static int FRAME_attak128 = 27; + + public final static int FRAME_attak129 = 28; + + public final static int FRAME_attak130 = 29; + + public final static int FRAME_attak131 = 30; + + public final static int FRAME_attak132 = 31; + + public final static int FRAME_attak201 = 32; + + public final static int FRAME_attak202 = 33; + + public final static int FRAME_attak203 = 34; + + public final static int FRAME_attak204 = 35; + + public final static int FRAME_attak205 = 36; + + public final static int FRAME_attak206 = 37; + + public final static int FRAME_attak207 = 38; + + public final static int FRAME_attak208 = 39; + + public final static int FRAME_attak209 = 40; + + public final static int FRAME_attak210 = 41; + + public final static int FRAME_attak211 = 42; + + public final static int FRAME_attak212 = 43; + + public final static int FRAME_attak213 = 44; + + public final static int FRAME_attak214 = 45; + + public final static int FRAME_attak215 = 46; + + public final static int FRAME_attak216 = 47; + + public final static int FRAME_death101 = 48; + + public final static int FRAME_death102 = 49; + + public final static int FRAME_death103 = 50; + + public final static int FRAME_death104 = 51; + + public final static int FRAME_death105 = 52; + + public final static int FRAME_death106 = 53; + + public final static int FRAME_death107 = 54; + + public final static int FRAME_death108 = 55; + + public final static int FRAME_death109 = 56; + + public final static int FRAME_death110 = 57; + + public final static int FRAME_death111 = 58; + + public final static int FRAME_death112 = 59; + + public final static int FRAME_death201 = 60; + + public final static int FRAME_death202 = 61; + + public final static int FRAME_death203 = 62; + + public final static int FRAME_death204 = 63; + + public final static int FRAME_death205 = 64; + + public final static int FRAME_death206 = 65; + + public final static int FRAME_death207 = 66; + + public final static int FRAME_death208 = 67; + + public final static int FRAME_death209 = 68; + + public final static int FRAME_death210 = 69; + + public final static int FRAME_death211 = 70; + + public final static int FRAME_death212 = 71; + + public final static int FRAME_death213 = 72; + + public final static int FRAME_death214 = 73; + + public final static int FRAME_death215 = 74; + + public final static int FRAME_death216 = 75; + + public final static int FRAME_death217 = 76; + + public final static int FRAME_death218 = 77; + + public final static int FRAME_death219 = 78; + + public final static int FRAME_death220 = 79; + + public final static int FRAME_death221 = 80; + + public final static int FRAME_death222 = 81; + + public final static int FRAME_death223 = 82; + + public final static int FRAME_duck01 = 83; + + public final static int FRAME_duck02 = 84; + + public final static int FRAME_duck03 = 85; + + public final static int FRAME_duck04 = 86; + + public final static int FRAME_duck05 = 87; + + public final static int FRAME_duck06 = 88; + + public final static int FRAME_duck07 = 89; + + public final static int FRAME_pain101 = 90; + + public final static int FRAME_pain102 = 91; + + public final static int FRAME_pain103 = 92; + + public final static int FRAME_pain104 = 93; + + public final static int FRAME_pain105 = 94; + + public final static int FRAME_pain201 = 95; + + public final static int FRAME_pain202 = 96; + + public final static int FRAME_pain203 = 97; + + public final static int FRAME_pain204 = 98; + + public final static int FRAME_pain205 = 99; + + public final static int FRAME_pain301 = 100; + + public final static int FRAME_pain302 = 101; + + public final static int FRAME_pain303 = 102; + + public final static int FRAME_pain304 = 103; + + public final static int FRAME_pain305 = 104; + + public final static int FRAME_pain306 = 105; + + public final static int FRAME_pain307 = 106; + + public final static int FRAME_pain308 = 107; + + public final static int FRAME_pain309 = 108; + + public final static int FRAME_pain310 = 109; + + public final static int FRAME_pain311 = 110; + + public final static int FRAME_pain312 = 111; + + public final static int FRAME_pain313 = 112; + + public final static int FRAME_pain314 = 113; + + public final static int FRAME_pain315 = 114; + + public final static int FRAME_pain316 = 115; + + public final static int FRAME_pain317 = 116; + + public final static int FRAME_pain318 = 117; + + public final static int FRAME_pain319 = 118; + + public final static int FRAME_pain320 = 119; + + public final static int FRAME_pain321 = 120; + + public final static int FRAME_stand101 = 121; + + public final static int FRAME_stand102 = 122; + + public final static int FRAME_stand103 = 123; + + public final static int FRAME_stand104 = 124; + + public final static int FRAME_stand105 = 125; + + public final static int FRAME_stand106 = 126; + + public final static int FRAME_stand107 = 127; + + public final static int FRAME_stand108 = 128; + + public final static int FRAME_stand109 = 129; + + public final static int FRAME_stand110 = 130; + + public final static int FRAME_stand111 = 131; + + public final static int FRAME_stand112 = 132; + + public final static int FRAME_stand113 = 133; + + public final static int FRAME_stand114 = 134; + + public final static int FRAME_stand115 = 135; + + public final static int FRAME_stand116 = 136; + + public final static int FRAME_stand117 = 137; + + public final static int FRAME_stand118 = 138; + + public final static int FRAME_stand119 = 139; + + public final static int FRAME_stand120 = 140; + + public final static int FRAME_stand121 = 141; + + public final static int FRAME_stand122 = 142; + + public final static int FRAME_stand123 = 143; + + public final static int FRAME_stand124 = 144; + + public final static int FRAME_stand125 = 145; + + public final static int FRAME_stand126 = 146; + + public final static int FRAME_stand127 = 147; + + public final static int FRAME_stand128 = 148; + + public final static int FRAME_stand129 = 149; + + public final static int FRAME_stand130 = 150; + + public final static int FRAME_stand201 = 151; + + public final static int FRAME_stand202 = 152; + + public final static int FRAME_stand203 = 153; + + public final static int FRAME_stand204 = 154; + + public final static int FRAME_stand205 = 155; + + public final static int FRAME_stand206 = 156; + + public final static int FRAME_stand207 = 157; + + public final static int FRAME_stand208 = 158; + + public final static int FRAME_stand209 = 159; + + public final static int FRAME_stand210 = 160; + + public final static int FRAME_stand211 = 161; + + public final static int FRAME_stand212 = 162; + + public final static int FRAME_stand213 = 163; + + public final static int FRAME_stand214 = 164; + + public final static int FRAME_stand215 = 165; + + public final static int FRAME_stand216 = 166; + + public final static int FRAME_stand217 = 167; + + public final static int FRAME_stand218 = 168; + + public final static int FRAME_stand219 = 169; + + public final static int FRAME_stand220 = 170; + + public final static int FRAME_stand221 = 171; + + public final static int FRAME_stand222 = 172; + + public final static int FRAME_stand223 = 173; + + public final static int FRAME_stand224 = 174; + + public final static int FRAME_stand225 = 175; + + public final static int FRAME_stand226 = 176; + + public final static int FRAME_stand227 = 177; + + public final static int FRAME_stand228 = 178; + + public final static int FRAME_stand229 = 179; + + public final static int FRAME_stand230 = 180; + + public final static int FRAME_walk01 = 181; + + public final static int FRAME_walk02 = 182; + + public final static int FRAME_walk03 = 183; + + public final static int FRAME_walk04 = 184; + + public final static int FRAME_walk05 = 185; + + public final static int FRAME_walk06 = 186; + + public final static int FRAME_walk07 = 187; + + public final static int FRAME_walk08 = 188; + + public final static int FRAME_walk09 = 189; + + public final static int FRAME_walk10 = 190; + + public final static int FRAME_walk11 = 191; + + public final static int FRAME_walk12 = 192; + + public final static int FRAME_walk13 = 193; + + public final static int FRAME_walk14 = 194; + + public final static int FRAME_walk15 = 195; + + public final static int FRAME_walk16 = 196; + + public final static int FRAME_walk17 = 197; + + public final static int FRAME_walk18 = 198; + + public final static int FRAME_walk19 = 199; + + public final static int FRAME_walk20 = 200; + + public final static int FRAME_walk21 = 201; + + public final static int FRAME_walk22 = 202; + + public final static int FRAME_walk23 = 203; + + public final static int FRAME_walk24 = 204; + + public final static int FRAME_walk25 = 205; + + public final static int FRAME_walk26 = 206; + + public final static int FRAME_walk27 = 207; + + public final static int FRAME_recln201 = 208; + + public final static int FRAME_recln202 = 209; + + public final static int FRAME_recln203 = 210; + + public final static int FRAME_recln204 = 211; + + public final static int FRAME_recln205 = 212; + + public final static int FRAME_recln206 = 213; + + public final static int FRAME_recln207 = 214; + + public final static int FRAME_recln208 = 215; + + public final static int FRAME_recln209 = 216; + + public final static int FRAME_recln210 = 217; + + public final static int FRAME_recln211 = 218; + + public final static int FRAME_recln212 = 219; + + public final static int FRAME_recln213 = 220; + + public final static int FRAME_recln214 = 221; + + public final static int FRAME_recln215 = 222; + + public final static int FRAME_recln216 = 223; + + public final static int FRAME_recln217 = 224; + + public final static int FRAME_recln218 = 225; + + public final static int FRAME_recln219 = 226; + + public final static int FRAME_recln220 = 227; + + public final static int FRAME_recln221 = 228; + + public final static int FRAME_recln222 = 229; + + public final static int FRAME_recln223 = 230; + + public final static int FRAME_recln224 = 231; + + public final static int FRAME_recln225 = 232; + + public final static int FRAME_recln226 = 233; + + public final static int FRAME_recln227 = 234; + + public final static int FRAME_recln228 = 235; + + public final static int FRAME_recln229 = 236; + + public final static int FRAME_recln230 = 237; + + public final static int FRAME_recln231 = 238; + + public final static int FRAME_recln232 = 239; + + public final static int FRAME_recln233 = 240; + + public final static int FRAME_recln234 = 241; + + public final static int FRAME_recln235 = 242; + + public final static int FRAME_recln236 = 243; + + public final static int FRAME_recln237 = 244; + + public final static int FRAME_recln238 = 245; + + public final static int FRAME_recln239 = 246; + + public final static int FRAME_recln240 = 247; + + public final static int FRAME_recln101 = 248; + + public final static int FRAME_recln102 = 249; + + public final static int FRAME_recln103 = 250; + + public final static int FRAME_recln104 = 251; + + public final static int FRAME_recln105 = 252; + + public final static int FRAME_recln106 = 253; + + public final static int FRAME_recln107 = 254; + + public final static int FRAME_recln108 = 255; + + public final static int FRAME_recln109 = 256; + + public final static int FRAME_recln110 = 257; + + public final static int FRAME_recln111 = 258; + + public final static int FRAME_recln112 = 259; + + public final static int FRAME_recln113 = 260; + + public final static int FRAME_recln114 = 261; + + public final static int FRAME_recln115 = 262; + + public final static int FRAME_recln116 = 263; + + public final static int FRAME_recln117 = 264; + + public final static int FRAME_recln118 = 265; + + public final static int FRAME_recln119 = 266; + + public final static int FRAME_recln120 = 267; + + public final static int FRAME_recln121 = 268; + + public final static int FRAME_recln122 = 269; + + public final static int FRAME_recln123 = 270; + + public final static int FRAME_recln124 = 271; + + public final static int FRAME_recln125 = 272; + + public final static int FRAME_recln126 = 273; + + public final static int FRAME_recln127 = 274; + + public final static int FRAME_recln128 = 275; + + public final static int FRAME_recln129 = 276; + + public final static int FRAME_recln130 = 277; + + public final static int FRAME_recln131 = 278; + + public final static int FRAME_recln132 = 279; + + public final static int FRAME_recln133 = 280; + + public final static int FRAME_recln134 = 281; + + public final static int FRAME_recln135 = 282; + + public final static int FRAME_recln136 = 283; + + public final static int FRAME_recln137 = 284; + + public final static int FRAME_recln138 = 285; + + public final static int FRAME_recln139 = 286; + + public final static int FRAME_recln140 = 287; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_missile_prelaunch; + + static int sound_missile_launch; + + static int sound_melee_swing; + + static int sound_melee_hit; + + static int sound_missile_reload; + + static int sound_death1; + + static int sound_death2; + + static int sound_fall_down; + + static int sound_idle1; + + static int sound_idle2; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_pain3; + + static int sound_sight; + + static int sound_search; + + static EntThinkAdapter ChickMoan = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle1, 1, + Defines.ATTN_IDLE, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle2, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static mframe_t chick_frames_fidget[] = 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, ChickMoan), + 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 EntThinkAdapter chick_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_stand; + return true; + } + }; + + static mmove_t chick_move_fidget = new mmove_t(FRAME_stand201, + FRAME_stand230, chick_frames_fidget, chick_stand); + + static EntThinkAdapter chick_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + return true; + if (Lib.random() <= 0.3) + self.monsterinfo.currentmove = chick_move_fidget; + return true; + } + }; + + static mframe_t chick_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, chick_fidget), }; + + static mmove_t chick_move_stand = new mmove_t(FRAME_stand101, + FRAME_stand130, chick_frames_stand, null); + + static EntThinkAdapter chick_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + self.monsterinfo.currentmove = chick_move_stand; + return true; + } + + if (self.monsterinfo.currentmove == chick_move_walk + || self.monsterinfo.currentmove == chick_move_start_run) { + self.monsterinfo.currentmove = chick_move_run; + } else { + self.monsterinfo.currentmove = chick_move_start_run; + } + return true; + } + }; + + static mframe_t chick_frames_start_run[] = new mframe_t[] { + 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, -1, null), + new mframe_t(GameAI.ai_run, -1, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 1, null), + new mframe_t(GameAI.ai_run, 3, null), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 3, null) }; + + static mmove_t chick_move_start_run = new mmove_t(FRAME_walk01, + FRAME_walk10, chick_frames_start_run, chick_run); + + static mframe_t chick_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 7, null), + new mframe_t(GameAI.ai_run, 4, null), + new mframe_t(GameAI.ai_run, 11, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 7, null) }; + + static mmove_t chick_move_run = new mmove_t(FRAME_walk11, FRAME_walk20, + chick_frames_run, null); + + static mframe_t chick_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 13, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 11, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 7, null) }; + + static mmove_t chick_move_walk = new mmove_t(FRAME_walk11, FRAME_walk20, + chick_frames_walk, null); + + static EntThinkAdapter chick_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_walk; + return true; + } + }; + + static mframe_t chick_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 chick_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain105, + chick_frames_pain1, chick_run); + + static mframe_t chick_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 chick_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain205, + chick_frames_pain2, chick_run); + + static mframe_t chick_frames_pain3[] = 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, -6, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 11, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 7, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -8, null), + new mframe_t(GameAI.ai_move, 2, null) }; + + static mmove_t chick_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain321, + chick_frames_pain3, chick_run); + + static EntPainAdapter chick_pain = new EntPainAdapter() { + 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; + + r = Lib.random(); + if (r < 0.33) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + else if (r < 0.66) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain3, 1, + Defines.ATTN_NORM, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 10) + self.monsterinfo.currentmove = chick_move_pain1; + else if (damage <= 25) + self.monsterinfo.currentmove = chick_move_pain2; + else + self.monsterinfo.currentmove = chick_move_pain3; + return; + } + }; + + static EntThinkAdapter chick_dead = new EntThinkAdapter() { + public boolean think(edict_t self) { + Math3D.VectorSet(self.mins, -16, -16, 0); + Math3D.VectorSet(self.maxs, 16, 16, 16); + self.movetype = Defines.MOVETYPE_TOSS; + self.svflags |= Defines.SVF_DEADMONSTER; + self.nextthink = 0; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t chick_frames_death2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 10, null), + new mframe_t(GameAI.ai_move, 2, 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), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 15, null), + new mframe_t(GameAI.ai_move, 14, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t chick_move_death2 = new mmove_t(FRAME_death201, + FRAME_death223, chick_frames_death2, chick_dead); + + static mframe_t chick_frames_death1[] = 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, -7, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 11, 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 chick_move_death1 = new mmove_t(FRAME_death101, + FRAME_death112, chick_frames_death1, chick_dead); + + static EntDieAdapter chick_die = new EntDieAdapter() { + + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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 + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + n = Lib.rand() % 2; + if (n == 0) { + self.monsterinfo.currentmove = chick_move_death1; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1, + Defines.ATTN_NORM, 0); + } else { + self.monsterinfo.currentmove = chick_move_death2; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death2, 1, + Defines.ATTN_NORM, 0); + } + } + + }; + + static EntThinkAdapter chick_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter chick_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static EntThinkAdapter chick_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t chick_frames_duck[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, chick_duck_down), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 4, chick_duck_hold), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -5, chick_duck_up), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t chick_move_duck = new mmove_t(FRAME_duck01, FRAME_duck07, + chick_frames_duck, chick_run); + + static EntDodgeAdapter chick_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + if (Lib.random() > 0.25) + return; + + if (self.enemy != null) + self.enemy = attacker; + + self.monsterinfo.currentmove = chick_move_duck; + return; + } + }; + + static EntThinkAdapter ChickSlash = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 10); + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee_swing, 1, + Defines.ATTN_NORM, 0); + Fire.fire_hit(self, aim, (10 + (Lib.rand() % 6)), 100); + return true; + } + }; + + static EntThinkAdapter ChickRocket = new EntThinkAdapter() { + 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 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_CHICK_ROCKET_1], + 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, + Defines.MZ2_CHICK_ROCKET_1); + return true; + } + }; + + static EntThinkAdapter Chick_PreAttack1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, + sound_missile_prelaunch, 1, Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter ChickReload = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_missile_reload, + 1, Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter chick_attack1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_attack1; + return true; + } + }; + + static EntThinkAdapter chick_rerocket = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy.health > 0) { + if (GameUtil.range(self, self.enemy) > Defines.RANGE_MELEE) + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() <= 0.6) { + self.monsterinfo.currentmove = chick_move_attack1; + return true; + } + } + self.monsterinfo.currentmove = chick_move_end_attack1; + return true; + } + }; + + static mframe_t chick_frames_start_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, Chick_PreAttack1), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 7, 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, chick_attack1) }; + + static mmove_t chick_move_start_attack1 = new mmove_t(FRAME_attak101, + FRAME_attak113, chick_frames_start_attack1, null); + + static mframe_t chick_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 19, ChickRocket), + new mframe_t(GameAI.ai_charge, -6, null), + new mframe_t(GameAI.ai_charge, -5, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -7, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 10, ChickReload), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 3, chick_rerocket) }; + + static mmove_t chick_move_attack1 = new mmove_t(FRAME_attak114, + FRAME_attak127, chick_frames_attack1, null); + + static mframe_t chick_frames_end_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -6, null), + new mframe_t(GameAI.ai_charge, -4, null), + new mframe_t(GameAI.ai_charge, -2, null) }; + + static mmove_t chick_move_end_attack1 = new mmove_t(FRAME_attak128, + FRAME_attak132, chick_frames_end_attack1, chick_run); + + static EntThinkAdapter chick_reslash = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy.health > 0) { + if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) + if (Lib.random() <= 0.9) { + self.monsterinfo.currentmove = chick_move_slash; + return true; + } else { + self.monsterinfo.currentmove = chick_move_end_slash; + return true; + } + } + self.monsterinfo.currentmove = chick_move_end_slash; + return true; + } + }; + + static mframe_t chick_frames_slash[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 7, ChickSlash), + new mframe_t(GameAI.ai_charge, -7, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, -2, chick_reslash) }; + + static mmove_t chick_move_slash = new mmove_t(FRAME_attak204, + FRAME_attak212, chick_frames_slash, null); + + static mframe_t chick_frames_end_slash[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, -6, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -6, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t chick_move_end_slash = new mmove_t(FRAME_attak213, + FRAME_attak216, chick_frames_end_slash, chick_run); + + static EntThinkAdapter chick_slash = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_slash; + return true; + } + }; + + static mframe_t chick_frames_start_slash[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 8, null), + new mframe_t(GameAI.ai_charge, 3, null) }; + + static mmove_t chick_move_start_slash = new mmove_t(FRAME_attak201, + FRAME_attak203, chick_frames_start_slash, chick_slash); + + static EntThinkAdapter chick_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_start_slash; + return true; + } + }; + + static EntThinkAdapter chick_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = chick_move_start_attack1; + return true; + } + }; + + static EntInteractAdapter chick_sight = new EntInteractAdapter() { + 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; + } + }; + + /* + * QUAKED monster_chick (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_chick(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_missile_prelaunch = GameBase.gi.soundindex("chick/chkatck1.wav"); + sound_missile_launch = GameBase.gi.soundindex("chick/chkatck2.wav"); + sound_melee_swing = GameBase.gi.soundindex("chick/chkatck3.wav"); + sound_melee_hit = GameBase.gi.soundindex("chick/chkatck4.wav"); + sound_missile_reload = GameBase.gi.soundindex("chick/chkatck5.wav"); + sound_death1 = GameBase.gi.soundindex("chick/chkdeth1.wav"); + sound_death2 = GameBase.gi.soundindex("chick/chkdeth2.wav"); + sound_fall_down = GameBase.gi.soundindex("chick/chkfall1.wav"); + sound_idle1 = GameBase.gi.soundindex("chick/chkidle1.wav"); + sound_idle2 = GameBase.gi.soundindex("chick/chkidle2.wav"); + sound_pain1 = GameBase.gi.soundindex("chick/chkpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("chick/chkpain2.wav"); + sound_pain3 = GameBase.gi.soundindex("chick/chkpain3.wav"); + sound_sight = GameBase.gi.soundindex("chick/chksght1.wav"); + sound_search = GameBase.gi.soundindex("chick/chksrch1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/bitch/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, 0); + Math3D.VectorSet(self.maxs, 16, 16, 56); + + self.health = 175; + self.gib_health = -70; + self.mass = 200; + + self.pain = chick_pain; + self.die = chick_die; + + self.monsterinfo.stand = chick_stand; + self.monsterinfo.walk = chick_walk; + self.monsterinfo.run = chick_run; + self.monsterinfo.dodge = chick_dodge; + self.monsterinfo.attack = chick_attack; + self.monsterinfo.melee = chick_melee; + self.monsterinfo.sight = chick_sight; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = chick_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Flash.java b/src/jake2/game/monsters/M_Flash.java new file mode 100644 index 0000000..e4ccdc5 --- /dev/null +++ b/src/jake2/game/monsters/M_Flash.java @@ -0,0 +1,494 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Flash.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +public class M_Flash { + + // m_flash.c + + // this file is included in both the game dll and quake2, + // the game needs it to source shot locations, the client + // needs it to position muzzle flashes + public static float monster_flash_offset[][] = { + // flash 0 is not used + { 0.0f, 0.0f, 0.0f }, + + // MZ2_TANK_BLASTER_1 1 + { 20.7f, -18.5f, 28.7f }, + // MZ2_TANK_BLASTER_2 2 + { 16.6f, -21.5f, 30.1f }, + // MZ2_TANK_BLASTER_3 3 + { 11.8f, -23.9f, 32.1f }, + // MZ2_TANK_MACHINEGUN_1 4 + { 22.9f, -0.7f, 25.3f }, + // MZ2_TANK_MACHINEGUN_2 5 + { 22.2f, 6.2f, 22.3f }, + // MZ2_TANK_MACHINEGUN_3 6 + { 19.4f, 13.1f, 18.6f }, + // MZ2_TANK_MACHINEGUN_4 7 + { 19.4f, 18.8f, 18.6f }, + // MZ2_TANK_MACHINEGUN_5 8 + { 17.9f, 25.0f, 18.6f }, + // MZ2_TANK_MACHINEGUN_6 9 + { 14.1f, 30.5f, 20.6f }, + // MZ2_TANK_MACHINEGUN_7 10 + { 9.3f, 35.3f, 22.1f }, + // MZ2_TANK_MACHINEGUN_8 11 + { 4.7f, 38.4f, 22.1f }, + // MZ2_TANK_MACHINEGUN_9 12 + { -1.1f, 40.4f, 24.1f }, + // MZ2_TANK_MACHINEGUN_10 13 + { -6.5f, 41.2f, 24.1f }, + // MZ2_TANK_MACHINEGUN_11 14 + { 3.2f, 40.1f, 24.7f }, + // MZ2_TANK_MACHINEGUN_12 15 + { 11.7f, 36.7f, 26.0f }, + // MZ2_TANK_MACHINEGUN_13 16 + { 18.9f, 31.3f, 26.0f }, + // MZ2_TANK_MACHINEGUN_14 17 + { 24.4f, 24.4f, 26.4f }, + // MZ2_TANK_MACHINEGUN_15 18 + { 27.1f, 17.1f, 27.2f }, + // MZ2_TANK_MACHINEGUN_16 19 + { 28.5f, 9.1f, 28.0f }, + // MZ2_TANK_MACHINEGUN_17 20 + { 27.1f, 2.2f, 28.0f }, + // MZ2_TANK_MACHINEGUN_18 21 + { 24.9f, -2.8f, 28.0f }, + // MZ2_TANK_MACHINEGUN_19 22 + { 21.6f, -7.0f, 26.4f }, + // MZ2_TANK_ROCKET_1 23 + { 6.2f, 29.1f, 49.1f }, + // MZ2_TANK_ROCKET_2 24 + { 6.9f, 23.8f, 49.1f }, + // MZ2_TANK_ROCKET_3 25 + { 8.3f, 17.8f, 49.5f }, + + // MZ2_INFANTRY_MACHINEGUN_1 26 + { 26.6f, 7.1f, 13.1f }, + // MZ2_INFANTRY_MACHINEGUN_2 27 + { 18.2f, 7.5f, 15.4f }, + // MZ2_INFANTRY_MACHINEGUN_3 28 + { 17.2f, 10.3f, 17.9f }, + // MZ2_INFANTRY_MACHINEGUN_4 29 + { 17.0f, 12.8f, 20.1f }, + // MZ2_INFANTRY_MACHINEGUN_5 30 + { 15.1f, 14.1f, 21.8f }, + // MZ2_INFANTRY_MACHINEGUN_6 31 + { 11.8f, 17.2f, 23.1f }, + // MZ2_INFANTRY_MACHINEGUN_7 32 + { 11.4f, 20.2f, 21.0f }, + // MZ2_INFANTRY_MACHINEGUN_8 33 + { 9.0f, 23.0f, 18.9f }, + // MZ2_INFANTRY_MACHINEGUN_9 34 + { 13.9f, 18.6f, 17.7f }, + // MZ2_INFANTRY_MACHINEGUN_10 35 + { 15.4f, 15.6f, 15.8f }, + // MZ2_INFANTRY_MACHINEGUN_11 36 + { 10.2f, 15.2f, 25.1f }, + // MZ2_INFANTRY_MACHINEGUN_12 37 + { -1.9f, 15.1f, 28.2f }, + // MZ2_INFANTRY_MACHINEGUN_13 38 + { -12.4f, 13.0f, 20.2f }, + + // MZ2_SOLDIER_BLASTER_1 39 + { 10.6f * 1.2f, 7.7f * 1.2f, 7.8f * 1.2f }, + // MZ2_SOLDIER_BLASTER_2 40 + { 21.1f * 1.2f, 3.6f * 1.2f, 19.0f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_1 41 + { 10.6f * 1.2f, 7.7f * 1.2f, 7.8f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_2 42 + { 21.1f * 1.2f, 3.6f * 1.2f, 19.0f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_1 43 + { 10.6f * 1.2f, 7.7f * 1.2f, 7.8f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_2 44 + { 21.1f * 1.2f, 3.6f * 1.2f, 19.0f * 1.2f }, + + // MZ2_GUNNER_MACHINEGUN_1 45 + { 30.1f * 1.15f, 3.9f * 1.15f, 19.6f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_2 46 + { 29.1f * 1.15f, 2.5f * 1.15f, 20.7f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_3 47 + { 28.2f * 1.15f, 2.5f * 1.15f, 22.2f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_4 48 + { 28.2f * 1.15f, 3.6f * 1.15f, 22.0f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_5 49 + { 26.9f * 1.15f, 2.0f * 1.15f, 23.4f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_6 50 + { 26.5f * 1.15f, 0.6f * 1.15f, 20.8f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_7 51 + { 26.9f * 1.15f, 0.5f * 1.15f, 21.5f * 1.15f }, + // MZ2_GUNNER_MACHINEGUN_8 52 + { 29.0f * 1.15f, 2.4f * 1.15f, 19.5f * 1.15f }, + // MZ2_GUNNER_GRENADE_1 53 + { 4.6f * 1.15f, -16.8f * 1.15f, 7.3f * 1.15f }, + // MZ2_GUNNER_GRENADE_2 54 + { 4.6f * 1.15f, -16.8f * 1.15f, 7.3f * 1.15f }, + // MZ2_GUNNER_GRENADE_3 55 + { 4.6f * 1.15f, -16.8f * 1.15f, 7.3f * 1.15f }, + // MZ2_GUNNER_GRENADE_4 56 + { 4.6f * 1.15f, -16.8f * 1.15f, 7.3f * 1.15f }, + + // MZ2_CHICK_ROCKET_1 57 + // -24.8f, -9.0f, 39.0f}, + { 24.8f, -9.0f, 39.0f }, // PGM - this was incorrect in Q2 + + // MZ2_FLYER_BLASTER_1 58 + { 12.1f, 13.4f, -14.5f }, + // MZ2_FLYER_BLASTER_2 59 + { 12.1f, -7.4f, -14.5f }, + + // MZ2_MEDIC_BLASTER_1 60 + { 12.1f, 5.4f, 16.5f }, + + // MZ2_GLADIATOR_RAILGUN_1 61 + { 30.0f, 18.0f, 28.0f }, + + // MZ2_HOVER_BLASTER_1 62 + { 32.5f, -0.8f, 10.0f }, + + // MZ2_ACTOR_MACHINEGUN_1 63 + { 18.4f, 7.4f, 9.6f }, + + // MZ2_SUPERTANK_MACHINEGUN_1 64 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_MACHINEGUN_2 65 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_MACHINEGUN_3 66 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_MACHINEGUN_4 67 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_MACHINEGUN_5 68 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_MACHINEGUN_6 69 + { 30.0f, 30.0f, 88.5f }, + // MZ2_SUPERTANK_ROCKET_1 70 + { 16.0f, -22.5f, 91.2f }, + // MZ2_SUPERTANK_ROCKET_2 71 + { 16.0f, -33.4f, 86.7f }, + // MZ2_SUPERTANK_ROCKET_3 72 + { 16.0f, -42.8f, 83.3f }, + + // --- Start Xian Stuff --- + // MZ2_BOSS2_MACHINEGUN_L1 73 + { 32f, -40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_L2 74 + { 32f, -40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_L3 75 + { 32f, -40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_L4 76 + { 32f, -40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_L5 77 + { 32f, -40f, 70f }, + // --- End Xian Stuff + + // MZ2_BOSS2_ROCKET_1 78 + { 22.0f, 16.0f, 10.0f }, + // MZ2_BOSS2_ROCKET_2 79 + { 22.0f, 8.0f, 10.0f }, + // MZ2_BOSS2_ROCKET_3 80 + { 22.0f, -8.0f, 10.0f }, + // MZ2_BOSS2_ROCKET_4 81 + { 22.0f, -16.0f, 10.0f }, + + // MZ2_FLOAT_BLASTER_1 82 + { 32.5f, -0.8f, 10f }, + + // MZ2_SOLDIER_BLASTER_3 83 + { 20.8f * 1.2f, 10.1f * 1.2f, -2.7f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_3 84 + { 20.8f * 1.2f, 10.1f * 1.2f, -2.7f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_3 85 + { 20.8f * 1.2f, 10.1f * 1.2f, -2.7f * 1.2f }, + // MZ2_SOLDIER_BLASTER_4 86 + { 7.6f * 1.2f, 9.3f * 1.2f, 0.8f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_4 87 + { 7.6f * 1.2f, 9.3f * 1.2f, 0.8f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_4 88 + { 7.6f * 1.2f, 9.3f * 1.2f, 0.8f * 1.2f }, + // MZ2_SOLDIER_BLASTER_5 89 + { 30.5f * 1.2f, 9.9f * 1.2f, -18.7f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_5 90 + { 30.5f * 1.2f, 9.9f * 1.2f, -18.7f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_5 91 + { 30.5f * 1.2f, 9.9f * 1.2f, -18.7f * 1.2f }, + // MZ2_SOLDIER_BLASTER_6 92 + { 27.6f * 1.2f, 3.4f * 1.2f, -10.4f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_6 93 + { 27.6f * 1.2f, 3.4f * 1.2f, -10.4f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_6 94 + { 27.6f * 1.2f, 3.4f * 1.2f, -10.4f * 1.2f }, + // MZ2_SOLDIER_BLASTER_7 95 + { 28.9f * 1.2f, 4.6f * 1.2f, -8.1f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_7 96 + { 28.9f * 1.2f, 4.6f * 1.2f, -8.1f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_7 97 + { 28.9f * 1.2f, 4.6f * 1.2f, -8.1f * 1.2f }, + // MZ2_SOLDIER_BLASTER_8 98 + // 34.5f * 1.2f, 9.6f * 1.2f, 6.1f * 1.2f}, + { 31.5f * 1.2f, 9.6f * 1.2f, 10.1f * 1.2f }, + // MZ2_SOLDIER_SHOTGUN_8 99 + { 34.5f * 1.2f, 9.6f * 1.2f, 6.1f * 1.2f }, + // MZ2_SOLDIER_MACHINEGUN_8 100 + { 34.5f * 1.2f, 9.6f * 1.2f, 6.1f * 1.2f }, + + // --- Xian shit below --- + // MZ2_MAKRON_BFG 101 + { 17f, -19.5f, 62.9f }, + // MZ2_MAKRON_BLASTER_1 102 + { -3.6f, -24.1f, 59.5f }, + // MZ2_MAKRON_BLASTER_2 103 + { -1.6f, -19.3f, 59.5f }, + // MZ2_MAKRON_BLASTER_3 104 + { -0.1f, -14.4f, 59.5f }, + // MZ2_MAKRON_BLASTER_4 105 + { 2.0f, -7.6f, 59.5f }, + // MZ2_MAKRON_BLASTER_5 106 + { 3.4f, 1.3f, 59.5f }, + // MZ2_MAKRON_BLASTER_6 107 + { 3.7f, 11.1f, 59.5f }, + // MZ2_MAKRON_BLASTER_7 108 + { -0.3f, 22.3f, 59.5f }, + // MZ2_MAKRON_BLASTER_8 109 + { -6f, 33f, 59.5f }, + // MZ2_MAKRON_BLASTER_9 110 + { -9.3f, 36.4f, 59.5f }, + // MZ2_MAKRON_BLASTER_10 111 + { -7f, 35f, 59.5f }, + // MZ2_MAKRON_BLASTER_11 112 + { -2.1f, 29f, 59.5f }, + // MZ2_MAKRON_BLASTER_12 113 + { 3.9f, 17.3f, 59.5f }, + // MZ2_MAKRON_BLASTER_13 114 + { 6.1f, 5.8f, 59.5f }, + // MZ2_MAKRON_BLASTER_14 115 + { 5.9f, -4.4f, 59.5f }, + // MZ2_MAKRON_BLASTER_15 116 + { 4.2f, -14.1f, 59.5f }, + // MZ2_MAKRON_BLASTER_16 117 + { 2.4f, -18.8f, 59.5f }, + // MZ2_MAKRON_BLASTER_17 118 + { -1.8f, -25.5f, 59.5f }, + // MZ2_MAKRON_RAILGUN_1 119 + { -17.3f, 7.8f, 72.4f }, + + // MZ2_JORG_MACHINEGUN_L1 120 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_L2 121 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_L3 122 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_L4 123 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_L5 124 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_L6 125 + { 78.5f, -47.1f, 96f }, + // MZ2_JORG_MACHINEGUN_R1 126 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_MACHINEGUN_R2 127 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_MACHINEGUN_R3 128 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_MACHINEGUN_R4 129 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_MACHINEGUN_R5 130 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_MACHINEGUN_R6 131 + { 78.5f, 46.7f, 96f }, + // MZ2_JORG_BFG_1 132 + { 6.3f, -9f, 111.2f }, + + // MZ2_BOSS2_MACHINEGUN_R1 73 + { 32f, 40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_R2 74 + { 32f, 40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_R3 75 + { 32f, 40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_R4 76 + { 32f, 40f, 70f }, + // MZ2_BOSS2_MACHINEGUN_R5 77 + { 32f, 40f, 70f }, + + // --- End Xian Shit --- + + // ROGUE + // note that the above really ends at 137 + // carrier machineguns + // MZ2_CARRIER_MACHINEGUN_L1 + { 56f, -32f, 32f }, + // MZ2_CARRIER_MACHINEGUN_R1 + { 56f, 32f, 32f }, + // MZ2_CARRIER_GRENADE + { 42f, 24f, 50f }, + // MZ2_TURRET_MACHINEGUN 141 + { 16f, 0f, 0f }, + // MZ2_TURRET_ROCKET 142 + { 16f, 0f, 0f }, + // MZ2_TURRET_BLASTER 143 + { 16f, 0f, 0f }, + // MZ2_STALKER_BLASTER 144 + { 24f, 0f, 6f }, + // MZ2_DAEDALUS_BLASTER 145 + { 32.5f, -0.8f, 10.0f }, + // MZ2_MEDIC_BLASTER_2 146 + { 12.1f, 5.4f, 16.5f }, + // MZ2_CARRIER_RAILGUN 147 + { 32f, 0f, 6f }, + // MZ2_WIDOW_DISRUPTOR 148 + { 57.72f, 14.50f, 88.81f }, + // MZ2_WIDOW_BLASTER 149 + { 56f, 32f, 32f }, + // MZ2_WIDOW_RAIL 150 + { 62f, -20f, 84f }, + // MZ2_WIDOW_PLASMABEAM 151 // PMM - not used! + { 32f, 0f, 6f }, + // MZ2_CARRIER_MACHINEGUN_L2 152 + { 61f, -32f, 12f }, + // MZ2_CARRIER_MACHINEGUN_R2 153 + { 61f, 32f, 12f }, + // MZ2_WIDOW_RAIL_LEFT 154 + { 17f, -62f, 91f }, + // MZ2_WIDOW_RAIL_RIGHT 155 + { 68f, 12f, 86f }, + // MZ2_WIDOW_BLASTER_SWEEP1 156 pmm - the sweeps need to be in + // sequential order + { 47.5f, 56f, 89f }, + // MZ2_WIDOW_BLASTER_SWEEP2 157 + { 54f, 52f, 91f }, + // MZ2_WIDOW_BLASTER_SWEEP3 158 + { 58f, 40f, 91f }, + // MZ2_WIDOW_BLASTER_SWEEP4 159 + { 68f, 30f, 88f }, + // MZ2_WIDOW_BLASTER_SWEEP5 160 + { 74f, 20f, 88f }, + // MZ2_WIDOW_BLASTER_SWEEP6 161 + { 73f, 11f, 87f }, + // MZ2_WIDOW_BLASTER_SWEEP7 162 + { 73f, 3f, 87f }, + // MZ2_WIDOW_BLASTER_SWEEP8 163 + { 70f, -12f, 87f }, + // MZ2_WIDOW_BLASTER_SWEEP9 164 + { 67f, -20f, 90f }, + // MZ2_WIDOW_BLASTER_100 165 + { -20f, 76f, 90f }, + // MZ2_WIDOW_BLASTER_90 166 + { -8f, 74f, 90f }, + // MZ2_WIDOW_BLASTER_80 167 + { 0f, 72f, 90f }, + // MZ2_WIDOW_BLASTER_70 168 d06 + { 10f, 71f, 89f }, + // MZ2_WIDOW_BLASTER_60 169 d07 + { 23f, 70f, 87f }, + // MZ2_WIDOW_BLASTER_50 170 d08 + { 32f, 64f, 85f }, + // MZ2_WIDOW_BLASTER_40 171 + { 40f, 58f, 84f }, + // MZ2_WIDOW_BLASTER_30 172 d10 + { 48f, 50f, 83f }, + // MZ2_WIDOW_BLASTER_20 173 + { 54f, 42f, 82f }, + // MZ2_WIDOW_BLASTER_10 174 d12 + { 56f, 34f, 82f }, + // MZ2_WIDOW_BLASTER_0 175 + { 58f, 26f, 82f }, + // MZ2_WIDOW_BLASTER_10L 176 d14 + { 60f, 16f, 82f }, + // MZ2_WIDOW_BLASTER_20L 177 + { 59f, 6f, 81f }, + // MZ2_WIDOW_BLASTER_30L 178 d16 + { 58f, -2f, 80f }, + // MZ2_WIDOW_BLASTER_40L 179 + { 57f, -10f, 79f }, + // MZ2_WIDOW_BLASTER_50L 180 d18 + { 54f, -18f, 78f }, + // MZ2_WIDOW_BLASTER_60L 181 + { 42f, -32f, 80f }, + // MZ2_WIDOW_BLASTER_70L 182 d20 + { 36f, -40f, 78f }, + // MZ2_WIDOW_RUN_1 183 + { 68.4f, 10.88f, 82.08f }, + // MZ2_WIDOW_RUN_2 184 + { 68.51f, 8.64f, 85.14f }, + // MZ2_WIDOW_RUN_3 185 + { 68.66f, 6.38f, 88.78f }, + // MZ2_WIDOW_RUN_4 186 + { 68.73f, 5.1f, 84.47f }, + // MZ2_WIDOW_RUN_5 187 + { 68.82f, 4.79f, 80.52f }, + // MZ2_WIDOW_RUN_6 188 + { 68.77f, 6.11f, 85.37f }, + // MZ2_WIDOW_RUN_7 189 + { 68.67f, 7.99f, 90.24f }, + // MZ2_WIDOW_RUN_8 190 + { 68.55f, 9.54f, 87.36f }, + // MZ2_CARRIER_ROCKET_1 191 + { 0f, 0f, -5f }, + // MZ2_CARRIER_ROCKET_2 192 + { 0f, 0f, -5f }, + // MZ2_CARRIER_ROCKET_3 193 + { 0f, 0f, -5f }, + // MZ2_CARRIER_ROCKET_4 194 + { 0f, 0f, -5f }, + // MZ2_WIDOW2_BEAMER_1 195 + // 72.13f, -17.63f, 93.77f}, + { 69.00f, -17.63f, 93.77f }, + // MZ2_WIDOW2_BEAMER_2 196 + // 71.46f, -17.08f, 89.82f}, + { 69.00f, -17.08f, 89.82f }, + // MZ2_WIDOW2_BEAMER_3 197 + // 71.47f, -18.40f, 90.70f}, + { 69.00f, -18.40f, 90.70f }, + // MZ2_WIDOW2_BEAMER_4 198 + // 71.96f, -18.34f, 94.32f}, + { 69.00f, -18.34f, 94.32f }, + // MZ2_WIDOW2_BEAMER_5 199 + // 72.25f, -18.30f, 97.98f}, + { 69.00f, -18.30f, 97.98f }, + // MZ2_WIDOW2_BEAM_SWEEP_1 200 + { 45.04f, -59.02f, 92.24f }, + // MZ2_WIDOW2_BEAM_SWEEP_2 201 + { 50.68f, -54.70f, 91.96f }, + // MZ2_WIDOW2_BEAM_SWEEP_3 202 + { 56.57f, -47.72f, 91.65f }, + // MZ2_WIDOW2_BEAM_SWEEP_4 203 + { 61.75f, -38.75f, 91.38f }, + // MZ2_WIDOW2_BEAM_SWEEP_5 204 + { 65.55f, -28.76f, 91.24f }, + // MZ2_WIDOW2_BEAM_SWEEP_6 205 + { 67.79f, -18.90f, 91.22f }, + // MZ2_WIDOW2_BEAM_SWEEP_7 206 + { 68.60f, -9.52f, 91.23f }, + // MZ2_WIDOW2_BEAM_SWEEP_8 207 + { 68.08f, 0.18f, 91.32f }, + // MZ2_WIDOW2_BEAM_SWEEP_9 208 + { 66.14f, 9.79f, 91.44f }, + // MZ2_WIDOW2_BEAM_SWEEP_10 209 + { 62.77f, 18.91f, 91.65f }, + // MZ2_WIDOW2_BEAM_SWEEP_11 210 + { 58.29f, 27.11f, 92.00f }, + + // end of table + { 0.0f, 0.0f, 0.0f } }; + +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Flipper.java b/src/jake2/game/monsters/M_Flipper.java new file mode 100644 index 0000000..14acc59 --- /dev/null +++ b/src/jake2/game/monsters/M_Flipper.java @@ -0,0 +1,774 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Flipper.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Flipper { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_flpbit01 = 0; + + public final static int FRAME_flpbit02 = 1; + + public final static int FRAME_flpbit03 = 2; + + public final static int FRAME_flpbit04 = 3; + + public final static int FRAME_flpbit05 = 4; + + public final static int FRAME_flpbit06 = 5; + + public final static int FRAME_flpbit07 = 6; + + public final static int FRAME_flpbit08 = 7; + + public final static int FRAME_flpbit09 = 8; + + public final static int FRAME_flpbit10 = 9; + + public final static int FRAME_flpbit11 = 10; + + public final static int FRAME_flpbit12 = 11; + + public final static int FRAME_flpbit13 = 12; + + public final static int FRAME_flpbit14 = 13; + + public final static int FRAME_flpbit15 = 14; + + public final static int FRAME_flpbit16 = 15; + + public final static int FRAME_flpbit17 = 16; + + public final static int FRAME_flpbit18 = 17; + + public final static int FRAME_flpbit19 = 18; + + public final static int FRAME_flpbit20 = 19; + + public final static int FRAME_flptal01 = 20; + + public final static int FRAME_flptal02 = 21; + + public final static int FRAME_flptal03 = 22; + + public final static int FRAME_flptal04 = 23; + + public final static int FRAME_flptal05 = 24; + + public final static int FRAME_flptal06 = 25; + + public final static int FRAME_flptal07 = 26; + + public final static int FRAME_flptal08 = 27; + + public final static int FRAME_flptal09 = 28; + + public final static int FRAME_flptal10 = 29; + + public final static int FRAME_flptal11 = 30; + + public final static int FRAME_flptal12 = 31; + + public final static int FRAME_flptal13 = 32; + + public final static int FRAME_flptal14 = 33; + + public final static int FRAME_flptal15 = 34; + + public final static int FRAME_flptal16 = 35; + + public final static int FRAME_flptal17 = 36; + + public final static int FRAME_flptal18 = 37; + + public final static int FRAME_flptal19 = 38; + + public final static int FRAME_flptal20 = 39; + + public final static int FRAME_flptal21 = 40; + + public final static int FRAME_flphor01 = 41; + + public final static int FRAME_flphor02 = 42; + + public final static int FRAME_flphor03 = 43; + + public final static int FRAME_flphor04 = 44; + + public final static int FRAME_flphor05 = 45; + + public final static int FRAME_flphor06 = 46; + + public final static int FRAME_flphor07 = 47; + + public final static int FRAME_flphor08 = 48; + + public final static int FRAME_flphor09 = 49; + + public final static int FRAME_flphor10 = 50; + + public final static int FRAME_flphor11 = 51; + + public final static int FRAME_flphor12 = 52; + + public final static int FRAME_flphor13 = 53; + + public final static int FRAME_flphor14 = 54; + + public final static int FRAME_flphor15 = 55; + + public final static int FRAME_flphor16 = 56; + + public final static int FRAME_flphor17 = 57; + + public final static int FRAME_flphor18 = 58; + + public final static int FRAME_flphor19 = 59; + + public final static int FRAME_flphor20 = 60; + + public final static int FRAME_flphor21 = 61; + + public final static int FRAME_flphor22 = 62; + + public final static int FRAME_flphor23 = 63; + + public final static int FRAME_flphor24 = 64; + + public final static int FRAME_flpver01 = 65; + + public final static int FRAME_flpver02 = 66; + + public final static int FRAME_flpver03 = 67; + + public final static int FRAME_flpver04 = 68; + + public final static int FRAME_flpver05 = 69; + + public final static int FRAME_flpver06 = 70; + + public final static int FRAME_flpver07 = 71; + + public final static int FRAME_flpver08 = 72; + + public final static int FRAME_flpver09 = 73; + + public final static int FRAME_flpver10 = 74; + + public final static int FRAME_flpver11 = 75; + + public final static int FRAME_flpver12 = 76; + + public final static int FRAME_flpver13 = 77; + + public final static int FRAME_flpver14 = 78; + + public final static int FRAME_flpver15 = 79; + + public final static int FRAME_flpver16 = 80; + + public final static int FRAME_flpver17 = 81; + + public final static int FRAME_flpver18 = 82; + + public final static int FRAME_flpver19 = 83; + + public final static int FRAME_flpver20 = 84; + + public final static int FRAME_flpver21 = 85; + + public final static int FRAME_flpver22 = 86; + + public final static int FRAME_flpver23 = 87; + + public final static int FRAME_flpver24 = 88; + + public final static int FRAME_flpver25 = 89; + + public final static int FRAME_flpver26 = 90; + + public final static int FRAME_flpver27 = 91; + + public final static int FRAME_flpver28 = 92; + + public final static int FRAME_flpver29 = 93; + + public final static int FRAME_flppn101 = 94; + + public final static int FRAME_flppn102 = 95; + + public final static int FRAME_flppn103 = 96; + + public final static int FRAME_flppn104 = 97; + + public final static int FRAME_flppn105 = 98; + + public final static int FRAME_flppn201 = 99; + + public final static int FRAME_flppn202 = 100; + + public final static int FRAME_flppn203 = 101; + + public final static int FRAME_flppn204 = 102; + + public final static int FRAME_flppn205 = 103; + + public final static int FRAME_flpdth01 = 104; + + public final static int FRAME_flpdth02 = 105; + + public final static int FRAME_flpdth03 = 106; + + public final static int FRAME_flpdth04 = 107; + + public final static int FRAME_flpdth05 = 108; + + public final static int FRAME_flpdth06 = 109; + + public final static int FRAME_flpdth07 = 110; + + public final static int FRAME_flpdth08 = 111; + + public final static int FRAME_flpdth09 = 112; + + public final static int FRAME_flpdth10 = 113; + + public final static int FRAME_flpdth11 = 114; + + public final static int FRAME_flpdth12 = 115; + + public final static int FRAME_flpdth13 = 116; + + public final static int FRAME_flpdth14 = 117; + + public final static int FRAME_flpdth15 = 118; + + public final static int FRAME_flpdth16 = 119; + + public final static int FRAME_flpdth17 = 120; + + public final static int FRAME_flpdth18 = 121; + + public final static int FRAME_flpdth19 = 122; + + public final static int FRAME_flpdth20 = 123; + + public final static int FRAME_flpdth21 = 124; + + public final static int FRAME_flpdth22 = 125; + + public final static int FRAME_flpdth23 = 126; + + public final static int FRAME_flpdth24 = 127; + + public final static int FRAME_flpdth25 = 128; + + public final static int FRAME_flpdth26 = 129; + + public final static int FRAME_flpdth27 = 130; + + public final static int FRAME_flpdth28 = 131; + + public final static int FRAME_flpdth29 = 132; + + public final static int FRAME_flpdth30 = 133; + + public final static int FRAME_flpdth31 = 134; + + public final static int FRAME_flpdth32 = 135; + + public final static int FRAME_flpdth33 = 136; + + public final static int FRAME_flpdth34 = 137; + + public final static int FRAME_flpdth35 = 138; + + public final static int FRAME_flpdth36 = 139; + + public final static int FRAME_flpdth37 = 140; + + public final static int FRAME_flpdth38 = 141; + + public final static int FRAME_flpdth39 = 142; + + public final static int FRAME_flpdth40 = 143; + + public final static int FRAME_flpdth41 = 144; + + public final static int FRAME_flpdth42 = 145; + + public final static int FRAME_flpdth43 = 146; + + public final static int FRAME_flpdth44 = 147; + + public final static int FRAME_flpdth45 = 148; + + public final static int FRAME_flpdth46 = 149; + + public final static int FRAME_flpdth47 = 150; + + public final static int FRAME_flpdth48 = 151; + + public final static int FRAME_flpdth49 = 152; + + public final static int FRAME_flpdth50 = 153; + + public final static int FRAME_flpdth51 = 154; + + public final static int FRAME_flpdth52 = 155; + + public final static int FRAME_flpdth53 = 156; + + public final static int FRAME_flpdth54 = 157; + + public final static int FRAME_flpdth55 = 158; + + public final static int FRAME_flpdth56 = 159; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_chomp; + + static int sound_attack; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_death; + + static int sound_idle; + + static int sound_search; + + static int sound_sight; + + static mframe_t flipper_frames_stand[] = new mframe_t[] { new mframe_t( + GameAI.ai_stand, 0, null) }; + + static mmove_t flipper_move_stand = new mmove_t(FRAME_flphor01, + FRAME_flphor01, flipper_frames_stand, null); + + static EntThinkAdapter flipper_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = flipper_move_stand; + return true; + } + }; + + 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 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 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 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 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 boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); + Fire.fire_hit(self, aim, 5, 0); + return true; + } + }; + + static EntThinkAdapter flipper_preattack = new EntThinkAdapter() { + + 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 boolean think(edict_t self) { + self.monsterinfo.currentmove = flipper_move_attack; + return true; + } + }; + + static EntPainAdapter flipper_pain = new EntPainAdapter() { + 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 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 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 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 2; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Float.java b/src/jake2/game/monsters/M_Float.java new file mode 100644 index 0000000..9c6ce07 --- /dev/null +++ b/src/jake2/game/monsters/M_Float.java @@ -0,0 +1,1224 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Float.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.Globals; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Float { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_actvat01 = 0; + + public final static int FRAME_actvat02 = 1; + + public final static int FRAME_actvat03 = 2; + + public final static int FRAME_actvat04 = 3; + + public final static int FRAME_actvat05 = 4; + + public final static int FRAME_actvat06 = 5; + + public final static int FRAME_actvat07 = 6; + + public final static int FRAME_actvat08 = 7; + + public final static int FRAME_actvat09 = 8; + + public final static int FRAME_actvat10 = 9; + + public final static int FRAME_actvat11 = 10; + + public final static int FRAME_actvat12 = 11; + + public final static int FRAME_actvat13 = 12; + + public final static int FRAME_actvat14 = 13; + + public final static int FRAME_actvat15 = 14; + + public final static int FRAME_actvat16 = 15; + + public final static int FRAME_actvat17 = 16; + + public final static int FRAME_actvat18 = 17; + + public final static int FRAME_actvat19 = 18; + + public final static int FRAME_actvat20 = 19; + + public final static int FRAME_actvat21 = 20; + + public final static int FRAME_actvat22 = 21; + + public final static int FRAME_actvat23 = 22; + + public final static int FRAME_actvat24 = 23; + + public final static int FRAME_actvat25 = 24; + + public final static int FRAME_actvat26 = 25; + + public final static int FRAME_actvat27 = 26; + + public final static int FRAME_actvat28 = 27; + + public final static int FRAME_actvat29 = 28; + + public final static int FRAME_actvat30 = 29; + + public final static int FRAME_actvat31 = 30; + + public final static int FRAME_attak101 = 31; + + public final static int FRAME_attak102 = 32; + + public final static int FRAME_attak103 = 33; + + public final static int FRAME_attak104 = 34; + + public final static int FRAME_attak105 = 35; + + public final static int FRAME_attak106 = 36; + + public final static int FRAME_attak107 = 37; + + public final static int FRAME_attak108 = 38; + + public final static int FRAME_attak109 = 39; + + public final static int FRAME_attak110 = 40; + + public final static int FRAME_attak111 = 41; + + public final static int FRAME_attak112 = 42; + + public final static int FRAME_attak113 = 43; + + public final static int FRAME_attak114 = 44; + + public final static int FRAME_attak201 = 45; + + public final static int FRAME_attak202 = 46; + + public final static int FRAME_attak203 = 47; + + public final static int FRAME_attak204 = 48; + + public final static int FRAME_attak205 = 49; + + public final static int FRAME_attak206 = 50; + + public final static int FRAME_attak207 = 51; + + public final static int FRAME_attak208 = 52; + + public final static int FRAME_attak209 = 53; + + public final static int FRAME_attak210 = 54; + + public final static int FRAME_attak211 = 55; + + public final static int FRAME_attak212 = 56; + + public final static int FRAME_attak213 = 57; + + public final static int FRAME_attak214 = 58; + + public final static int FRAME_attak215 = 59; + + public final static int FRAME_attak216 = 60; + + public final static int FRAME_attak217 = 61; + + public final static int FRAME_attak218 = 62; + + public final static int FRAME_attak219 = 63; + + public final static int FRAME_attak220 = 64; + + public final static int FRAME_attak221 = 65; + + public final static int FRAME_attak222 = 66; + + public final static int FRAME_attak223 = 67; + + public final static int FRAME_attak224 = 68; + + public final static int FRAME_attak225 = 69; + + public final static int FRAME_attak301 = 70; + + public final static int FRAME_attak302 = 71; + + public final static int FRAME_attak303 = 72; + + public final static int FRAME_attak304 = 73; + + public final static int FRAME_attak305 = 74; + + public final static int FRAME_attak306 = 75; + + public final static int FRAME_attak307 = 76; + + public final static int FRAME_attak308 = 77; + + public final static int FRAME_attak309 = 78; + + public final static int FRAME_attak310 = 79; + + public final static int FRAME_attak311 = 80; + + public final static int FRAME_attak312 = 81; + + public final static int FRAME_attak313 = 82; + + public final static int FRAME_attak314 = 83; + + public final static int FRAME_attak315 = 84; + + public final static int FRAME_attak316 = 85; + + public final static int FRAME_attak317 = 86; + + public final static int FRAME_attak318 = 87; + + public final static int FRAME_attak319 = 88; + + public final static int FRAME_attak320 = 89; + + public final static int FRAME_attak321 = 90; + + public final static int FRAME_attak322 = 91; + + public final static int FRAME_attak323 = 92; + + public final static int FRAME_attak324 = 93; + + public final static int FRAME_attak325 = 94; + + public final static int FRAME_attak326 = 95; + + public final static int FRAME_attak327 = 96; + + public final static int FRAME_attak328 = 97; + + public final static int FRAME_attak329 = 98; + + public final static int FRAME_attak330 = 99; + + public final static int FRAME_attak331 = 100; + + public final static int FRAME_attak332 = 101; + + public final static int FRAME_attak333 = 102; + + public final static int FRAME_attak334 = 103; + + public final static int FRAME_death01 = 104; + + public final static int FRAME_death02 = 105; + + public final static int FRAME_death03 = 106; + + public final static int FRAME_death04 = 107; + + public final static int FRAME_death05 = 108; + + public final static int FRAME_death06 = 109; + + public final static int FRAME_death07 = 110; + + public final static int FRAME_death08 = 111; + + public final static int FRAME_death09 = 112; + + public final static int FRAME_death10 = 113; + + public final static int FRAME_death11 = 114; + + public final static int FRAME_death12 = 115; + + public final static int FRAME_death13 = 116; + + public final static int FRAME_pain101 = 117; + + public final static int FRAME_pain102 = 118; + + public final static int FRAME_pain103 = 119; + + public final static int FRAME_pain104 = 120; + + public final static int FRAME_pain105 = 121; + + public final static int FRAME_pain106 = 122; + + public final static int FRAME_pain107 = 123; + + public final static int FRAME_pain201 = 124; + + public final static int FRAME_pain202 = 125; + + public final static int FRAME_pain203 = 126; + + public final static int FRAME_pain204 = 127; + + public final static int FRAME_pain205 = 128; + + public final static int FRAME_pain206 = 129; + + public final static int FRAME_pain207 = 130; + + public final static int FRAME_pain208 = 131; + + public final static int FRAME_pain301 = 132; + + public final static int FRAME_pain302 = 133; + + public final static int FRAME_pain303 = 134; + + public final static int FRAME_pain304 = 135; + + public final static int FRAME_pain305 = 136; + + public final static int FRAME_pain306 = 137; + + public final static int FRAME_pain307 = 138; + + public final static int FRAME_pain308 = 139; + + public final static int FRAME_pain309 = 140; + + public final static int FRAME_pain310 = 141; + + public final static int FRAME_pain311 = 142; + + public final static int FRAME_pain312 = 143; + + public final static int FRAME_stand101 = 144; + + public final static int FRAME_stand102 = 145; + + public final static int FRAME_stand103 = 146; + + public final static int FRAME_stand104 = 147; + + public final static int FRAME_stand105 = 148; + + public final static int FRAME_stand106 = 149; + + public final static int FRAME_stand107 = 150; + + public final static int FRAME_stand108 = 151; + + public final static int FRAME_stand109 = 152; + + public final static int FRAME_stand110 = 153; + + public final static int FRAME_stand111 = 154; + + public final static int FRAME_stand112 = 155; + + public final static int FRAME_stand113 = 156; + + public final static int FRAME_stand114 = 157; + + public final static int FRAME_stand115 = 158; + + public final static int FRAME_stand116 = 159; + + public final static int FRAME_stand117 = 160; + + public final static int FRAME_stand118 = 161; + + public final static int FRAME_stand119 = 162; + + public final static int FRAME_stand120 = 163; + + public final static int FRAME_stand121 = 164; + + public final static int FRAME_stand122 = 165; + + public final static int FRAME_stand123 = 166; + + public final static int FRAME_stand124 = 167; + + public final static int FRAME_stand125 = 168; + + public final static int FRAME_stand126 = 169; + + public final static int FRAME_stand127 = 170; + + public final static int FRAME_stand128 = 171; + + public final static int FRAME_stand129 = 172; + + public final static int FRAME_stand130 = 173; + + public final static int FRAME_stand131 = 174; + + public final static int FRAME_stand132 = 175; + + public final static int FRAME_stand133 = 176; + + public final static int FRAME_stand134 = 177; + + public final static int FRAME_stand135 = 178; + + public final static int FRAME_stand136 = 179; + + public final static int FRAME_stand137 = 180; + + public final static int FRAME_stand138 = 181; + + public final static int FRAME_stand139 = 182; + + public final static int FRAME_stand140 = 183; + + public final static int FRAME_stand141 = 184; + + public final static int FRAME_stand142 = 185; + + public final static int FRAME_stand143 = 186; + + public final static int FRAME_stand144 = 187; + + public final static int FRAME_stand145 = 188; + + public final static int FRAME_stand146 = 189; + + public final static int FRAME_stand147 = 190; + + public final static int FRAME_stand148 = 191; + + public final static int FRAME_stand149 = 192; + + public final static int FRAME_stand150 = 193; + + public final static int FRAME_stand151 = 194; + + public final static int FRAME_stand152 = 195; + + public final static int FRAME_stand201 = 196; + + public final static int FRAME_stand202 = 197; + + public final static int FRAME_stand203 = 198; + + public final static int FRAME_stand204 = 199; + + public final static int FRAME_stand205 = 200; + + public final static int FRAME_stand206 = 201; + + public final static int FRAME_stand207 = 202; + + public final static int FRAME_stand208 = 203; + + public final static int FRAME_stand209 = 204; + + public final static int FRAME_stand210 = 205; + + public final static int FRAME_stand211 = 206; + + public final static int FRAME_stand212 = 207; + + public final static int FRAME_stand213 = 208; + + public final static int FRAME_stand214 = 209; + + public final static int FRAME_stand215 = 210; + + public final static int FRAME_stand216 = 211; + + public final static int FRAME_stand217 = 212; + + public final static int FRAME_stand218 = 213; + + public final static int FRAME_stand219 = 214; + + public final static int FRAME_stand220 = 215; + + public final static int FRAME_stand221 = 216; + + public final static int FRAME_stand222 = 217; + + public final static int FRAME_stand223 = 218; + + public final static int FRAME_stand224 = 219; + + public final static int FRAME_stand225 = 220; + + public final static int FRAME_stand226 = 221; + + public final static int FRAME_stand227 = 222; + + public final static int FRAME_stand228 = 223; + + public final static int FRAME_stand229 = 224; + + public final static int FRAME_stand230 = 225; + + public final static int FRAME_stand231 = 226; + + public final static int FRAME_stand232 = 227; + + public final static int FRAME_stand233 = 228; + + public final static int FRAME_stand234 = 229; + + public final static int FRAME_stand235 = 230; + + public final static int FRAME_stand236 = 231; + + public final static int FRAME_stand237 = 232; + + public final static int FRAME_stand238 = 233; + + public final static int FRAME_stand239 = 234; + + public final static int FRAME_stand240 = 235; + + public final static int FRAME_stand241 = 236; + + public final static int FRAME_stand242 = 237; + + public final static int FRAME_stand243 = 238; + + public final static int FRAME_stand244 = 239; + + public final static int FRAME_stand245 = 240; + + public final static int FRAME_stand246 = 241; + + public final static int FRAME_stand247 = 242; + + public final static int FRAME_stand248 = 243; + + public final static int FRAME_stand249 = 244; + + public final static int FRAME_stand250 = 245; + + public final static int FRAME_stand251 = 246; + + public final static int FRAME_stand252 = 247; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_attack2; + + static int sound_attack3; + + static int sound_death1; + + static int sound_idle; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_sight; + + static EntInteractAdapter floater_sight = new EntInteractAdapter() { + 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 EntThinkAdapter floater_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter floater_fire_blaster = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + int effect; + + if ((self.s.frame == FRAME_attak104) + || (self.s.frame == FRAME_attak107)) + effect = Defines.EF_HYPERBLASTER; + else + effect = 0; + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_FLOAT_BLASTER_1], + forward, right, start); + + Math3D.VectorCopy(self.enemy.s.origin, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, dir); + + Monster.monster_fire_blaster(self, start, dir, 1, 1000, + Defines.MZ2_FLOAT_BLASTER_1, effect); + + return true; + } + }; + + static mframe_t floater_frames_stand1[] = 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) }; + + static mmove_t floater_move_stand1 = new mmove_t(FRAME_stand101, + FRAME_stand152, floater_frames_stand1, null); + + static mframe_t floater_frames_stand2[] = 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) }; + + static mmove_t floater_move_stand2 = new mmove_t(FRAME_stand201, + FRAME_stand252, floater_frames_stand2, null); + + static EntThinkAdapter floater_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() <= 0.5) + self.monsterinfo.currentmove = floater_move_stand1; + else + self.monsterinfo.currentmove = floater_move_stand2; + return true; + } + }; + + static mframe_t floater_frames_activate[] = 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) }; + + static mmove_t floater_move_activate = new mmove_t(FRAME_actvat01, + FRAME_actvat31, floater_frames_activate, null); + + static EntThinkAdapter floater_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = floater_move_stand1; + else + self.monsterinfo.currentmove = floater_move_run; + + return true; + } + }; + + static mframe_t floater_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), // Blaster attack) + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + // BOOM (0, -25.8, 32.5) -- LOOP Starts + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, floater_fire_blaster), + 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) + // -- LOOP Ends + }; + + static mmove_t floater_move_attack1 = new mmove_t(FRAME_attak101, + FRAME_attak114, floater_frames_attack1, floater_run); + + static float[] aim = { Defines.MELEE_DISTANCE, 0, 0 }; + + static EntThinkAdapter floater_wham = new EntThinkAdapter() { + public boolean think(edict_t self) { + + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack3, 1, + Defines.ATTN_NORM, 0); + Fire.fire_hit(self, aim, 5 + Lib.rand() % 6, -50); + return true; + } + }; + + static mframe_t floater_frames_attack2[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), // Claws + 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, floater_wham), + // WHAM (0, -45, 29.6) -- LOOP Starts + 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), + // -- LOOP Ends + 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) }; + + static mmove_t floater_move_attack2 = new mmove_t(FRAME_attak201, + FRAME_attak225, floater_frames_attack2, floater_run); + + static EntThinkAdapter floater_zap = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] origin = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + float[] offset = { 0, 0, 0 }; + + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, dir); + + Math3D.AngleVectors(self.s.angles, forward, right, null); + //FIXME use a flash and replace these two lines with the commented + // one + Math3D.VectorSet(offset, 18.5f, -0.9f, 10f); + Math3D.G_ProjectSource(self.s.origin, offset, forward, right, + origin); + // G_ProjectSource (self.s.origin, + // monster_flash_offset[flash_number], forward, right, origin); + + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_attack2, 1, + Defines.ATTN_NORM, 0); + + //FIXME use the flash, Luke + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_SPLASH); + GameBase.gi.WriteByte(32); + GameBase.gi.WritePosition(origin); + GameBase.gi.WriteDir(dir); + GameBase.gi.WriteByte(1); //sparks + GameBase.gi.multicast(origin, Defines.MULTICAST_PVS); + + GameUtil.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, + Globals.vec3_origin, 5 + Lib.rand() % 6, -10, + Defines.DAMAGE_ENERGY, Defines.MOD_UNKNOWN); + return true; + } + }; + + static mframe_t floater_frames_attack3[] = new mframe_t[] { + 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, floater_zap), + // -- LOOP Starts + 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, 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), + // -- LOOP Ends + 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) }; + + static mmove_t floater_move_attack3 = new mmove_t(FRAME_attak301, + FRAME_attak334, floater_frames_attack3, floater_run); + + static mframe_t floater_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) }; + + static EntThinkAdapter floater_dead = new EntThinkAdapter() { + 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 mmove_t floater_move_death = new mmove_t(FRAME_death01, + FRAME_death13, floater_frames_death, floater_dead); + + static mframe_t floater_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), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t floater_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain107, floater_frames_pain1, floater_run); + + static mframe_t floater_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), + 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 floater_move_pain2 = new mmove_t(FRAME_pain201, + FRAME_pain208, floater_frames_pain2, floater_run); + + static mframe_t floater_frames_pain3[] = 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) }; + + static mmove_t floater_move_pain3 = new mmove_t(FRAME_pain301, + FRAME_pain312, floater_frames_pain3, floater_run); + + static mframe_t floater_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null) }; + + static mmove_t floater_move_walk = new mmove_t(FRAME_stand101, + FRAME_stand152, floater_frames_walk, null); + + static mframe_t floater_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 13, null) }; + + static mmove_t floater_move_run = new mmove_t(FRAME_stand101, + FRAME_stand152, floater_frames_run, null); + + static EntThinkAdapter floater_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = floater_move_walk; + return true; + } + }; + + static EntThinkAdapter floater_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = floater_move_attack1; + return true; + } + }; + + static EntThinkAdapter floater_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = floater_move_attack3; + else + self.monsterinfo.currentmove = floater_move_attack2; + return true; + } + }; + + static EntPainAdapter floater_pain = new EntPainAdapter() { + 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) % 3; + if (n == 0) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = floater_move_pain1; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = floater_move_pain2; + } + return; + } + }; + + static EntDieAdapter floater_die = new EntDieAdapter() { + + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1, + Defines.ATTN_NORM, 0); + GameAI.BecomeExplosion1(self); + + } + }; + + /* + * QUAKED monster_floater (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_floater(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_attack2 = GameBase.gi.soundindex("floater/fltatck2.wav"); + sound_attack3 = GameBase.gi.soundindex("floater/fltatck3.wav"); + sound_death1 = GameBase.gi.soundindex("floater/fltdeth1.wav"); + sound_idle = GameBase.gi.soundindex("floater/fltidle1.wav"); + sound_pain1 = GameBase.gi.soundindex("floater/fltpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("floater/fltpain2.wav"); + sound_sight = GameBase.gi.soundindex("floater/fltsght1.wav"); + + GameBase.gi.soundindex("floater/fltatck1.wav"); + + self.s.sound = GameBase.gi.soundindex("floater/fltsrch1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/float/tris.md2"); + Math3D.VectorSet(self.mins, -24, -24, -24); + Math3D.VectorSet(self.maxs, 24, 24, 32); + + self.health = 200; + self.gib_health = -80; + self.mass = 300; + + self.pain = floater_pain; + self.die = floater_die; + + self.monsterinfo.stand = floater_stand; + self.monsterinfo.walk = floater_walk; + self.monsterinfo.run = floater_run; + // self.monsterinfo.dodge = floater_dodge; + self.monsterinfo.attack = floater_attack; + self.monsterinfo.melee = floater_melee; + self.monsterinfo.sight = floater_sight; + self.monsterinfo.idle = floater_idle; + + GameBase.gi.linkentity(self); + + if (Lib.random() <= 0.5) + self.monsterinfo.currentmove = floater_move_stand1; + else + self.monsterinfo.currentmove = floater_move_stand2; + + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.flymonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Flyer.java b/src/jake2/game/monsters/M_Flyer.java new file mode 100644 index 0000000..24e1c78 --- /dev/null +++ b/src/jake2/game/monsters/M_Flyer.java @@ -0,0 +1,996 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Flyer.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Flyer { + // This file generated by ModelGen - Do NOT Modify + + public final static int ACTION_nothing = 0; + + public final static int ACTION_attack1 = 1; + + public final static int ACTION_attack2 = 2; + + public final static int ACTION_run = 3; + + public final static int ACTION_walk = 4; + + public final static int FRAME_start01 = 0; + + public final static int FRAME_start02 = 1; + + public final static int FRAME_start03 = 2; + + public final static int FRAME_start04 = 3; + + public final static int FRAME_start05 = 4; + + public final static int FRAME_start06 = 5; + + public final static int FRAME_stop01 = 6; + + public final static int FRAME_stop02 = 7; + + public final static int FRAME_stop03 = 8; + + public final static int FRAME_stop04 = 9; + + public final static int FRAME_stop05 = 10; + + public final static int FRAME_stop06 = 11; + + public final static int FRAME_stop07 = 12; + + public final static int FRAME_stand01 = 13; + + public final static int FRAME_stand02 = 14; + + public final static int FRAME_stand03 = 15; + + public final static int FRAME_stand04 = 16; + + public final static int FRAME_stand05 = 17; + + public final static int FRAME_stand06 = 18; + + public final static int FRAME_stand07 = 19; + + public final static int FRAME_stand08 = 20; + + public final static int FRAME_stand09 = 21; + + public final static int FRAME_stand10 = 22; + + public final static int FRAME_stand11 = 23; + + public final static int FRAME_stand12 = 24; + + public final static int FRAME_stand13 = 25; + + public final static int FRAME_stand14 = 26; + + public final static int FRAME_stand15 = 27; + + public final static int FRAME_stand16 = 28; + + public final static int FRAME_stand17 = 29; + + public final static int FRAME_stand18 = 30; + + public final static int FRAME_stand19 = 31; + + public final static int FRAME_stand20 = 32; + + public final static int FRAME_stand21 = 33; + + public final static int FRAME_stand22 = 34; + + public final static int FRAME_stand23 = 35; + + public final static int FRAME_stand24 = 36; + + public final static int FRAME_stand25 = 37; + + public final static int FRAME_stand26 = 38; + + public final static int FRAME_stand27 = 39; + + public final static int FRAME_stand28 = 40; + + public final static int FRAME_stand29 = 41; + + public final static int FRAME_stand30 = 42; + + public final static int FRAME_stand31 = 43; + + public final static int FRAME_stand32 = 44; + + public final static int FRAME_stand33 = 45; + + public final static int FRAME_stand34 = 46; + + public final static int FRAME_stand35 = 47; + + public final static int FRAME_stand36 = 48; + + public final static int FRAME_stand37 = 49; + + public final static int FRAME_stand38 = 50; + + public final static int FRAME_stand39 = 51; + + public final static int FRAME_stand40 = 52; + + public final static int FRAME_stand41 = 53; + + public final static int FRAME_stand42 = 54; + + public final static int FRAME_stand43 = 55; + + public final static int FRAME_stand44 = 56; + + public final static int FRAME_stand45 = 57; + + public final static int FRAME_attak101 = 58; + + public final static int FRAME_attak102 = 59; + + public final static int FRAME_attak103 = 60; + + public final static int FRAME_attak104 = 61; + + public final static int FRAME_attak105 = 62; + + public final static int FRAME_attak106 = 63; + + public final static int FRAME_attak107 = 64; + + public final static int FRAME_attak108 = 65; + + public final static int FRAME_attak109 = 66; + + public final static int FRAME_attak110 = 67; + + public final static int FRAME_attak111 = 68; + + public final static int FRAME_attak112 = 69; + + public final static int FRAME_attak113 = 70; + + public final static int FRAME_attak114 = 71; + + public final static int FRAME_attak115 = 72; + + public final static int FRAME_attak116 = 73; + + public final static int FRAME_attak117 = 74; + + public final static int FRAME_attak118 = 75; + + public final static int FRAME_attak119 = 76; + + public final static int FRAME_attak120 = 77; + + public final static int FRAME_attak121 = 78; + + public final static int FRAME_attak201 = 79; + + public final static int FRAME_attak202 = 80; + + public final static int FRAME_attak203 = 81; + + public final static int FRAME_attak204 = 82; + + public final static int FRAME_attak205 = 83; + + public final static int FRAME_attak206 = 84; + + public final static int FRAME_attak207 = 85; + + public final static int FRAME_attak208 = 86; + + public final static int FRAME_attak209 = 87; + + public final static int FRAME_attak210 = 88; + + public final static int FRAME_attak211 = 89; + + public final static int FRAME_attak212 = 90; + + public final static int FRAME_attak213 = 91; + + public final static int FRAME_attak214 = 92; + + public final static int FRAME_attak215 = 93; + + public final static int FRAME_attak216 = 94; + + public final static int FRAME_attak217 = 95; + + public final static int FRAME_bankl01 = 96; + + public final static int FRAME_bankl02 = 97; + + public final static int FRAME_bankl03 = 98; + + public final static int FRAME_bankl04 = 99; + + public final static int FRAME_bankl05 = 100; + + public final static int FRAME_bankl06 = 101; + + public final static int FRAME_bankl07 = 102; + + public final static int FRAME_bankr01 = 103; + + public final static int FRAME_bankr02 = 104; + + public final static int FRAME_bankr03 = 105; + + public final static int FRAME_bankr04 = 106; + + public final static int FRAME_bankr05 = 107; + + public final static int FRAME_bankr06 = 108; + + public final static int FRAME_bankr07 = 109; + + public final static int FRAME_rollf01 = 110; + + public final static int FRAME_rollf02 = 111; + + public final static int FRAME_rollf03 = 112; + + public final static int FRAME_rollf04 = 113; + + public final static int FRAME_rollf05 = 114; + + public final static int FRAME_rollf06 = 115; + + public final static int FRAME_rollf07 = 116; + + public final static int FRAME_rollf08 = 117; + + public final static int FRAME_rollf09 = 118; + + public final static int FRAME_rollr01 = 119; + + public final static int FRAME_rollr02 = 120; + + public final static int FRAME_rollr03 = 121; + + public final static int FRAME_rollr04 = 122; + + public final static int FRAME_rollr05 = 123; + + public final static int FRAME_rollr06 = 124; + + public final static int FRAME_rollr07 = 125; + + public final static int FRAME_rollr08 = 126; + + public final static int FRAME_rollr09 = 127; + + public final static int FRAME_defens01 = 128; + + public final static int FRAME_defens02 = 129; + + public final static int FRAME_defens03 = 130; + + public final static int FRAME_defens04 = 131; + + public final static int FRAME_defens05 = 132; + + public final static int FRAME_defens06 = 133; + + public final static int FRAME_pain101 = 134; + + public final static int FRAME_pain102 = 135; + + public final static int FRAME_pain103 = 136; + + public final static int FRAME_pain104 = 137; + + public final static int FRAME_pain105 = 138; + + public final static int FRAME_pain106 = 139; + + public final static int FRAME_pain107 = 140; + + public final static int FRAME_pain108 = 141; + + public final static int FRAME_pain109 = 142; + + public final static int FRAME_pain201 = 143; + + public final static int FRAME_pain202 = 144; + + public final static int FRAME_pain203 = 145; + + public final static int FRAME_pain204 = 146; + + public final static int FRAME_pain301 = 147; + + public final static int FRAME_pain302 = 148; + + public final static int FRAME_pain303 = 149; + + public final static int FRAME_pain304 = 150; + + public final static float MODEL_SCALE = 1.000000f; + + static int nextmove; // Used for start/stop frames + + static int sound_sight; + + static int sound_idle; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_slash; + + static int sound_sproing; + + static int sound_die; + + public static EntInteractAdapter flyer_sight = new EntInteractAdapter() { + 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 EntThinkAdapter flyer_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter flyer_pop_blades = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sproing, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t flyer_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) }; + + static mmove_t flyer_move_stand = new mmove_t(FRAME_stand01, FRAME_stand45, + flyer_frames_stand, null); + + static mframe_t flyer_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null) }; + + static mmove_t flyer_move_walk = new mmove_t(FRAME_stand01, FRAME_stand45, + flyer_frames_walk, null); + + static mframe_t flyer_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null) }; + + static mmove_t flyer_move_run = new mmove_t(FRAME_stand01, FRAME_stand45, + flyer_frames_run, null); + + static EntThinkAdapter flyer_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = flyer_move_stand; + else + self.monsterinfo.currentmove = flyer_move_run; + return true; + } + }; + + static EntThinkAdapter flyer_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = flyer_move_walk; + return true; + } + }; + + static EntThinkAdapter flyer_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = flyer_move_stand; + return true; + } + }; + + static EntThinkAdapter flyer_nextmove = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (nextmove == ACTION_attack1) + self.monsterinfo.currentmove = flyer_move_start_melee; + else if (nextmove == ACTION_attack2) + self.monsterinfo.currentmove = flyer_move_attack2; + else if (nextmove == ACTION_run) + self.monsterinfo.currentmove = flyer_move_run; + return true; + } + }; + + static mframe_t flyer_frames_start[] = 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, flyer_nextmove) }; + + static mmove_t flyer_move_start = new mmove_t(FRAME_start01, FRAME_start06, + flyer_frames_start, null); + + static mframe_t flyer_frames_stop[] = 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, flyer_nextmove) }; + + static mmove_t flyer_move_stop = new mmove_t(FRAME_stop01, FRAME_stop07, + flyer_frames_stop, null); + + static EntThinkAdapter flyer_stop = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = flyer_move_stop; + return true; + } + }; + + static EntThinkAdapter flyer_start = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = flyer_move_start; + return true; + } + }; + + static mframe_t flyer_frames_rollright[] = 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 flyer_move_rollright = new mmove_t(FRAME_rollr01, + FRAME_rollr09, flyer_frames_rollright, null); + + static mframe_t flyer_frames_rollleft[] = 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 flyer_move_rollleft = new mmove_t(FRAME_rollf01, + FRAME_rollf09, flyer_frames_rollleft, null); + + static mframe_t flyer_frames_pain3[] = 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) }; + + static mmove_t flyer_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain304, + flyer_frames_pain3, flyer_run); + + static mframe_t flyer_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) }; + + static mmove_t flyer_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain204, + flyer_frames_pain2, flyer_run); + + static mframe_t flyer_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), + 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 flyer_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain109, + flyer_frames_pain1, flyer_run); + + static mframe_t flyer_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), + // Hold this frame + 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 flyer_move_defense = new mmove_t(FRAME_defens01, + FRAME_defens06, flyer_frames_defense, null); + + static mframe_t flyer_frames_bankright[] = 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) }; + + static mmove_t flyer_move_bankright = new mmove_t(FRAME_bankr01, + FRAME_bankr07, flyer_frames_bankright, null); + + static mframe_t flyer_frames_bankleft[] = 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) }; + + static mmove_t flyer_move_bankleft = new mmove_t(FRAME_bankl01, + FRAME_bankl07, flyer_frames_bankleft, null); + + static EntThinkAdapter flyer_fireleft = new EntThinkAdapter() { + public boolean think(edict_t self) { + flyer_fire(self, Defines.MZ2_FLYER_BLASTER_1); + return true; + } + }; + + static EntThinkAdapter flyer_fireright = new EntThinkAdapter() { + public boolean think(edict_t self) { + flyer_fire(self, Defines.MZ2_FLYER_BLASTER_2); + return true; + } + }; + + static mframe_t flyer_frames_attack2[] = new mframe_t[] { + 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, -10, flyer_fireleft), + // left gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireright), // right gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireleft), // left gun + new mframe_t(GameAI.ai_charge, -10, flyer_fireright), // right gun + 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) }; + + static mmove_t flyer_move_attack2 = new mmove_t(FRAME_attak201, + FRAME_attak217, flyer_frames_attack2, flyer_run); + + static EntThinkAdapter flyer_slash_left = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 0); + Fire.fire_hit(self, aim, 5, 0); + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter flyer_slash_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 0); + Fire.fire_hit(self, aim, 5, 0); + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_slash, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter flyer_loop_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + /* + * if (random() <= 0.5) self.monsterinfo.currentmove = + * flyer_move_attack1; else + */ + self.monsterinfo.currentmove = flyer_move_loop_melee; + return true; + } + }; + + static mframe_t flyer_frames_start_melee[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, flyer_pop_blades), + 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) }; + + static mmove_t flyer_move_start_melee = new mmove_t(FRAME_attak101, + FRAME_attak106, flyer_frames_start_melee, flyer_loop_melee); + + static mframe_t flyer_frames_end_melee[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t flyer_move_end_melee = new mmove_t(FRAME_attak119, + FRAME_attak121, flyer_frames_end_melee, flyer_run); + + static mframe_t flyer_frames_loop_melee[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), // Loop Start + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, flyer_slash_left), + // Left Wing Strike + 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, flyer_slash_right), + // Right Wing Strike + 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) // Loop Ends + + }; + + static EntThinkAdapter flyer_check_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) + if (Lib.random() <= 0.8) + self.monsterinfo.currentmove = flyer_move_loop_melee; + else + self.monsterinfo.currentmove = flyer_move_end_melee; + else + self.monsterinfo.currentmove = flyer_move_end_melee; + return true; + } + }; + + static mmove_t flyer_move_loop_melee = new mmove_t(FRAME_attak107, + FRAME_attak118, flyer_frames_loop_melee, flyer_check_melee); + + static EntThinkAdapter flyer_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + /* + * if (random() <= 0.5) self.monsterinfo.currentmove = + * flyer_move_attack1; else + */ + self.monsterinfo.currentmove = flyer_move_attack2; + + return true; + } + }; + + static EntThinkAdapter flyer_setstart = new EntThinkAdapter() { + public boolean think(edict_t self) { + nextmove = ACTION_run; + self.monsterinfo.currentmove = flyer_move_start; + return true; + } + }; + + static EntThinkAdapter flyer_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + // flyer.nextmove = ACTION_attack1; + // self.monsterinfo.currentmove = flyer_move_stop; + self.monsterinfo.currentmove = flyer_move_start_melee; + return true; + } + }; + + static EntPainAdapter flyer_pain = new EntPainAdapter() { + 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() % 3; + if (n == 0) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = flyer_move_pain1; + } else if (n == 1) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = flyer_move_pain2; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = flyer_move_pain3; + } + + } + }; + + static EntDieAdapter flyer_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, + Defines.ATTN_NORM, 0); + GameAI.BecomeExplosion1(self); + } + }; + + static void flyer_fire(edict_t self, int flash_number) { + float[] start = { 0, 0, 0 }; + + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + int effect; + + if ((self.s.frame == FRAME_attak204) + || (self.s.frame == FRAME_attak207) + || (self.s.frame == FRAME_attak210)) + effect = Defines.EF_HYPERBLASTER; + else + effect = 0; + 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, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, dir); + + Monster.monster_fire_blaster(self, start, dir, 1, 1000, flash_number, + effect); + } + + /* + * QUAKED monster_flyer (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_flyer(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + // fix a map bug in jail5.bsp + if (GameBase.level.mapname.equalsIgnoreCase("jail5") + && (self.s.origin[2] == -104)) { + self.targetname = self.target; + self.target = null; + } + + sound_sight = GameBase.gi.soundindex("flyer/flysght1.wav"); + sound_idle = GameBase.gi.soundindex("flyer/flysrch1.wav"); + sound_pain1 = GameBase.gi.soundindex("flyer/flypain1.wav"); + sound_pain2 = GameBase.gi.soundindex("flyer/flypain2.wav"); + sound_slash = GameBase.gi.soundindex("flyer/flyatck2.wav"); + sound_sproing = GameBase.gi.soundindex("flyer/flyatck1.wav"); + sound_die = GameBase.gi.soundindex("flyer/flydeth1.wav"); + + GameBase.gi.soundindex("flyer/flyatck3.wav"); + + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/flyer/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + self.s.sound = GameBase.gi.soundindex("flyer/flyidle1.wav"); + + self.health = 50; + self.mass = 50; + + self.pain = flyer_pain; + self.die = flyer_die; + + self.monsterinfo.stand = flyer_stand; + self.monsterinfo.walk = flyer_walk; + self.monsterinfo.run = flyer_run; + self.monsterinfo.attack = flyer_attack; + self.monsterinfo.melee = flyer_melee; + self.monsterinfo.sight = flyer_sight; + self.monsterinfo.idle = flyer_idle; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = flyer_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.flymonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Gladiator.java b/src/jake2/game/monsters/M_Gladiator.java new file mode 100644 index 0000000..a2022ad --- /dev/null +++ b/src/jake2/game/monsters/M_Gladiator.java @@ -0,0 +1,650 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Gladiator.java,v 1.2 2005-02-06 18:48:18 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Gladiator { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_stand1 = 0; + + public final static int FRAME_stand2 = 1; + + public final static int FRAME_stand3 = 2; + + public final static int FRAME_stand4 = 3; + + public final static int FRAME_stand5 = 4; + + public final static int FRAME_stand6 = 5; + + public final static int FRAME_stand7 = 6; + + public final static int FRAME_walk1 = 7; + + public final static int FRAME_walk2 = 8; + + public final static int FRAME_walk3 = 9; + + public final static int FRAME_walk4 = 10; + + public final static int FRAME_walk5 = 11; + + public final static int FRAME_walk6 = 12; + + public final static int FRAME_walk7 = 13; + + public final static int FRAME_walk8 = 14; + + public final static int FRAME_walk9 = 15; + + public final static int FRAME_walk10 = 16; + + public final static int FRAME_walk11 = 17; + + public final static int FRAME_walk12 = 18; + + public final static int FRAME_walk13 = 19; + + public final static int FRAME_walk14 = 20; + + public final static int FRAME_walk15 = 21; + + public final static int FRAME_walk16 = 22; + + public final static int FRAME_run1 = 23; + + public final static int FRAME_run2 = 24; + + public final static int FRAME_run3 = 25; + + public final static int FRAME_run4 = 26; + + public final static int FRAME_run5 = 27; + + public final static int FRAME_run6 = 28; + + public final static int FRAME_melee1 = 29; + + public final static int FRAME_melee2 = 30; + + public final static int FRAME_melee3 = 31; + + public final static int FRAME_melee4 = 32; + + public final static int FRAME_melee5 = 33; + + public final static int FRAME_melee6 = 34; + + public final static int FRAME_melee7 = 35; + + public final static int FRAME_melee8 = 36; + + public final static int FRAME_melee9 = 37; + + public final static int FRAME_melee10 = 38; + + public final static int FRAME_melee11 = 39; + + public final static int FRAME_melee12 = 40; + + public final static int FRAME_melee13 = 41; + + public final static int FRAME_melee14 = 42; + + public final static int FRAME_melee15 = 43; + + public final static int FRAME_melee16 = 44; + + public final static int FRAME_melee17 = 45; + + public final static int FRAME_attack1 = 46; + + public final static int FRAME_attack2 = 47; + + public final static int FRAME_attack3 = 48; + + public final static int FRAME_attack4 = 49; + + public final static int FRAME_attack5 = 50; + + public final static int FRAME_attack6 = 51; + + public final static int FRAME_attack7 = 52; + + public final static int FRAME_attack8 = 53; + + public final static int FRAME_attack9 = 54; + + public final static int FRAME_pain1 = 55; + + public final static int FRAME_pain2 = 56; + + public final static int FRAME_pain3 = 57; + + public final static int FRAME_pain4 = 58; + + public final static int FRAME_pain5 = 59; + + public final static int FRAME_pain6 = 60; + + public final static int FRAME_death1 = 61; + + public final static int FRAME_death2 = 62; + + public final static int FRAME_death3 = 63; + + public final static int FRAME_death4 = 64; + + public final static int FRAME_death5 = 65; + + public final static int FRAME_death6 = 66; + + public final static int FRAME_death7 = 67; + + public final static int FRAME_death8 = 68; + + public final static int FRAME_death9 = 69; + + public final static int FRAME_death10 = 70; + + public final static int FRAME_death11 = 71; + + public final static int FRAME_death12 = 72; + + public final static int FRAME_death13 = 73; + + public final static int FRAME_death14 = 74; + + public final static int FRAME_death15 = 75; + + public final static int FRAME_death16 = 76; + + public final static int FRAME_death17 = 77; + + public final static int FRAME_death18 = 78; + + public final static int FRAME_death19 = 79; + + public final static int FRAME_death20 = 80; + + public final static int FRAME_death21 = 81; + + public final static int FRAME_death22 = 82; + + public final static int FRAME_painup1 = 83; + + public final static int FRAME_painup2 = 84; + + public final static int FRAME_painup3 = 85; + + public final static int FRAME_painup4 = 86; + + public final static int FRAME_painup5 = 87; + + public final static int FRAME_painup6 = 88; + + public final static int FRAME_painup7 = 89; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_die; + + static int sound_gun; + + static int sound_cleaver_swing; + + static int sound_cleaver_hit; + + static int sound_cleaver_miss; + + static int sound_idle; + + static int sound_search; + + static int sound_sight; + + static EntThinkAdapter gladiator_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntInteractAdapter gladiator_sight = new EntInteractAdapter() { + 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 EntThinkAdapter gladiator_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter gladiator_cleaver_swing = new EntThinkAdapter() { + public boolean think(edict_t self) { + + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_cleaver_swing, + 1, Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t gladiator_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) }; + + static mmove_t gladiator_move_stand = new mmove_t(FRAME_stand1, + FRAME_stand7, gladiator_frames_stand, null); + + static EntThinkAdapter gladiator_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.monsterinfo.currentmove = gladiator_move_stand; + return true; + } + }; + + static mframe_t gladiator_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 15, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 12, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 8, null) }; + + static mmove_t gladiator_move_walk = new mmove_t(FRAME_walk1, FRAME_walk16, + gladiator_frames_walk, null); + + static EntThinkAdapter gladiator_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.monsterinfo.currentmove = gladiator_move_walk; + + return true; + } + }; + + static mframe_t gladiator_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 23, null), + new mframe_t(GameAI.ai_run, 14, null), + new mframe_t(GameAI.ai_run, 14, null), + new mframe_t(GameAI.ai_run, 21, null), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, 13, null) }; + + static mmove_t gladiator_move_run = new mmove_t(FRAME_run1, FRAME_run6, + gladiator_frames_run, null); + + static EntThinkAdapter gladiator_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = gladiator_move_stand; + else + self.monsterinfo.currentmove = gladiator_move_run; + + return true; + } + }; + + static EntThinkAdapter GaldiatorMelee = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], -4); + if (Fire.fire_hit(self, aim, (20 + (Lib.rand() % 5)), 300)) + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_cleaver_hit, + 1, Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_AUTO, sound_cleaver_miss, + 1, Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t gladiator_frames_attack_melee[] = new mframe_t[] { + 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, gladiator_cleaver_swing), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, GaldiatorMelee), + 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, gladiator_cleaver_swing), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, GaldiatorMelee), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t gladiator_move_attack_melee = new mmove_t(FRAME_melee1, + FRAME_melee17, gladiator_frames_attack_melee, gladiator_run); + + static EntThinkAdapter gladiator_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.monsterinfo.currentmove = gladiator_move_attack_melee; + return true; + } + }; + + static EntThinkAdapter GladiatorGun = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] start = { 0, 0, 0 }; + + float[] dir = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D + .G_ProjectSource( + self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_GLADIATOR_RAILGUN_1], + forward, right, start); + + // calc direction to where we targted + Math3D.VectorSubtract(self.pos1, start, dir); + Math3D.VectorNormalize(dir); + + Monster.monster_fire_railgun(self, start, dir, 50, 100, + Defines.MZ2_GLADIATOR_RAILGUN_1); + + return true; + } + }; + + static mframe_t gladiator_frames_attack_gun[] = new mframe_t[] { + 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, GladiatorGun), + 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) }; + + static mmove_t gladiator_move_attack_gun = new mmove_t(FRAME_attack1, + FRAME_attack9, gladiator_frames_attack_gun, gladiator_run); + + static EntThinkAdapter gladiator_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float range; + float[] v = { 0, 0, 0 }; + + // a small safe zone + Math3D.VectorSubtract(self.s.origin, self.enemy.s.origin, v); + range = Math3D.VectorLength(v); + if (range <= (Defines.MELEE_DISTANCE + 32)) + return true; + + // charge up the railgun + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_gun, 1, + Defines.ATTN_NORM, 0); + Math3D.VectorCopy(self.enemy.s.origin, self.pos1); + //save for aiming the shot + self.pos1[2] += self.enemy.viewheight; + self.monsterinfo.currentmove = gladiator_move_attack_gun; + return true; + } + }; + + static mframe_t gladiator_frames_pain[] = 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) }; + + static mmove_t gladiator_move_pain = new mmove_t(FRAME_pain1, FRAME_pain6, + gladiator_frames_pain, gladiator_run); + + static mframe_t gladiator_frames_pain_air[] = 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) }; + + static mmove_t gladiator_move_pain_air = new mmove_t(FRAME_painup1, + FRAME_painup7, gladiator_frames_pain_air, gladiator_run); + + static EntPainAdapter gladiator_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + + if (self.health < (self.max_health / 2)) + self.s.skinnum = 1; + + if (GameBase.level.time < self.pain_debounce_time) { + if ((self.velocity[2] > 100) + && (self.monsterinfo.currentmove == gladiator_move_pain)) + self.monsterinfo.currentmove = gladiator_move_pain_air; + return; + } + + self.pain_debounce_time = GameBase.level.time + 3; + + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (self.velocity[2] > 100) + self.monsterinfo.currentmove = gladiator_move_pain_air; + else + self.monsterinfo.currentmove = gladiator_move_pain; + + } + }; + + static EntThinkAdapter gladiator_dead = new EntThinkAdapter() { + 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 gladiator_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) }; + + static mmove_t gladiator_move_death = new mmove_t(FRAME_death1, + FRAME_death22, gladiator_frames_death, gladiator_dead); + + static EntDieAdapter gladiator_die = new EntDieAdapter() { + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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_die, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + self.monsterinfo.currentmove = gladiator_move_death; + + } + }; + + /* + * QUAKED monster_gladiator (1 .5 0) (-32 -32 -24) (32 32 64) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_gladiator(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_pain1 = GameBase.gi.soundindex("gladiator/pain.wav"); + sound_pain2 = GameBase.gi.soundindex("gladiator/gldpain2.wav"); + sound_die = GameBase.gi.soundindex("gladiator/glddeth2.wav"); + sound_gun = GameBase.gi.soundindex("gladiator/railgun.wav"); + sound_cleaver_swing = GameBase.gi.soundindex("gladiator/melee1.wav"); + sound_cleaver_hit = GameBase.gi.soundindex("gladiator/melee2.wav"); + sound_cleaver_miss = GameBase.gi.soundindex("gladiator/melee3.wav"); + sound_idle = GameBase.gi.soundindex("gladiator/gldidle1.wav"); + sound_search = GameBase.gi.soundindex("gladiator/gldsrch1.wav"); + sound_sight = GameBase.gi.soundindex("gladiator/sight.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/gladiatr/tris.md2"); + Math3D.VectorSet(self.mins, -32, -32, -24); + Math3D.VectorSet(self.maxs, 32, 32, 64); + + self.health = 400; + self.gib_health = -175; + self.mass = 400; + + self.pain = gladiator_pain; + self.die = gladiator_die; + + self.monsterinfo.stand = gladiator_stand; + self.monsterinfo.walk = gladiator_walk; + self.monsterinfo.run = gladiator_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = gladiator_attack; + self.monsterinfo.melee = gladiator_melee; + self.monsterinfo.sight = gladiator_sight; + self.monsterinfo.idle = gladiator_idle; + self.monsterinfo.search = gladiator_search; + + GameBase.gi.linkentity(self); + self.monsterinfo.currentmove = gladiator_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Gunner.java b/src/jake2/game/monsters/M_Gunner.java new file mode 100644 index 0000000..4d80bd8 --- /dev/null +++ b/src/jake2/game/monsters/M_Gunner.java @@ -0,0 +1,1095 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Gunner.java,v 1.2 2005-02-06 18:48:15 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Gunner { + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_stand01 = 0; + + public final static int FRAME_stand02 = 1; + + public final static int FRAME_stand03 = 2; + + public final static int FRAME_stand04 = 3; + + public final static int FRAME_stand05 = 4; + + public final static int FRAME_stand06 = 5; + + public final static int FRAME_stand07 = 6; + + public final static int FRAME_stand08 = 7; + + public final static int FRAME_stand09 = 8; + + public final static int FRAME_stand10 = 9; + + public final static int FRAME_stand11 = 10; + + public final static int FRAME_stand12 = 11; + + public final static int FRAME_stand13 = 12; + + public final static int FRAME_stand14 = 13; + + public final static int FRAME_stand15 = 14; + + public final static int FRAME_stand16 = 15; + + public final static int FRAME_stand17 = 16; + + public final static int FRAME_stand18 = 17; + + public final static int FRAME_stand19 = 18; + + public final static int FRAME_stand20 = 19; + + public final static int FRAME_stand21 = 20; + + public final static int FRAME_stand22 = 21; + + public final static int FRAME_stand23 = 22; + + public final static int FRAME_stand24 = 23; + + public final static int FRAME_stand25 = 24; + + public final static int FRAME_stand26 = 25; + + public final static int FRAME_stand27 = 26; + + public final static int FRAME_stand28 = 27; + + public final static int FRAME_stand29 = 28; + + public final static int FRAME_stand30 = 29; + + public final static int FRAME_stand31 = 30; + + public final static int FRAME_stand32 = 31; + + public final static int FRAME_stand33 = 32; + + public final static int FRAME_stand34 = 33; + + public final static int FRAME_stand35 = 34; + + public final static int FRAME_stand36 = 35; + + public final static int FRAME_stand37 = 36; + + public final static int FRAME_stand38 = 37; + + public final static int FRAME_stand39 = 38; + + public final static int FRAME_stand40 = 39; + + public final static int FRAME_stand41 = 40; + + public final static int FRAME_stand42 = 41; + + public final static int FRAME_stand43 = 42; + + public final static int FRAME_stand44 = 43; + + public final static int FRAME_stand45 = 44; + + public final static int FRAME_stand46 = 45; + + public final static int FRAME_stand47 = 46; + + public final static int FRAME_stand48 = 47; + + public final static int FRAME_stand49 = 48; + + public final static int FRAME_stand50 = 49; + + public final static int FRAME_stand51 = 50; + + public final static int FRAME_stand52 = 51; + + public final static int FRAME_stand53 = 52; + + public final static int FRAME_stand54 = 53; + + public final static int FRAME_stand55 = 54; + + public final static int FRAME_stand56 = 55; + + public final static int FRAME_stand57 = 56; + + public final static int FRAME_stand58 = 57; + + public final static int FRAME_stand59 = 58; + + public final static int FRAME_stand60 = 59; + + public final static int FRAME_stand61 = 60; + + public final static int FRAME_stand62 = 61; + + public final static int FRAME_stand63 = 62; + + public final static int FRAME_stand64 = 63; + + public final static int FRAME_stand65 = 64; + + public final static int FRAME_stand66 = 65; + + public final static int FRAME_stand67 = 66; + + public final static int FRAME_stand68 = 67; + + public final static int FRAME_stand69 = 68; + + public final static int FRAME_stand70 = 69; + + public final static int FRAME_walk01 = 70; + + public final static int FRAME_walk02 = 71; + + public final static int FRAME_walk03 = 72; + + public final static int FRAME_walk04 = 73; + + public final static int FRAME_walk05 = 74; + + public final static int FRAME_walk06 = 75; + + public final static int FRAME_walk07 = 76; + + public final static int FRAME_walk08 = 77; + + public final static int FRAME_walk09 = 78; + + public final static int FRAME_walk10 = 79; + + public final static int FRAME_walk11 = 80; + + public final static int FRAME_walk12 = 81; + + public final static int FRAME_walk13 = 82; + + public final static int FRAME_walk14 = 83; + + public final static int FRAME_walk15 = 84; + + public final static int FRAME_walk16 = 85; + + public final static int FRAME_walk17 = 86; + + public final static int FRAME_walk18 = 87; + + public final static int FRAME_walk19 = 88; + + public final static int FRAME_walk20 = 89; + + public final static int FRAME_walk21 = 90; + + public final static int FRAME_walk22 = 91; + + public final static int FRAME_walk23 = 92; + + public final static int FRAME_walk24 = 93; + + public final static int FRAME_run01 = 94; + + public final static int FRAME_run02 = 95; + + public final static int FRAME_run03 = 96; + + public final static int FRAME_run04 = 97; + + public final static int FRAME_run05 = 98; + + public final static int FRAME_run06 = 99; + + public final static int FRAME_run07 = 100; + + public final static int FRAME_run08 = 101; + + public final static int FRAME_runs01 = 102; + + public final static int FRAME_runs02 = 103; + + public final static int FRAME_runs03 = 104; + + public final static int FRAME_runs04 = 105; + + public final static int FRAME_runs05 = 106; + + public final static int FRAME_runs06 = 107; + + public final static int FRAME_attak101 = 108; + + public final static int FRAME_attak102 = 109; + + public final static int FRAME_attak103 = 110; + + public final static int FRAME_attak104 = 111; + + public final static int FRAME_attak105 = 112; + + public final static int FRAME_attak106 = 113; + + public final static int FRAME_attak107 = 114; + + public final static int FRAME_attak108 = 115; + + public final static int FRAME_attak109 = 116; + + public final static int FRAME_attak110 = 117; + + public final static int FRAME_attak111 = 118; + + public final static int FRAME_attak112 = 119; + + public final static int FRAME_attak113 = 120; + + public final static int FRAME_attak114 = 121; + + public final static int FRAME_attak115 = 122; + + public final static int FRAME_attak116 = 123; + + public final static int FRAME_attak117 = 124; + + public final static int FRAME_attak118 = 125; + + public final static int FRAME_attak119 = 126; + + public final static int FRAME_attak120 = 127; + + public final static int FRAME_attak121 = 128; + + public final static int FRAME_attak201 = 129; + + public final static int FRAME_attak202 = 130; + + public final static int FRAME_attak203 = 131; + + public final static int FRAME_attak204 = 132; + + public final static int FRAME_attak205 = 133; + + public final static int FRAME_attak206 = 134; + + public final static int FRAME_attak207 = 135; + + public final static int FRAME_attak208 = 136; + + public final static int FRAME_attak209 = 137; + + public final static int FRAME_attak210 = 138; + + public final static int FRAME_attak211 = 139; + + public final static int FRAME_attak212 = 140; + + public final static int FRAME_attak213 = 141; + + public final static int FRAME_attak214 = 142; + + public final static int FRAME_attak215 = 143; + + public final static int FRAME_attak216 = 144; + + public final static int FRAME_attak217 = 145; + + public final static int FRAME_attak218 = 146; + + public final static int FRAME_attak219 = 147; + + public final static int FRAME_attak220 = 148; + + public final static int FRAME_attak221 = 149; + + public final static int FRAME_attak222 = 150; + + public final static int FRAME_attak223 = 151; + + public final static int FRAME_attak224 = 152; + + public final static int FRAME_attak225 = 153; + + public final static int FRAME_attak226 = 154; + + public final static int FRAME_attak227 = 155; + + public final static int FRAME_attak228 = 156; + + public final static int FRAME_attak229 = 157; + + public final static int FRAME_attak230 = 158; + + public final static int FRAME_pain101 = 159; + + public final static int FRAME_pain102 = 160; + + public final static int FRAME_pain103 = 161; + + public final static int FRAME_pain104 = 162; + + public final static int FRAME_pain105 = 163; + + public final static int FRAME_pain106 = 164; + + public final static int FRAME_pain107 = 165; + + public final static int FRAME_pain108 = 166; + + public final static int FRAME_pain109 = 167; + + public final static int FRAME_pain110 = 168; + + public final static int FRAME_pain111 = 169; + + public final static int FRAME_pain112 = 170; + + public final static int FRAME_pain113 = 171; + + public final static int FRAME_pain114 = 172; + + public final static int FRAME_pain115 = 173; + + public final static int FRAME_pain116 = 174; + + public final static int FRAME_pain117 = 175; + + public final static int FRAME_pain118 = 176; + + public final static int FRAME_pain201 = 177; + + public final static int FRAME_pain202 = 178; + + public final static int FRAME_pain203 = 179; + + public final static int FRAME_pain204 = 180; + + public final static int FRAME_pain205 = 181; + + public final static int FRAME_pain206 = 182; + + public final static int FRAME_pain207 = 183; + + public final static int FRAME_pain208 = 184; + + public final static int FRAME_pain301 = 185; + + public final static int FRAME_pain302 = 186; + + public final static int FRAME_pain303 = 187; + + public final static int FRAME_pain304 = 188; + + public final static int FRAME_pain305 = 189; + + public final static int FRAME_death01 = 190; + + public final static int FRAME_death02 = 191; + + public final static int FRAME_death03 = 192; + + public final static int FRAME_death04 = 193; + + public final static int FRAME_death05 = 194; + + public final static int FRAME_death06 = 195; + + public final static int FRAME_death07 = 196; + + public final static int FRAME_death08 = 197; + + public final static int FRAME_death09 = 198; + + public final static int FRAME_death10 = 199; + + public final static int FRAME_death11 = 200; + + public final static int FRAME_duck01 = 201; + + public final static int FRAME_duck02 = 202; + + public final static int FRAME_duck03 = 203; + + public final static int FRAME_duck04 = 204; + + public final static int FRAME_duck05 = 205; + + public final static int FRAME_duck06 = 206; + + public final static int FRAME_duck07 = 207; + + public final static int FRAME_duck08 = 208; + + public final static float MODEL_SCALE = 1.150000f; + + static int sound_pain; + + static int sound_pain2; + + static int sound_death; + + static int sound_idle; + + static int sound_open; + + static int sound_search; + + static int sound_sight; + + static EntThinkAdapter gunner_idlesound = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntInteractAdapter gunner_sight = new EntInteractAdapter() { + 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 EntThinkAdapter gunner_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t gunner_frames_fidget[] = 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, gunner_idlesound), + 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 EntThinkAdapter gunner_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = gunner_move_stand; + return true; + } + }; + + static mmove_t gunner_move_fidget = new mmove_t(FRAME_stand31, + FRAME_stand70, gunner_frames_fidget, gunner_stand); + + static EntThinkAdapter gunner_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + return true; + if (Lib.random() <= 0.05) + self.monsterinfo.currentmove = gunner_move_fidget; + return true; + } + }; + + static mframe_t gunner_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, gunner_fidget), + 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, gunner_fidget), + 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, gunner_fidget) }; + + static mmove_t gunner_move_stand = new mmove_t(FRAME_stand01, + FRAME_stand30, gunner_frames_stand, null); + + static mframe_t gunner_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 4, null) }; + + static mmove_t gunner_move_walk = new mmove_t(FRAME_walk07, FRAME_walk19, + gunner_frames_walk, null); + + static EntThinkAdapter gunner_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = gunner_move_walk; + return true; + } + }; + + static mframe_t gunner_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 26, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 9, null), + new mframe_t(GameAI.ai_run, 15, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 13, null), + new mframe_t(GameAI.ai_run, 6, null) }; + + static mmove_t gunner_move_run = new mmove_t(FRAME_run01, FRAME_run08, + gunner_frames_run, null); + + static EntThinkAdapter gunner_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = gunner_move_stand; + else + self.monsterinfo.currentmove = gunner_move_run; + return true; + } + }; + + static mframe_t gunner_frames_runandshoot[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 32, null), + new mframe_t(GameAI.ai_run, 15, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 18, null), + new mframe_t(GameAI.ai_run, 8, null), + new mframe_t(GameAI.ai_run, 20, null) }; + + static mmove_t gunner_move_runandshoot = new mmove_t(FRAME_runs01, + FRAME_runs06, gunner_frames_runandshoot, null); + + static EntThinkAdapter gunner_runandshoot = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = gunner_move_runandshoot; + return true; + } + }; + + static mframe_t gunner_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t gunner_move_pain3 = new mmove_t(FRAME_pain301, + FRAME_pain305, gunner_frames_pain3, gunner_run); + + static mframe_t gunner_frames_pain2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 11, null), + new mframe_t(GameAI.ai_move, 6, 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, -2, null), + new mframe_t(GameAI.ai_move, -7, null) }; + + static mmove_t gunner_move_pain2 = new mmove_t(FRAME_pain201, + FRAME_pain208, gunner_frames_pain2, gunner_run); + + static mframe_t gunner_frames_pain1[] = 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, -5, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, -1, 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, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t gunner_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain118, gunner_frames_pain1, gunner_run); + + static EntPainAdapter gunner_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + 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 ((Lib.rand() & 1) != 0) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 10) + self.monsterinfo.currentmove = gunner_move_pain3; + else if (damage <= 25) + self.monsterinfo.currentmove = gunner_move_pain2; + else + self.monsterinfo.currentmove = gunner_move_pain1; + + } + }; + + static EntThinkAdapter gunner_dead = new EntThinkAdapter() { + 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 gunner_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, -7, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, 8, 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) }; + + static mmove_t gunner_move_death = new mmove_t(FRAME_death01, + FRAME_death11, gunner_frames_death, gunner_dead); + + static EntDieAdapter gunner_die = new EntDieAdapter() { + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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; + self.monsterinfo.currentmove = gunner_move_death; + } + }; + + static EntThinkAdapter gunner_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + if (GameBase.skill.value >= 2) { + if (Lib.random() > 0.5) + GunnerGrenade.think(self); + } + + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter gunner_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static EntThinkAdapter gunner_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t gunner_frames_duck[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 1, gunner_duck_down), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, gunner_duck_hold), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 0, gunner_duck_up), + new mframe_t(GameAI.ai_move, -1, null) }; + + static mmove_t gunner_move_duck = new mmove_t(FRAME_duck01, FRAME_duck08, + gunner_frames_duck, gunner_run); + + static EntDodgeAdapter gunner_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + if (Lib.random() > 0.25) + return; + + if (self.enemy == null) + self.enemy = attacker; + + self.monsterinfo.currentmove = gunner_move_duck; + } + }; + + static EntThinkAdapter gunner_opengun = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_open, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter GunnerFire = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] target = { 0, 0, 0 }; + float[] aim = { 0, 0, 0 }; + int flash_number; + + flash_number = Defines.MZ2_GUNNER_MACHINEGUN_1 + + (self.s.frame - FRAME_attak216); + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[flash_number], forward, right, + start); + + // project enemy back a bit and target there + Math3D.VectorCopy(self.enemy.s.origin, target); + Math3D.VectorMA(target, -0.2f, self.enemy.velocity, target); + target[2] += self.enemy.viewheight; + + Math3D.VectorSubtract(target, start, aim); + Math3D.VectorNormalize(aim); + Monster.monster_fire_bullet(self, start, aim, 3, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, flash_number); + + return true; + } + }; + + static EntThinkAdapter GunnerGrenade = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] aim = { 0, 0, 0 }; + int flash_number; + + if (self.s.frame == FRAME_attak105) + flash_number = Defines.MZ2_GUNNER_GRENADE_1; + else if (self.s.frame == FRAME_attak108) + flash_number = Defines.MZ2_GUNNER_GRENADE_2; + else if (self.s.frame == FRAME_attak111) + flash_number = Defines.MZ2_GUNNER_GRENADE_3; + else + // (self.s.frame == FRAME_attak114) + flash_number = Defines.MZ2_GUNNER_GRENADE_4; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[flash_number], forward, right, + start); + + //FIXME : do a spread -225 -75 75 225 degrees around forward + Math3D.VectorCopy(forward, aim); + + Monster.monster_fire_grenade(self, start, aim, 50, 600, + flash_number); + return true; + } + }; + + static EntThinkAdapter gunner_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) { + self.monsterinfo.currentmove = gunner_move_attack_chain; + } else { + if (Lib.random() <= 0.5) + self.monsterinfo.currentmove = gunner_move_attack_grenade; + else + self.monsterinfo.currentmove = gunner_move_attack_chain; + } + return true; + } + }; + + static EntThinkAdapter gunner_fire_chain = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = gunner_move_fire_chain; + return true; + } + }; + + static mframe_t gunner_frames_attack_chain[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, gunner_opengun), + 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) }; + + static mmove_t gunner_move_attack_chain = new mmove_t(FRAME_attak209, + FRAME_attak215, gunner_frames_attack_chain, gunner_fire_chain); + + static mframe_t gunner_frames_fire_chain[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire), + new mframe_t(GameAI.ai_charge, 0, GunnerFire) }; + + static EntThinkAdapter gunner_refire_chain = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy.health > 0) + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() <= 0.5) { + self.monsterinfo.currentmove = gunner_move_fire_chain; + return true; + } + self.monsterinfo.currentmove = gunner_move_endfire_chain; + return true; + } + }; + + static mmove_t gunner_move_fire_chain = new mmove_t(FRAME_attak216, + FRAME_attak223, gunner_frames_fire_chain, gunner_refire_chain); + + static mframe_t gunner_frames_endfire_chain[] = new mframe_t[] { + 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) }; + + static mmove_t gunner_move_endfire_chain = new mmove_t(FRAME_attak224, + FRAME_attak230, gunner_frames_endfire_chain, gunner_run); + + static mframe_t gunner_frames_attack_grenade[] = new mframe_t[] { + 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, GunnerGrenade), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, GunnerGrenade), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, GunnerGrenade), + 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) }; + + static mmove_t gunner_move_attack_grenade = new mmove_t(FRAME_attak101, + FRAME_attak121, gunner_frames_attack_grenade, gunner_run); + + /* + * QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_gunner(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_death = GameBase.gi.soundindex("gunner/death1.wav"); + sound_pain = GameBase.gi.soundindex("gunner/gunpain2.wav"); + sound_pain2 = GameBase.gi.soundindex("gunner/gunpain1.wav"); + sound_idle = GameBase.gi.soundindex("gunner/gunidle1.wav"); + sound_open = GameBase.gi.soundindex("gunner/gunatck1.wav"); + sound_search = GameBase.gi.soundindex("gunner/gunsrch1.wav"); + sound_sight = GameBase.gi.soundindex("gunner/sight1.wav"); + + GameBase.gi.soundindex("gunner/gunatck2.wav"); + GameBase.gi.soundindex("gunner/gunatck3.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/gunner/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + + self.health = 175; + self.gib_health = -70; + self.mass = 200; + + self.pain = gunner_pain; + self.die = gunner_die; + + self.monsterinfo.stand = gunner_stand; + self.monsterinfo.walk = gunner_walk; + self.monsterinfo.run = gunner_run; + self.monsterinfo.dodge = gunner_dodge; + self.monsterinfo.attack = gunner_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = gunner_sight; + self.monsterinfo.search = gunner_search; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = gunner_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Hover.java b/src/jake2/game/monsters/M_Hover.java new file mode 100644 index 0000000..f2d3055 --- /dev/null +++ b/src/jake2/game/monsters/M_Hover.java @@ -0,0 +1,1071 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Hover.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Hover { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_stand01 = 0; + + public final static int FRAME_stand02 = 1; + + public final static int FRAME_stand03 = 2; + + public final static int FRAME_stand04 = 3; + + public final static int FRAME_stand05 = 4; + + public final static int FRAME_stand06 = 5; + + public final static int FRAME_stand07 = 6; + + public final static int FRAME_stand08 = 7; + + public final static int FRAME_stand09 = 8; + + public final static int FRAME_stand10 = 9; + + public final static int FRAME_stand11 = 10; + + public final static int FRAME_stand12 = 11; + + public final static int FRAME_stand13 = 12; + + public final static int FRAME_stand14 = 13; + + public final static int FRAME_stand15 = 14; + + public final static int FRAME_stand16 = 15; + + public final static int FRAME_stand17 = 16; + + public final static int FRAME_stand18 = 17; + + public final static int FRAME_stand19 = 18; + + public final static int FRAME_stand20 = 19; + + public final static int FRAME_stand21 = 20; + + public final static int FRAME_stand22 = 21; + + public final static int FRAME_stand23 = 22; + + public final static int FRAME_stand24 = 23; + + public final static int FRAME_stand25 = 24; + + public final static int FRAME_stand26 = 25; + + public final static int FRAME_stand27 = 26; + + public final static int FRAME_stand28 = 27; + + public final static int FRAME_stand29 = 28; + + public final static int FRAME_stand30 = 29; + + public final static int FRAME_forwrd01 = 30; + + public final static int FRAME_forwrd02 = 31; + + public final static int FRAME_forwrd03 = 32; + + public final static int FRAME_forwrd04 = 33; + + public final static int FRAME_forwrd05 = 34; + + public final static int FRAME_forwrd06 = 35; + + public final static int FRAME_forwrd07 = 36; + + public final static int FRAME_forwrd08 = 37; + + public final static int FRAME_forwrd09 = 38; + + public final static int FRAME_forwrd10 = 39; + + public final static int FRAME_forwrd11 = 40; + + public final static int FRAME_forwrd12 = 41; + + public final static int FRAME_forwrd13 = 42; + + public final static int FRAME_forwrd14 = 43; + + public final static int FRAME_forwrd15 = 44; + + public final static int FRAME_forwrd16 = 45; + + public final static int FRAME_forwrd17 = 46; + + public final static int FRAME_forwrd18 = 47; + + public final static int FRAME_forwrd19 = 48; + + public final static int FRAME_forwrd20 = 49; + + public final static int FRAME_forwrd21 = 50; + + public final static int FRAME_forwrd22 = 51; + + public final static int FRAME_forwrd23 = 52; + + public final static int FRAME_forwrd24 = 53; + + public final static int FRAME_forwrd25 = 54; + + public final static int FRAME_forwrd26 = 55; + + public final static int FRAME_forwrd27 = 56; + + public final static int FRAME_forwrd28 = 57; + + public final static int FRAME_forwrd29 = 58; + + public final static int FRAME_forwrd30 = 59; + + public final static int FRAME_forwrd31 = 60; + + public final static int FRAME_forwrd32 = 61; + + public final static int FRAME_forwrd33 = 62; + + public final static int FRAME_forwrd34 = 63; + + public final static int FRAME_forwrd35 = 64; + + public final static int FRAME_stop101 = 65; + + public final static int FRAME_stop102 = 66; + + public final static int FRAME_stop103 = 67; + + public final static int FRAME_stop104 = 68; + + public final static int FRAME_stop105 = 69; + + public final static int FRAME_stop106 = 70; + + public final static int FRAME_stop107 = 71; + + public final static int FRAME_stop108 = 72; + + public final static int FRAME_stop109 = 73; + + public final static int FRAME_stop201 = 74; + + public final static int FRAME_stop202 = 75; + + public final static int FRAME_stop203 = 76; + + public final static int FRAME_stop204 = 77; + + public final static int FRAME_stop205 = 78; + + public final static int FRAME_stop206 = 79; + + public final static int FRAME_stop207 = 80; + + public final static int FRAME_stop208 = 81; + + public final static int FRAME_takeof01 = 82; + + public final static int FRAME_takeof02 = 83; + + public final static int FRAME_takeof03 = 84; + + public final static int FRAME_takeof04 = 85; + + public final static int FRAME_takeof05 = 86; + + public final static int FRAME_takeof06 = 87; + + public final static int FRAME_takeof07 = 88; + + public final static int FRAME_takeof08 = 89; + + public final static int FRAME_takeof09 = 90; + + public final static int FRAME_takeof10 = 91; + + public final static int FRAME_takeof11 = 92; + + public final static int FRAME_takeof12 = 93; + + public final static int FRAME_takeof13 = 94; + + public final static int FRAME_takeof14 = 95; + + public final static int FRAME_takeof15 = 96; + + public final static int FRAME_takeof16 = 97; + + public final static int FRAME_takeof17 = 98; + + public final static int FRAME_takeof18 = 99; + + public final static int FRAME_takeof19 = 100; + + public final static int FRAME_takeof20 = 101; + + public final static int FRAME_takeof21 = 102; + + public final static int FRAME_takeof22 = 103; + + public final static int FRAME_takeof23 = 104; + + public final static int FRAME_takeof24 = 105; + + public final static int FRAME_takeof25 = 106; + + public final static int FRAME_takeof26 = 107; + + public final static int FRAME_takeof27 = 108; + + public final static int FRAME_takeof28 = 109; + + public final static int FRAME_takeof29 = 110; + + public final static int FRAME_takeof30 = 111; + + public final static int FRAME_land01 = 112; + + public final static int FRAME_pain101 = 113; + + public final static int FRAME_pain102 = 114; + + public final static int FRAME_pain103 = 115; + + public final static int FRAME_pain104 = 116; + + public final static int FRAME_pain105 = 117; + + public final static int FRAME_pain106 = 118; + + public final static int FRAME_pain107 = 119; + + public final static int FRAME_pain108 = 120; + + public final static int FRAME_pain109 = 121; + + public final static int FRAME_pain110 = 122; + + public final static int FRAME_pain111 = 123; + + public final static int FRAME_pain112 = 124; + + public final static int FRAME_pain113 = 125; + + public final static int FRAME_pain114 = 126; + + public final static int FRAME_pain115 = 127; + + public final static int FRAME_pain116 = 128; + + public final static int FRAME_pain117 = 129; + + public final static int FRAME_pain118 = 130; + + public final static int FRAME_pain119 = 131; + + public final static int FRAME_pain120 = 132; + + public final static int FRAME_pain121 = 133; + + public final static int FRAME_pain122 = 134; + + public final static int FRAME_pain123 = 135; + + public final static int FRAME_pain124 = 136; + + public final static int FRAME_pain125 = 137; + + public final static int FRAME_pain126 = 138; + + public final static int FRAME_pain127 = 139; + + public final static int FRAME_pain128 = 140; + + public final static int FRAME_pain201 = 141; + + public final static int FRAME_pain202 = 142; + + public final static int FRAME_pain203 = 143; + + public final static int FRAME_pain204 = 144; + + public final static int FRAME_pain205 = 145; + + public final static int FRAME_pain206 = 146; + + public final static int FRAME_pain207 = 147; + + public final static int FRAME_pain208 = 148; + + public final static int FRAME_pain209 = 149; + + public final static int FRAME_pain210 = 150; + + public final static int FRAME_pain211 = 151; + + public final static int FRAME_pain212 = 152; + + public final static int FRAME_pain301 = 153; + + public final static int FRAME_pain302 = 154; + + public final static int FRAME_pain303 = 155; + + public final static int FRAME_pain304 = 156; + + public final static int FRAME_pain305 = 157; + + public final static int FRAME_pain306 = 158; + + public final static int FRAME_pain307 = 159; + + public final static int FRAME_pain308 = 160; + + public final static int FRAME_pain309 = 161; + + public final static int FRAME_death101 = 162; + + public final static int FRAME_death102 = 163; + + public final static int FRAME_death103 = 164; + + public final static int FRAME_death104 = 165; + + public final static int FRAME_death105 = 166; + + public final static int FRAME_death106 = 167; + + public final static int FRAME_death107 = 168; + + public final static int FRAME_death108 = 169; + + public final static int FRAME_death109 = 170; + + public final static int FRAME_death110 = 171; + + public final static int FRAME_death111 = 172; + + public final static int FRAME_backwd01 = 173; + + public final static int FRAME_backwd02 = 174; + + public final static int FRAME_backwd03 = 175; + + public final static int FRAME_backwd04 = 176; + + public final static int FRAME_backwd05 = 177; + + public final static int FRAME_backwd06 = 178; + + public final static int FRAME_backwd07 = 179; + + public final static int FRAME_backwd08 = 180; + + public final static int FRAME_backwd09 = 181; + + public final static int FRAME_backwd10 = 182; + + public final static int FRAME_backwd11 = 183; + + public final static int FRAME_backwd12 = 184; + + public final static int FRAME_backwd13 = 185; + + public final static int FRAME_backwd14 = 186; + + public final static int FRAME_backwd15 = 187; + + public final static int FRAME_backwd16 = 188; + + public final static int FRAME_backwd17 = 189; + + public final static int FRAME_backwd18 = 190; + + public final static int FRAME_backwd19 = 191; + + public final static int FRAME_backwd20 = 192; + + public final static int FRAME_backwd21 = 193; + + public final static int FRAME_backwd22 = 194; + + public final static int FRAME_backwd23 = 195; + + public final static int FRAME_backwd24 = 196; + + public final static int FRAME_attak101 = 197; + + public final static int FRAME_attak102 = 198; + + public final static int FRAME_attak103 = 199; + + public final static int FRAME_attak104 = 200; + + public final static int FRAME_attak105 = 201; + + public final static int FRAME_attak106 = 202; + + public final static int FRAME_attak107 = 203; + + public final static int FRAME_attak108 = 204; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_death1; + + static int sound_death2; + + static int sound_sight; + + static int sound_search1; + + static int sound_search2; + + static EntThinkAdapter hover_reattack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy.health > 0) + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() <= 0.6) { + self.monsterinfo.currentmove = hover_move_attack1; + return true; + } + self.monsterinfo.currentmove = hover_move_end_attack; + return true; + } + }; + + static EntThinkAdapter hover_fire_blaster = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + int effect; + + if (self.s.frame == FRAME_attak104) + effect = Defines.EF_HYPERBLASTER; + else + effect = 0; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_HOVER_BLASTER_1], + forward, right, start); + + Math3D.VectorCopy(self.enemy.s.origin, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, dir); + + Monster.monster_fire_blaster(self, start, dir, 1, 1000, + Defines.MZ2_HOVER_BLASTER_1, effect); + return true; + } + }; + + static EntThinkAdapter hover_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = hover_move_stand; + return true; + } + }; + + static EntThinkAdapter hover_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = hover_move_stand; + else + self.monsterinfo.currentmove = hover_move_run; + return true; + } + }; + + static EntThinkAdapter hover_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = hover_move_walk; + return true; + } + }; + + static EntThinkAdapter hover_start_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = hover_move_start_attack; + return true; + } + }; + + static EntThinkAdapter hover_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = hover_move_attack1; + return true; + } + }; + + static EntPainAdapter hover_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + 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 + + if (damage <= 25) { + if (Lib.random() < 0.5) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = hover_move_pain3; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = hover_move_pain2; + } + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = hover_move_pain1; + } + } + }; + + static EntThinkAdapter hover_deadthink = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (null == self.groundentity + && GameBase.level.time < self.timestamp) { + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + return true; + } + GameAI.BecomeExplosion1(self); + return true; + } + }; + + static EntThinkAdapter hover_dead = new EntThinkAdapter() { + 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.think = hover_deadthink; + self.nextthink = GameBase.level.time + Defines.FRAMETIME; + self.timestamp = GameBase.level.time + 15; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntDieAdapter hover_die = new EntDieAdapter() { + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 2; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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 + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death2, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.currentmove = hover_move_death1; + } + }; + + static EntInteractAdapter hover_sight = new EntInteractAdapter() { + 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 EntThinkAdapter hover_search = new EntThinkAdapter() { + 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; + } + }; + + static mframe_t hover_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) }; + + static mmove_t hover_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, + hover_frames_stand, null); + + static mframe_t hover_frames_stop1[] = 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 hover_move_stop1 = new mmove_t(FRAME_stop101, FRAME_stop109, + hover_frames_stop1, null); + + static mframe_t hover_frames_stop2[] = 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) }; + + static mmove_t hover_move_stop2 = new mmove_t(FRAME_stop201, FRAME_stop208, + hover_frames_stop2, null); + + static mframe_t hover_frames_takeoff[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 0, null), + 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, 1, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -9, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + 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, 1, null), + new mframe_t(GameAI.ai_move, 1, 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, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t hover_move_takeoff = new mmove_t(FRAME_takeof01, + FRAME_takeof30, hover_frames_takeoff, null); + + static mframe_t hover_frames_pain3[] = 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 hover_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain309, + hover_frames_pain3, hover_run); + + static mframe_t hover_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), + 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 hover_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain212, + hover_frames_pain2, hover_run); + + static mframe_t hover_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, 2, null), + new mframe_t(GameAI.ai_move, -8, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, 1, 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, 0, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 7, null), + new mframe_t(GameAI.ai_move, 1, 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, 0, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 4, null) }; + + static mmove_t hover_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain128, + hover_frames_pain1, hover_run); + + static mframe_t hover_frames_land[] = new mframe_t[] { new mframe_t( + GameAI.ai_move, 0, null) }; + + static mmove_t hover_move_land = new mmove_t(FRAME_land01, FRAME_land01, + hover_frames_land, null); + + static mframe_t hover_frames_forward[] = 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) }; + + static mmove_t hover_move_forward = new mmove_t(FRAME_forwrd01, + FRAME_forwrd35, hover_frames_forward, null); + + static mframe_t hover_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), + 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 hover_move_walk = new mmove_t(FRAME_forwrd01, + FRAME_forwrd35, hover_frames_walk, null); + + static mframe_t hover_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 10, null) }; + + static mmove_t hover_move_run = new mmove_t(FRAME_forwrd01, FRAME_forwrd35, + hover_frames_run, null); + + static mframe_t hover_frames_death1[] = 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, -10, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 7, null) }; + + static mmove_t hover_move_death1 = new mmove_t(FRAME_death101, + FRAME_death111, hover_frames_death1, hover_dead); + + static mframe_t hover_frames_backward[] = 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) }; + + static mmove_t hover_move_backward = new mmove_t(FRAME_backwd01, + FRAME_backwd24, hover_frames_backward, null); + + static mframe_t hover_frames_start_attack[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null) }; + + static mmove_t hover_move_start_attack = new mmove_t(FRAME_attak101, + FRAME_attak103, hover_frames_start_attack, hover_attack); + + static mframe_t hover_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, -10, hover_fire_blaster), + new mframe_t(GameAI.ai_charge, -10, hover_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, hover_reattack), }; + + static mmove_t hover_move_attack1 = new mmove_t(FRAME_attak104, + FRAME_attak106, hover_frames_attack1, null); + + static mframe_t hover_frames_end_attack[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null) }; + + static mmove_t hover_move_end_attack = new mmove_t(FRAME_attak107, + FRAME_attak108, hover_frames_end_attack, hover_run); + + /* + * QUAKED monster_hover (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_hover(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_pain1 = GameBase.gi.soundindex("hover/hovpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("hover/hovpain2.wav"); + sound_death1 = GameBase.gi.soundindex("hover/hovdeth1.wav"); + sound_death2 = GameBase.gi.soundindex("hover/hovdeth2.wav"); + sound_sight = GameBase.gi.soundindex("hover/hovsght1.wav"); + sound_search1 = GameBase.gi.soundindex("hover/hovsrch1.wav"); + sound_search2 = GameBase.gi.soundindex("hover/hovsrch2.wav"); + + GameBase.gi.soundindex("hover/hovatck1.wav"); + + self.s.sound = GameBase.gi.soundindex("hover/hovidle1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/hover/tris.md2"); + Math3D.VectorSet(self.mins, -24, -24, -24); + Math3D.VectorSet(self.maxs, 24, 24, 32); + + self.health = 240; + self.gib_health = -100; + self.mass = 150; + + self.pain = hover_pain; + self.die = hover_die; + + self.monsterinfo.stand = hover_stand; + self.monsterinfo.walk = hover_walk; + self.monsterinfo.run = hover_run; + // self.monsterinfo.dodge = hover_dodge; + self.monsterinfo.attack = hover_start_attack; + self.monsterinfo.sight = hover_sight; + self.monsterinfo.search = hover_search; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = hover_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.flymonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Infantry.java b/src/jake2/game/monsters/M_Infantry.java new file mode 100644 index 0000000..c0493eb --- /dev/null +++ b/src/jake2/game/monsters/M_Infantry.java @@ -0,0 +1,1080 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Infantry.java,v 1.2 2005-02-06 18:48:14 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.client.M; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Infantry { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_gun02 = 0; + + public final static int FRAME_stand01 = 1; + + public final static int FRAME_stand02 = 2; + + public final static int FRAME_stand03 = 3; + + public final static int FRAME_stand04 = 4; + + public final static int FRAME_stand05 = 5; + + public final static int FRAME_stand06 = 6; + + public final static int FRAME_stand07 = 7; + + public final static int FRAME_stand08 = 8; + + public final static int FRAME_stand09 = 9; + + public final static int FRAME_stand10 = 10; + + public final static int FRAME_stand11 = 11; + + public final static int FRAME_stand12 = 12; + + public final static int FRAME_stand13 = 13; + + public final static int FRAME_stand14 = 14; + + public final static int FRAME_stand15 = 15; + + public final static int FRAME_stand16 = 16; + + public final static int FRAME_stand17 = 17; + + public final static int FRAME_stand18 = 18; + + public final static int FRAME_stand19 = 19; + + public final static int FRAME_stand20 = 20; + + public final static int FRAME_stand21 = 21; + + public final static int FRAME_stand22 = 22; + + public final static int FRAME_stand23 = 23; + + public final static int FRAME_stand24 = 24; + + public final static int FRAME_stand25 = 25; + + public final static int FRAME_stand26 = 26; + + public final static int FRAME_stand27 = 27; + + public final static int FRAME_stand28 = 28; + + public final static int FRAME_stand29 = 29; + + public final static int FRAME_stand30 = 30; + + public final static int FRAME_stand31 = 31; + + public final static int FRAME_stand32 = 32; + + public final static int FRAME_stand33 = 33; + + public final static int FRAME_stand34 = 34; + + public final static int FRAME_stand35 = 35; + + public final static int FRAME_stand36 = 36; + + public final static int FRAME_stand37 = 37; + + public final static int FRAME_stand38 = 38; + + public final static int FRAME_stand39 = 39; + + public final static int FRAME_stand40 = 40; + + public final static int FRAME_stand41 = 41; + + public final static int FRAME_stand42 = 42; + + public final static int FRAME_stand43 = 43; + + public final static int FRAME_stand44 = 44; + + public final static int FRAME_stand45 = 45; + + public final static int FRAME_stand46 = 46; + + public final static int FRAME_stand47 = 47; + + public final static int FRAME_stand48 = 48; + + public final static int FRAME_stand49 = 49; + + public final static int FRAME_stand50 = 50; + + public final static int FRAME_stand51 = 51; + + public final static int FRAME_stand52 = 52; + + public final static int FRAME_stand53 = 53; + + public final static int FRAME_stand54 = 54; + + public final static int FRAME_stand55 = 55; + + public final static int FRAME_stand56 = 56; + + public final static int FRAME_stand57 = 57; + + public final static int FRAME_stand58 = 58; + + public final static int FRAME_stand59 = 59; + + public final static int FRAME_stand60 = 60; + + public final static int FRAME_stand61 = 61; + + public final static int FRAME_stand62 = 62; + + public final static int FRAME_stand63 = 63; + + public final static int FRAME_stand64 = 64; + + public final static int FRAME_stand65 = 65; + + public final static int FRAME_stand66 = 66; + + public final static int FRAME_stand67 = 67; + + public final static int FRAME_stand68 = 68; + + public final static int FRAME_stand69 = 69; + + public final static int FRAME_stand70 = 70; + + public final static int FRAME_stand71 = 71; + + public final static int FRAME_walk01 = 72; + + public final static int FRAME_walk02 = 73; + + public final static int FRAME_walk03 = 74; + + public final static int FRAME_walk04 = 75; + + public final static int FRAME_walk05 = 76; + + public final static int FRAME_walk06 = 77; + + public final static int FRAME_walk07 = 78; + + public final static int FRAME_walk08 = 79; + + public final static int FRAME_walk09 = 80; + + public final static int FRAME_walk10 = 81; + + public final static int FRAME_walk11 = 82; + + public final static int FRAME_walk12 = 83; + + public final static int FRAME_walk13 = 84; + + public final static int FRAME_walk14 = 85; + + public final static int FRAME_walk15 = 86; + + public final static int FRAME_walk16 = 87; + + public final static int FRAME_walk17 = 88; + + public final static int FRAME_walk18 = 89; + + public final static int FRAME_walk19 = 90; + + public final static int FRAME_walk20 = 91; + + public final static int FRAME_run01 = 92; + + public final static int FRAME_run02 = 93; + + public final static int FRAME_run03 = 94; + + public final static int FRAME_run04 = 95; + + public final static int FRAME_run05 = 96; + + public final static int FRAME_run06 = 97; + + public final static int FRAME_run07 = 98; + + public final static int FRAME_run08 = 99; + + public final static int FRAME_pain101 = 100; + + public final static int FRAME_pain102 = 101; + + public final static int FRAME_pain103 = 102; + + public final static int FRAME_pain104 = 103; + + public final static int FRAME_pain105 = 104; + + public final static int FRAME_pain106 = 105; + + public final static int FRAME_pain107 = 106; + + public final static int FRAME_pain108 = 107; + + public final static int FRAME_pain109 = 108; + + public final static int FRAME_pain110 = 109; + + public final static int FRAME_pain201 = 110; + + public final static int FRAME_pain202 = 111; + + public final static int FRAME_pain203 = 112; + + public final static int FRAME_pain204 = 113; + + public final static int FRAME_pain205 = 114; + + public final static int FRAME_pain206 = 115; + + public final static int FRAME_pain207 = 116; + + public final static int FRAME_pain208 = 117; + + public final static int FRAME_pain209 = 118; + + public final static int FRAME_pain210 = 119; + + public final static int FRAME_duck01 = 120; + + public final static int FRAME_duck02 = 121; + + public final static int FRAME_duck03 = 122; + + public final static int FRAME_duck04 = 123; + + public final static int FRAME_duck05 = 124; + + public final static int FRAME_death101 = 125; + + public final static int FRAME_death102 = 126; + + public final static int FRAME_death103 = 127; + + public final static int FRAME_death104 = 128; + + public final static int FRAME_death105 = 129; + + public final static int FRAME_death106 = 130; + + public final static int FRAME_death107 = 131; + + public final static int FRAME_death108 = 132; + + public final static int FRAME_death109 = 133; + + public final static int FRAME_death110 = 134; + + public final static int FRAME_death111 = 135; + + public final static int FRAME_death112 = 136; + + public final static int FRAME_death113 = 137; + + public final static int FRAME_death114 = 138; + + public final static int FRAME_death115 = 139; + + public final static int FRAME_death116 = 140; + + public final static int FRAME_death117 = 141; + + public final static int FRAME_death118 = 142; + + public final static int FRAME_death119 = 143; + + public final static int FRAME_death120 = 144; + + public final static int FRAME_death201 = 145; + + public final static int FRAME_death202 = 146; + + public final static int FRAME_death203 = 147; + + public final static int FRAME_death204 = 148; + + public final static int FRAME_death205 = 149; + + public final static int FRAME_death206 = 150; + + public final static int FRAME_death207 = 151; + + public final static int FRAME_death208 = 152; + + public final static int FRAME_death209 = 153; + + public final static int FRAME_death210 = 154; + + public final static int FRAME_death211 = 155; + + public final static int FRAME_death212 = 156; + + public final static int FRAME_death213 = 157; + + public final static int FRAME_death214 = 158; + + public final static int FRAME_death215 = 159; + + public final static int FRAME_death216 = 160; + + public final static int FRAME_death217 = 161; + + public final static int FRAME_death218 = 162; + + public final static int FRAME_death219 = 163; + + public final static int FRAME_death220 = 164; + + public final static int FRAME_death221 = 165; + + public final static int FRAME_death222 = 166; + + public final static int FRAME_death223 = 167; + + public final static int FRAME_death224 = 168; + + public final static int FRAME_death225 = 169; + + public final static int FRAME_death301 = 170; + + public final static int FRAME_death302 = 171; + + public final static int FRAME_death303 = 172; + + public final static int FRAME_death304 = 173; + + public final static int FRAME_death305 = 174; + + public final static int FRAME_death306 = 175; + + public final static int FRAME_death307 = 176; + + public final static int FRAME_death308 = 177; + + public final static int FRAME_death309 = 178; + + public final static int FRAME_block01 = 179; + + public final static int FRAME_block02 = 180; + + public final static int FRAME_block03 = 181; + + public final static int FRAME_block04 = 182; + + public final static int FRAME_block05 = 183; + + public final static int FRAME_attak101 = 184; + + public final static int FRAME_attak102 = 185; + + public final static int FRAME_attak103 = 186; + + public final static int FRAME_attak104 = 187; + + public final static int FRAME_attak105 = 188; + + public final static int FRAME_attak106 = 189; + + public final static int FRAME_attak107 = 190; + + public final static int FRAME_attak108 = 191; + + public final static int FRAME_attak109 = 192; + + public final static int FRAME_attak110 = 193; + + public final static int FRAME_attak111 = 194; + + public final static int FRAME_attak112 = 195; + + public final static int FRAME_attak113 = 196; + + public final static int FRAME_attak114 = 197; + + public final static int FRAME_attak115 = 198; + + public final static int FRAME_attak201 = 199; + + public final static int FRAME_attak202 = 200; + + public final static int FRAME_attak203 = 201; + + public final static int FRAME_attak204 = 202; + + public final static int FRAME_attak205 = 203; + + public final static int FRAME_attak206 = 204; + + public final static int FRAME_attak207 = 205; + + public final static int FRAME_attak208 = 206; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_die1; + + static int sound_die2; + + static int sound_gunshot; + + static int sound_weapon_cock; + + static int sound_punch_swing; + + static int sound_punch_hit; + + static int sound_sight; + + static int sound_search; + + static int sound_idle; + + static mframe_t infantry_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) }; + + static mmove_t infantry_move_stand = new mmove_t(FRAME_stand50, + FRAME_stand71, infantry_frames_stand, null); + + public static EntThinkAdapter infantry_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = infantry_move_stand; + return true; + } + }; + + static mframe_t infantry_frames_fidget[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 3, null), + new mframe_t(GameAI.ai_stand, 6, null), + new mframe_t(GameAI.ai_stand, 3, 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, 1, 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, 1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -2, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, -1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -1, 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, -1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -1, null), + new mframe_t(GameAI.ai_stand, -1, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, -3, null), + new mframe_t(GameAI.ai_stand, -2, null), + new mframe_t(GameAI.ai_stand, -3, null), + new mframe_t(GameAI.ai_stand, -3, null), + new mframe_t(GameAI.ai_stand, -2, null) }; + + static mmove_t infantry_move_fidget = new mmove_t(FRAME_stand01, + FRAME_stand49, infantry_frames_fidget, infantry_stand); + + static EntThinkAdapter infantry_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = infantry_move_fidget; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static mframe_t infantry_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 6, 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, 5, null) }; + + static mmove_t infantry_move_walk = new mmove_t(FRAME_walk03, FRAME_walk14, + infantry_frames_walk, null); + + static EntThinkAdapter infantry_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = infantry_move_walk; + return true; + } + }; + + static mframe_t infantry_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 20, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 7, null), + new mframe_t(GameAI.ai_run, 30, null), + new mframe_t(GameAI.ai_run, 35, null), + new mframe_t(GameAI.ai_run, 2, null), + new mframe_t(GameAI.ai_run, 6, null) }; + + static mmove_t infantry_move_run = new mmove_t(FRAME_run01, FRAME_run08, + infantry_frames_run, null); + + static EntThinkAdapter infantry_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = infantry_move_stand; + else + self.monsterinfo.currentmove = infantry_move_run; + return true; + } + }; + + static mframe_t infantry_frames_pain1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 6, null), + new mframe_t(GameAI.ai_move, 2, null) }; + + static mmove_t infantry_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain110, infantry_frames_pain1, infantry_run); + + static mframe_t infantry_frames_pain2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + 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, 2, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 2, null) }; + + static mmove_t infantry_move_pain2 = new mmove_t(FRAME_pain201, + FRAME_pain210, infantry_frames_pain2, infantry_run); + + static EntPainAdapter infantry_pain = new EntPainAdapter() { + 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() % 2; + if (n == 0) { + self.monsterinfo.currentmove = infantry_move_pain1; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + } else { + self.monsterinfo.currentmove = infantry_move_pain2; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + } + } + }; + + static float[] aimangles[] = { { 0.0f, 5.0f, 0.0f }, + { 10.0f, 15.0f, 0.0f }, { 20.0f, 25.0f, 0.0f }, + { 25.0f, 35.0f, 0.0f }, { 30.0f, 40.0f, 0.0f }, + { 30.0f, 45.0f, 0.0f }, { 25.0f, 50.0f, 0.0f }, + { 20.0f, 40.0f, 0.0f }, { 15.0f, 35.0f, 0.0f }, + { 40.0f, 35.0f, 0.0f }, { 70.0f, 35.0f, 0.0f }, + { 90.0f, 35.0f, 0.0f } }; + + static EntThinkAdapter InfantryMachineGun = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }, target = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] vec = { 0, 0, 0 }; + int flash_number; + + if (self.s.frame == FRAME_attak111) { + flash_number = Defines.MZ2_INFANTRY_MACHINEGUN_1; + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[flash_number], forward, + right, start); + + if (self.enemy != null) { + Math3D.VectorMA(self.enemy.s.origin, -0.2f, + self.enemy.velocity, target); + target[2] += self.enemy.viewheight; + Math3D.VectorSubtract(target, start, forward); + Math3D.VectorNormalize(forward); + } else { + Math3D.AngleVectors(self.s.angles, forward, right, null); + } + } else { + flash_number = Defines.MZ2_INFANTRY_MACHINEGUN_2 + + (self.s.frame - FRAME_death211); + + 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.VectorSubtract(self.s.angles, aimangles[flash_number + - Defines.MZ2_INFANTRY_MACHINEGUN_2], vec); + Math3D.AngleVectors(vec, forward, null, null); + } + + Monster.monster_fire_bullet(self, start, forward, 3, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, flash_number); + return true; + } + }; + + static EntInteractAdapter infantry_sight = new EntInteractAdapter() { + public boolean interact(edict_t self, edict_t other) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_sight, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + /// + + static EntThinkAdapter infantry_dead = new EntThinkAdapter() { + 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; + GameBase.gi.linkentity(self); + + M.M_FlyCheck.think(self); + return true; + } + }; + + static mframe_t infantry_frames_death1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -4, 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, -1, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 9, null), + new mframe_t(GameAI.ai_move, 9, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -3, null) }; + + static mmove_t infantry_move_death1 = new mmove_t(FRAME_death101, + FRAME_death120, infantry_frames_death1, infantry_dead); + + // Off with his head + static mframe_t infantry_frames_death2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -3, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -1, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -2, InfantryMachineGun), + new mframe_t(GameAI.ai_move, 0, InfantryMachineGun), + new mframe_t(GameAI.ai_move, 2, InfantryMachineGun), + new mframe_t(GameAI.ai_move, 2, InfantryMachineGun), + new mframe_t(GameAI.ai_move, 3, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -10, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -7, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -8, InfantryMachineGun), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t infantry_move_death2 = new mmove_t(FRAME_death201, + FRAME_death225, infantry_frames_death2, infantry_dead); + + static mframe_t infantry_frames_death3[] = 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, -6, null), + new mframe_t(GameAI.ai_move, -11, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -11, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t infantry_move_death3 = new mmove_t(FRAME_death301, + FRAME_death309, infantry_frames_death3, infantry_dead); + + public static EntDieAdapter infantry_die = new EntDieAdapter() { + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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 + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + n = Lib.rand() % 3; + if (n == 0) { + self.monsterinfo.currentmove = infantry_move_death1; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die2, 1, + Defines.ATTN_NORM, 0); + } else if (n == 1) { + self.monsterinfo.currentmove = infantry_move_death2; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die1, 1, + Defines.ATTN_NORM, 0); + } else { + self.monsterinfo.currentmove = infantry_move_death3; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die2, 1, + Defines.ATTN_NORM, 0); + } + } + }; + + static EntThinkAdapter infantry_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter infantry_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static EntThinkAdapter infantry_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t infantry_frames_duck[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -2, infantry_duck_down), + new mframe_t(GameAI.ai_move, -5, infantry_duck_hold), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 4, infantry_duck_up), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t infantry_move_duck = new mmove_t(FRAME_duck01, FRAME_duck05, + infantry_frames_duck, infantry_run); + + static EntDodgeAdapter infantry_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + if (Lib.random() > 0.25) + return; + + if (null == self.enemy) + self.enemy = attacker; + + self.monsterinfo.currentmove = infantry_move_duck; + } + }; + + static EntThinkAdapter infantry_cock_gun = new EntThinkAdapter() { + public boolean think(edict_t self) { + int n; + + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_weapon_cock, 1, + Defines.ATTN_NORM, 0); + n = (Lib.rand() & 15) + 3 + 7; + self.monsterinfo.pausetime = GameBase.level.time + n + * Defines.FRAMETIME; + return true; + } + }; + + static EntThinkAdapter infantry_fire = new EntThinkAdapter() { + public boolean think(edict_t self) { + InfantryMachineGun.think(self); + + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static mframe_t infantry_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, 0, infantry_cock_gun), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 2, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 1, infantry_fire), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -3, null) }; + + static mmove_t infantry_move_attack1 = new mmove_t(FRAME_attak101, + FRAME_attak115, infantry_frames_attack1, infantry_run); + + static EntThinkAdapter infantry_swing = new EntThinkAdapter() { + + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch_swing, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter infantry_smack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0); + if (Fire.fire_hit(self, aim, (5 + (Lib.rand() % 5)), 50)) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_punch_hit, + 1, Defines.ATTN_NORM, 0); + return true; + } + }; + + static mframe_t infantry_frames_attack2[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 0, infantry_swing), + new mframe_t(GameAI.ai_charge, 8, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 8, infantry_smack), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 3, null), }; + + static mmove_t infantry_move_attack2 = new mmove_t(FRAME_attak201, + FRAME_attak208, infantry_frames_attack2, infantry_run); + + static EntThinkAdapter infantry_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) + self.monsterinfo.currentmove = infantry_move_attack2; + else + self.monsterinfo.currentmove = infantry_move_attack1; + return true; + } + }; + + /* + * QUAKED monster_infantry (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_infantry(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_pain1 = GameBase.gi.soundindex("infantry/infpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("infantry/infpain2.wav"); + sound_die1 = GameBase.gi.soundindex("infantry/infdeth1.wav"); + sound_die2 = GameBase.gi.soundindex("infantry/infdeth2.wav"); + + sound_gunshot = GameBase.gi.soundindex("infantry/infatck1.wav"); + sound_weapon_cock = GameBase.gi.soundindex("infantry/infatck3.wav"); + sound_punch_swing = GameBase.gi.soundindex("infantry/infatck2.wav"); + sound_punch_hit = GameBase.gi.soundindex("infantry/melee2.wav"); + + sound_sight = GameBase.gi.soundindex("infantry/infsght1.wav"); + sound_search = GameBase.gi.soundindex("infantry/infsrch1.wav"); + sound_idle = GameBase.gi.soundindex("infantry/infidle1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/infantry/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + + self.health = 100; + self.gib_health = -40; + self.mass = 200; + + self.pain = infantry_pain; + self.die = infantry_die; + + self.monsterinfo.stand = infantry_stand; + self.monsterinfo.walk = infantry_walk; + self.monsterinfo.run = infantry_run; + self.monsterinfo.dodge = infantry_dodge; + self.monsterinfo.attack = infantry_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = infantry_sight; + self.monsterinfo.idle = infantry_fidget; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = infantry_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Insane.java b/src/jake2/game/monsters/M_Insane.java new file mode 100644 index 0000000..c227c75 --- /dev/null +++ b/src/jake2/game/monsters/M_Insane.java @@ -0,0 +1,1294 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Insane.java,v 1.2 2005-02-06 18:48:14 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Insane { + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_stand1 = 0; + + public final static int FRAME_stand2 = 1; + + public final static int FRAME_stand3 = 2; + + public final static int FRAME_stand4 = 3; + + public final static int FRAME_stand5 = 4; + + public final static int FRAME_stand6 = 5; + + public final static int FRAME_stand7 = 6; + + public final static int FRAME_stand8 = 7; + + public final static int FRAME_stand9 = 8; + + public final static int FRAME_stand10 = 9; + + public final static int FRAME_stand11 = 10; + + public final static int FRAME_stand12 = 11; + + public final static int FRAME_stand13 = 12; + + public final static int FRAME_stand14 = 13; + + public final static int FRAME_stand15 = 14; + + public final static int FRAME_stand16 = 15; + + public final static int FRAME_stand17 = 16; + + public final static int FRAME_stand18 = 17; + + public final static int FRAME_stand19 = 18; + + public final static int FRAME_stand20 = 19; + + public final static int FRAME_stand21 = 20; + + public final static int FRAME_stand22 = 21; + + public final static int FRAME_stand23 = 22; + + public final static int FRAME_stand24 = 23; + + public final static int FRAME_stand25 = 24; + + public final static int FRAME_stand26 = 25; + + public final static int FRAME_stand27 = 26; + + public final static int FRAME_stand28 = 27; + + public final static int FRAME_stand29 = 28; + + public final static int FRAME_stand30 = 29; + + public final static int FRAME_stand31 = 30; + + public final static int FRAME_stand32 = 31; + + public final static int FRAME_stand33 = 32; + + public final static int FRAME_stand34 = 33; + + public final static int FRAME_stand35 = 34; + + public final static int FRAME_stand36 = 35; + + public final static int FRAME_stand37 = 36; + + public final static int FRAME_stand38 = 37; + + public final static int FRAME_stand39 = 38; + + public final static int FRAME_stand40 = 39; + + public final static int FRAME_stand41 = 40; + + public final static int FRAME_stand42 = 41; + + public final static int FRAME_stand43 = 42; + + public final static int FRAME_stand44 = 43; + + public final static int FRAME_stand45 = 44; + + public final static int FRAME_stand46 = 45; + + public final static int FRAME_stand47 = 46; + + public final static int FRAME_stand48 = 47; + + public final static int FRAME_stand49 = 48; + + public final static int FRAME_stand50 = 49; + + public final static int FRAME_stand51 = 50; + + public final static int FRAME_stand52 = 51; + + public final static int FRAME_stand53 = 52; + + public final static int FRAME_stand54 = 53; + + public final static int FRAME_stand55 = 54; + + public final static int FRAME_stand56 = 55; + + public final static int FRAME_stand57 = 56; + + public final static int FRAME_stand58 = 57; + + public final static int FRAME_stand59 = 58; + + public final static int FRAME_stand60 = 59; + + public final static int FRAME_stand61 = 60; + + public final static int FRAME_stand62 = 61; + + public final static int FRAME_stand63 = 62; + + public final static int FRAME_stand64 = 63; + + public final static int FRAME_stand65 = 64; + + public final static int FRAME_stand66 = 65; + + public final static int FRAME_stand67 = 66; + + public final static int FRAME_stand68 = 67; + + public final static int FRAME_stand69 = 68; + + public final static int FRAME_stand70 = 69; + + public final static int FRAME_stand71 = 70; + + public final static int FRAME_stand72 = 71; + + public final static int FRAME_stand73 = 72; + + public final static int FRAME_stand74 = 73; + + public final static int FRAME_stand75 = 74; + + public final static int FRAME_stand76 = 75; + + public final static int FRAME_stand77 = 76; + + public final static int FRAME_stand78 = 77; + + public final static int FRAME_stand79 = 78; + + public final static int FRAME_stand80 = 79; + + public final static int FRAME_stand81 = 80; + + public final static int FRAME_stand82 = 81; + + public final static int FRAME_stand83 = 82; + + public final static int FRAME_stand84 = 83; + + public final static int FRAME_stand85 = 84; + + public final static int FRAME_stand86 = 85; + + public final static int FRAME_stand87 = 86; + + public final static int FRAME_stand88 = 87; + + public final static int FRAME_stand89 = 88; + + public final static int FRAME_stand90 = 89; + + public final static int FRAME_stand91 = 90; + + public final static int FRAME_stand92 = 91; + + public final static int FRAME_stand93 = 92; + + public final static int FRAME_stand94 = 93; + + public final static int FRAME_stand95 = 94; + + public final static int FRAME_stand96 = 95; + + public final static int FRAME_stand97 = 96; + + public final static int FRAME_stand98 = 97; + + public final static int FRAME_stand99 = 98; + + public final static int FRAME_stand100 = 99; + + public final static int FRAME_stand101 = 100; + + public final static int FRAME_stand102 = 101; + + public final static int FRAME_stand103 = 102; + + public final static int FRAME_stand104 = 103; + + public final static int FRAME_stand105 = 104; + + public final static int FRAME_stand106 = 105; + + public final static int FRAME_stand107 = 106; + + public final static int FRAME_stand108 = 107; + + public final static int FRAME_stand109 = 108; + + public final static int FRAME_stand110 = 109; + + public final static int FRAME_stand111 = 110; + + public final static int FRAME_stand112 = 111; + + public final static int FRAME_stand113 = 112; + + public final static int FRAME_stand114 = 113; + + public final static int FRAME_stand115 = 114; + + public final static int FRAME_stand116 = 115; + + public final static int FRAME_stand117 = 116; + + public final static int FRAME_stand118 = 117; + + public final static int FRAME_stand119 = 118; + + public final static int FRAME_stand120 = 119; + + public final static int FRAME_stand121 = 120; + + public final static int FRAME_stand122 = 121; + + public final static int FRAME_stand123 = 122; + + public final static int FRAME_stand124 = 123; + + public final static int FRAME_stand125 = 124; + + public final static int FRAME_stand126 = 125; + + public final static int FRAME_stand127 = 126; + + public final static int FRAME_stand128 = 127; + + public final static int FRAME_stand129 = 128; + + public final static int FRAME_stand130 = 129; + + public final static int FRAME_stand131 = 130; + + public final static int FRAME_stand132 = 131; + + public final static int FRAME_stand133 = 132; + + public final static int FRAME_stand134 = 133; + + public final static int FRAME_stand135 = 134; + + public final static int FRAME_stand136 = 135; + + public final static int FRAME_stand137 = 136; + + public final static int FRAME_stand138 = 137; + + public final static int FRAME_stand139 = 138; + + public final static int FRAME_stand140 = 139; + + public final static int FRAME_stand141 = 140; + + public final static int FRAME_stand142 = 141; + + public final static int FRAME_stand143 = 142; + + public final static int FRAME_stand144 = 143; + + public final static int FRAME_stand145 = 144; + + public final static int FRAME_stand146 = 145; + + public final static int FRAME_stand147 = 146; + + public final static int FRAME_stand148 = 147; + + public final static int FRAME_stand149 = 148; + + public final static int FRAME_stand150 = 149; + + public final static int FRAME_stand151 = 150; + + public final static int FRAME_stand152 = 151; + + public final static int FRAME_stand153 = 152; + + public final static int FRAME_stand154 = 153; + + public final static int FRAME_stand155 = 154; + + public final static int FRAME_stand156 = 155; + + public final static int FRAME_stand157 = 156; + + public final static int FRAME_stand158 = 157; + + public final static int FRAME_stand159 = 158; + + public final static int FRAME_stand160 = 159; + + public final static int FRAME_walk27 = 160; + + public final static int FRAME_walk28 = 161; + + public final static int FRAME_walk29 = 162; + + public final static int FRAME_walk30 = 163; + + public final static int FRAME_walk31 = 164; + + public final static int FRAME_walk32 = 165; + + public final static int FRAME_walk33 = 166; + + public final static int FRAME_walk34 = 167; + + public final static int FRAME_walk35 = 168; + + public final static int FRAME_walk36 = 169; + + public final static int FRAME_walk37 = 170; + + public final static int FRAME_walk38 = 171; + + public final static int FRAME_walk39 = 172; + + public final static int FRAME_walk1 = 173; + + public final static int FRAME_walk2 = 174; + + public final static int FRAME_walk3 = 175; + + public final static int FRAME_walk4 = 176; + + public final static int FRAME_walk5 = 177; + + public final static int FRAME_walk6 = 178; + + public final static int FRAME_walk7 = 179; + + public final static int FRAME_walk8 = 180; + + public final static int FRAME_walk9 = 181; + + public final static int FRAME_walk10 = 182; + + public final static int FRAME_walk11 = 183; + + public final static int FRAME_walk12 = 184; + + public final static int FRAME_walk13 = 185; + + public final static int FRAME_walk14 = 186; + + public final static int FRAME_walk15 = 187; + + public final static int FRAME_walk16 = 188; + + public final static int FRAME_walk17 = 189; + + public final static int FRAME_walk18 = 190; + + public final static int FRAME_walk19 = 191; + + public final static int FRAME_walk20 = 192; + + public final static int FRAME_walk21 = 193; + + public final static int FRAME_walk22 = 194; + + public final static int FRAME_walk23 = 195; + + public final static int FRAME_walk24 = 196; + + public final static int FRAME_walk25 = 197; + + public final static int FRAME_walk26 = 198; + + public final static int FRAME_st_pain2 = 199; + + public final static int FRAME_st_pain3 = 200; + + public final static int FRAME_st_pain4 = 201; + + public final static int FRAME_st_pain5 = 202; + + public final static int FRAME_st_pain6 = 203; + + public final static int FRAME_st_pain7 = 204; + + public final static int FRAME_st_pain8 = 205; + + public final static int FRAME_st_pain9 = 206; + + public final static int FRAME_st_pain10 = 207; + + public final static int FRAME_st_pain11 = 208; + + public final static int FRAME_st_pain12 = 209; + + public final static int FRAME_st_death2 = 210; + + public final static int FRAME_st_death3 = 211; + + public final static int FRAME_st_death4 = 212; + + public final static int FRAME_st_death5 = 213; + + public final static int FRAME_st_death6 = 214; + + public final static int FRAME_st_death7 = 215; + + public final static int FRAME_st_death8 = 216; + + public final static int FRAME_st_death9 = 217; + + public final static int FRAME_st_death10 = 218; + + public final static int FRAME_st_death11 = 219; + + public final static int FRAME_st_death12 = 220; + + public final static int FRAME_st_death13 = 221; + + public final static int FRAME_st_death14 = 222; + + public final static int FRAME_st_death15 = 223; + + public final static int FRAME_st_death16 = 224; + + public final static int FRAME_st_death17 = 225; + + public final static int FRAME_st_death18 = 226; + + public final static int FRAME_crawl1 = 227; + + public final static int FRAME_crawl2 = 228; + + public final static int FRAME_crawl3 = 229; + + public final static int FRAME_crawl4 = 230; + + public final static int FRAME_crawl5 = 231; + + public final static int FRAME_crawl6 = 232; + + public final static int FRAME_crawl7 = 233; + + public final static int FRAME_crawl8 = 234; + + public final static int FRAME_crawl9 = 235; + + public final static int FRAME_cr_pain2 = 236; + + public final static int FRAME_cr_pain3 = 237; + + public final static int FRAME_cr_pain4 = 238; + + public final static int FRAME_cr_pain5 = 239; + + public final static int FRAME_cr_pain6 = 240; + + public final static int FRAME_cr_pain7 = 241; + + public final static int FRAME_cr_pain8 = 242; + + public final static int FRAME_cr_pain9 = 243; + + public final static int FRAME_cr_pain10 = 244; + + public final static int FRAME_cr_death10 = 245; + + public final static int FRAME_cr_death11 = 246; + + public final static int FRAME_cr_death12 = 247; + + public final static int FRAME_cr_death13 = 248; + + public final static int FRAME_cr_death14 = 249; + + public final static int FRAME_cr_death15 = 250; + + public final static int FRAME_cr_death16 = 251; + + public final static int FRAME_cross1 = 252; + + public final static int FRAME_cross2 = 253; + + public final static int FRAME_cross3 = 254; + + public final static int FRAME_cross4 = 255; + + public final static int FRAME_cross5 = 256; + + public final static int FRAME_cross6 = 257; + + public final static int FRAME_cross7 = 258; + + public final static int FRAME_cross8 = 259; + + public final static int FRAME_cross9 = 260; + + public final static int FRAME_cross10 = 261; + + public final static int FRAME_cross11 = 262; + + public final static int FRAME_cross12 = 263; + + public final static int FRAME_cross13 = 264; + + public final static int FRAME_cross14 = 265; + + public final static int FRAME_cross15 = 266; + + public final static int FRAME_cross16 = 267; + + public final static int FRAME_cross17 = 268; + + public final static int FRAME_cross18 = 269; + + public final static int FRAME_cross19 = 270; + + public final static int FRAME_cross20 = 271; + + public final static int FRAME_cross21 = 272; + + public final static int FRAME_cross22 = 273; + + public final static int FRAME_cross23 = 274; + + public final static int FRAME_cross24 = 275; + + public final static int FRAME_cross25 = 276; + + public final static int FRAME_cross26 = 277; + + public final static int FRAME_cross27 = 278; + + public final static int FRAME_cross28 = 279; + + public final static int FRAME_cross29 = 280; + + public final static int FRAME_cross30 = 281; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_fist; + + static int sound_shake; + + static int sound_moan; + + static int sound_scream[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + static EntThinkAdapter insane_fist = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_fist, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter insane_shake = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_shake, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter insane_moan = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_moan, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter insane_scream = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, + sound_scream[Lib.rand() % 8], 1, Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter insane_cross = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() < 0.8) + self.monsterinfo.currentmove = insane_move_cross; + else + self.monsterinfo.currentmove = insane_move_struggle_cross; + return true; + } + }; + + static EntThinkAdapter insane_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.spawnflags & 16) != 0) // Hold Ground? + if (self.s.frame == FRAME_cr_pain10) { + self.monsterinfo.currentmove = insane_move_down; + return true; + } + if ((self.spawnflags & 4) != 0) + self.monsterinfo.currentmove = insane_move_crawl; + else if (Lib.random() <= 0.5) + self.monsterinfo.currentmove = insane_move_walk_normal; + else + self.monsterinfo.currentmove = insane_move_walk_insane; + return true; + } + }; + + static EntThinkAdapter insane_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.spawnflags & 16) != 0) // Hold Ground? + if (self.s.frame == FRAME_cr_pain10) { + self.monsterinfo.currentmove = insane_move_down; + return true; + } + if ((self.spawnflags & 4) != 0) // Crawling? + self.monsterinfo.currentmove = insane_move_runcrawl; + else if (Lib.random() <= 0.5) // Else, mix it up + self.monsterinfo.currentmove = insane_move_run_normal; + else + self.monsterinfo.currentmove = insane_move_run_insane; + return true; + } + }; + + static EntPainAdapter insane_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + int l, 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; + + r = 1 + (Lib.rand() & 1); + if (self.health < 25) + l = 25; + else if (self.health < 50) + l = 50; + else if (self.health < 75) + l = 75; + else + l = 100; + GameBase.gi.sound(self, Defines.CHAN_VOICE, GameBase.gi + .soundindex("player/male/pain" + l + "_" + r + ".wav"), 1, + Defines.ATTN_IDLE, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + // Don't go into pain frames if crucified. + if ((self.spawnflags & 8) != 0) { + self.monsterinfo.currentmove = insane_move_struggle_cross; + return; + } + + if (((self.s.frame >= FRAME_crawl1) && (self.s.frame <= FRAME_crawl9)) + || ((self.s.frame >= FRAME_stand99) && (self.s.frame <= FRAME_stand160))) { + self.monsterinfo.currentmove = insane_move_crawl_pain; + } else + self.monsterinfo.currentmove = insane_move_stand_pain; + } + }; + + static EntThinkAdapter insane_onground = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = insane_move_down; + return true; + } + }; + + static EntThinkAdapter insane_checkdown = new EntThinkAdapter() { + public boolean think(edict_t self) { + // if ( (self.s.frame == FRAME_stand94) || (self.s.frame == + // FRAME_stand65) ) + if ((self.spawnflags & 32) != 0) // Always stand + return true; + if (Lib.random() < 0.3) + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = insane_move_uptodown; + else + self.monsterinfo.currentmove = insane_move_jumpdown; + return true; + } + }; + + static EntThinkAdapter insane_checkup = new EntThinkAdapter() { + public boolean think(edict_t self) { + // If Hold_Ground and Crawl are set + if ((self.spawnflags & 4) != 0 && (self.spawnflags & 16) != 0) + return true; + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = insane_move_downtoup; + return true; + } + }; + + static EntThinkAdapter insane_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.spawnflags & 8) != 0) // If crucified + { + self.monsterinfo.currentmove = insane_move_cross; + self.monsterinfo.aiflags |= Defines.AI_STAND_GROUND; + } + // If Hold_Ground and Crawl are set + else if ((self.spawnflags & 4) != 0 && (self.spawnflags & 16) != 0) + self.monsterinfo.currentmove = insane_move_down; + else if (Lib.random() < 0.5) + self.monsterinfo.currentmove = insane_move_stand_normal; + else + self.monsterinfo.currentmove = insane_move_stand_insane; + return true; + } + }; + + static EntThinkAdapter insane_dead = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.spawnflags & 8) != 0) { + self.flags |= Defines.FL_FLY; + } else { + 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 EntDieAdapter insane_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + int n; + + if (self.health <= self.gib_health) { + GameBase.gi + .sound(self, Defines.CHAN_VOICE, GameBase.gi + .soundindex("misc/udeath.wav"), 1, + Defines.ATTN_IDLE, 0); + for (n = 0; n < 2; n++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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; + + GameBase.gi.sound(self, Defines.CHAN_VOICE, GameBase.gi + .soundindex("player/male/death" + ((Lib.rand() % 4) + 1) + + ".wav"), 1, Defines.ATTN_IDLE, 0); + + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + if ((self.spawnflags & 8) != 0) { + insane_dead.think(self); + } else { + if (((self.s.frame >= FRAME_crawl1) && (self.s.frame <= FRAME_crawl9)) + || ((self.s.frame >= FRAME_stand99) && (self.s.frame <= FRAME_stand160))) + self.monsterinfo.currentmove = insane_move_crawl_death; + else + self.monsterinfo.currentmove = insane_move_stand_death; + } + } + + }; + + static mframe_t insane_frames_stand_normal[] = 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, insane_checkdown) }; + + static mmove_t insane_move_stand_normal = new mmove_t(FRAME_stand60, + FRAME_stand65, insane_frames_stand_normal, insane_stand); + + static mframe_t insane_frames_stand_insane[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, insane_shake), + 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, insane_checkdown) }; + + static mmove_t insane_move_stand_insane = new mmove_t(FRAME_stand65, + FRAME_stand94, insane_frames_stand_insane, insane_stand); + + static mframe_t insane_frames_uptodown[] = 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, insane_moan), + 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, 2.7f, null), + new mframe_t(GameAI.ai_move, 4.1f, null), + new mframe_t(GameAI.ai_move, 6f, null), + new mframe_t(GameAI.ai_move, 7.6f, null), + new mframe_t(GameAI.ai_move, 3.6f, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, insane_fist), + 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, insane_fist), + 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 insane_move_uptodown = new mmove_t(FRAME_stand1, + FRAME_stand40, insane_frames_uptodown, insane_onground); + + static mframe_t insane_frames_downtoup[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -0.7f, null), // 41 + new mframe_t(GameAI.ai_move, -1.2f, null), // 42 + new mframe_t(GameAI.ai_move, -1.5f, null), // 43 + new mframe_t(GameAI.ai_move, -4.5f, null), // 44 + new mframe_t(GameAI.ai_move, -3.5f, null), // 45 + new mframe_t(GameAI.ai_move, -0.2f, null), // 46 + new mframe_t(GameAI.ai_move, 0, null), // 47 + new mframe_t(GameAI.ai_move, -1.3f, null), // 48 + new mframe_t(GameAI.ai_move, -3, null), // 49 + new mframe_t(GameAI.ai_move, -2, null), // 50 + new mframe_t(GameAI.ai_move, 0, null), // 51 + new mframe_t(GameAI.ai_move, 0, null), // 52 + new mframe_t(GameAI.ai_move, 0, null), // 53 + new mframe_t(GameAI.ai_move, -3.3f, null), // 54 + new mframe_t(GameAI.ai_move, -1.6f, null), // 55 + new mframe_t(GameAI.ai_move, -0.3f, null), // 56 + new mframe_t(GameAI.ai_move, 0, null), // 57 + new mframe_t(GameAI.ai_move, 0, null), // 58 + new mframe_t(GameAI.ai_move, 0, null) // 59 + }; + + static mmove_t insane_move_downtoup = new mmove_t(FRAME_stand41, + FRAME_stand59, insane_frames_downtoup, insane_stand); + + static mframe_t insane_frames_jumpdown[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0.2f, null), + new mframe_t(GameAI.ai_move, 11.5f, null), + new mframe_t(GameAI.ai_move, 5.1f, null), + new mframe_t(GameAI.ai_move, 7.1f, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t insane_move_jumpdown = new mmove_t(FRAME_stand96, + FRAME_stand100, insane_frames_jumpdown, insane_onground); + + static mframe_t insane_frames_down[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), // 100) + 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), + // 110) + new mframe_t(GameAI.ai_move, -1.7f, null), + new mframe_t(GameAI.ai_move, -1.6f, 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, insane_fist), + 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), + // 120) + 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), + // 130 + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, insane_moan), + 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), + // 140 + 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), + // 150 + new mframe_t(GameAI.ai_move, 0.5f, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -0.2f, insane_scream), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0.2f, null), + new mframe_t(GameAI.ai_move, 0.4f, null), + new mframe_t(GameAI.ai_move, 0.6f, null), + new mframe_t(GameAI.ai_move, 0.8f, null), + new mframe_t(GameAI.ai_move, 0.7f, null), + new mframe_t(GameAI.ai_move, 0, insane_checkup) // 160 + }; + + static mmove_t insane_move_down = new mmove_t(FRAME_stand100, + FRAME_stand160, insane_frames_down, insane_onground); + + static mframe_t insane_frames_walk_normal[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, insane_scream), + new mframe_t(GameAI.ai_walk, 2.5f, null), + new mframe_t(GameAI.ai_walk, 3.5f, null), + new mframe_t(GameAI.ai_walk, 1.7f, null), + new mframe_t(GameAI.ai_walk, 2.3f, null), + new mframe_t(GameAI.ai_walk, 2.4f, null), + new mframe_t(GameAI.ai_walk, 2.2f, null), + new mframe_t(GameAI.ai_walk, 4.2f, null), + new mframe_t(GameAI.ai_walk, 5.6f, null), + new mframe_t(GameAI.ai_walk, 3.3f, null), + new mframe_t(GameAI.ai_walk, 2.4f, null), + new mframe_t(GameAI.ai_walk, 0.9f, null), + new mframe_t(GameAI.ai_walk, 0, null) }; + + static mmove_t insane_move_walk_normal = new mmove_t(FRAME_walk27, + FRAME_walk39, insane_frames_walk_normal, insane_walk); + + static mmove_t insane_move_run_normal = new mmove_t(FRAME_walk27, + FRAME_walk39, insane_frames_walk_normal, insane_run); + + static mframe_t insane_frames_walk_insane[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, insane_scream), // walk 1 + new mframe_t(GameAI.ai_walk, 3.4f, null), // walk 2 + new mframe_t(GameAI.ai_walk, 3.6f, null), // 3 + new mframe_t(GameAI.ai_walk, 2.9f, null), // 4 + new mframe_t(GameAI.ai_walk, 2.2f, null), // 5 + new mframe_t(GameAI.ai_walk, 2.6f, null), // 6 + new mframe_t(GameAI.ai_walk, 0, null), // 7 + new mframe_t(GameAI.ai_walk, 0.7f, null), // 8 + new mframe_t(GameAI.ai_walk, 4.8f, null), // 9 + new mframe_t(GameAI.ai_walk, 5.3f, null), // 10 + new mframe_t(GameAI.ai_walk, 1.1f, null), // 11 + new mframe_t(GameAI.ai_walk, 2, null), // 12 + new mframe_t(GameAI.ai_walk, 0.5f, null), // 13 + new mframe_t(GameAI.ai_walk, 0, null), // 14 + new mframe_t(GameAI.ai_walk, 0, null), // 15 + new mframe_t(GameAI.ai_walk, 4.9f, null), // 16 + new mframe_t(GameAI.ai_walk, 6.7f, null), // 17 + new mframe_t(GameAI.ai_walk, 3.8f, null), // 18 + new mframe_t(GameAI.ai_walk, 2, null), // 19 + new mframe_t(GameAI.ai_walk, 0.2f, null), // 20 + new mframe_t(GameAI.ai_walk, 0, null), // 21 + new mframe_t(GameAI.ai_walk, 3.4f, null), // 22 + new mframe_t(GameAI.ai_walk, 6.4f, null), // 23 + new mframe_t(GameAI.ai_walk, 5, null), // 24 + new mframe_t(GameAI.ai_walk, 1.8f, null), // 25 + new mframe_t(GameAI.ai_walk, 0, null) // 26 + }; + + static mmove_t insane_move_walk_insane = new mmove_t(FRAME_walk1, + FRAME_walk26, insane_frames_walk_insane, insane_walk); + + static mmove_t insane_move_run_insane = new mmove_t(FRAME_walk1, + FRAME_walk26, insane_frames_walk_insane, insane_run); + + static mframe_t insane_frames_stand_pain[] = 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) }; + + static mmove_t insane_move_stand_pain = new mmove_t(FRAME_st_pain2, + FRAME_st_pain12, insane_frames_stand_pain, insane_run); + + static mframe_t insane_frames_stand_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) }; + + static mmove_t insane_move_stand_death = new mmove_t(FRAME_st_death2, + FRAME_st_death18, insane_frames_stand_death, insane_dead); + + static mframe_t insane_frames_crawl[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, insane_scream), + new mframe_t(GameAI.ai_walk, 1.5f, null), + new mframe_t(GameAI.ai_walk, 2.1f, null), + new mframe_t(GameAI.ai_walk, 3.6f, null), + new mframe_t(GameAI.ai_walk, 2f, null), + new mframe_t(GameAI.ai_walk, 0.9f, null), + new mframe_t(GameAI.ai_walk, 3f, null), + new mframe_t(GameAI.ai_walk, 3.4f, null), + new mframe_t(GameAI.ai_walk, 2.4f, null) }; + + static mmove_t insane_move_crawl = new mmove_t(FRAME_crawl1, FRAME_crawl9, + insane_frames_crawl, null); + + static mmove_t insane_move_runcrawl = new mmove_t(FRAME_crawl1, + FRAME_crawl9, insane_frames_crawl, null); + + static mframe_t insane_frames_crawl_pain[] = 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 insane_move_crawl_pain = new mmove_t(FRAME_cr_pain2, + FRAME_cr_pain10, insane_frames_crawl_pain, insane_run); + + static mframe_t insane_frames_crawl_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) }; + + static mmove_t insane_move_crawl_death = new mmove_t(FRAME_cr_death10, + FRAME_cr_death16, insane_frames_crawl_death, insane_dead); + + static mframe_t insane_frames_cross[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, insane_moan), + 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 insane_move_cross = new mmove_t(FRAME_cross1, FRAME_cross15, + insane_frames_cross, insane_cross); + + static mframe_t insane_frames_struggle_cross[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, insane_scream), + 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 insane_move_struggle_cross = new mmove_t(FRAME_cross16, + FRAME_cross30, insane_frames_struggle_cross, insane_cross); + + /* + * QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn + * CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND + */ + public static void SP_misc_insane(edict_t self) { + // static int skin = 0; //@@ + + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_fist = GameBase.gi.soundindex("insane/insane11.wav"); + sound_shake = GameBase.gi.soundindex("insane/insane5.wav"); + sound_moan = GameBase.gi.soundindex("insane/insane7.wav"); + sound_scream[0] = GameBase.gi.soundindex("insane/insane1.wav"); + sound_scream[1] = GameBase.gi.soundindex("insane/insane2.wav"); + sound_scream[2] = GameBase.gi.soundindex("insane/insane3.wav"); + sound_scream[3] = GameBase.gi.soundindex("insane/insane4.wav"); + sound_scream[4] = GameBase.gi.soundindex("insane/insane6.wav"); + sound_scream[5] = GameBase.gi.soundindex("insane/insane8.wav"); + sound_scream[6] = GameBase.gi.soundindex("insane/insane9.wav"); + sound_scream[7] = GameBase.gi.soundindex("insane/insane10.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/insane/tris.md2"); + + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + + self.health = 100; + self.gib_health = -50; + self.mass = 300; + + self.pain = insane_pain; + self.die = insane_die; + + self.monsterinfo.stand = insane_stand; + self.monsterinfo.walk = insane_walk; + self.monsterinfo.run = insane_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = null; + self.monsterinfo.melee = null; + self.monsterinfo.sight = null; + self.monsterinfo.aiflags |= Defines.AI_GOOD_GUY; + + // @@ + // self.s.skinnum = skin; + // skin++; + // if (skin > 12) + // skin = 0; + + GameBase.gi.linkentity(self); + + if ((self.spawnflags & 16) != 0) // Stand Ground + self.monsterinfo.aiflags |= Defines.AI_STAND_GROUND; + + self.monsterinfo.currentmove = insane_move_stand_normal; + + self.monsterinfo.scale = MODEL_SCALE; + if ((self.spawnflags & 8) != 0) // Crucified ? + { + Math3D.VectorSet(self.mins, -16, 0, 0); + Math3D.VectorSet(self.maxs, 16, 8, 32); + self.flags |= Defines.FL_NO_KNOCKBACK; + GameAI.flymonster_start.think(self); + } else { + GameAI.walkmonster_start.think(self); + self.s.skinnum = Lib.rand() % 3; + } + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Medic.java b/src/jake2/game/monsters/M_Medic.java new file mode 100644 index 0000000..ac8eb74 --- /dev/null +++ b/src/jake2/game/monsters/M_Medic.java @@ -0,0 +1,1299 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Medic.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EdictIterator; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameSpawn; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.game.trace_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Medic { + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_walk1 = 0; + + public final static int FRAME_walk2 = 1; + + public final static int FRAME_walk3 = 2; + + public final static int FRAME_walk4 = 3; + + public final static int FRAME_walk5 = 4; + + public final static int FRAME_walk6 = 5; + + public final static int FRAME_walk7 = 6; + + public final static int FRAME_walk8 = 7; + + public final static int FRAME_walk9 = 8; + + public final static int FRAME_walk10 = 9; + + public final static int FRAME_walk11 = 10; + + public final static int FRAME_walk12 = 11; + + public final static int FRAME_wait1 = 12; + + public final static int FRAME_wait2 = 13; + + public final static int FRAME_wait3 = 14; + + public final static int FRAME_wait4 = 15; + + public final static int FRAME_wait5 = 16; + + public final static int FRAME_wait6 = 17; + + public final static int FRAME_wait7 = 18; + + public final static int FRAME_wait8 = 19; + + public final static int FRAME_wait9 = 20; + + public final static int FRAME_wait10 = 21; + + public final static int FRAME_wait11 = 22; + + public final static int FRAME_wait12 = 23; + + public final static int FRAME_wait13 = 24; + + public final static int FRAME_wait14 = 25; + + public final static int FRAME_wait15 = 26; + + public final static int FRAME_wait16 = 27; + + public final static int FRAME_wait17 = 28; + + public final static int FRAME_wait18 = 29; + + public final static int FRAME_wait19 = 30; + + public final static int FRAME_wait20 = 31; + + public final static int FRAME_wait21 = 32; + + public final static int FRAME_wait22 = 33; + + public final static int FRAME_wait23 = 34; + + public final static int FRAME_wait24 = 35; + + public final static int FRAME_wait25 = 36; + + public final static int FRAME_wait26 = 37; + + public final static int FRAME_wait27 = 38; + + public final static int FRAME_wait28 = 39; + + public final static int FRAME_wait29 = 40; + + public final static int FRAME_wait30 = 41; + + public final static int FRAME_wait31 = 42; + + public final static int FRAME_wait32 = 43; + + public final static int FRAME_wait33 = 44; + + public final static int FRAME_wait34 = 45; + + public final static int FRAME_wait35 = 46; + + public final static int FRAME_wait36 = 47; + + public final static int FRAME_wait37 = 48; + + public final static int FRAME_wait38 = 49; + + public final static int FRAME_wait39 = 50; + + public final static int FRAME_wait40 = 51; + + public final static int FRAME_wait41 = 52; + + public final static int FRAME_wait42 = 53; + + public final static int FRAME_wait43 = 54; + + public final static int FRAME_wait44 = 55; + + public final static int FRAME_wait45 = 56; + + public final static int FRAME_wait46 = 57; + + public final static int FRAME_wait47 = 58; + + public final static int FRAME_wait48 = 59; + + public final static int FRAME_wait49 = 60; + + public final static int FRAME_wait50 = 61; + + public final static int FRAME_wait51 = 62; + + public final static int FRAME_wait52 = 63; + + public final static int FRAME_wait53 = 64; + + public final static int FRAME_wait54 = 65; + + public final static int FRAME_wait55 = 66; + + public final static int FRAME_wait56 = 67; + + public final static int FRAME_wait57 = 68; + + public final static int FRAME_wait58 = 69; + + public final static int FRAME_wait59 = 70; + + public final static int FRAME_wait60 = 71; + + public final static int FRAME_wait61 = 72; + + public final static int FRAME_wait62 = 73; + + public final static int FRAME_wait63 = 74; + + public final static int FRAME_wait64 = 75; + + public final static int FRAME_wait65 = 76; + + public final static int FRAME_wait66 = 77; + + public final static int FRAME_wait67 = 78; + + public final static int FRAME_wait68 = 79; + + public final static int FRAME_wait69 = 80; + + public final static int FRAME_wait70 = 81; + + public final static int FRAME_wait71 = 82; + + public final static int FRAME_wait72 = 83; + + public final static int FRAME_wait73 = 84; + + public final static int FRAME_wait74 = 85; + + public final static int FRAME_wait75 = 86; + + public final static int FRAME_wait76 = 87; + + public final static int FRAME_wait77 = 88; + + public final static int FRAME_wait78 = 89; + + public final static int FRAME_wait79 = 90; + + public final static int FRAME_wait80 = 91; + + public final static int FRAME_wait81 = 92; + + public final static int FRAME_wait82 = 93; + + public final static int FRAME_wait83 = 94; + + public final static int FRAME_wait84 = 95; + + public final static int FRAME_wait85 = 96; + + public final static int FRAME_wait86 = 97; + + public final static int FRAME_wait87 = 98; + + public final static int FRAME_wait88 = 99; + + public final static int FRAME_wait89 = 100; + + public final static int FRAME_wait90 = 101; + + public final static int FRAME_run1 = 102; + + public final static int FRAME_run2 = 103; + + public final static int FRAME_run3 = 104; + + public final static int FRAME_run4 = 105; + + public final static int FRAME_run5 = 106; + + public final static int FRAME_run6 = 107; + + public final static int FRAME_paina1 = 108; + + public final static int FRAME_paina2 = 109; + + public final static int FRAME_paina3 = 110; + + public final static int FRAME_paina4 = 111; + + public final static int FRAME_paina5 = 112; + + public final static int FRAME_paina6 = 113; + + public final static int FRAME_paina7 = 114; + + public final static int FRAME_paina8 = 115; + + public final static int FRAME_painb1 = 116; + + public final static int FRAME_painb2 = 117; + + public final static int FRAME_painb3 = 118; + + public final static int FRAME_painb4 = 119; + + public final static int FRAME_painb5 = 120; + + public final static int FRAME_painb6 = 121; + + public final static int FRAME_painb7 = 122; + + public final static int FRAME_painb8 = 123; + + public final static int FRAME_painb9 = 124; + + public final static int FRAME_painb10 = 125; + + public final static int FRAME_painb11 = 126; + + public final static int FRAME_painb12 = 127; + + public final static int FRAME_painb13 = 128; + + public final static int FRAME_painb14 = 129; + + public final static int FRAME_painb15 = 130; + + public final static int FRAME_duck1 = 131; + + public final static int FRAME_duck2 = 132; + + public final static int FRAME_duck3 = 133; + + public final static int FRAME_duck4 = 134; + + public final static int FRAME_duck5 = 135; + + public final static int FRAME_duck6 = 136; + + public final static int FRAME_duck7 = 137; + + public final static int FRAME_duck8 = 138; + + public final static int FRAME_duck9 = 139; + + public final static int FRAME_duck10 = 140; + + public final static int FRAME_duck11 = 141; + + public final static int FRAME_duck12 = 142; + + public final static int FRAME_duck13 = 143; + + public final static int FRAME_duck14 = 144; + + public final static int FRAME_duck15 = 145; + + public final static int FRAME_duck16 = 146; + + public final static int FRAME_death1 = 147; + + public final static int FRAME_death2 = 148; + + public final static int FRAME_death3 = 149; + + public final static int FRAME_death4 = 150; + + public final static int FRAME_death5 = 151; + + public final static int FRAME_death6 = 152; + + public final static int FRAME_death7 = 153; + + public final static int FRAME_death8 = 154; + + public final static int FRAME_death9 = 155; + + public final static int FRAME_death10 = 156; + + public final static int FRAME_death11 = 157; + + public final static int FRAME_death12 = 158; + + public final static int FRAME_death13 = 159; + + public final static int FRAME_death14 = 160; + + public final static int FRAME_death15 = 161; + + public final static int FRAME_death16 = 162; + + public final static int FRAME_death17 = 163; + + public final static int FRAME_death18 = 164; + + public final static int FRAME_death19 = 165; + + public final static int FRAME_death20 = 166; + + public final static int FRAME_death21 = 167; + + public final static int FRAME_death22 = 168; + + public final static int FRAME_death23 = 169; + + public final static int FRAME_death24 = 170; + + public final static int FRAME_death25 = 171; + + public final static int FRAME_death26 = 172; + + public final static int FRAME_death27 = 173; + + public final static int FRAME_death28 = 174; + + public final static int FRAME_death29 = 175; + + public final static int FRAME_death30 = 176; + + public final static int FRAME_attack1 = 177; + + public final static int FRAME_attack2 = 178; + + public final static int FRAME_attack3 = 179; + + public final static int FRAME_attack4 = 180; + + public final static int FRAME_attack5 = 181; + + public final static int FRAME_attack6 = 182; + + public final static int FRAME_attack7 = 183; + + public final static int FRAME_attack8 = 184; + + public final static int FRAME_attack9 = 185; + + public final static int FRAME_attack10 = 186; + + public final static int FRAME_attack11 = 187; + + public final static int FRAME_attack12 = 188; + + public final static int FRAME_attack13 = 189; + + public final static int FRAME_attack14 = 190; + + public final static int FRAME_attack15 = 191; + + public final static int FRAME_attack16 = 192; + + public final static int FRAME_attack17 = 193; + + public final static int FRAME_attack18 = 194; + + public final static int FRAME_attack19 = 195; + + public final static int FRAME_attack20 = 196; + + public final static int FRAME_attack21 = 197; + + public final static int FRAME_attack22 = 198; + + public final static int FRAME_attack23 = 199; + + public final static int FRAME_attack24 = 200; + + public final static int FRAME_attack25 = 201; + + public final static int FRAME_attack26 = 202; + + public final static int FRAME_attack27 = 203; + + public final static int FRAME_attack28 = 204; + + public final static int FRAME_attack29 = 205; + + public final static int FRAME_attack30 = 206; + + public final static int FRAME_attack31 = 207; + + public final static int FRAME_attack32 = 208; + + public final static int FRAME_attack33 = 209; + + public final static int FRAME_attack34 = 210; + + public final static int FRAME_attack35 = 211; + + public final static int FRAME_attack36 = 212; + + public final static int FRAME_attack37 = 213; + + public final static int FRAME_attack38 = 214; + + public final static int FRAME_attack39 = 215; + + public final static int FRAME_attack40 = 216; + + public final static int FRAME_attack41 = 217; + + public final static int FRAME_attack42 = 218; + + public final static int FRAME_attack43 = 219; + + public final static int FRAME_attack44 = 220; + + public final static int FRAME_attack45 = 221; + + public final static int FRAME_attack46 = 222; + + public final static int FRAME_attack47 = 223; + + public final static int FRAME_attack48 = 224; + + public final static int FRAME_attack49 = 225; + + public final static int FRAME_attack50 = 226; + + public final static int FRAME_attack51 = 227; + + public final static int FRAME_attack52 = 228; + + public final static int FRAME_attack53 = 229; + + public final static int FRAME_attack54 = 230; + + public final static int FRAME_attack55 = 231; + + public final static int FRAME_attack56 = 232; + + public final static int FRAME_attack57 = 233; + + public final static int FRAME_attack58 = 234; + + public final static int FRAME_attack59 = 235; + + public final static int FRAME_attack60 = 236; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_idle1; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_die; + + static int sound_sight; + + static int sound_search; + + static int sound_hook_launch; + + static int sound_hook_hit; + + static int sound_hook_heal; + + static int sound_hook_retract; + + static edict_t medic_FindDeadMonster(edict_t self) { + edict_t ent = null; + edict_t best = null; + EdictIterator edit = null; + + while ((edit = GameBase.findradius(edit, self.s.origin, 1024)) != null) { + ent = edit.o; + if (ent == self) + continue; + if (0 == (ent.svflags & Defines.SVF_MONSTER)) + continue; + if ((ent.monsterinfo.aiflags & Defines.AI_GOOD_GUY) != 0) + continue; + if (ent.owner == null) + continue; + if (ent.health > 0) + continue; + if (ent.nextthink == 0) + continue; + if (!GameUtil.visible(self, ent)) + continue; + if (best == null) { + best = ent; + continue; + } + if (ent.max_health <= best.max_health) + continue; + best = ent; + } + + return best; + } + + static EntThinkAdapter medic_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + edict_t ent; + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle1, 1, + Defines.ATTN_IDLE, 0); + + ent = medic_FindDeadMonster(self); + if (ent != null) { + self.enemy = ent; + self.enemy.owner = self; + self.monsterinfo.aiflags |= Defines.AI_MEDIC; + GameUtil.FoundTarget(self); + } + return true; + } + }; + + static EntThinkAdapter medic_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + edict_t ent; + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_IDLE, 0); + + if (self.oldenemy == null) { + ent = medic_FindDeadMonster(self); + if (ent != null) { + self.oldenemy = self.enemy; + self.enemy = ent; + self.enemy.owner = self; + self.monsterinfo.aiflags |= Defines.AI_MEDIC; + GameUtil.FoundTarget(self); + } + } + return true; + } + }; + + static EntInteractAdapter medic_sight = new EntInteractAdapter() { + 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 mframe_t medic_frames_stand[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, medic_idle), + 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), + 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 medic_move_stand = new mmove_t(FRAME_wait1, FRAME_wait90, + medic_frames_stand, null); + + static EntThinkAdapter medic_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = medic_move_stand; + return true; + } + }; + + static mframe_t medic_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 6.2f, null), + new mframe_t(GameAI.ai_walk, 18.1f, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 9, null), + new mframe_t(GameAI.ai_walk, 11, null), + new mframe_t(GameAI.ai_walk, 11.6f, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 9.9f, null), + new mframe_t(GameAI.ai_walk, 14, null), + new mframe_t(GameAI.ai_walk, 9.3f, null) }; + + static mmove_t medic_move_walk = new mmove_t(FRAME_walk1, FRAME_walk12, + medic_frames_walk, null); + + static EntThinkAdapter medic_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = medic_move_walk; + return true; + } + }; + + static mframe_t medic_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 18, null), + new mframe_t(GameAI.ai_run, 22.5f, null), + new mframe_t(GameAI.ai_run, 25.4f, null), + new mframe_t(GameAI.ai_run, 23.4f, null), + new mframe_t(GameAI.ai_run, 24, null), + new mframe_t(GameAI.ai_run, 35.6f, null) }; + + static mmove_t medic_move_run = new mmove_t(FRAME_run1, FRAME_run6, + medic_frames_run, null); + + static EntThinkAdapter medic_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (0 == (self.monsterinfo.aiflags & Defines.AI_MEDIC)) { + edict_t ent; + + ent = medic_FindDeadMonster(self); + if (ent != null) { + self.oldenemy = self.enemy; + self.enemy = ent; + self.enemy.owner = self; + self.monsterinfo.aiflags |= Defines.AI_MEDIC; + GameUtil.FoundTarget(self); + return true; + } + } + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = medic_move_stand; + else + self.monsterinfo.currentmove = medic_move_run; + return true; + } + }; + + static mframe_t medic_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), + 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 medic_move_pain1 = new mmove_t(FRAME_paina1, FRAME_paina8, + medic_frames_pain1, medic_run); + + static mframe_t medic_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), + 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 medic_move_pain2 = new mmove_t(FRAME_painb1, FRAME_painb15, + medic_frames_pain2, medic_run); + + static EntPainAdapter medic_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + + 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 + + if (Lib.random() < 0.5) { + self.monsterinfo.currentmove = medic_move_pain1; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + } else { + self.monsterinfo.currentmove = medic_move_pain2; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + } + } + }; + + static EntThinkAdapter medic_fire_blaster = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + int effect; + + if ((self.s.frame == FRAME_attack9) + || (self.s.frame == FRAME_attack12)) + effect = Defines.EF_BLASTER; + else if ((self.s.frame == FRAME_attack19) + || (self.s.frame == FRAME_attack22) + || (self.s.frame == FRAME_attack25) + || (self.s.frame == FRAME_attack28)) + effect = Defines.EF_HYPERBLASTER; + else + effect = 0; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[Defines.MZ2_MEDIC_BLASTER_1], + forward, right, start); + + Math3D.VectorCopy(self.enemy.s.origin, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, dir); + + Monster.monster_fire_blaster(self, start, dir, 2, 1000, + Defines.MZ2_MEDIC_BLASTER_1, effect); + return true; + } + }; + + static EntThinkAdapter medic_dead = new EntThinkAdapter() { + 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 medic_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) }; + + static mmove_t medic_move_death = new mmove_t(FRAME_death1, FRAME_death30, + medic_frames_death, medic_dead); + + static EntDieAdapter medic_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + + int n; + + // if we had a pending patient, free him up for another medic + if ((self.enemy != null) && (self.enemy.owner == self)) + self.enemy.owner = null; + + // 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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_die, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + self.monsterinfo.currentmove = medic_move_death; + } + }; + + static EntThinkAdapter medic_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter medic_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + static EntThinkAdapter medic_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t medic_frames_duck[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, medic_duck_down), + new mframe_t(GameAI.ai_move, -1, medic_duck_hold), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, medic_duck_up), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null) }; + + static mmove_t medic_move_duck = new mmove_t(FRAME_duck1, FRAME_duck16, + medic_frames_duck, medic_run); + + static EntDodgeAdapter medic_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + if (Lib.random() > 0.25) + return; + + if (self.enemy == null) + self.enemy = attacker; + + self.monsterinfo.currentmove = medic_move_duck; + } + }; + + static mframe_t medic_frames_attackHyperBlaster[] = new mframe_t[] { + 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, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster) }; + + static mmove_t medic_move_attackHyperBlaster = new mmove_t(FRAME_attack15, + FRAME_attack30, medic_frames_attackHyperBlaster, medic_run); + + static EntThinkAdapter medic_continue = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() <= 0.95) + self.monsterinfo.currentmove = medic_move_attackHyperBlaster; + return true; + } + }; + + static mframe_t medic_frames_attackBlaster[] = { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 2, 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, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, medic_fire_blaster), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, medic_continue) // Change to + // medic_continue... + // Else, go to + // frame 32 + }; + + static mmove_t medic_move_attackBlaster = new mmove_t(FRAME_attack1, + FRAME_attack14, medic_frames_attackBlaster, medic_run); + + static EntThinkAdapter medic_hook_launch = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hook_launch, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static float medic_cable_offsets[][] = { { 45.0f, -9.2f, 15.5f }, + { 48.4f, -9.7f, 15.2f }, { 47.8f, -9.8f, 15.8f }, + { 47.3f, -9.3f, 14.3f }, { 45.4f, -10.1f, 13.1f }, + { 41.9f, -12.7f, 12.0f }, { 37.8f, -15.8f, 11.2f }, + { 34.3f, -18.4f, 10.7f }, { 32.7f, -19.7f, 10.4f }, + { 32.7f, -19.7f, 10.4f } }; + + static EntThinkAdapter medic_cable_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] offset = { 0, 0, 0 }, start = { 0, 0, 0 }, end = { 0, 0, 0 }, f = { + 0, 0, 0 }, r = { 0, 0, 0 }; + trace_t tr; + float[] dir = { 0, 0, 0 }, angles = { 0, 0, 0 }; + float distance; + + if (!self.enemy.inuse) + return true; + + Math3D.AngleVectors(self.s.angles, f, r, null); + Math3D.VectorCopy( + medic_cable_offsets[self.s.frame - FRAME_attack42], offset); + Math3D.G_ProjectSource(self.s.origin, offset, f, r, start); + + // check for max distance + Math3D.VectorSubtract(start, self.enemy.s.origin, dir); + distance = Math3D.VectorLength(dir); + if (distance > 256) + return true; + + // check for min/max pitch + Math3D.vectoangles(dir, angles); + if (angles[0] < -180) + angles[0] += 360; + if (Math.abs(angles[0]) > 45) + return true; + + tr = GameBase.gi.trace(start, null, null, self.enemy.s.origin, + self, Defines.MASK_SHOT); + if (tr.fraction != 1.0 && tr.ent != self.enemy) + return true; + + if (self.s.frame == FRAME_attack43) { + GameBase.gi.sound(self.enemy, Defines.CHAN_AUTO, + sound_hook_hit, 1, Defines.ATTN_NORM, 0); + self.enemy.monsterinfo.aiflags |= Defines.AI_RESURRECTING; + } else if (self.s.frame == FRAME_attack50) { + self.enemy.spawnflags = 0; + self.enemy.monsterinfo.aiflags = 0; + self.enemy.target = null; + self.enemy.targetname = null; + self.enemy.combattarget = null; + self.enemy.deathtarget = null; + self.enemy.owner = self; + GameSpawn.ED_CallSpawn(self.enemy); + self.enemy.owner = null; + if (self.enemy.think != null) { + self.enemy.nextthink = GameBase.level.time; + self.enemy.think.think(self.enemy); + } + self.enemy.monsterinfo.aiflags |= Defines.AI_RESURRECTING; + if (self.oldenemy != null && self.oldenemy.client != null) { + self.enemy.enemy = self.oldenemy; + GameUtil.FoundTarget(self.enemy); + } + } else { + if (self.s.frame == FRAME_attack44) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, + sound_hook_heal, 1, Defines.ATTN_NORM, 0); + } + + // adjust start for beam origin being in middle of a segment + Math3D.VectorMA(start, 8, f, start); + + // adjust end z for end spot since the monster is currently dead + Math3D.VectorCopy(self.enemy.s.origin, end); + end[2] = self.enemy.absmin[2] + self.enemy.size[2] / 2; + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_MEDIC_CABLE_ATTACK); + GameBase.gi.WriteShort(self.index); + GameBase.gi.WritePosition(start); + GameBase.gi.WritePosition(end); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + return true; + } + }; + + static EntThinkAdapter medic_hook_retract = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hook_retract, 1, + Defines.ATTN_NORM, 0); + self.enemy.monsterinfo.aiflags &= ~Defines.AI_RESURRECTING; + return true; + } + }; + + static mframe_t medic_frames_attackCable[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 4.4f, null), + new mframe_t(GameAI.ai_charge, 4.7f, null), + new mframe_t(GameAI.ai_charge, 5, null), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_move, 0, medic_hook_launch), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, 0, medic_cable_attack), + new mframe_t(GameAI.ai_move, -15, medic_hook_retract), + new mframe_t(GameAI.ai_move, -1.5f, null), + new mframe_t(GameAI.ai_move, -1.2f, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 0.3f, null), + new mframe_t(GameAI.ai_move, 0.7f, null), + new mframe_t(GameAI.ai_move, 1.2f, null), + new mframe_t(GameAI.ai_move, 1.3f, null) }; + + static mmove_t medic_move_attackCable = new mmove_t(FRAME_attack33, + FRAME_attack60, medic_frames_attackCable, medic_run); + + static EntThinkAdapter medic_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_MEDIC) != 0) + self.monsterinfo.currentmove = medic_move_attackCable; + else + self.monsterinfo.currentmove = medic_move_attackBlaster; + return true; + } + }; + + static EntThinkAdapter medic_checkattack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_MEDIC) != 0) { + medic_attack.think(self); + return true; + } + + return GameUtil.M_CheckAttack.think(self); + + } + }; + + /* + * QUAKED monster_medic (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static void SP_monster_medic(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return; + } + + sound_idle1 = GameBase.gi.soundindex("medic/idle.wav"); + sound_pain1 = GameBase.gi.soundindex("medic/medpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("medic/medpain2.wav"); + sound_die = GameBase.gi.soundindex("medic/meddeth1.wav"); + sound_sight = GameBase.gi.soundindex("medic/medsght1.wav"); + sound_search = GameBase.gi.soundindex("medic/medsrch1.wav"); + sound_hook_launch = GameBase.gi.soundindex("medic/medatck2.wav"); + sound_hook_hit = GameBase.gi.soundindex("medic/medatck3.wav"); + sound_hook_heal = GameBase.gi.soundindex("medic/medatck4.wav"); + sound_hook_retract = GameBase.gi.soundindex("medic/medatck5.wav"); + + GameBase.gi.soundindex("medic/medatck1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/medic/tris.md2"); + Math3D.VectorSet(self.mins, -24, -24, -24); + Math3D.VectorSet(self.maxs, 24, 24, 32); + + self.health = 300; + self.gib_health = -130; + self.mass = 400; + + self.pain = medic_pain; + self.die = medic_die; + + self.monsterinfo.stand = medic_stand; + self.monsterinfo.walk = medic_walk; + self.monsterinfo.run = medic_run; + self.monsterinfo.dodge = medic_dodge; + self.monsterinfo.attack = medic_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = medic_sight; + self.monsterinfo.idle = medic_idle; + self.monsterinfo.search = medic_search; + self.monsterinfo.checkattack = medic_checkattack; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = medic_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Mutant.java b/src/jake2/game/monsters/M_Mutant.java new file mode 100644 index 0000000..5fba33b --- /dev/null +++ b/src/jake2/game/monsters/M_Mutant.java @@ -0,0 +1,1051 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Mutant.java,v 1.2 2005-02-06 18:48:17 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.client.M; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.EntTouchAdapter; +import jake2.game.Fire; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.cplane_t; +import jake2.game.csurface_t; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Mutant { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_attack01 = 0; + + public final static int FRAME_attack02 = 1; + + public final static int FRAME_attack03 = 2; + + public final static int FRAME_attack04 = 3; + + public final static int FRAME_attack05 = 4; + + public final static int FRAME_attack06 = 5; + + public final static int FRAME_attack07 = 6; + + public final static int FRAME_attack08 = 7; + + public final static int FRAME_attack09 = 8; + + public final static int FRAME_attack10 = 9; + + public final static int FRAME_attack11 = 10; + + public final static int FRAME_attack12 = 11; + + public final static int FRAME_attack13 = 12; + + public final static int FRAME_attack14 = 13; + + public final static int FRAME_attack15 = 14; + + public final static int FRAME_death101 = 15; + + public final static int FRAME_death102 = 16; + + public final static int FRAME_death103 = 17; + + public final static int FRAME_death104 = 18; + + public final static int FRAME_death105 = 19; + + public final static int FRAME_death106 = 20; + + public final static int FRAME_death107 = 21; + + public final static int FRAME_death108 = 22; + + public final static int FRAME_death109 = 23; + + public final static int FRAME_death201 = 24; + + public final static int FRAME_death202 = 25; + + public final static int FRAME_death203 = 26; + + public final static int FRAME_death204 = 27; + + public final static int FRAME_death205 = 28; + + public final static int FRAME_death206 = 29; + + public final static int FRAME_death207 = 30; + + public final static int FRAME_death208 = 31; + + public final static int FRAME_death209 = 32; + + public final static int FRAME_death210 = 33; + + public final static int FRAME_pain101 = 34; + + public final static int FRAME_pain102 = 35; + + public final static int FRAME_pain103 = 36; + + public final static int FRAME_pain104 = 37; + + public final static int FRAME_pain105 = 38; + + public final static int FRAME_pain201 = 39; + + public final static int FRAME_pain202 = 40; + + public final static int FRAME_pain203 = 41; + + public final static int FRAME_pain204 = 42; + + public final static int FRAME_pain205 = 43; + + public final static int FRAME_pain206 = 44; + + public final static int FRAME_pain301 = 45; + + public final static int FRAME_pain302 = 46; + + public final static int FRAME_pain303 = 47; + + public final static int FRAME_pain304 = 48; + + public final static int FRAME_pain305 = 49; + + public final static int FRAME_pain306 = 50; + + public final static int FRAME_pain307 = 51; + + public final static int FRAME_pain308 = 52; + + public final static int FRAME_pain309 = 53; + + public final static int FRAME_pain310 = 54; + + public final static int FRAME_pain311 = 55; + + public final static int FRAME_run03 = 56; + + public final static int FRAME_run04 = 57; + + public final static int FRAME_run05 = 58; + + public final static int FRAME_run06 = 59; + + public final static int FRAME_run07 = 60; + + public final static int FRAME_run08 = 61; + + public final static int FRAME_stand101 = 62; + + public final static int FRAME_stand102 = 63; + + public final static int FRAME_stand103 = 64; + + public final static int FRAME_stand104 = 65; + + public final static int FRAME_stand105 = 66; + + public final static int FRAME_stand106 = 67; + + public final static int FRAME_stand107 = 68; + + public final static int FRAME_stand108 = 69; + + public final static int FRAME_stand109 = 70; + + public final static int FRAME_stand110 = 71; + + public final static int FRAME_stand111 = 72; + + public final static int FRAME_stand112 = 73; + + public final static int FRAME_stand113 = 74; + + public final static int FRAME_stand114 = 75; + + public final static int FRAME_stand115 = 76; + + public final static int FRAME_stand116 = 77; + + public final static int FRAME_stand117 = 78; + + public final static int FRAME_stand118 = 79; + + public final static int FRAME_stand119 = 80; + + public final static int FRAME_stand120 = 81; + + public final static int FRAME_stand121 = 82; + + public final static int FRAME_stand122 = 83; + + public final static int FRAME_stand123 = 84; + + public final static int FRAME_stand124 = 85; + + public final static int FRAME_stand125 = 86; + + public final static int FRAME_stand126 = 87; + + public final static int FRAME_stand127 = 88; + + public final static int FRAME_stand128 = 89; + + public final static int FRAME_stand129 = 90; + + public final static int FRAME_stand130 = 91; + + public final static int FRAME_stand131 = 92; + + public final static int FRAME_stand132 = 93; + + public final static int FRAME_stand133 = 94; + + public final static int FRAME_stand134 = 95; + + public final static int FRAME_stand135 = 96; + + public final static int FRAME_stand136 = 97; + + public final static int FRAME_stand137 = 98; + + public final static int FRAME_stand138 = 99; + + public final static int FRAME_stand139 = 100; + + public final static int FRAME_stand140 = 101; + + public final static int FRAME_stand141 = 102; + + public final static int FRAME_stand142 = 103; + + public final static int FRAME_stand143 = 104; + + public final static int FRAME_stand144 = 105; + + public final static int FRAME_stand145 = 106; + + public final static int FRAME_stand146 = 107; + + public final static int FRAME_stand147 = 108; + + public final static int FRAME_stand148 = 109; + + public final static int FRAME_stand149 = 110; + + public final static int FRAME_stand150 = 111; + + public final static int FRAME_stand151 = 112; + + public final static int FRAME_stand152 = 113; + + public final static int FRAME_stand153 = 114; + + public final static int FRAME_stand154 = 115; + + public final static int FRAME_stand155 = 116; + + public final static int FRAME_stand156 = 117; + + public final static int FRAME_stand157 = 118; + + public final static int FRAME_stand158 = 119; + + public final static int FRAME_stand159 = 120; + + public final static int FRAME_stand160 = 121; + + public final static int FRAME_stand161 = 122; + + public final static int FRAME_stand162 = 123; + + public final static int FRAME_stand163 = 124; + + public final static int FRAME_stand164 = 125; + + public final static int FRAME_walk01 = 126; + + public final static int FRAME_walk02 = 127; + + public final static int FRAME_walk03 = 128; + + public final static int FRAME_walk04 = 129; + + public final static int FRAME_walk05 = 130; + + public final static int FRAME_walk06 = 131; + + public final static int FRAME_walk07 = 132; + + public final static int FRAME_walk08 = 133; + + public final static int FRAME_walk09 = 134; + + public final static int FRAME_walk10 = 135; + + public final static int FRAME_walk11 = 136; + + public final static int FRAME_walk12 = 137; + + public final static int FRAME_walk13 = 138; + + public final static int FRAME_walk14 = 139; + + public final static int FRAME_walk15 = 140; + + public final static int FRAME_walk16 = 141; + + public final static int FRAME_walk17 = 142; + + public final static int FRAME_walk18 = 143; + + public final static int FRAME_walk19 = 144; + + public final static int FRAME_walk20 = 145; + + public final static int FRAME_walk21 = 146; + + public final static int FRAME_walk22 = 147; + + public final static int FRAME_walk23 = 148; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_swing; + + static int sound_hit; + + static int sound_hit2; + + static int sound_death; + + static int sound_idle; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_sight; + + static int sound_search; + + static int sound_step1; + + static int sound_step2; + + static int sound_step3; + + static int sound_thud; + + // + // SOUNDS + // + static EntThinkAdapter mutant_step = new EntThinkAdapter() { + public boolean think(edict_t self) { + int n; + n = (Lib.rand() + 1) % 3; + if (n == 0) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step1, 1, + Defines.ATTN_NORM, 0); + else if (n == 1) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step2, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_step3, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntInteractAdapter mutant_sight = new EntInteractAdapter() { + 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 EntThinkAdapter mutant_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_search, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter mutant_swing = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_swing, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + // + // STAND + // + + static mframe_t mutant_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), + // 10) + + 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), + // 20) + + 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), + // 30) + + 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), + // 40) + + 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), + // 50) + + new mframe_t(GameAI.ai_stand, 0, null) }; + + static mmove_t mutant_move_stand = new mmove_t(FRAME_stand101, + FRAME_stand151, mutant_frames_stand, null); + + static EntThinkAdapter mutant_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = mutant_move_stand; + return true; + } + }; + + // + // IDLE + // + + static EntThinkAdapter mutant_idle_loop = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() < 0.75) + self.monsterinfo.nextframe = FRAME_stand155; + return true; + } + }; + + static mframe_t mutant_frames_idle[] = 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), + // scratch loop start + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, mutant_idle_loop), + // scratch loop end + 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 mutant_move_idle = new mmove_t(FRAME_stand152, + FRAME_stand164, mutant_frames_idle, mutant_stand); + + static EntThinkAdapter mutant_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = mutant_move_idle; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + // + // WALK + // + + static mframe_t mutant_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 13, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 16, null), + new mframe_t(GameAI.ai_walk, 15, null), + new mframe_t(GameAI.ai_walk, 6, null) }; + + static mmove_t mutant_move_walk = new mmove_t(FRAME_walk05, FRAME_walk16, + mutant_frames_walk, null); + + static EntThinkAdapter mutant_walk_loop = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = mutant_move_walk; + return true; + } + }; + + static mframe_t mutant_frames_start_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, -2, null), + new mframe_t(GameAI.ai_walk, 1, null) }; + + static mmove_t mutant_move_start_walk = new mmove_t(FRAME_walk01, + FRAME_walk04, mutant_frames_start_walk, mutant_walk_loop); + + static EntThinkAdapter mutant_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = mutant_move_start_walk; + return true; + } + }; + + // + // RUN + // + + static mframe_t mutant_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 40, null), + new mframe_t(GameAI.ai_run, 40, mutant_step), + new mframe_t(GameAI.ai_run, 24, null), + new mframe_t(GameAI.ai_run, 5, mutant_step), + new mframe_t(GameAI.ai_run, 17, null), + new mframe_t(GameAI.ai_run, 10, null) }; + + static mmove_t mutant_move_run = new mmove_t(FRAME_run03, FRAME_run08, + mutant_frames_run, null); + + static EntThinkAdapter mutant_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = mutant_move_stand; + else + self.monsterinfo.currentmove = mutant_move_run; + + return true; + } + }; + + // + // MELEE + // + + static EntThinkAdapter mutant_hit_left = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 8); + if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_swing, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter mutant_hit_right = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] aim = { 0, 0, 0 }; + + Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.maxs[0], 8); + if (Fire.fire_hit(self, aim, (10 + (Lib.rand() % 5)), 100)) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_hit2, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_swing, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter mutant_check_refire = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (null == self.enemy || !self.enemy.inuse + || self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) + || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = FRAME_attack09; + return true; + } + }; + + static mframe_t mutant_frames_attack[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, mutant_hit_left), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, mutant_hit_right), + new mframe_t(GameAI.ai_charge, 0, mutant_check_refire) }; + + static mmove_t mutant_move_attack = new mmove_t(FRAME_attack09, + FRAME_attack15, mutant_frames_attack, mutant_run); + + static EntThinkAdapter mutant_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = mutant_move_attack; + return true; + } + }; + + // + // ATTACK + // + + static EntTouchAdapter mutant_jump_touch = new EntTouchAdapter() { + + public void touch(edict_t self, edict_t other, cplane_t plane, + csurface_t surf) { + if (self.health <= 0) { + self.touch = null; + return; + } + + if (other.takedamage != 0) { + if (Math3D.VectorLength(self.velocity) > 400) { + float[] point = { 0, 0, 0 }; + float[] normal = { 0, 0, 0 }; + int damage; + + Math3D.VectorCopy(self.velocity, normal); + Math3D.VectorNormalize(normal); + Math3D.VectorMA(self.s.origin, self.maxs[0], normal, point); + damage = (int) (40 + 10 * Lib.random()); + GameUtil.T_Damage(other, self, self, self.velocity, point, + normal, damage, damage, 0, Defines.MOD_UNKNOWN); + } + } + + if (!M.M_CheckBottom(self)) { + if (self.groundentity != null) { + self.monsterinfo.nextframe = FRAME_attack02; + self.touch = null; + } + return; + } + + self.touch = null; + } + }; + + static EntThinkAdapter mutant_jump_takeoff = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] forward = { 0, 0, 0 }; + + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1, + Defines.ATTN_NORM, 0); + Math3D.AngleVectors(self.s.angles, forward, null, null); + self.s.origin[2] += 1; + Math3D.VectorScale(forward, 600, self.velocity); + self.velocity[2] = 250; + self.groundentity = null; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.monsterinfo.attack_finished = GameBase.level.time + 3; + self.touch = mutant_jump_touch; + return true; + } + }; + + static EntThinkAdapter mutant_check_landing = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.groundentity != null) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_thud, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.attack_finished = 0; + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + return true; + } + + if (GameBase.level.time > self.monsterinfo.attack_finished) + self.monsterinfo.nextframe = FRAME_attack02; + else + self.monsterinfo.nextframe = FRAME_attack05; + return true; + } + }; + + static mframe_t mutant_frames_jump[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 17, null), + new mframe_t(GameAI.ai_charge, 15, mutant_jump_takeoff), + new mframe_t(GameAI.ai_charge, 15, null), + new mframe_t(GameAI.ai_charge, 15, mutant_check_landing), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t mutant_move_jump = new mmove_t(FRAME_attack01, + FRAME_attack08, mutant_frames_jump, mutant_run); + + static EntThinkAdapter mutant_jump = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.monsterinfo.currentmove = mutant_move_jump; + return true; + } + }; + + // + // CHECKATTACK + // + static EntThinkAdapter mutant_check_melee = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE) + return true; + return false; + + } + }; + + static EntThinkAdapter mutant_check_jump = new EntThinkAdapter() { + public boolean think(edict_t self) { + + float[] v = { 0, 0, 0 }; + float distance; + + if (self.absmin[2] > (self.enemy.absmin[2] + 0.75 * self.enemy.size[2])) + return false; + + if (self.absmax[2] < (self.enemy.absmin[2] + 0.25 * self.enemy.size[2])) + return false; + + v[0] = self.s.origin[0] - self.enemy.s.origin[0]; + v[1] = self.s.origin[1] - self.enemy.s.origin[1]; + v[2] = 0; + distance = Math3D.VectorLength(v); + + if (distance < 100) + return false; + if (distance > 100) { + if (Lib.random() < 0.9) + return false; + } + + return true; + } + }; + + static EntThinkAdapter mutant_checkattack = new EntThinkAdapter() { + public boolean think(edict_t self) { + + if (null == self.enemy || self.enemy.health <= 0) + return false; + + if (mutant_check_melee.think(self)) { + self.monsterinfo.attack_state = Defines.AS_MELEE; + return true; + } + + if (mutant_check_jump.think(self)) { + self.monsterinfo.attack_state = Defines.AS_MISSILE; + // FIXME play a jump sound here + return true; + } + + return false; + } + }; + + // + // PAIN + // + + static mframe_t mutant_frames_pain1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -8, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 5, null) }; + + static mmove_t mutant_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain105, mutant_frames_pain1, mutant_run); + + static mframe_t mutant_frames_pain2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -24, null), + new mframe_t(GameAI.ai_move, 11, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 6, null), + new mframe_t(GameAI.ai_move, 4, null) }; + + static mmove_t mutant_move_pain2 = new mmove_t(FRAME_pain201, + FRAME_pain206, mutant_frames_pain2, mutant_run); + + static mframe_t mutant_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -22, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 6, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 1, null) }; + + static mmove_t mutant_move_pain3 = new mmove_t(FRAME_pain301, + FRAME_pain311, mutant_frames_pain3, mutant_run); + + static EntPainAdapter mutant_pain = new EntPainAdapter() { + 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 = mutant_move_pain1; + } else if (r < 0.66) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = mutant_move_pain2; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = mutant_move_pain3; + } + } + }; + + // + // DEATH + // + static EntThinkAdapter mutant_dead = new EntThinkAdapter() { + 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; + GameBase.gi.linkentity(self); + + M.M_FlyCheck.think(self); + return true; + } + }; + + static mframe_t mutant_frames_death1[] = 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 mutant_move_death1 = new mmove_t(FRAME_death101, + FRAME_death109, mutant_frames_death1, mutant_dead); + + static mframe_t mutant_frames_death2[] = 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) }; + + static mmove_t mutant_move_death2 = new mmove_t(FRAME_death201, + FRAME_death210, mutant_frames_death2, mutant_dead); + + static EntDieAdapter mutant_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + int n; + + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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; + + 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.s.skinnum = 1; + + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = mutant_move_death1; + else + self.monsterinfo.currentmove = mutant_move_death2; + } + }; + + // + // SPAWN + // + + /* + * QUAKED monster_mutant (1 .5 0) (-32 -32 -24) (32 32 32) Ambush + * Trigger_Spawn Sight + */ + public static EntThinkAdapter SP_monster_mutant = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return false; + } + + sound_swing = GameBase.gi.soundindex("mutant/mutatck1.wav"); + sound_hit = GameBase.gi.soundindex("mutant/mutatck2.wav"); + sound_hit2 = GameBase.gi.soundindex("mutant/mutatck3.wav"); + sound_death = GameBase.gi.soundindex("mutant/mutdeth1.wav"); + sound_idle = GameBase.gi.soundindex("mutant/mutidle1.wav"); + sound_pain1 = GameBase.gi.soundindex("mutant/mutpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("mutant/mutpain2.wav"); + sound_sight = GameBase.gi.soundindex("mutant/mutsght1.wav"); + sound_search = GameBase.gi.soundindex("mutant/mutsrch1.wav"); + sound_step1 = GameBase.gi.soundindex("mutant/step1.wav"); + sound_step2 = GameBase.gi.soundindex("mutant/step2.wav"); + sound_step3 = GameBase.gi.soundindex("mutant/step3.wav"); + sound_thud = GameBase.gi.soundindex("mutant/thud1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/mutant/tris.md2"); + Math3D.VectorSet(self.mins, -32, -32, -24); + Math3D.VectorSet(self.maxs, 32, 32, 48); + + self.health = 300; + self.gib_health = -120; + self.mass = 300; + + self.pain = mutant_pain; + self.die = mutant_die; + + self.monsterinfo.stand = mutant_stand; + self.monsterinfo.walk = mutant_walk; + self.monsterinfo.run = mutant_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = mutant_jump; + self.monsterinfo.melee = mutant_melee; + self.monsterinfo.sight = mutant_sight; + self.monsterinfo.search = mutant_search; + self.monsterinfo.idle = mutant_idle; + self.monsterinfo.checkattack = mutant_checkattack; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = mutant_move_stand; + + self.monsterinfo.scale = MODEL_SCALE; + GameAI.walkmonster_start.think(self); + return true; + } + }; +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Parasite.java b/src/jake2/game/monsters/M_Parasite.java new file mode 100644 index 0000000..34859f6 --- /dev/null +++ b/src/jake2/game/monsters/M_Parasite.java @@ -0,0 +1,852 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Parasite.java,v 1.2 2005-02-06 18:48:16 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.Globals; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.game.trace_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Parasite { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_break01 = 0; + + public final static int FRAME_break02 = 1; + + public final static int FRAME_break03 = 2; + + public final static int FRAME_break04 = 3; + + public final static int FRAME_break05 = 4; + + public final static int FRAME_break06 = 5; + + public final static int FRAME_break07 = 6; + + public final static int FRAME_break08 = 7; + + public final static int FRAME_break09 = 8; + + public final static int FRAME_break10 = 9; + + public final static int FRAME_break11 = 10; + + public final static int FRAME_break12 = 11; + + public final static int FRAME_break13 = 12; + + public final static int FRAME_break14 = 13; + + public final static int FRAME_break15 = 14; + + public final static int FRAME_break16 = 15; + + public final static int FRAME_break17 = 16; + + public final static int FRAME_break18 = 17; + + public final static int FRAME_break19 = 18; + + public final static int FRAME_break20 = 19; + + public final static int FRAME_break21 = 20; + + public final static int FRAME_break22 = 21; + + public final static int FRAME_break23 = 22; + + public final static int FRAME_break24 = 23; + + public final static int FRAME_break25 = 24; + + public final static int FRAME_break26 = 25; + + public final static int FRAME_break27 = 26; + + public final static int FRAME_break28 = 27; + + public final static int FRAME_break29 = 28; + + public final static int FRAME_break30 = 29; + + public final static int FRAME_break31 = 30; + + public final static int FRAME_break32 = 31; + + public final static int FRAME_death101 = 32; + + public final static int FRAME_death102 = 33; + + public final static int FRAME_death103 = 34; + + public final static int FRAME_death104 = 35; + + public final static int FRAME_death105 = 36; + + public final static int FRAME_death106 = 37; + + public final static int FRAME_death107 = 38; + + public final static int FRAME_drain01 = 39; + + public final static int FRAME_drain02 = 40; + + public final static int FRAME_drain03 = 41; + + public final static int FRAME_drain04 = 42; + + public final static int FRAME_drain05 = 43; + + public final static int FRAME_drain06 = 44; + + public final static int FRAME_drain07 = 45; + + public final static int FRAME_drain08 = 46; + + public final static int FRAME_drain09 = 47; + + public final static int FRAME_drain10 = 48; + + public final static int FRAME_drain11 = 49; + + public final static int FRAME_drain12 = 50; + + public final static int FRAME_drain13 = 51; + + public final static int FRAME_drain14 = 52; + + public final static int FRAME_drain15 = 53; + + public final static int FRAME_drain16 = 54; + + public final static int FRAME_drain17 = 55; + + public final static int FRAME_drain18 = 56; + + public final static int FRAME_pain101 = 57; + + public final static int FRAME_pain102 = 58; + + public final static int FRAME_pain103 = 59; + + public final static int FRAME_pain104 = 60; + + public final static int FRAME_pain105 = 61; + + public final static int FRAME_pain106 = 62; + + public final static int FRAME_pain107 = 63; + + public final static int FRAME_pain108 = 64; + + public final static int FRAME_pain109 = 65; + + public final static int FRAME_pain110 = 66; + + public final static int FRAME_pain111 = 67; + + public final static int FRAME_run01 = 68; + + public final static int FRAME_run02 = 69; + + public final static int FRAME_run03 = 70; + + public final static int FRAME_run04 = 71; + + public final static int FRAME_run05 = 72; + + public final static int FRAME_run06 = 73; + + public final static int FRAME_run07 = 74; + + public final static int FRAME_run08 = 75; + + public final static int FRAME_run09 = 76; + + public final static int FRAME_run10 = 77; + + public final static int FRAME_run11 = 78; + + public final static int FRAME_run12 = 79; + + public final static int FRAME_run13 = 80; + + public final static int FRAME_run14 = 81; + + public final static int FRAME_run15 = 82; + + public final static int FRAME_stand01 = 83; + + public final static int FRAME_stand02 = 84; + + public final static int FRAME_stand03 = 85; + + public final static int FRAME_stand04 = 86; + + public final static int FRAME_stand05 = 87; + + public final static int FRAME_stand06 = 88; + + public final static int FRAME_stand07 = 89; + + public final static int FRAME_stand08 = 90; + + public final static int FRAME_stand09 = 91; + + public final static int FRAME_stand10 = 92; + + public final static int FRAME_stand11 = 93; + + public final static int FRAME_stand12 = 94; + + public final static int FRAME_stand13 = 95; + + public final static int FRAME_stand14 = 96; + + public final static int FRAME_stand15 = 97; + + public final static int FRAME_stand16 = 98; + + public final static int FRAME_stand17 = 99; + + public final static int FRAME_stand18 = 100; + + public final static int FRAME_stand19 = 101; + + public final static int FRAME_stand20 = 102; + + public final static int FRAME_stand21 = 103; + + public final static int FRAME_stand22 = 104; + + public final static int FRAME_stand23 = 105; + + public final static int FRAME_stand24 = 106; + + public final static int FRAME_stand25 = 107; + + public final static int FRAME_stand26 = 108; + + public final static int FRAME_stand27 = 109; + + public final static int FRAME_stand28 = 110; + + public final static int FRAME_stand29 = 111; + + public final static int FRAME_stand30 = 112; + + public final static int FRAME_stand31 = 113; + + public final static int FRAME_stand32 = 114; + + public final static int FRAME_stand33 = 115; + + public final static int FRAME_stand34 = 116; + + public final static int FRAME_stand35 = 117; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_pain1; + + static int sound_pain2; + + static int sound_die; + + static int sound_launch; + + static int sound_impact; + + static int sound_suck; + + static int sound_reelin; + + static int sound_sight; + + static int sound_tap; + + static int sound_scratch; + + static int sound_search; + + static EntThinkAdapter parasite_launch = new EntThinkAdapter() { + public boolean think(edict_t self) { + + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_launch, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter parasite_reel_in = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_reelin, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntInteractAdapter parasite_sight = new EntInteractAdapter() { + public boolean interact(edict_t self, edict_t other) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_sight, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter parasite_tap = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_tap, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter parasite_scratch = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_scratch, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter parasite_search = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_search, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter parasite_start_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_start_walk; + return true; + } + }; + + static EntThinkAdapter parasite_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_walk; + return true; + } + }; + + static EntThinkAdapter parasite_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_stand; + return true; + } + }; + + static EntThinkAdapter parasite_end_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_end_fidget; + return true; + } + }; + + static EntThinkAdapter parasite_do_fidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_fidget; + return true; + } + }; + + static EntThinkAdapter parasite_refidget = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() <= 0.8) + self.monsterinfo.currentmove = parasite_move_fidget; + else + self.monsterinfo.currentmove = parasite_move_end_fidget; + return true; + } + }; + + static EntThinkAdapter parasite_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = parasite_move_start_fidget; + return true; + } + }; + + static EntThinkAdapter parasite_start_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = parasite_move_stand; + else + self.monsterinfo.currentmove = parasite_move_start_run; + return true; + } + }; + + static EntThinkAdapter parasite_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) + self.monsterinfo.currentmove = parasite_move_stand; + else + self.monsterinfo.currentmove = parasite_move_run; + return true; + } + }; + + static mframe_t parasite_frames_start_fidget[] = 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) }; + + static mmove_t parasite_move_start_fidget = new mmove_t(FRAME_stand18, + FRAME_stand21, parasite_frames_start_fidget, parasite_do_fidget); + + static mframe_t parasite_frames_fidget[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, parasite_scratch), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, parasite_scratch), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, null) }; + + static mmove_t parasite_move_fidget = new mmove_t(FRAME_stand22, + FRAME_stand27, parasite_frames_fidget, parasite_refidget); + + static mframe_t parasite_frames_end_fidget[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, parasite_scratch), + 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 parasite_move_end_fidget = new mmove_t(FRAME_stand28, + FRAME_stand35, parasite_frames_end_fidget, parasite_stand); + + static mframe_t parasite_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, parasite_tap), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, parasite_tap), + 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, parasite_tap), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, parasite_tap), + 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, parasite_tap), + new mframe_t(GameAI.ai_stand, 0, null), + new mframe_t(GameAI.ai_stand, 0, parasite_tap) }; + + static mmove_t parasite_move_stand = new mmove_t(FRAME_stand01, + FRAME_stand17, parasite_frames_stand, parasite_stand); + + static mframe_t parasite_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 30, null), + new mframe_t(GameAI.ai_run, 30, null), + new mframe_t(GameAI.ai_run, 22, null), + new mframe_t(GameAI.ai_run, 19, null), + new mframe_t(GameAI.ai_run, 24, null), + new mframe_t(GameAI.ai_run, 28, null), + new mframe_t(GameAI.ai_run, 25, null) }; + + static mmove_t parasite_move_run = new mmove_t(FRAME_run03, FRAME_run09, + parasite_frames_run, null); + + static mframe_t parasite_frames_start_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 30, null), }; + + static mmove_t parasite_move_start_run = new mmove_t(FRAME_run01, + FRAME_run02, parasite_frames_start_run, parasite_run); + + static mframe_t parasite_frames_stop_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 20, null), + new mframe_t(GameAI.ai_run, 20, null), + new mframe_t(GameAI.ai_run, 12, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 0, null) }; + + static mmove_t parasite_move_stop_run = new mmove_t(FRAME_run10, + FRAME_run15, parasite_frames_stop_run, null); + + static mframe_t parasite_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 30, null), + new mframe_t(GameAI.ai_walk, 30, null), + new mframe_t(GameAI.ai_walk, 22, null), + new mframe_t(GameAI.ai_walk, 19, null), + new mframe_t(GameAI.ai_walk, 24, null), + new mframe_t(GameAI.ai_walk, 28, null), + new mframe_t(GameAI.ai_walk, 25, null) }; + + static mmove_t parasite_move_walk = new mmove_t(FRAME_run03, FRAME_run09, + parasite_frames_walk, parasite_walk); + + static mframe_t parasite_frames_start_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 30, parasite_walk) }; + + static mmove_t parasite_move_start_walk = new mmove_t(FRAME_run01, + FRAME_run02, parasite_frames_start_walk, null); + + static mframe_t parasite_frames_stop_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 20, null), + new mframe_t(GameAI.ai_walk, 20, null), + new mframe_t(GameAI.ai_walk, 12, null), + new mframe_t(GameAI.ai_walk, 10, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null) }; + + static mmove_t parasite_move_stop_walk = new mmove_t(FRAME_run10, + FRAME_run15, parasite_frames_stop_walk, null); + + static mframe_t parasite_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), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 6, null), + new mframe_t(GameAI.ai_move, 16, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -7, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t parasite_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain111, parasite_frames_pain1, parasite_start_run); + + static EntPainAdapter parasite_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + 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 + + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + + self.monsterinfo.currentmove = parasite_move_pain1; + } + }; + + static EntThinkAdapter parasite_drain_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] offset = { 0, 0, 0 }, start = { 0, 0, 0 }, f = { 0, 0, 0 }, r = { + 0, 0, 0 }, end = { 0, 0, 0 }, dir = { 0, 0, 0 }; + trace_t tr; + int damage; + + Math3D.AngleVectors(self.s.angles, f, r, null); + Math3D.VectorSet(offset, 24, 0, 6); + Math3D.G_ProjectSource(self.s.origin, offset, f, r, start); + + Math3D.VectorCopy(self.enemy.s.origin, end); + if (!parasite_drain_attack_ok(start, end)) { + end[2] = self.enemy.s.origin[2] + self.enemy.maxs[2] - 8; + if (!parasite_drain_attack_ok(start, end)) { + end[2] = self.enemy.s.origin[2] + self.enemy.mins[2] + 8; + if (!parasite_drain_attack_ok(start, end)) + return true; + } + } + Math3D.VectorCopy(self.enemy.s.origin, end); + + tr = GameBase.gi.trace(start, null, null, end, self, + Defines.MASK_SHOT); + if (tr.ent != self.enemy) + return true; + + if (self.s.frame == FRAME_drain03) { + damage = 5; + GameBase.gi.sound(self.enemy, Defines.CHAN_AUTO, sound_impact, + 1, Defines.ATTN_NORM, 0); + } else { + if (self.s.frame == FRAME_drain04) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_suck, 1, + Defines.ATTN_NORM, 0); + damage = 2; + } + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_PARASITE_ATTACK); + //gi.WriteShort(self - g_edicts); + GameBase.gi.WriteShort(self.index); + GameBase.gi.WritePosition(start); + GameBase.gi.WritePosition(end); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + + Math3D.VectorSubtract(start, end, dir); + GameUtil.T_Damage(self.enemy, self, self, dir, self.enemy.s.origin, + Globals.vec3_origin, damage, 0, + Defines.DAMAGE_NO_KNOCKBACK, Defines.MOD_UNKNOWN); + return true; + } + }; + + static mframe_t parasite_frames_drain[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, parasite_launch), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 15, parasite_drain_attack), + // Target hits) + new mframe_t(GameAI.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, -3, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, -2, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, 0, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, -1, parasite_drain_attack), // drain) + new mframe_t(GameAI.ai_charge, 0, parasite_reel_in), // let go) + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t parasite_move_drain = new mmove_t(FRAME_drain01, + FRAME_drain18, parasite_frames_drain, parasite_start_run); + + static mframe_t parasite_frames_break[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 2, null), + new mframe_t(GameAI.ai_charge, -3, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -18, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 9, null), + new mframe_t(GameAI.ai_charge, 6, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -18, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 8, null), + new mframe_t(GameAI.ai_charge, 9, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -18, 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), + /* airborne */ + new mframe_t(GameAI.ai_charge, 0, null), /* slides */ + new mframe_t(GameAI.ai_charge, 0, null), /* slides */ + new mframe_t(GameAI.ai_charge, 0, null), /* slides */ + new mframe_t(GameAI.ai_charge, 0, null), /* slides */ + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 11, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -5, null), + new mframe_t(GameAI.ai_charge, 1, null) }; + + static mmove_t parasite_move_break = new mmove_t(FRAME_break01, + FRAME_break32, parasite_frames_break, parasite_start_run); + + /* + * === Break Stuff Ends === + */ + + static EntThinkAdapter parasite_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + // if (random() <= 0.2) + // self.monsterinfo.currentmove = ¶site_move_break; + // else + self.monsterinfo.currentmove = parasite_move_drain; + return true; + } + }; + + /* + * === Death Stuff Starts === + */ + + static EntThinkAdapter parasite_dead = new EntThinkAdapter() { + 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 parasite_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) }; + + static mmove_t parasite_move_death = new mmove_t(FRAME_death101, + FRAME_death107, parasite_frames_death, parasite_dead); + + static EntDieAdapter parasite_die = new EntDieAdapter() { + 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++) + GameAI.ThrowGib(self, "models/objects/gibs/bone/tris.md2", + damage, Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.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_die, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.currentmove = parasite_move_death; + } + }; + + /* + * === End Death Stuff === + */ + + /* + * QUAKED monster_parasite (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + + public static EntThinkAdapter SP_monster_parasite = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + sound_pain1 = GameBase.gi.soundindex("parasite/parpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("parasite/parpain2.wav"); + sound_die = GameBase.gi.soundindex("parasite/pardeth1.wav"); + sound_launch = GameBase.gi.soundindex("parasite/paratck1.wav"); + sound_impact = GameBase.gi.soundindex("parasite/paratck2.wav"); + sound_suck = GameBase.gi.soundindex("parasite/paratck3.wav"); + sound_reelin = GameBase.gi.soundindex("parasite/paratck4.wav"); + sound_sight = GameBase.gi.soundindex("parasite/parsght1.wav"); + sound_tap = GameBase.gi.soundindex("parasite/paridle1.wav"); + sound_scratch = GameBase.gi.soundindex("parasite/paridle2.wav"); + sound_search = GameBase.gi.soundindex("parasite/parsrch1.wav"); + + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/parasite/tris.md2"); + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 24); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + self.health = 175; + self.gib_health = -50; + self.mass = 250; + + self.pain = parasite_pain; + self.die = parasite_die; + + self.monsterinfo.stand = parasite_stand; + self.monsterinfo.walk = parasite_start_walk; + self.monsterinfo.run = parasite_start_run; + self.monsterinfo.attack = parasite_attack; + self.monsterinfo.sight = parasite_sight; + self.monsterinfo.idle = parasite_idle; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = parasite_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + + return true; + } + }; + + static boolean parasite_drain_attack_ok(float[] start, float[] end) { + float[] dir = { 0, 0, 0 }, angles = { 0, 0, 0 }; + + // check for max distance + Math3D.VectorSubtract(start, end, dir); + if (Math3D.VectorLength(dir) > 256) + return false; + + // check for min/max pitch + Math3D.vectoangles(dir, angles); + if (angles[0] < -180) + angles[0] += 360; + if (Math.abs(angles[0]) > 30) + return false; + + return true; + } +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Player.java b/src/jake2/game/monsters/M_Player.java new file mode 100644 index 0000000..b15761e --- /dev/null +++ b/src/jake2/game/monsters/M_Player.java @@ -0,0 +1,426 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 11.11.2003 by RST. +// $Id: M_Player.java,v 1.2 2005-02-06 18:48:14 salomo Exp $ +package jake2.game.monsters; + +public class M_Player { + // This file generated by qdata - Do NOT Modify + + public final static int FRAME_stand01 = 0; + + public final static int FRAME_stand02 = 1; + + public final static int FRAME_stand03 = 2; + + public final static int FRAME_stand04 = 3; + + public final static int FRAME_stand05 = 4; + + public final static int FRAME_stand06 = 5; + + public final static int FRAME_stand07 = 6; + + public final static int FRAME_stand08 = 7; + + public final static int FRAME_stand09 = 8; + + public final static int FRAME_stand10 = 9; + + public final static int FRAME_stand11 = 10; + + public final static int FRAME_stand12 = 11; + + public final static int FRAME_stand13 = 12; + + public final static int FRAME_stand14 = 13; + + public final static int FRAME_stand15 = 14; + + public final static int FRAME_stand16 = 15; + + public final static int FRAME_stand17 = 16; + + public final static int FRAME_stand18 = 17; + + public final static int FRAME_stand19 = 18; + + public final static int FRAME_stand20 = 19; + + public final static int FRAME_stand21 = 20; + + public final static int FRAME_stand22 = 21; + + public final static int FRAME_stand23 = 22; + + public final static int FRAME_stand24 = 23; + + public final static int FRAME_stand25 = 24; + + public final static int FRAME_stand26 = 25; + + public final static int FRAME_stand27 = 26; + + public final static int FRAME_stand28 = 27; + + public final static int FRAME_stand29 = 28; + + public final static int FRAME_stand30 = 29; + + public final static int FRAME_stand31 = 30; + + public final static int FRAME_stand32 = 31; + + public final static int FRAME_stand33 = 32; + + public final static int FRAME_stand34 = 33; + + public final static int FRAME_stand35 = 34; + + public final static int FRAME_stand36 = 35; + + public final static int FRAME_stand37 = 36; + + public final static int FRAME_stand38 = 37; + + public final static int FRAME_stand39 = 38; + + public final static int FRAME_stand40 = 39; + + public final static int FRAME_run1 = 40; + + public final static int FRAME_run2 = 41; + + public final static int FRAME_run3 = 42; + + public final static int FRAME_run4 = 43; + + public final static int FRAME_run5 = 44; + + public final static int FRAME_run6 = 45; + + public final static int FRAME_attack1 = 46; + + public final static int FRAME_attack2 = 47; + + public final static int FRAME_attack3 = 48; + + public final static int FRAME_attack4 = 49; + + public final static int FRAME_attack5 = 50; + + public final static int FRAME_attack6 = 51; + + public final static int FRAME_attack7 = 52; + + public final static int FRAME_attack8 = 53; + + public final static int FRAME_pain101 = 54; + + public final static int FRAME_pain102 = 55; + + public final static int FRAME_pain103 = 56; + + public final static int FRAME_pain104 = 57; + + public final static int FRAME_pain201 = 58; + + public final static int FRAME_pain202 = 59; + + public final static int FRAME_pain203 = 60; + + public final static int FRAME_pain204 = 61; + + public final static int FRAME_pain301 = 62; + + public final static int FRAME_pain302 = 63; + + public final static int FRAME_pain303 = 64; + + public final static int FRAME_pain304 = 65; + + public final static int FRAME_jump1 = 66; + + public final static int FRAME_jump2 = 67; + + public final static int FRAME_jump3 = 68; + + public final static int FRAME_jump4 = 69; + + public final static int FRAME_jump5 = 70; + + public final static int FRAME_jump6 = 71; + + public final static int FRAME_flip01 = 72; + + public final static int FRAME_flip02 = 73; + + public final static int FRAME_flip03 = 74; + + public final static int FRAME_flip04 = 75; + + public final static int FRAME_flip05 = 76; + + public final static int FRAME_flip06 = 77; + + public final static int FRAME_flip07 = 78; + + public final static int FRAME_flip08 = 79; + + public final static int FRAME_flip09 = 80; + + public final static int FRAME_flip10 = 81; + + public final static int FRAME_flip11 = 82; + + public final static int FRAME_flip12 = 83; + + public final static int FRAME_salute01 = 84; + + public final static int FRAME_salute02 = 85; + + public final static int FRAME_salute03 = 86; + + public final static int FRAME_salute04 = 87; + + public final static int FRAME_salute05 = 88; + + public final static int FRAME_salute06 = 89; + + public final static int FRAME_salute07 = 90; + + public final static int FRAME_salute08 = 91; + + public final static int FRAME_salute09 = 92; + + public final static int FRAME_salute10 = 93; + + public final static int FRAME_salute11 = 94; + + public final static int FRAME_taunt01 = 95; + + public final static int FRAME_taunt02 = 96; + + public final static int FRAME_taunt03 = 97; + + public final static int FRAME_taunt04 = 98; + + public final static int FRAME_taunt05 = 99; + + public final static int FRAME_taunt06 = 100; + + public final static int FRAME_taunt07 = 101; + + public final static int FRAME_taunt08 = 102; + + public final static int FRAME_taunt09 = 103; + + public final static int FRAME_taunt10 = 104; + + public final static int FRAME_taunt11 = 105; + + public final static int FRAME_taunt12 = 106; + + public final static int FRAME_taunt13 = 107; + + public final static int FRAME_taunt14 = 108; + + public final static int FRAME_taunt15 = 109; + + public final static int FRAME_taunt16 = 110; + + public final static int FRAME_taunt17 = 111; + + public final static int FRAME_wave01 = 112; + + public final static int FRAME_wave02 = 113; + + public final static int FRAME_wave03 = 114; + + public final static int FRAME_wave04 = 115; + + public final static int FRAME_wave05 = 116; + + public final static int FRAME_wave06 = 117; + + public final static int FRAME_wave07 = 118; + + public final static int FRAME_wave08 = 119; + + public final static int FRAME_wave09 = 120; + + public final static int FRAME_wave10 = 121; + + public final static int FRAME_wave11 = 122; + + public final static int FRAME_point01 = 123; + + public final static int FRAME_point02 = 124; + + public final static int FRAME_point03 = 125; + + public final static int FRAME_point04 = 126; + + public final static int FRAME_point05 = 127; + + public final static int FRAME_point06 = 128; + + public final static int FRAME_point07 = 129; + + public final static int FRAME_point08 = 130; + + public final static int FRAME_point09 = 131; + + public final static int FRAME_point10 = 132; + + public final static int FRAME_point11 = 133; + + public final static int FRAME_point12 = 134; + + public final static int FRAME_crstnd01 = 135; + + public final static int FRAME_crstnd02 = 136; + + public final static int FRAME_crstnd03 = 137; + + public final static int FRAME_crstnd04 = 138; + + public final static int FRAME_crstnd05 = 139; + + public final static int FRAME_crstnd06 = 140; + + public final static int FRAME_crstnd07 = 141; + + public final static int FRAME_crstnd08 = 142; + + public final static int FRAME_crstnd09 = 143; + + public final static int FRAME_crstnd10 = 144; + + public final static int FRAME_crstnd11 = 145; + + public final static int FRAME_crstnd12 = 146; + + public final static int FRAME_crstnd13 = 147; + + public final static int FRAME_crstnd14 = 148; + + public final static int FRAME_crstnd15 = 149; + + public final static int FRAME_crstnd16 = 150; + + public final static int FRAME_crstnd17 = 151; + + public final static int FRAME_crstnd18 = 152; + + public final static int FRAME_crstnd19 = 153; + + public final static int FRAME_crwalk1 = 154; + + public final static int FRAME_crwalk2 = 155; + + public final static int FRAME_crwalk3 = 156; + + public final static int FRAME_crwalk4 = 157; + + public final static int FRAME_crwalk5 = 158; + + public final static int FRAME_crwalk6 = 159; + + public final static int FRAME_crattak1 = 160; + + public final static int FRAME_crattak2 = 161; + + public final static int FRAME_crattak3 = 162; + + public final static int FRAME_crattak4 = 163; + + public final static int FRAME_crattak5 = 164; + + public final static int FRAME_crattak6 = 165; + + public final static int FRAME_crattak7 = 166; + + public final static int FRAME_crattak8 = 167; + + public final static int FRAME_crattak9 = 168; + + public final static int FRAME_crpain1 = 169; + + public final static int FRAME_crpain2 = 170; + + public final static int FRAME_crpain3 = 171; + + public final static int FRAME_crpain4 = 172; + + public final static int FRAME_crdeath1 = 173; + + public final static int FRAME_crdeath2 = 174; + + public final static int FRAME_crdeath3 = 175; + + public final static int FRAME_crdeath4 = 176; + + public final static int FRAME_crdeath5 = 177; + + public final static int FRAME_death101 = 178; + + public final static int FRAME_death102 = 179; + + public final static int FRAME_death103 = 180; + + public final static int FRAME_death104 = 181; + + public final static int FRAME_death105 = 182; + + public final static int FRAME_death106 = 183; + + public final static int FRAME_death201 = 184; + + public final static int FRAME_death202 = 185; + + public final static int FRAME_death203 = 186; + + public final static int FRAME_death204 = 187; + + public final static int FRAME_death205 = 188; + + public final static int FRAME_death206 = 189; + + public final static int FRAME_death301 = 190; + + public final static int FRAME_death302 = 191; + + public final static int FRAME_death303 = 192; + + public final static int FRAME_death304 = 193; + + public final static int FRAME_death305 = 194; + + public final static int FRAME_death306 = 195; + + public final static int FRAME_death307 = 196; + + public final static int FRAME_death308 = 197; + + public final static float MODEL_SCALE = 1.000000f; + +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Soldier.java b/src/jake2/game/monsters/M_Soldier.java new file mode 100644 index 0000000..a42c9ef --- /dev/null +++ b/src/jake2/game/monsters/M_Soldier.java @@ -0,0 +1,2242 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Soldier.java,v 1.2 2005-02-06 18:48:15 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntDodgeAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.qcommon.Com; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Soldier { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_attak101 = 0; + + public final static int FRAME_attak102 = 1; + + public final static int FRAME_attak103 = 2; + + public final static int FRAME_attak104 = 3; + + public final static int FRAME_attak105 = 4; + + public final static int FRAME_attak106 = 5; + + public final static int FRAME_attak107 = 6; + + public final static int FRAME_attak108 = 7; + + public final static int FRAME_attak109 = 8; + + public final static int FRAME_attak110 = 9; + + public final static int FRAME_attak111 = 10; + + public final static int FRAME_attak112 = 11; + + public final static int FRAME_attak201 = 12; + + public final static int FRAME_attak202 = 13; + + public final static int FRAME_attak203 = 14; + + public final static int FRAME_attak204 = 15; + + public final static int FRAME_attak205 = 16; + + public final static int FRAME_attak206 = 17; + + public final static int FRAME_attak207 = 18; + + public final static int FRAME_attak208 = 19; + + public final static int FRAME_attak209 = 20; + + public final static int FRAME_attak210 = 21; + + public final static int FRAME_attak211 = 22; + + public final static int FRAME_attak212 = 23; + + public final static int FRAME_attak213 = 24; + + public final static int FRAME_attak214 = 25; + + public final static int FRAME_attak215 = 26; + + public final static int FRAME_attak216 = 27; + + public final static int FRAME_attak217 = 28; + + public final static int FRAME_attak218 = 29; + + public final static int FRAME_attak301 = 30; + + public final static int FRAME_attak302 = 31; + + public final static int FRAME_attak303 = 32; + + public final static int FRAME_attak304 = 33; + + public final static int FRAME_attak305 = 34; + + public final static int FRAME_attak306 = 35; + + public final static int FRAME_attak307 = 36; + + public final static int FRAME_attak308 = 37; + + public final static int FRAME_attak309 = 38; + + public final static int FRAME_attak401 = 39; + + public final static int FRAME_attak402 = 40; + + public final static int FRAME_attak403 = 41; + + public final static int FRAME_attak404 = 42; + + public final static int FRAME_attak405 = 43; + + public final static int FRAME_attak406 = 44; + + public final static int FRAME_duck01 = 45; + + public final static int FRAME_duck02 = 46; + + public final static int FRAME_duck03 = 47; + + public final static int FRAME_duck04 = 48; + + public final static int FRAME_duck05 = 49; + + public final static int FRAME_pain101 = 50; + + public final static int FRAME_pain102 = 51; + + public final static int FRAME_pain103 = 52; + + public final static int FRAME_pain104 = 53; + + public final static int FRAME_pain105 = 54; + + public final static int FRAME_pain201 = 55; + + public final static int FRAME_pain202 = 56; + + public final static int FRAME_pain203 = 57; + + public final static int FRAME_pain204 = 58; + + public final static int FRAME_pain205 = 59; + + public final static int FRAME_pain206 = 60; + + public final static int FRAME_pain207 = 61; + + public final static int FRAME_pain301 = 62; + + public final static int FRAME_pain302 = 63; + + public final static int FRAME_pain303 = 64; + + public final static int FRAME_pain304 = 65; + + public final static int FRAME_pain305 = 66; + + public final static int FRAME_pain306 = 67; + + public final static int FRAME_pain307 = 68; + + public final static int FRAME_pain308 = 69; + + public final static int FRAME_pain309 = 70; + + public final static int FRAME_pain310 = 71; + + public final static int FRAME_pain311 = 72; + + public final static int FRAME_pain312 = 73; + + public final static int FRAME_pain313 = 74; + + public final static int FRAME_pain314 = 75; + + public final static int FRAME_pain315 = 76; + + public final static int FRAME_pain316 = 77; + + public final static int FRAME_pain317 = 78; + + public final static int FRAME_pain318 = 79; + + public final static int FRAME_pain401 = 80; + + public final static int FRAME_pain402 = 81; + + public final static int FRAME_pain403 = 82; + + public final static int FRAME_pain404 = 83; + + public final static int FRAME_pain405 = 84; + + public final static int FRAME_pain406 = 85; + + public final static int FRAME_pain407 = 86; + + public final static int FRAME_pain408 = 87; + + public final static int FRAME_pain409 = 88; + + public final static int FRAME_pain410 = 89; + + public final static int FRAME_pain411 = 90; + + public final static int FRAME_pain412 = 91; + + public final static int FRAME_pain413 = 92; + + public final static int FRAME_pain414 = 93; + + public final static int FRAME_pain415 = 94; + + public final static int FRAME_pain416 = 95; + + public final static int FRAME_pain417 = 96; + + public final static int FRAME_run01 = 97; + + public final static int FRAME_run02 = 98; + + public final static int FRAME_run03 = 99; + + public final static int FRAME_run04 = 100; + + public final static int FRAME_run05 = 101; + + public final static int FRAME_run06 = 102; + + public final static int FRAME_run07 = 103; + + public final static int FRAME_run08 = 104; + + public final static int FRAME_run09 = 105; + + public final static int FRAME_run10 = 106; + + public final static int FRAME_run11 = 107; + + public final static int FRAME_run12 = 108; + + public final static int FRAME_runs01 = 109; + + public final static int FRAME_runs02 = 110; + + public final static int FRAME_runs03 = 111; + + public final static int FRAME_runs04 = 112; + + public final static int FRAME_runs05 = 113; + + public final static int FRAME_runs06 = 114; + + public final static int FRAME_runs07 = 115; + + public final static int FRAME_runs08 = 116; + + public final static int FRAME_runs09 = 117; + + public final static int FRAME_runs10 = 118; + + public final static int FRAME_runs11 = 119; + + public final static int FRAME_runs12 = 120; + + public final static int FRAME_runs13 = 121; + + public final static int FRAME_runs14 = 122; + + public final static int FRAME_runs15 = 123; + + public final static int FRAME_runs16 = 124; + + public final static int FRAME_runs17 = 125; + + public final static int FRAME_runs18 = 126; + + public final static int FRAME_runt01 = 127; + + public final static int FRAME_runt02 = 128; + + public final static int FRAME_runt03 = 129; + + public final static int FRAME_runt04 = 130; + + public final static int FRAME_runt05 = 131; + + public final static int FRAME_runt06 = 132; + + public final static int FRAME_runt07 = 133; + + public final static int FRAME_runt08 = 134; + + public final static int FRAME_runt09 = 135; + + public final static int FRAME_runt10 = 136; + + public final static int FRAME_runt11 = 137; + + public final static int FRAME_runt12 = 138; + + public final static int FRAME_runt13 = 139; + + public final static int FRAME_runt14 = 140; + + public final static int FRAME_runt15 = 141; + + public final static int FRAME_runt16 = 142; + + public final static int FRAME_runt17 = 143; + + public final static int FRAME_runt18 = 144; + + public final static int FRAME_runt19 = 145; + + public final static int FRAME_stand101 = 146; + + public final static int FRAME_stand102 = 147; + + public final static int FRAME_stand103 = 148; + + public final static int FRAME_stand104 = 149; + + public final static int FRAME_stand105 = 150; + + public final static int FRAME_stand106 = 151; + + public final static int FRAME_stand107 = 152; + + public final static int FRAME_stand108 = 153; + + public final static int FRAME_stand109 = 154; + + public final static int FRAME_stand110 = 155; + + public final static int FRAME_stand111 = 156; + + public final static int FRAME_stand112 = 157; + + public final static int FRAME_stand113 = 158; + + public final static int FRAME_stand114 = 159; + + public final static int FRAME_stand115 = 160; + + public final static int FRAME_stand116 = 161; + + public final static int FRAME_stand117 = 162; + + public final static int FRAME_stand118 = 163; + + public final static int FRAME_stand119 = 164; + + public final static int FRAME_stand120 = 165; + + public final static int FRAME_stand121 = 166; + + public final static int FRAME_stand122 = 167; + + public final static int FRAME_stand123 = 168; + + public final static int FRAME_stand124 = 169; + + public final static int FRAME_stand125 = 170; + + public final static int FRAME_stand126 = 171; + + public final static int FRAME_stand127 = 172; + + public final static int FRAME_stand128 = 173; + + public final static int FRAME_stand129 = 174; + + public final static int FRAME_stand130 = 175; + + public final static int FRAME_stand301 = 176; + + public final static int FRAME_stand302 = 177; + + public final static int FRAME_stand303 = 178; + + public final static int FRAME_stand304 = 179; + + public final static int FRAME_stand305 = 180; + + public final static int FRAME_stand306 = 181; + + public final static int FRAME_stand307 = 182; + + public final static int FRAME_stand308 = 183; + + public final static int FRAME_stand309 = 184; + + public final static int FRAME_stand310 = 185; + + public final static int FRAME_stand311 = 186; + + public final static int FRAME_stand312 = 187; + + public final static int FRAME_stand313 = 188; + + public final static int FRAME_stand314 = 189; + + public final static int FRAME_stand315 = 190; + + public final static int FRAME_stand316 = 191; + + public final static int FRAME_stand317 = 192; + + public final static int FRAME_stand318 = 193; + + public final static int FRAME_stand319 = 194; + + public final static int FRAME_stand320 = 195; + + public final static int FRAME_stand321 = 196; + + public final static int FRAME_stand322 = 197; + + public final static int FRAME_stand323 = 198; + + public final static int FRAME_stand324 = 199; + + public final static int FRAME_stand325 = 200; + + public final static int FRAME_stand326 = 201; + + public final static int FRAME_stand327 = 202; + + public final static int FRAME_stand328 = 203; + + public final static int FRAME_stand329 = 204; + + public final static int FRAME_stand330 = 205; + + public final static int FRAME_stand331 = 206; + + public final static int FRAME_stand332 = 207; + + public final static int FRAME_stand333 = 208; + + public final static int FRAME_stand334 = 209; + + public final static int FRAME_stand335 = 210; + + public final static int FRAME_stand336 = 211; + + public final static int FRAME_stand337 = 212; + + public final static int FRAME_stand338 = 213; + + public final static int FRAME_stand339 = 214; + + public final static int FRAME_walk101 = 215; + + public final static int FRAME_walk102 = 216; + + public final static int FRAME_walk103 = 217; + + public final static int FRAME_walk104 = 218; + + public final static int FRAME_walk105 = 219; + + public final static int FRAME_walk106 = 220; + + public final static int FRAME_walk107 = 221; + + public final static int FRAME_walk108 = 222; + + public final static int FRAME_walk109 = 223; + + public final static int FRAME_walk110 = 224; + + public final static int FRAME_walk111 = 225; + + public final static int FRAME_walk112 = 226; + + public final static int FRAME_walk113 = 227; + + public final static int FRAME_walk114 = 228; + + public final static int FRAME_walk115 = 229; + + public final static int FRAME_walk116 = 230; + + public final static int FRAME_walk117 = 231; + + public final static int FRAME_walk118 = 232; + + public final static int FRAME_walk119 = 233; + + public final static int FRAME_walk120 = 234; + + public final static int FRAME_walk121 = 235; + + public final static int FRAME_walk122 = 236; + + public final static int FRAME_walk123 = 237; + + public final static int FRAME_walk124 = 238; + + public final static int FRAME_walk125 = 239; + + public final static int FRAME_walk126 = 240; + + public final static int FRAME_walk127 = 241; + + public final static int FRAME_walk128 = 242; + + public final static int FRAME_walk129 = 243; + + public final static int FRAME_walk130 = 244; + + public final static int FRAME_walk131 = 245; + + public final static int FRAME_walk132 = 246; + + public final static int FRAME_walk133 = 247; + + public final static int FRAME_walk201 = 248; + + public final static int FRAME_walk202 = 249; + + public final static int FRAME_walk203 = 250; + + public final static int FRAME_walk204 = 251; + + public final static int FRAME_walk205 = 252; + + public final static int FRAME_walk206 = 253; + + public final static int FRAME_walk207 = 254; + + public final static int FRAME_walk208 = 255; + + public final static int FRAME_walk209 = 256; + + public final static int FRAME_walk210 = 257; + + public final static int FRAME_walk211 = 258; + + public final static int FRAME_walk212 = 259; + + public final static int FRAME_walk213 = 260; + + public final static int FRAME_walk214 = 261; + + public final static int FRAME_walk215 = 262; + + public final static int FRAME_walk216 = 263; + + public final static int FRAME_walk217 = 264; + + public final static int FRAME_walk218 = 265; + + public final static int FRAME_walk219 = 266; + + public final static int FRAME_walk220 = 267; + + public final static int FRAME_walk221 = 268; + + public final static int FRAME_walk222 = 269; + + public final static int FRAME_walk223 = 270; + + public final static int FRAME_walk224 = 271; + + public final static int FRAME_death101 = 272; + + public final static int FRAME_death102 = 273; + + public final static int FRAME_death103 = 274; + + public final static int FRAME_death104 = 275; + + public final static int FRAME_death105 = 276; + + public final static int FRAME_death106 = 277; + + public final static int FRAME_death107 = 278; + + public final static int FRAME_death108 = 279; + + public final static int FRAME_death109 = 280; + + public final static int FRAME_death110 = 281; + + public final static int FRAME_death111 = 282; + + public final static int FRAME_death112 = 283; + + public final static int FRAME_death113 = 284; + + public final static int FRAME_death114 = 285; + + public final static int FRAME_death115 = 286; + + public final static int FRAME_death116 = 287; + + public final static int FRAME_death117 = 288; + + public final static int FRAME_death118 = 289; + + public final static int FRAME_death119 = 290; + + public final static int FRAME_death120 = 291; + + public final static int FRAME_death121 = 292; + + public final static int FRAME_death122 = 293; + + public final static int FRAME_death123 = 294; + + public final static int FRAME_death124 = 295; + + public final static int FRAME_death125 = 296; + + public final static int FRAME_death126 = 297; + + public final static int FRAME_death127 = 298; + + public final static int FRAME_death128 = 299; + + public final static int FRAME_death129 = 300; + + public final static int FRAME_death130 = 301; + + public final static int FRAME_death131 = 302; + + public final static int FRAME_death132 = 303; + + public final static int FRAME_death133 = 304; + + public final static int FRAME_death134 = 305; + + public final static int FRAME_death135 = 306; + + public final static int FRAME_death136 = 307; + + public final static int FRAME_death201 = 308; + + public final static int FRAME_death202 = 309; + + public final static int FRAME_death203 = 310; + + public final static int FRAME_death204 = 311; + + public final static int FRAME_death205 = 312; + + public final static int FRAME_death206 = 313; + + public final static int FRAME_death207 = 314; + + public final static int FRAME_death208 = 315; + + public final static int FRAME_death209 = 316; + + public final static int FRAME_death210 = 317; + + public final static int FRAME_death211 = 318; + + public final static int FRAME_death212 = 319; + + public final static int FRAME_death213 = 320; + + public final static int FRAME_death214 = 321; + + public final static int FRAME_death215 = 322; + + public final static int FRAME_death216 = 323; + + public final static int FRAME_death217 = 324; + + public final static int FRAME_death218 = 325; + + public final static int FRAME_death219 = 326; + + public final static int FRAME_death220 = 327; + + public final static int FRAME_death221 = 328; + + public final static int FRAME_death222 = 329; + + public final static int FRAME_death223 = 330; + + public final static int FRAME_death224 = 331; + + public final static int FRAME_death225 = 332; + + public final static int FRAME_death226 = 333; + + public final static int FRAME_death227 = 334; + + public final static int FRAME_death228 = 335; + + public final static int FRAME_death229 = 336; + + public final static int FRAME_death230 = 337; + + public final static int FRAME_death231 = 338; + + public final static int FRAME_death232 = 339; + + public final static int FRAME_death233 = 340; + + public final static int FRAME_death234 = 341; + + public final static int FRAME_death235 = 342; + + public final static int FRAME_death301 = 343; + + public final static int FRAME_death302 = 344; + + public final static int FRAME_death303 = 345; + + public final static int FRAME_death304 = 346; + + public final static int FRAME_death305 = 347; + + public final static int FRAME_death306 = 348; + + public final static int FRAME_death307 = 349; + + public final static int FRAME_death308 = 350; + + public final static int FRAME_death309 = 351; + + public final static int FRAME_death310 = 352; + + public final static int FRAME_death311 = 353; + + public final static int FRAME_death312 = 354; + + public final static int FRAME_death313 = 355; + + public final static int FRAME_death314 = 356; + + public final static int FRAME_death315 = 357; + + public final static int FRAME_death316 = 358; + + public final static int FRAME_death317 = 359; + + public final static int FRAME_death318 = 360; + + public final static int FRAME_death319 = 361; + + public final static int FRAME_death320 = 362; + + public final static int FRAME_death321 = 363; + + public final static int FRAME_death322 = 364; + + public final static int FRAME_death323 = 365; + + public final static int FRAME_death324 = 366; + + public final static int FRAME_death325 = 367; + + public final static int FRAME_death326 = 368; + + public final static int FRAME_death327 = 369; + + public final static int FRAME_death328 = 370; + + public final static int FRAME_death329 = 371; + + public final static int FRAME_death330 = 372; + + public final static int FRAME_death331 = 373; + + public final static int FRAME_death332 = 374; + + public final static int FRAME_death333 = 375; + + public final static int FRAME_death334 = 376; + + public final static int FRAME_death335 = 377; + + public final static int FRAME_death336 = 378; + + public final static int FRAME_death337 = 379; + + public final static int FRAME_death338 = 380; + + public final static int FRAME_death339 = 381; + + public final static int FRAME_death340 = 382; + + public final static int FRAME_death341 = 383; + + public final static int FRAME_death342 = 384; + + public final static int FRAME_death343 = 385; + + public final static int FRAME_death344 = 386; + + public final static int FRAME_death345 = 387; + + public final static int FRAME_death401 = 388; + + public final static int FRAME_death402 = 389; + + public final static int FRAME_death403 = 390; + + public final static int FRAME_death404 = 391; + + public final static int FRAME_death405 = 392; + + public final static int FRAME_death406 = 393; + + public final static int FRAME_death407 = 394; + + public final static int FRAME_death408 = 395; + + public final static int FRAME_death409 = 396; + + public final static int FRAME_death410 = 397; + + public final static int FRAME_death411 = 398; + + public final static int FRAME_death412 = 399; + + public final static int FRAME_death413 = 400; + + public final static int FRAME_death414 = 401; + + public final static int FRAME_death415 = 402; + + public final static int FRAME_death416 = 403; + + public final static int FRAME_death417 = 404; + + public final static int FRAME_death418 = 405; + + public final static int FRAME_death419 = 406; + + public final static int FRAME_death420 = 407; + + public final static int FRAME_death421 = 408; + + public final static int FRAME_death422 = 409; + + public final static int FRAME_death423 = 410; + + public final static int FRAME_death424 = 411; + + public final static int FRAME_death425 = 412; + + public final static int FRAME_death426 = 413; + + public final static int FRAME_death427 = 414; + + public final static int FRAME_death428 = 415; + + public final static int FRAME_death429 = 416; + + public final static int FRAME_death430 = 417; + + public final static int FRAME_death431 = 418; + + public final static int FRAME_death432 = 419; + + public final static int FRAME_death433 = 420; + + public final static int FRAME_death434 = 421; + + public final static int FRAME_death435 = 422; + + public final static int FRAME_death436 = 423; + + public final static int FRAME_death437 = 424; + + public final static int FRAME_death438 = 425; + + public final static int FRAME_death439 = 426; + + public final static int FRAME_death440 = 427; + + public final static int FRAME_death441 = 428; + + public final static int FRAME_death442 = 429; + + public final static int FRAME_death443 = 430; + + public final static int FRAME_death444 = 431; + + public final static int FRAME_death445 = 432; + + public final static int FRAME_death446 = 433; + + public final static int FRAME_death447 = 434; + + public final static int FRAME_death448 = 435; + + public final static int FRAME_death449 = 436; + + public final static int FRAME_death450 = 437; + + public final static int FRAME_death451 = 438; + + public final static int FRAME_death452 = 439; + + public final static int FRAME_death453 = 440; + + public final static int FRAME_death501 = 441; + + public final static int FRAME_death502 = 442; + + public final static int FRAME_death503 = 443; + + public final static int FRAME_death504 = 444; + + public final static int FRAME_death505 = 445; + + public final static int FRAME_death506 = 446; + + public final static int FRAME_death507 = 447; + + public final static int FRAME_death508 = 448; + + public final static int FRAME_death509 = 449; + + public final static int FRAME_death510 = 450; + + public final static int FRAME_death511 = 451; + + public final static int FRAME_death512 = 452; + + public final static int FRAME_death513 = 453; + + public final static int FRAME_death514 = 454; + + public final static int FRAME_death515 = 455; + + public final static int FRAME_death516 = 456; + + public final static int FRAME_death517 = 457; + + public final static int FRAME_death518 = 458; + + public final static int FRAME_death519 = 459; + + public final static int FRAME_death520 = 460; + + public final static int FRAME_death521 = 461; + + public final static int FRAME_death522 = 462; + + public final static int FRAME_death523 = 463; + + public final static int FRAME_death524 = 464; + + public final static int FRAME_death601 = 465; + + public final static int FRAME_death602 = 466; + + public final static int FRAME_death603 = 467; + + public final static int FRAME_death604 = 468; + + public final static int FRAME_death605 = 469; + + public final static int FRAME_death606 = 470; + + public final static int FRAME_death607 = 471; + + public final static int FRAME_death608 = 472; + + public final static int FRAME_death609 = 473; + + public final static int FRAME_death610 = 474; + + public final static float MODEL_SCALE = 1.200000f; + + static int sound_idle; + + static int sound_sight1; + + static int sound_sight2; + + static int sound_pain_light; + + static int sound_pain; + + static int sound_pain_ss; + + static int sound_death_light; + + static int sound_death; + + static int sound_death_ss; + + static int sound_cock; + + static EntThinkAdapter soldier_dead = new EntThinkAdapter() { + 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 EntDieAdapter soldier_die = new EntDieAdapter() { + 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 < 3; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", + damage, Defines.GIB_ORGANIC); + GameAI.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 + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + self.s.skinnum |= 1; + + if (self.s.skinnum == 1) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death_light, + 1, Defines.ATTN_NORM, 0); + else if (self.s.skinnum == 3) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1, + Defines.ATTN_NORM, 0); + else + // (self.s.skinnum == 5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death_ss, 1, + Defines.ATTN_NORM, 0); + + if (Math.abs((self.s.origin[2] + self.viewheight) - point[2]) <= 4) { + // head shot + self.monsterinfo.currentmove = soldier_move_death3; + return; + } + + n = Lib.rand() % 5; + if (n == 0) + self.monsterinfo.currentmove = soldier_move_death1; + else if (n == 1) + self.monsterinfo.currentmove = soldier_move_death2; + else if (n == 2) + self.monsterinfo.currentmove = soldier_move_death4; + else if (n == 3) + self.monsterinfo.currentmove = soldier_move_death5; + else + self.monsterinfo.currentmove = soldier_move_death6; + } + }; + + static EntThinkAdapter soldier_attack1_refire1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.skinnum > 1) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) + || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = FRAME_attak102; + else + self.monsterinfo.nextframe = FRAME_attak110; + return true; + } + }; + + static EntThinkAdapter soldier_attack1_refire2 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.skinnum < 2) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) + || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = FRAME_attak102; + return true; + } + }; + + static EntThinkAdapter soldier_attack2_refire1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.skinnum > 1) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) + || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = FRAME_attak204; + else + self.monsterinfo.nextframe = FRAME_attak216; + return true; + } + }; + + static EntThinkAdapter soldier_attack2_refire2 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.skinnum < 2) + return true; + + if (self.enemy.health <= 0) + return true; + + if (((GameBase.skill.value == 3) && (Lib.random() < 0.5)) + || (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)) + self.monsterinfo.nextframe = FRAME_attak204; + return true; + } + }; + + static EntThinkAdapter soldier_attack3_refire = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((GameBase.level.time + 0.4) < self.monsterinfo.pausetime) + self.monsterinfo.nextframe = FRAME_attak303; + return true; + } + }; + + static EntThinkAdapter soldier_attack6_refire = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy.health <= 0) + return true; + + if (GameUtil.range(self, self.enemy) < Defines.RANGE_MID) + return true; + + if (GameBase.skill.value == 3) + self.monsterinfo.nextframe = FRAME_runs03; + return true; + } + }; + + // ATTACK6 (run & shoot) + static EntThinkAdapter soldier_fire8 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 7); + return true; + } + }; + + // ATTACK1 (blaster/shotgun) + + static EntThinkAdapter soldier_fire1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 0); + return true; + } + }; + + // ATTACK2 (blaster/shotgun) + + static EntThinkAdapter soldier_fire2 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 1); + return true; + } + }; + + static EntThinkAdapter soldier_duck_down = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0) + return true; + self.monsterinfo.aiflags |= Defines.AI_DUCKED; + self.maxs[2] -= 32; + self.takedamage = Defines.DAMAGE_YES; + self.monsterinfo.pausetime = GameBase.level.time + 1; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntThinkAdapter soldier_fire3 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_duck_down.think(self); + soldier_fire(self, 2); + return true; + } + }; + + // ATTACK4 (machinegun) + + static EntThinkAdapter soldier_fire4 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 3); + // + // if (self.enemy.health <= 0) + // return; + // + // if ( ((skill.value == 3) && (random() < 0.5)) || (range(self, + // self.enemy) == RANGE_MELEE) ) + // self.monsterinfo.nextframe = FRAME_attak402; + return true; + } + }; + + // + // DEATH + // + + static EntThinkAdapter soldier_fire6 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 5); + return true; + } + }; + + static EntThinkAdapter soldier_fire7 = new EntThinkAdapter() { + public boolean think(edict_t self) { + soldier_fire(self, 6); + return true; + } + }; + + static EntThinkAdapter soldier_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() > 0.8) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + static EntThinkAdapter soldier_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.currentmove == soldier_move_stand3) + || (Lib.random() < 0.8)) + self.monsterinfo.currentmove = soldier_move_stand1; + else + self.monsterinfo.currentmove = soldier_move_stand3; + return true; + } + }; + + // + // WALK + // + static EntThinkAdapter soldier_walk1_random = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() > 0.1) + self.monsterinfo.nextframe = FRAME_walk101; + return true; + } + }; + + static EntThinkAdapter soldier_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = soldier_move_walk1; + else + self.monsterinfo.currentmove = soldier_move_walk2; + return true; + } + }; + + static EntThinkAdapter soldier_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + self.monsterinfo.currentmove = soldier_move_stand1; + return true; + } + + if (self.monsterinfo.currentmove == soldier_move_walk1 + || self.monsterinfo.currentmove == soldier_move_walk2 + || self.monsterinfo.currentmove == soldier_move_start_run) { + self.monsterinfo.currentmove = soldier_move_run; + int a = 2; + } else { + self.monsterinfo.currentmove = soldier_move_start_run; + } + return true; + } + }; + + static EntPainAdapter soldier_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + float r; + int n; + + if (self.health < (self.max_health / 2)) + self.s.skinnum |= 1; + + if (GameBase.level.time < self.pain_debounce_time) { + if ((self.velocity[2] > 100) + && ((self.monsterinfo.currentmove == soldier_move_pain1) + || (self.monsterinfo.currentmove == soldier_move_pain2) || (self.monsterinfo.currentmove == soldier_move_pain3))) + self.monsterinfo.currentmove = soldier_move_pain4; + return; + } + + self.pain_debounce_time = GameBase.level.time + 3; + + n = self.s.skinnum | 1; + if (n == 1) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain_light, + 1, Defines.ATTN_NORM, 0); + else if (n == 3) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain_ss, 1, + Defines.ATTN_NORM, 0); + + if (self.velocity[2] > 100) { + self.monsterinfo.currentmove = soldier_move_pain4; + return; + } + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + r = Lib.random(); + + if (r < 0.33) + self.monsterinfo.currentmove = soldier_move_pain1; + else if (r < 0.66) + self.monsterinfo.currentmove = soldier_move_pain2; + else + self.monsterinfo.currentmove = soldier_move_pain3; + } + }; + + // + // SIGHT + // + + static EntThinkAdapter soldier_duck_up = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.aiflags &= ~Defines.AI_DUCKED; + self.maxs[2] += 32; + self.takedamage = Defines.DAMAGE_AIM; + GameBase.gi.linkentity(self); + return true; + } + }; + + static EntInteractAdapter soldier_sight = new EntInteractAdapter() { + public boolean interact(edict_t self, edict_t other) { + if (Lib.random() < 0.5) + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight1, 1, + Defines.ATTN_NORM, 0); + else + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight2, 1, + Defines.ATTN_NORM, 0); + + if ((GameBase.skill.value > 0) + && (GameUtil.range(self, self.enemy) >= Defines.RANGE_MID)) { + if (Lib.random() > 0.5) + self.monsterinfo.currentmove = soldier_move_attack6; + } + return true; + } + }; + + // + // SPAWN + // + + static EntThinkAdapter SP_monster_soldier_x = new EntThinkAdapter() { + public boolean think(edict_t self) { + + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/soldier/tris.md2"); + self.monsterinfo.scale = MODEL_SCALE; + Math3D.VectorSet(self.mins, -16, -16, -24); + Math3D.VectorSet(self.maxs, 16, 16, 32); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + sound_idle = GameBase.gi.soundindex("soldier/solidle1.wav"); + sound_sight1 = GameBase.gi.soundindex("soldier/solsght1.wav"); + sound_sight2 = GameBase.gi.soundindex("soldier/solsrch1.wav"); + sound_cock = GameBase.gi.soundindex("infantry/infatck3.wav"); + + self.mass = 100; + + self.pain = soldier_pain; + self.die = soldier_die; + + self.monsterinfo.stand = soldier_stand; + self.monsterinfo.walk = soldier_walk; + self.monsterinfo.run = soldier_run; + self.monsterinfo.dodge = soldier_dodge; + self.monsterinfo.attack = soldier_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = soldier_sight; + + GameBase.gi.linkentity(self); + + self.monsterinfo.stand.think(self); + + GameAI.walkmonster_start.think(self); + return true; + } + }; + + /* + * QUAKED monster_soldier_light (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static EntThinkAdapter SP_monster_soldier_light = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + sound_pain_light = GameBase.gi.soundindex("soldier/solpain2.wav"); + sound_death_light = GameBase.gi.soundindex("soldier/soldeth2.wav"); + GameBase.gi.modelindex("models/objects/laser/tris.md2"); + GameBase.gi.soundindex("misc/lasfly.wav"); + GameBase.gi.soundindex("soldier/solatck2.wav"); + + self.s.skinnum = 0; + self.health = 20; + self.gib_health = -30; + return true; + } + }; + + /* + * QUAKED monster_soldier (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + + public static EntThinkAdapter SP_monster_soldier = new EntThinkAdapter() { + public boolean think(edict_t self) { + Com.DPrintf("Spawning a soldier at " + self.s.origin[0] + " " + + self.s.origin[1] + " " + + self.s.origin[2] + " " + + "\n"); + + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + sound_pain = GameBase.gi.soundindex("soldier/solpain1.wav"); + sound_death = GameBase.gi.soundindex("soldier/soldeth1.wav"); + GameBase.gi.soundindex("soldier/solatck1.wav"); + + self.s.skinnum = 2; + self.health = 30; + self.gib_health = -30; + return true; + } + }; + + /** + * QUAKED monster_soldier_ss (1 .5 0) (-16 -16 -24) (16 16 32) Ambush + * Trigger_Spawn Sight + */ + public static EntThinkAdapter SP_monster_soldier_ss = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + SP_monster_soldier_x.think(self); + + sound_pain_ss = GameBase.gi.soundindex("soldier/solpain3.wav"); + sound_death_ss = GameBase.gi.soundindex("soldier/soldeth3.wav"); + GameBase.gi.soundindex("soldier/solatck3.wav"); + + self.s.skinnum = 4; + self.health = 40; + self.gib_health = -30; + return true; + } + }; + + static void soldier_fire(edict_t self, int flash_number) { + float[] start = { 0, 0, 0 }; + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }, up = { 0, 0, 0 }; + float[] aim = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float r, u; + int flash_index; + + if (self.s.skinnum < 2) + flash_index = blaster_flash[flash_number]; + else if (self.s.skinnum < 4) + flash_index = shotgun_flash[flash_number]; + else + flash_index = machinegun_flash[flash_number]; + + Math3D.AngleVectors(self.s.angles, forward, right, null); + Math3D.G_ProjectSource(self.s.origin, + M_Flash.monster_flash_offset[flash_index], forward, right, + start); + + if (flash_number == 5 || flash_number == 6) { + Math3D.VectorCopy(forward, aim); + } else { + Math3D.VectorCopy(self.enemy.s.origin, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, aim); + Math3D.vectoangles(aim, dir); + Math3D.AngleVectors(dir, forward, right, up); + + r = Lib.crandom() * 1000; + u = Lib.crandom() * 500; + Math3D.VectorMA(start, 8192, forward, end); + Math3D.VectorMA(end, r, right, end); + Math3D.VectorMA(end, u, up, end); + + Math3D.VectorSubtract(end, start, aim); + Math3D.VectorNormalize(aim); + } + + if (self.s.skinnum <= 1) { + Monster.monster_fire_blaster(self, start, aim, 5, 600, flash_index, + Defines.EF_BLASTER); + } else if (self.s.skinnum <= 3) { + Monster.monster_fire_shotgun(self, start, aim, 2, 1, + Defines.DEFAULT_SHOTGUN_HSPREAD, + Defines.DEFAULT_SHOTGUN_VSPREAD, + Defines.DEFAULT_SHOTGUN_COUNT, flash_index); + } else { + if (0 == (self.monsterinfo.aiflags & Defines.AI_HOLD_FRAME)) + self.monsterinfo.pausetime = GameBase.level.time + + (3 + Lib.rand() % 8) * Defines.FRAMETIME; + + Monster.monster_fire_bullet(self, start, aim, 2, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, flash_index); + + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + } + } + + static EntThinkAdapter soldier_cock = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.frame == FRAME_stand322) + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_cock, 1, + Defines.ATTN_IDLE, 0); + else + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_cock, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + // STAND + static mframe_t soldier_frames_stand1[] = new mframe_t[] { + new mframe_t(GameAI.ai_stand, 0, soldier_idle), + 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 soldier_move_stand1 = new mmove_t(FRAME_stand101, + FRAME_stand130, soldier_frames_stand1, soldier_stand); + + static mframe_t soldier_frames_stand3[] = 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, soldier_cock), + 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 soldier_move_stand3 = new mmove_t(FRAME_stand301, + FRAME_stand339, soldier_frames_stand3, soldier_stand); + + static mframe_t soldier_frames_walk1[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, -1, soldier_walk1_random), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null) }; + + static mmove_t soldier_move_walk1 = new mmove_t(FRAME_walk101, + FRAME_walk133, soldier_frames_walk1, null); + + static mframe_t soldier_frames_walk2[] = 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, 9, null), + new mframe_t(GameAI.ai_walk, 8, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 1, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 7, null) }; + + static mmove_t soldier_move_walk2 = new mmove_t(FRAME_walk209, + FRAME_walk218, soldier_frames_walk2, null); + + // + // RUN + // + + static mframe_t soldier_frames_start_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 7, null), + new mframe_t(GameAI.ai_run, 5, null) }; + + static mmove_t soldier_move_start_run = new mmove_t(FRAME_run01, + FRAME_run02, soldier_frames_start_run, soldier_run); + + static mframe_t soldier_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 11, null), + new mframe_t(GameAI.ai_run, 11, null), + new mframe_t(GameAI.ai_run, 16, null), + new mframe_t(GameAI.ai_run, 10, null), + new mframe_t(GameAI.ai_run, 15, null) }; + + static mmove_t soldier_move_run = new mmove_t(FRAME_run03, FRAME_run08, + soldier_frames_run, null); + + // + // DUCK + // + + static EntThinkAdapter soldier_duck_hold = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.level.time >= self.monsterinfo.pausetime) + self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME; + else + self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME; + return true; + } + }; + + // + // PAIN + // + + static mframe_t soldier_frames_pain1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t soldier_move_pain1 = new mmove_t(FRAME_pain101, + FRAME_pain105, soldier_frames_pain1, soldier_run); + + static mframe_t soldier_frames_pain2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -13, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null) }; + + static mmove_t soldier_move_pain2 = new mmove_t(FRAME_pain201, + FRAME_pain207, soldier_frames_pain2, soldier_run); + + static mframe_t soldier_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -8, null), + new mframe_t(GameAI.ai_move, 10, null), + new mframe_t(GameAI.ai_move, -4, 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, 3, 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, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null) }; + + static mmove_t soldier_move_pain3 = new mmove_t(FRAME_pain301, + FRAME_pain318, soldier_frames_pain3, soldier_run); + + static mframe_t soldier_frames_pain4[] = 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, -10, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, 8, null), + new mframe_t(GameAI.ai_move, 4, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 5, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 0, null) }; + + static mmove_t soldier_move_pain4 = new mmove_t(FRAME_pain401, + FRAME_pain417, soldier_frames_pain4, soldier_run); + + // + // ATTACK + // + + static int blaster_flash[] = { Defines.MZ2_SOLDIER_BLASTER_1, + Defines.MZ2_SOLDIER_BLASTER_2, Defines.MZ2_SOLDIER_BLASTER_3, + Defines.MZ2_SOLDIER_BLASTER_4, Defines.MZ2_SOLDIER_BLASTER_5, + Defines.MZ2_SOLDIER_BLASTER_6, Defines.MZ2_SOLDIER_BLASTER_7, + Defines.MZ2_SOLDIER_BLASTER_8 }; + + static int shotgun_flash[] = { Defines.MZ2_SOLDIER_SHOTGUN_1, + Defines.MZ2_SOLDIER_SHOTGUN_2, Defines.MZ2_SOLDIER_SHOTGUN_3, + Defines.MZ2_SOLDIER_SHOTGUN_4, Defines.MZ2_SOLDIER_SHOTGUN_5, + Defines.MZ2_SOLDIER_SHOTGUN_6, Defines.MZ2_SOLDIER_SHOTGUN_7, + Defines.MZ2_SOLDIER_SHOTGUN_8 }; + + static int machinegun_flash[] = { Defines.MZ2_SOLDIER_MACHINEGUN_1, + Defines.MZ2_SOLDIER_MACHINEGUN_2, Defines.MZ2_SOLDIER_MACHINEGUN_3, + Defines.MZ2_SOLDIER_MACHINEGUN_4, Defines.MZ2_SOLDIER_MACHINEGUN_5, + Defines.MZ2_SOLDIER_MACHINEGUN_6, Defines.MZ2_SOLDIER_MACHINEGUN_7, + Defines.MZ2_SOLDIER_MACHINEGUN_8 }; + + static mframe_t soldier_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_fire1), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_attack1_refire1), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_cock), + new mframe_t(GameAI.ai_charge, 0, soldier_attack1_refire2), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t soldier_move_attack1 = new mmove_t(FRAME_attak101, + FRAME_attak112, soldier_frames_attack1, soldier_run); + + static mframe_t soldier_frames_attack2[] = new mframe_t[] { + 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, soldier_fire2), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_attack2_refire1), + 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, soldier_cock), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_attack2_refire2), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t soldier_move_attack2 = new mmove_t(FRAME_attak201, + FRAME_attak218, soldier_frames_attack2, soldier_run); + + static mframe_t soldier_frames_attack3[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_fire3), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_attack3_refire), + new mframe_t(GameAI.ai_charge, 0, soldier_duck_up), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t soldier_move_attack3 = new mmove_t(FRAME_attak301, + FRAME_attak309, soldier_frames_attack3, soldier_run); + + static mframe_t soldier_frames_attack4[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, soldier_fire4), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t soldier_move_attack4 = new mmove_t(FRAME_attak401, + FRAME_attak406, soldier_frames_attack4, soldier_run); + + static mframe_t soldier_frames_attack6[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 10, null), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 12, null), + new mframe_t(GameAI.ai_charge, 11, soldier_fire8), + new mframe_t(GameAI.ai_charge, 13, null), + new mframe_t(GameAI.ai_charge, 18, null), + new mframe_t(GameAI.ai_charge, 15, null), + new mframe_t(GameAI.ai_charge, 14, null), + new mframe_t(GameAI.ai_charge, 11, null), + new mframe_t(GameAI.ai_charge, 8, null), + new mframe_t(GameAI.ai_charge, 11, null), + new mframe_t(GameAI.ai_charge, 12, null), + new mframe_t(GameAI.ai_charge, 12, null), + new mframe_t(GameAI.ai_charge, 17, soldier_attack6_refire) }; + + static mmove_t soldier_move_attack6 = new mmove_t(FRAME_runs01, + FRAME_runs14, soldier_frames_attack6, soldier_run); + + static mframe_t soldier_frames_duck[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 5, soldier_duck_down), + new mframe_t(GameAI.ai_move, -1, soldier_duck_hold), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 0, soldier_duck_up), + new mframe_t(GameAI.ai_move, 5, null) }; + + static mmove_t soldier_move_duck = new mmove_t(FRAME_duck01, FRAME_duck05, + soldier_frames_duck, soldier_run); + + static mframe_t soldier_frames_death1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -10, null), + new mframe_t(GameAI.ai_move, -10, null), + new mframe_t(GameAI.ai_move, -10, null), + new mframe_t(GameAI.ai_move, -5, 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, soldier_fire6), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, soldier_fire7), + 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 soldier_move_death1 = new mmove_t(FRAME_death101, + FRAME_death136, soldier_frames_death1, soldier_dead); + + static mframe_t soldier_frames_death2[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, 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 soldier_move_death2 = new mmove_t(FRAME_death201, + FRAME_death235, soldier_frames_death2, soldier_dead); + + static mframe_t soldier_frames_death3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, 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 soldier_move_death3 = new mmove_t(FRAME_death301, + FRAME_death345, soldier_frames_death3, soldier_dead); + + static mframe_t soldier_frames_death4[] = 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) }; + + static mmove_t soldier_move_death4 = new mmove_t(FRAME_death401, + FRAME_death453, soldier_frames_death4, soldier_dead); + + static mframe_t soldier_frames_death5[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -5, 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 soldier_move_death5 = new mmove_t(FRAME_death501, + FRAME_death524, soldier_frames_death5, soldier_dead); + + static mframe_t soldier_frames_death6[] = 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) }; + + static mmove_t soldier_move_death6 = new mmove_t(FRAME_death601, + FRAME_death610, soldier_frames_death6, soldier_dead); + + // ATTACK3 (duck and shoot) + + static EntThinkAdapter soldier_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.s.skinnum < 4) { + if (Lib.random() < 0.5) + self.monsterinfo.currentmove = soldier_move_attack1; + else + self.monsterinfo.currentmove = soldier_move_attack2; + } else { + self.monsterinfo.currentmove = soldier_move_attack4; + } + return true; + } + }; + + static EntDodgeAdapter soldier_dodge = new EntDodgeAdapter() { + public void dodge(edict_t self, edict_t attacker, float eta) { + float r; + + r = Lib.random(); + if (r > 0.25) + return; + + if (self.enemy == null) + self.enemy = attacker; + + if (GameBase.skill.value == 0) { + self.monsterinfo.currentmove = soldier_move_duck; + return; + } + + self.monsterinfo.pausetime = GameBase.level.time + eta + 0.3f; + r = Lib.random(); + + if (GameBase.skill.value == 1) { + if (r > 0.33) + self.monsterinfo.currentmove = soldier_move_duck; + else + self.monsterinfo.currentmove = soldier_move_attack3; + return; + } + + if (GameBase.skill.value >= 2) { + if (r > 0.66) + self.monsterinfo.currentmove = soldier_move_duck; + else + self.monsterinfo.currentmove = soldier_move_attack3; + return; + } + + self.monsterinfo.currentmove = soldier_move_attack3; + } + }; + +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Supertank.java b/src/jake2/game/monsters/M_Supertank.java new file mode 100644 index 0000000..b2f18c3 --- /dev/null +++ b/src/jake2/game/monsters/M_Supertank.java @@ -0,0 +1,1263 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Supertank.java,v 1.2 2005-02-06 18:48:32 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Supertank { + + // This file generated by ModelGen - Do NOT Modify + + public final static int FRAME_attak1_1 = 0; + + public final static int FRAME_attak1_2 = 1; + + public final static int FRAME_attak1_3 = 2; + + public final static int FRAME_attak1_4 = 3; + + public final static int FRAME_attak1_5 = 4; + + public final static int FRAME_attak1_6 = 5; + + public final static int FRAME_attak1_7 = 6; + + public final static int FRAME_attak1_8 = 7; + + public final static int FRAME_attak1_9 = 8; + + public final static int FRAME_attak1_10 = 9; + + public final static int FRAME_attak1_11 = 10; + + public final static int FRAME_attak1_12 = 11; + + public final static int FRAME_attak1_13 = 12; + + public final static int FRAME_attak1_14 = 13; + + public final static int FRAME_attak1_15 = 14; + + public final static int FRAME_attak1_16 = 15; + + public final static int FRAME_attak1_17 = 16; + + public final static int FRAME_attak1_18 = 17; + + public final static int FRAME_attak1_19 = 18; + + public final static int FRAME_attak1_20 = 19; + + public final static int FRAME_attak2_1 = 20; + + public final static int FRAME_attak2_2 = 21; + + public final static int FRAME_attak2_3 = 22; + + public final static int FRAME_attak2_4 = 23; + + public final static int FRAME_attak2_5 = 24; + + public final static int FRAME_attak2_6 = 25; + + public final static int FRAME_attak2_7 = 26; + + public final static int FRAME_attak2_8 = 27; + + public final static int FRAME_attak2_9 = 28; + + public final static int FRAME_attak2_10 = 29; + + public final static int FRAME_attak2_11 = 30; + + public final static int FRAME_attak2_12 = 31; + + public final static int FRAME_attak2_13 = 32; + + public final static int FRAME_attak2_14 = 33; + + public final static int FRAME_attak2_15 = 34; + + public final static int FRAME_attak2_16 = 35; + + public final static int FRAME_attak2_17 = 36; + + public final static int FRAME_attak2_18 = 37; + + public final static int FRAME_attak2_19 = 38; + + public final static int FRAME_attak2_20 = 39; + + public final static int FRAME_attak2_21 = 40; + + public final static int FRAME_attak2_22 = 41; + + public final static int FRAME_attak2_23 = 42; + + public final static int FRAME_attak2_24 = 43; + + public final static int FRAME_attak2_25 = 44; + + public final static int FRAME_attak2_26 = 45; + + public final static int FRAME_attak2_27 = 46; + + public final static int FRAME_attak3_1 = 47; + + public final static int FRAME_attak3_2 = 48; + + public final static int FRAME_attak3_3 = 49; + + public final static int FRAME_attak3_4 = 50; + + public final static int FRAME_attak3_5 = 51; + + public final static int FRAME_attak3_6 = 52; + + public final static int FRAME_attak3_7 = 53; + + public final static int FRAME_attak3_8 = 54; + + public final static int FRAME_attak3_9 = 55; + + public final static int FRAME_attak3_10 = 56; + + public final static int FRAME_attak3_11 = 57; + + public final static int FRAME_attak3_12 = 58; + + public final static int FRAME_attak3_13 = 59; + + public final static int FRAME_attak3_14 = 60; + + public final static int FRAME_attak3_15 = 61; + + public final static int FRAME_attak3_16 = 62; + + public final static int FRAME_attak3_17 = 63; + + public final static int FRAME_attak3_18 = 64; + + public final static int FRAME_attak3_19 = 65; + + public final static int FRAME_attak3_20 = 66; + + public final static int FRAME_attak3_21 = 67; + + public final static int FRAME_attak3_22 = 68; + + public final static int FRAME_attak3_23 = 69; + + public final static int FRAME_attak3_24 = 70; + + public final static int FRAME_attak3_25 = 71; + + public final static int FRAME_attak3_26 = 72; + + public final static int FRAME_attak3_27 = 73; + + public final static int FRAME_attak4_1 = 74; + + public final static int FRAME_attak4_2 = 75; + + public final static int FRAME_attak4_3 = 76; + + public final static int FRAME_attak4_4 = 77; + + public final static int FRAME_attak4_5 = 78; + + public final static int FRAME_attak4_6 = 79; + + public final static int FRAME_backwd_1 = 80; + + public final static int FRAME_backwd_2 = 81; + + public final static int FRAME_backwd_3 = 82; + + public final static int FRAME_backwd_4 = 83; + + public final static int FRAME_backwd_5 = 84; + + public final static int FRAME_backwd_6 = 85; + + public final static int FRAME_backwd_7 = 86; + + public final static int FRAME_backwd_8 = 87; + + public final static int FRAME_backwd_9 = 88; + + public final static int FRAME_backwd_10 = 89; + + public final static int FRAME_backwd_11 = 90; + + public final static int FRAME_backwd_12 = 91; + + public final static int FRAME_backwd_13 = 92; + + public final static int FRAME_backwd_14 = 93; + + public final static int FRAME_backwd_15 = 94; + + public final static int FRAME_backwd_16 = 95; + + public final static int FRAME_backwd_17 = 96; + + public final static int FRAME_backwd_18 = 97; + + public final static int FRAME_death_1 = 98; + + public final static int FRAME_death_2 = 99; + + public final static int FRAME_death_3 = 100; + + public final static int FRAME_death_4 = 101; + + public final static int FRAME_death_5 = 102; + + public final static int FRAME_death_6 = 103; + + public final static int FRAME_death_7 = 104; + + public final static int FRAME_death_8 = 105; + + public final static int FRAME_death_9 = 106; + + public final static int FRAME_death_10 = 107; + + public final static int FRAME_death_11 = 108; + + public final static int FRAME_death_12 = 109; + + public final static int FRAME_death_13 = 110; + + public final static int FRAME_death_14 = 111; + + public final static int FRAME_death_15 = 112; + + public final static int FRAME_death_16 = 113; + + public final static int FRAME_death_17 = 114; + + public final static int FRAME_death_18 = 115; + + public final static int FRAME_death_19 = 116; + + public final static int FRAME_death_20 = 117; + + public final static int FRAME_death_21 = 118; + + public final static int FRAME_death_22 = 119; + + public final static int FRAME_death_23 = 120; + + public final static int FRAME_death_24 = 121; + + public final static int FRAME_death_31 = 122; + + public final static int FRAME_death_32 = 123; + + public final static int FRAME_death_33 = 124; + + public final static int FRAME_death_45 = 125; + + public final static int FRAME_death_46 = 126; + + public final static int FRAME_death_47 = 127; + + public final static int FRAME_forwrd_1 = 128; + + public final static int FRAME_forwrd_2 = 129; + + public final static int FRAME_forwrd_3 = 130; + + public final static int FRAME_forwrd_4 = 131; + + public final static int FRAME_forwrd_5 = 132; + + public final static int FRAME_forwrd_6 = 133; + + public final static int FRAME_forwrd_7 = 134; + + public final static int FRAME_forwrd_8 = 135; + + public final static int FRAME_forwrd_9 = 136; + + public final static int FRAME_forwrd_10 = 137; + + public final static int FRAME_forwrd_11 = 138; + + public final static int FRAME_forwrd_12 = 139; + + public final static int FRAME_forwrd_13 = 140; + + public final static int FRAME_forwrd_14 = 141; + + public final static int FRAME_forwrd_15 = 142; + + public final static int FRAME_forwrd_16 = 143; + + public final static int FRAME_forwrd_17 = 144; + + public final static int FRAME_forwrd_18 = 145; + + public final static int FRAME_left_1 = 146; + + public final static int FRAME_left_2 = 147; + + public final static int FRAME_left_3 = 148; + + public final static int FRAME_left_4 = 149; + + public final static int FRAME_left_5 = 150; + + public final static int FRAME_left_6 = 151; + + public final static int FRAME_left_7 = 152; + + public final static int FRAME_left_8 = 153; + + public final static int FRAME_left_9 = 154; + + public final static int FRAME_left_10 = 155; + + public final static int FRAME_left_11 = 156; + + public final static int FRAME_left_12 = 157; + + public final static int FRAME_left_13 = 158; + + public final static int FRAME_left_14 = 159; + + public final static int FRAME_left_15 = 160; + + public final static int FRAME_left_16 = 161; + + public final static int FRAME_left_17 = 162; + + public final static int FRAME_left_18 = 163; + + public final static int FRAME_pain1_1 = 164; + + public final static int FRAME_pain1_2 = 165; + + public final static int FRAME_pain1_3 = 166; + + public final static int FRAME_pain1_4 = 167; + + public final static int FRAME_pain2_5 = 168; + + public final static int FRAME_pain2_6 = 169; + + public final static int FRAME_pain2_7 = 170; + + public final static int FRAME_pain2_8 = 171; + + public final static int FRAME_pain3_9 = 172; + + public final static int FRAME_pain3_10 = 173; + + public final static int FRAME_pain3_11 = 174; + + public final static int FRAME_pain3_12 = 175; + + public final static int FRAME_right_1 = 176; + + public final static int FRAME_right_2 = 177; + + public final static int FRAME_right_3 = 178; + + public final static int FRAME_right_4 = 179; + + public final static int FRAME_right_5 = 180; + + public final static int FRAME_right_6 = 181; + + public final static int FRAME_right_7 = 182; + + public final static int FRAME_right_8 = 183; + + public final static int FRAME_right_9 = 184; + + public final static int FRAME_right_10 = 185; + + public final static int FRAME_right_11 = 186; + + public final static int FRAME_right_12 = 187; + + public final static int FRAME_right_13 = 188; + + public final static int FRAME_right_14 = 189; + + public final static int FRAME_right_15 = 190; + + public final static int FRAME_right_16 = 191; + + public final static int FRAME_right_17 = 192; + + 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 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 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 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 boolean think(edict_t self) { + self.monsterinfo.currentmove = supertank_move_forward; + return true; + } + }; + + static EntThinkAdapter supertank_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = supertank_move_forward; + return true; + } + }; + + static EntThinkAdapter supertank_run = new EntThinkAdapter() { + 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 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 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 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 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[] { + new mframe_t(GameAI.ai_move, 0, TreadSound), + 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 supertank_move_turn_right = new mmove_t(FRAME_right_1, + FRAME_right_18, supertank_frames_turn_right, supertank_run); + + static mframe_t supertank_frames_turn_left[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, TreadSound), + 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 supertank_move_turn_left = new mmove_t(FRAME_left_1, + FRAME_left_18, supertank_frames_turn_left, supertank_run); + + static mframe_t supertank_frames_pain3[] = 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) }; + + static mmove_t supertank_move_pain3 = new mmove_t(FRAME_pain3_9, + FRAME_pain3_12, supertank_frames_pain3, supertank_run); + + static mframe_t supertank_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) }; + + static mmove_t supertank_move_pain2 = new mmove_t(FRAME_pain2_5, + FRAME_pain2_8, supertank_frames_pain2, supertank_run); + + static mframe_t supertank_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) }; + + static mmove_t supertank_move_pain1 = new mmove_t(FRAME_pain1_1, + FRAME_pain1_4, supertank_frames_pain1, supertank_run); + + static mframe_t supertank_frames_death1[] = 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, GameAI.BossExplode) }; + + static mmove_t supertank_move_death = new mmove_t(FRAME_death_1, + FRAME_death_24, supertank_frames_death1, supertank_dead); + + static mframe_t supertank_frames_backward[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, TreadSound), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 0, null) }; + + static mmove_t supertank_move_backward = new mmove_t(FRAME_backwd_1, + FRAME_backwd_18, supertank_frames_backward, null); + + static mframe_t supertank_frames_attack4[] = 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) }; + + static mmove_t supertank_move_attack4 = new mmove_t(FRAME_attak4_1, + FRAME_attak4_6, supertank_frames_attack4, supertank_run); + + static mframe_t supertank_frames_attack3[] = 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) }; + + static mmove_t supertank_move_attack3 = new mmove_t(FRAME_attak3_1, + FRAME_attak3_27, supertank_frames_attack3, supertank_run); + + static mframe_t supertank_frames_attack2[] = new mframe_t[] { + 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, supertankRocket), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, supertankRocket), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 0, supertankRocket), + 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 supertank_move_attack2 = new mmove_t(FRAME_attak2_1, + FRAME_attak2_27, supertank_frames_attack2, supertank_run); + + static EntThinkAdapter supertank_reattack1 = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() < 0.9) + self.monsterinfo.currentmove = supertank_move_attack1; + else + self.monsterinfo.currentmove = supertank_move_end_attack1; + else + self.monsterinfo.currentmove = supertank_move_end_attack1; + return true; + } + }; + + static mframe_t supertank_frames_attack1[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), + new mframe_t(GameAI.ai_charge, 0, supertankMachineGun), }; + + static mmove_t supertank_move_attack1 = new mmove_t(FRAME_attak1_1, + FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1); + + static mframe_t supertank_frames_end_attack1[] = 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) }; + + static mmove_t supertank_move_end_attack1 = new mmove_t(FRAME_attak1_7, + FRAME_attak1_20, supertank_frames_end_attack1, supertank_run); + + static EntPainAdapter supertank_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + if (self.health < (self.max_health / 2)) + self.s.skinnum = 1; + + if (GameBase.level.time < self.pain_debounce_time) + return; + + // Lessen the chance of him going into his pain frames + if (damage <= 25) + if (Lib.random() < 0.2) + return; + + // Don't go into pain if he's firing his rockets + if (GameBase.skill.value >= 2) + if ((self.s.frame >= FRAME_attak2_1) + && (self.s.frame <= FRAME_attak2_14)) + return; + + self.pain_debounce_time = GameBase.level.time + 3; + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 10) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = supertank_move_pain1; + } else if (damage <= 25) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain3, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = supertank_move_pain2; + } else { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1, + Defines.ATTN_NORM, 0); + self.monsterinfo.currentmove = supertank_move_pain3; + } + } + }; + + static EntDieAdapter supertank_die = new EntDieAdapter() { + public void die(edict_t self, edict_t inflictor, edict_t attacker, + int damage, float[] point) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_NO; + self.count = 0; + self.monsterinfo.currentmove = supertank_move_death; + } + }; + + // + // monster_supertank + // + + /* + * QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush + * Trigger_Spawn Sight + */ + public static EntThinkAdapter SP_monster_supertank = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + sound_pain1 = GameBase.gi.soundindex("bosstank/btkpain1.wav"); + sound_pain2 = GameBase.gi.soundindex("bosstank/btkpain2.wav"); + sound_pain3 = GameBase.gi.soundindex("bosstank/btkpain3.wav"); + sound_death = GameBase.gi.soundindex("bosstank/btkdeth1.wav"); + sound_search1 = GameBase.gi.soundindex("bosstank/btkunqv1.wav"); + sound_search2 = GameBase.gi.soundindex("bosstank/btkunqv2.wav"); + + // self.s.sound = gi.soundindex ("bosstank/btkengn1.wav"); + tread_sound = GameBase.gi.soundindex("bosstank/btkengn1.wav"); + + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/boss1/tris.md2"); + Math3D.VectorSet(self.mins, -64, -64, 0); + Math3D.VectorSet(self.maxs, 64, 64, 112); + + self.health = 1500; + self.gib_health = -500; + self.mass = 800; + + self.pain = supertank_pain; + self.die = supertank_die; + self.monsterinfo.stand = supertank_stand; + self.monsterinfo.walk = supertank_walk; + self.monsterinfo.run = supertank_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = supertank_attack; + self.monsterinfo.search = supertank_search; + self.monsterinfo.melee = null; + self.monsterinfo.sight = null; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = supertank_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + return true; + } + }; + + void BossExplode(edict_t self) { + float[] org = { 0, 0, 0 }; + int n; + + self.think = GameAI.BossExplode; + Math3D.VectorCopy(self.s.origin, org); + org[2] += 24 + (Lib.rand() & 15); + switch (self.count++) { + case 0: + org[0] -= 24; + org[1] -= 24; + break; + case 1: + org[0] += 24; + org[1] += 24; + break; + case 2: + org[0] += 24; + org[1] -= 24; + break; + case 3: + org[0] -= 24; + org[1] += 24; + break; + case 4: + org[0] -= 48; + org[1] -= 48; + break; + case 5: + org[0] += 48; + org[1] += 48; + break; + case 6: + org[0] -= 48; + org[1] += 48; + break; + case 7: + org[0] += 48; + org[1] -= 48; + break; + case 8: + self.s.sound = 0; + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", + 500, Defines.GIB_ORGANIC); + for (n = 0; n < 8; n++) + GameAI.ThrowGib(self, "models/objects/gibs/sm_metal/tris.md2", + 500, Defines.GIB_METALLIC); + GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", 500, + Defines.GIB_ORGANIC); + GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", 500, + Defines.GIB_METALLIC); + self.deadflag = Defines.DEAD_DEAD; + return; + } + + GameBase.gi.WriteByte(Defines.svc_temp_entity); + GameBase.gi.WriteByte(Defines.TE_EXPLOSION1); + GameBase.gi.WritePosition(org); + GameBase.gi.multicast(self.s.origin, Defines.MULTICAST_PVS); + + self.nextthink = GameBase.level.time + 0.1f; + } + +}
\ No newline at end of file diff --git a/src/jake2/game/monsters/M_Tank.java b/src/jake2/game/monsters/M_Tank.java new file mode 100644 index 0000000..a2def15 --- /dev/null +++ b/src/jake2/game/monsters/M_Tank.java @@ -0,0 +1,1521 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +// Created on 13.11.2003 by RST. +// $Id: M_Tank.java,v 1.2 2005-02-06 18:48:15 salomo Exp $ +package jake2.game.monsters; + +import jake2.Defines; +import jake2.game.EntDieAdapter; +import jake2.game.EntInteractAdapter; +import jake2.game.EntPainAdapter; +import jake2.game.EntThinkAdapter; +import jake2.game.GameAI; +import jake2.game.GameBase; +import jake2.game.GameUtil; +import jake2.game.Monster; +import jake2.game.edict_t; +import jake2.game.mframe_t; +import jake2.game.mmove_t; +import jake2.util.Lib; +import jake2.util.Math3D; + +public class M_Tank { + // G:\quake2\baseq2\models/monsters/tank + + // This file generated by qdata - Do NOT Modify + + public final static int FRAME_stand01 = 0; + + public final static int FRAME_stand02 = 1; + + public final static int FRAME_stand03 = 2; + + public final static int FRAME_stand04 = 3; + + public final static int FRAME_stand05 = 4; + + public final static int FRAME_stand06 = 5; + + public final static int FRAME_stand07 = 6; + + public final static int FRAME_stand08 = 7; + + public final static int FRAME_stand09 = 8; + + public final static int FRAME_stand10 = 9; + + public final static int FRAME_stand11 = 10; + + public final static int FRAME_stand12 = 11; + + public final static int FRAME_stand13 = 12; + + public final static int FRAME_stand14 = 13; + + public final static int FRAME_stand15 = 14; + + public final static int FRAME_stand16 = 15; + + public final static int FRAME_stand17 = 16; + + public final static int FRAME_stand18 = 17; + + public final static int FRAME_stand19 = 18; + + public final static int FRAME_stand20 = 19; + + public final static int FRAME_stand21 = 20; + + public final static int FRAME_stand22 = 21; + + public final static int FRAME_stand23 = 22; + + public final static int FRAME_stand24 = 23; + + public final static int FRAME_stand25 = 24; + + public final static int FRAME_stand26 = 25; + + public final static int FRAME_stand27 = 26; + + public final static int FRAME_stand28 = 27; + + public final static int FRAME_stand29 = 28; + + public final static int FRAME_stand30 = 29; + + public final static int FRAME_walk01 = 30; + + public final static int FRAME_walk02 = 31; + + public final static int FRAME_walk03 = 32; + + public final static int FRAME_walk04 = 33; + + public final static int FRAME_walk05 = 34; + + public final static int FRAME_walk06 = 35; + + public final static int FRAME_walk07 = 36; + + public final static int FRAME_walk08 = 37; + + public final static int FRAME_walk09 = 38; + + public final static int FRAME_walk10 = 39; + + public final static int FRAME_walk11 = 40; + + public final static int FRAME_walk12 = 41; + + public final static int FRAME_walk13 = 42; + + public final static int FRAME_walk14 = 43; + + public final static int FRAME_walk15 = 44; + + public final static int FRAME_walk16 = 45; + + public final static int FRAME_walk17 = 46; + + public final static int FRAME_walk18 = 47; + + public final static int FRAME_walk19 = 48; + + public final static int FRAME_walk20 = 49; + + public final static int FRAME_walk21 = 50; + + public final static int FRAME_walk22 = 51; + + public final static int FRAME_walk23 = 52; + + public final static int FRAME_walk24 = 53; + + public final static int FRAME_walk25 = 54; + + public final static int FRAME_attak101 = 55; + + public final static int FRAME_attak102 = 56; + + public final static int FRAME_attak103 = 57; + + public final static int FRAME_attak104 = 58; + + public final static int FRAME_attak105 = 59; + + public final static int FRAME_attak106 = 60; + + public final static int FRAME_attak107 = 61; + + public final static int FRAME_attak108 = 62; + + public final static int FRAME_attak109 = 63; + + public final static int FRAME_attak110 = 64; + + public final static int FRAME_attak111 = 65; + + public final static int FRAME_attak112 = 66; + + public final static int FRAME_attak113 = 67; + + public final static int FRAME_attak114 = 68; + + public final static int FRAME_attak115 = 69; + + public final static int FRAME_attak116 = 70; + + public final static int FRAME_attak117 = 71; + + public final static int FRAME_attak118 = 72; + + public final static int FRAME_attak119 = 73; + + public final static int FRAME_attak120 = 74; + + public final static int FRAME_attak121 = 75; + + public final static int FRAME_attak122 = 76; + + public final static int FRAME_attak201 = 77; + + public final static int FRAME_attak202 = 78; + + public final static int FRAME_attak203 = 79; + + public final static int FRAME_attak204 = 80; + + public final static int FRAME_attak205 = 81; + + public final static int FRAME_attak206 = 82; + + public final static int FRAME_attak207 = 83; + + public final static int FRAME_attak208 = 84; + + public final static int FRAME_attak209 = 85; + + public final static int FRAME_attak210 = 86; + + public final static int FRAME_attak211 = 87; + + public final static int FRAME_attak212 = 88; + + public final static int FRAME_attak213 = 89; + + public final static int FRAME_attak214 = 90; + + public final static int FRAME_attak215 = 91; + + public final static int FRAME_attak216 = 92; + + public final static int FRAME_attak217 = 93; + + public final static int FRAME_attak218 = 94; + + public final static int FRAME_attak219 = 95; + + public final static int FRAME_attak220 = 96; + + public final static int FRAME_attak221 = 97; + + public final static int FRAME_attak222 = 98; + + public final static int FRAME_attak223 = 99; + + public final static int FRAME_attak224 = 100; + + public final static int FRAME_attak225 = 101; + + public final static int FRAME_attak226 = 102; + + public final static int FRAME_attak227 = 103; + + public final static int FRAME_attak228 = 104; + + public final static int FRAME_attak229 = 105; + + public final static int FRAME_attak230 = 106; + + public final static int FRAME_attak231 = 107; + + public final static int FRAME_attak232 = 108; + + public final static int FRAME_attak233 = 109; + + public final static int FRAME_attak234 = 110; + + public final static int FRAME_attak235 = 111; + + public final static int FRAME_attak236 = 112; + + public final static int FRAME_attak237 = 113; + + public final static int FRAME_attak238 = 114; + + public final static int FRAME_attak301 = 115; + + public final static int FRAME_attak302 = 116; + + public final static int FRAME_attak303 = 117; + + public final static int FRAME_attak304 = 118; + + public final static int FRAME_attak305 = 119; + + public final static int FRAME_attak306 = 120; + + public final static int FRAME_attak307 = 121; + + public final static int FRAME_attak308 = 122; + + public final static int FRAME_attak309 = 123; + + public final static int FRAME_attak310 = 124; + + public final static int FRAME_attak311 = 125; + + public final static int FRAME_attak312 = 126; + + public final static int FRAME_attak313 = 127; + + public final static int FRAME_attak314 = 128; + + public final static int FRAME_attak315 = 129; + + public final static int FRAME_attak316 = 130; + + public final static int FRAME_attak317 = 131; + + public final static int FRAME_attak318 = 132; + + public final static int FRAME_attak319 = 133; + + public final static int FRAME_attak320 = 134; + + public final static int FRAME_attak321 = 135; + + public final static int FRAME_attak322 = 136; + + public final static int FRAME_attak323 = 137; + + public final static int FRAME_attak324 = 138; + + public final static int FRAME_attak325 = 139; + + public final static int FRAME_attak326 = 140; + + public final static int FRAME_attak327 = 141; + + public final static int FRAME_attak328 = 142; + + public final static int FRAME_attak329 = 143; + + public final static int FRAME_attak330 = 144; + + public final static int FRAME_attak331 = 145; + + public final static int FRAME_attak332 = 146; + + public final static int FRAME_attak333 = 147; + + public final static int FRAME_attak334 = 148; + + public final static int FRAME_attak335 = 149; + + public final static int FRAME_attak336 = 150; + + public final static int FRAME_attak337 = 151; + + public final static int FRAME_attak338 = 152; + + public final static int FRAME_attak339 = 153; + + public final static int FRAME_attak340 = 154; + + public final static int FRAME_attak341 = 155; + + public final static int FRAME_attak342 = 156; + + public final static int FRAME_attak343 = 157; + + public final static int FRAME_attak344 = 158; + + public final static int FRAME_attak345 = 159; + + public final static int FRAME_attak346 = 160; + + public final static int FRAME_attak347 = 161; + + public final static int FRAME_attak348 = 162; + + public final static int FRAME_attak349 = 163; + + public final static int FRAME_attak350 = 164; + + public final static int FRAME_attak351 = 165; + + public final static int FRAME_attak352 = 166; + + public final static int FRAME_attak353 = 167; + + public final static int FRAME_attak401 = 168; + + public final static int FRAME_attak402 = 169; + + public final static int FRAME_attak403 = 170; + + public final static int FRAME_attak404 = 171; + + public final static int FRAME_attak405 = 172; + + public final static int FRAME_attak406 = 173; + + public final static int FRAME_attak407 = 174; + + public final static int FRAME_attak408 = 175; + + public final static int FRAME_attak409 = 176; + + public final static int FRAME_attak410 = 177; + + public final static int FRAME_attak411 = 178; + + public final static int FRAME_attak412 = 179; + + public final static int FRAME_attak413 = 180; + + public final static int FRAME_attak414 = 181; + + public final static int FRAME_attak415 = 182; + + public final static int FRAME_attak416 = 183; + + public final static int FRAME_attak417 = 184; + + public final static int FRAME_attak418 = 185; + + public final static int FRAME_attak419 = 186; + + public final static int FRAME_attak420 = 187; + + public final static int FRAME_attak421 = 188; + + public final static int FRAME_attak422 = 189; + + public final static int FRAME_attak423 = 190; + + public final static int FRAME_attak424 = 191; + + public final static int FRAME_attak425 = 192; + + public final static int FRAME_attak426 = 193; + + public final static int FRAME_attak427 = 194; + + public final static int FRAME_attak428 = 195; + + public final static int FRAME_attak429 = 196; + + public final static int FRAME_pain101 = 197; + + public final static int FRAME_pain102 = 198; + + public final static int FRAME_pain103 = 199; + + public final static int FRAME_pain104 = 200; + + public final static int FRAME_pain201 = 201; + + public final static int FRAME_pain202 = 202; + + public final static int FRAME_pain203 = 203; + + public final static int FRAME_pain204 = 204; + + public final static int FRAME_pain205 = 205; + + public final static int FRAME_pain301 = 206; + + public final static int FRAME_pain302 = 207; + + public final static int FRAME_pain303 = 208; + + public final static int FRAME_pain304 = 209; + + public final static int FRAME_pain305 = 210; + + public final static int FRAME_pain306 = 211; + + public final static int FRAME_pain307 = 212; + + public final static int FRAME_pain308 = 213; + + public final static int FRAME_pain309 = 214; + + public final static int FRAME_pain310 = 215; + + public final static int FRAME_pain311 = 216; + + public final static int FRAME_pain312 = 217; + + public final static int FRAME_pain313 = 218; + + public final static int FRAME_pain314 = 219; + + public final static int FRAME_pain315 = 220; + + public final static int FRAME_pain316 = 221; + + public final static int FRAME_death101 = 222; + + public final static int FRAME_death102 = 223; + + public final static int FRAME_death103 = 224; + + public final static int FRAME_death104 = 225; + + public final static int FRAME_death105 = 226; + + public final static int FRAME_death106 = 227; + + public final static int FRAME_death107 = 228; + + public final static int FRAME_death108 = 229; + + public final static int FRAME_death109 = 230; + + public final static int FRAME_death110 = 231; + + public final static int FRAME_death111 = 232; + + public final static int FRAME_death112 = 233; + + public final static int FRAME_death113 = 234; + + public final static int FRAME_death114 = 235; + + public final static int FRAME_death115 = 236; + + public final static int FRAME_death116 = 237; + + public final static int FRAME_death117 = 238; + + public final static int FRAME_death118 = 239; + + public final static int FRAME_death119 = 240; + + public final static int FRAME_death120 = 241; + + public final static int FRAME_death121 = 242; + + public final static int FRAME_death122 = 243; + + public final static int FRAME_death123 = 244; + + public final static int FRAME_death124 = 245; + + public final static int FRAME_death125 = 246; + + public final static int FRAME_death126 = 247; + + public final static int FRAME_death127 = 248; + + public final static int FRAME_death128 = 249; + + public final static int FRAME_death129 = 250; + + public final static int FRAME_death130 = 251; + + public final static int FRAME_death131 = 252; + + public final static int FRAME_death132 = 253; + + public final static int FRAME_recln101 = 254; + + public final static int FRAME_recln102 = 255; + + public final static int FRAME_recln103 = 256; + + public final static int FRAME_recln104 = 257; + + public final static int FRAME_recln105 = 258; + + public final static int FRAME_recln106 = 259; + + public final static int FRAME_recln107 = 260; + + public final static int FRAME_recln108 = 261; + + public final static int FRAME_recln109 = 262; + + public final static int FRAME_recln110 = 263; + + public final static int FRAME_recln111 = 264; + + public final static int FRAME_recln112 = 265; + + public final static int FRAME_recln113 = 266; + + public final static int FRAME_recln114 = 267; + + public final static int FRAME_recln115 = 268; + + public final static int FRAME_recln116 = 269; + + public final static int FRAME_recln117 = 270; + + public final static int FRAME_recln118 = 271; + + public final static int FRAME_recln119 = 272; + + public final static int FRAME_recln120 = 273; + + public final static int FRAME_recln121 = 274; + + public final static int FRAME_recln122 = 275; + + public final static int FRAME_recln123 = 276; + + public final static int FRAME_recln124 = 277; + + public final static int FRAME_recln125 = 278; + + public final static int FRAME_recln126 = 279; + + public final static int FRAME_recln127 = 280; + + public final static int FRAME_recln128 = 281; + + public final static int FRAME_recln129 = 282; + + public final static int FRAME_recln130 = 283; + + public final static int FRAME_recln131 = 284; + + public final static int FRAME_recln132 = 285; + + public final static int FRAME_recln133 = 286; + + public final static int FRAME_recln134 = 287; + + public final static int FRAME_recln135 = 288; + + public final static int FRAME_recln136 = 289; + + public final static int FRAME_recln137 = 290; + + public final static int FRAME_recln138 = 291; + + public final static int FRAME_recln139 = 292; + + public final static int FRAME_recln140 = 293; + + public final static float MODEL_SCALE = 1.000000f; + + static int sound_thud; + + static int sound_pain; + + static int sound_idle; + + static int sound_die; + + static int sound_step; + + static int sound_sight; + + static int sound_windup; + + static int sound_strike; + + // + // misc + // + + static EntInteractAdapter tank_sight = new EntInteractAdapter() { + 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 EntThinkAdapter tank_footstep = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_step, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter tank_thud = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_BODY, sound_thud, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter tank_windup = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_windup, 1, + Defines.ATTN_NORM, 0); + return true; + } + }; + + static EntThinkAdapter tank_idle = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_idle, 1, + Defines.ATTN_IDLE, 0); + return true; + } + }; + + // + // stand + // + + static mframe_t tank_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) }; + + static mmove_t tank_move_stand = new mmove_t(FRAME_stand01, FRAME_stand30, + tank_frames_stand, null); + + static EntThinkAdapter tank_stand = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = tank_move_stand; + return true; + } + }; + + // + // walk + // + static EntThinkAdapter tank_run = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (self.enemy != null && self.enemy.client != null) + self.monsterinfo.aiflags |= Defines.AI_BRUTAL; + else + self.monsterinfo.aiflags &= ~Defines.AI_BRUTAL; + + if ((self.monsterinfo.aiflags & Defines.AI_STAND_GROUND) != 0) { + self.monsterinfo.currentmove = tank_move_stand; + return true; + } + + if (self.monsterinfo.currentmove == tank_move_walk + || self.monsterinfo.currentmove == tank_move_start_run) { + self.monsterinfo.currentmove = tank_move_run; + } else { + self.monsterinfo.currentmove = tank_move_start_run; + } + return true; + } + }; + + static EntThinkAdapter tank_walk = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = tank_move_walk; + return true; + } + }; + + static mframe_t tank_frames_start_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 0, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 11, tank_footstep) }; + + static mmove_t tank_move_start_walk = new mmove_t(FRAME_walk01, + FRAME_walk04, tank_frames_start_walk, tank_walk); + + static mframe_t tank_frames_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 4, tank_footstep), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 4, null), + new mframe_t(GameAI.ai_walk, 5, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 7, null), + new mframe_t(GameAI.ai_walk, 6, null), + new mframe_t(GameAI.ai_walk, 6, tank_footstep) }; + + static mmove_t tank_move_walk = new mmove_t(FRAME_walk05, FRAME_walk20, + tank_frames_walk, null); + + static mframe_t tank_frames_stop_walk[] = new mframe_t[] { + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 3, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 2, null), + new mframe_t(GameAI.ai_walk, 4, tank_footstep) }; + + static mmove_t tank_move_stop_walk = new mmove_t(FRAME_walk21, + FRAME_walk25, tank_frames_stop_walk, tank_stand); + + // + // run + // + + static mframe_t tank_frames_start_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 0, null), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 11, tank_footstep) }; + + static mmove_t tank_move_start_run = new mmove_t(FRAME_walk01, + FRAME_walk04, tank_frames_start_run, tank_run); + + static mframe_t tank_frames_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 4, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 3, null), + new mframe_t(GameAI.ai_run, 2, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 4, null), + new mframe_t(GameAI.ai_run, 4, tank_footstep), + new mframe_t(GameAI.ai_run, 3, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 4, null), + new mframe_t(GameAI.ai_run, 5, null), + new mframe_t(GameAI.ai_run, 7, null), + new mframe_t(GameAI.ai_run, 7, null), + new mframe_t(GameAI.ai_run, 6, null), + new mframe_t(GameAI.ai_run, 6, tank_footstep) }; + + static mmove_t tank_move_run = new mmove_t(FRAME_walk05, FRAME_walk20, + tank_frames_run, null); + + static mframe_t tank_frames_stop_run[] = new mframe_t[] { + new mframe_t(GameAI.ai_run, 3, null), + new mframe_t(GameAI.ai_run, 3, null), + new mframe_t(GameAI.ai_run, 2, null), + new mframe_t(GameAI.ai_run, 2, null), + new mframe_t(GameAI.ai_run, 4, tank_footstep) }; + + static mmove_t tank_move_stop_run = new mmove_t(FRAME_walk21, FRAME_walk25, + tank_frames_stop_run, tank_walk); + + // + // pain + // + + static mframe_t tank_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) }; + + static mmove_t tank_move_pain1 = new mmove_t(FRAME_pain101, FRAME_pain104, + tank_frames_pain1, tank_run); + + static mframe_t tank_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 tank_move_pain2 = new mmove_t(FRAME_pain201, FRAME_pain205, + tank_frames_pain2, tank_run); + + static mframe_t tank_frames_pain3[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -7, 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, 0, null), + new mframe_t(GameAI.ai_move, 3, 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, 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, tank_footstep) }; + + static mmove_t tank_move_pain3 = new mmove_t(FRAME_pain301, FRAME_pain316, + tank_frames_pain3, tank_run); + + static EntPainAdapter tank_pain = new EntPainAdapter() { + public void pain(edict_t self, edict_t other, float kick, int damage) { + if (self.health < (self.max_health / 2)) + self.s.skinnum |= 1; + + if (damage <= 10) + return; + + if (GameBase.level.time < self.pain_debounce_time) + return; + + if (damage <= 30) + if (Lib.random() > 0.2) + return; + + // If hard or nightmare, don't go into pain while attacking + if (GameBase.skill.value >= 2) { + if ((self.s.frame >= FRAME_attak301) + && (self.s.frame <= FRAME_attak330)) + return; + if ((self.s.frame >= FRAME_attak101) + && (self.s.frame <= FRAME_attak116)) + return; + } + + self.pain_debounce_time = GameBase.level.time + 3; + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain, 1, + Defines.ATTN_NORM, 0); + + if (GameBase.skill.value == 3) + return; // no pain anims in nightmare + + if (damage <= 30) + self.monsterinfo.currentmove = tank_move_pain1; + else if (damage <= 60) + self.monsterinfo.currentmove = tank_move_pain2; + else + self.monsterinfo.currentmove = tank_move_pain3; + } + }; + + // + // attacks + // + + static EntThinkAdapter TankBlaster = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 }; + float[] start = { 0, 0, 0 }; + float[] end = { 0, 0, 0 }; + float[] dir = { 0, 0, 0 }; + int flash_number; + + if (self.s.frame == FRAME_attak110) + flash_number = Defines.MZ2_TANK_BLASTER_1; + else if (self.s.frame == FRAME_attak113) + flash_number = Defines.MZ2_TANK_BLASTER_2; + else + // (self.s.frame == FRAME_attak116) + flash_number = Defines.MZ2_TANK_BLASTER_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, end); + end[2] += self.enemy.viewheight; + Math3D.VectorSubtract(end, start, dir); + + Monster.monster_fire_blaster(self, start, dir, 30, 800, + flash_number, Defines.EF_BLASTER); + + return true; + } + }; + + static EntThinkAdapter TankStrike = new EntThinkAdapter() { + public boolean think(edict_t self) { + GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_strike, 1, + Defines.ATTN_NORM, 0); + + return true; + } + }; + + static EntThinkAdapter TankRocket = new EntThinkAdapter() { + 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_attak324) + flash_number = Defines.MZ2_TANK_ROCKET_1; + else if (self.s.frame == FRAME_attak327) + flash_number = Defines.MZ2_TANK_ROCKET_2; + else + // (self.s.frame == FRAME_attak330) + flash_number = Defines.MZ2_TANK_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, 550, + flash_number); + return true; + } + }; + + static EntThinkAdapter TankMachineGun = new EntThinkAdapter() { + 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_TANK_MACHINEGUN_1 + + (self.s.frame - FRAME_attak406); + + Math3D.AngleVectors(self.s.angles, 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); + vec[2] += self.enemy.viewheight; + Math3D.VectorSubtract(vec, start, vec); + Math3D.vectoangles(vec, vec); + dir[0] = vec[0]; + } else { + dir[0] = 0; + } + if (self.s.frame <= FRAME_attak415) + dir[1] = self.s.angles[1] - 8 * (self.s.frame - FRAME_attak411); + else + dir[1] = self.s.angles[1] + 8 * (self.s.frame - FRAME_attak419); + dir[2] = 0; + + Math3D.AngleVectors(dir, forward, null, null); + + Monster.monster_fire_bullet(self, start, forward, 20, 4, + Defines.DEFAULT_BULLET_HSPREAD, + Defines.DEFAULT_BULLET_VSPREAD, flash_number); + + return true; + } + }; + + static EntThinkAdapter tank_reattack_blaster = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.skill.value >= 2) + if (GameUtil.visible(self, self.enemy)) + if (self.enemy.health > 0) + if (Lib.random() <= 0.6) { + self.monsterinfo.currentmove = tank_move_reattack_blast; + return true; + } + self.monsterinfo.currentmove = tank_move_attack_post_blast; + return true; + } + }; + + static mframe_t tank_frames_attack_blast[] = new mframe_t[] { + 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, -1, null), + new mframe_t(GameAI.ai_charge, -2, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankBlaster), + // 10 + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankBlaster), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankBlaster) // 16 + }; + + static mmove_t tank_move_attack_blast = new mmove_t(FRAME_attak101, + FRAME_attak116, tank_frames_attack_blast, tank_reattack_blaster); + + static mframe_t tank_frames_reattack_blast[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankBlaster), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankBlaster) // 16) + }; + + static mmove_t tank_move_reattack_blast = new mmove_t(FRAME_attak111, + FRAME_attak116, tank_frames_reattack_blast, tank_reattack_blaster); + + static mframe_t tank_frames_attack_post_blast[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 0, null), // 17) + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 3, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, -2, tank_footstep) // 22 + }; + + static mmove_t tank_move_attack_post_blast = new mmove_t(FRAME_attak117, + FRAME_attak122, tank_frames_attack_post_blast, tank_run); + + static EntThinkAdapter tank_poststrike = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.enemy = null; + tank_run.think(self); + return true; + } + }; + + static EntThinkAdapter tank_doattack_rocket = new EntThinkAdapter() { + public boolean think(edict_t self) { + self.monsterinfo.currentmove = tank_move_attack_fire_rocket; + return true; + } + }; + + static EntThinkAdapter tank_refire_rocket = new EntThinkAdapter() { + public boolean think(edict_t self) { + // Only on hard or nightmare + if (GameBase.skill.value >= 2) + if (self.enemy.health > 0) + if (GameUtil.visible(self, self.enemy)) + if (Lib.random() <= 0.4) { + self.monsterinfo.currentmove = tank_move_attack_fire_rocket; + return true; + } + self.monsterinfo.currentmove = tank_move_attack_post_rocket; + return true; + } + }; + + static mframe_t tank_frames_attack_strike[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, 3, null), + 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, 6, null), + new mframe_t(GameAI.ai_move, 7, null), + new mframe_t(GameAI.ai_move, 9, tank_footstep), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 2, null), + new mframe_t(GameAI.ai_move, 2, tank_footstep), + 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, -2, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, 0, tank_windup), + 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, TankStrike), + new mframe_t(GameAI.ai_move, 0, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -1, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -10, null), + new mframe_t(GameAI.ai_move, -10, null), + new mframe_t(GameAI.ai_move, -2, null), + new mframe_t(GameAI.ai_move, -3, null), + new mframe_t(GameAI.ai_move, -2, tank_footstep) }; + + static mmove_t tank_move_attack_strike = new mmove_t(FRAME_attak201, + FRAME_attak238, tank_frames_attack_strike, tank_poststrike); + + static mframe_t tank_frames_attack_pre_rocket[] = new mframe_t[] { + 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), + // 10) + + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 1, null), + new mframe_t(GameAI.ai_charge, 2, null), + new mframe_t(GameAI.ai_charge, 7, null), + new mframe_t(GameAI.ai_charge, 7, null), + new mframe_t(GameAI.ai_charge, 7, tank_footstep), + 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), + // 20) + + new mframe_t(GameAI.ai_charge, -3, null) }; + + static mmove_t tank_move_attack_pre_rocket = new mmove_t(FRAME_attak301, + FRAME_attak321, tank_frames_attack_pre_rocket, tank_doattack_rocket); + + static mframe_t tank_frames_attack_fire_rocket[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, -3, null), // Loop Start 22 ) + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankRocket), // 24) + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, TankRocket), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -1, TankRocket) // 30 Loop End + }; + + static mmove_t tank_move_attack_fire_rocket = new mmove_t(FRAME_attak322, + FRAME_attak330, tank_frames_attack_fire_rocket, tank_refire_rocket); + + static mframe_t tank_frames_attack_post_rocket[] = new mframe_t[] { + new mframe_t(GameAI.ai_charge, 0, null), // 31) + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 2, null), + new mframe_t(GameAI.ai_charge, 3, null), + new mframe_t(GameAI.ai_charge, 4, null), + new mframe_t(GameAI.ai_charge, 2, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + // 40) + + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, -9, null), + new mframe_t(GameAI.ai_charge, -8, null), + new mframe_t(GameAI.ai_charge, -7, null), + new mframe_t(GameAI.ai_charge, -1, null), + new mframe_t(GameAI.ai_charge, -1, tank_footstep), + 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), + // 50) + + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null), + new mframe_t(GameAI.ai_charge, 0, null) }; + + static mmove_t tank_move_attack_post_rocket = new mmove_t(FRAME_attak331, + FRAME_attak353, tank_frames_attack_post_rocket, tank_run); + + static mframe_t tank_frames_attack_chain[] = new mframe_t[] { + 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(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + new mframe_t(null, 0, TankMachineGun), + 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) }; + + static mmove_t tank_move_attack_chain = new mmove_t(FRAME_attak401, + FRAME_attak429, tank_frames_attack_chain, tank_run); + + static EntThinkAdapter tank_attack = new EntThinkAdapter() { + public boolean think(edict_t self) { + float[] vec = { 0, 0, 0 }; + float range; + float r; + + if (self.enemy.health < 0) { + self.monsterinfo.currentmove = tank_move_attack_strike; + self.monsterinfo.aiflags &= ~Defines.AI_BRUTAL; + return true; + } + + Math3D.VectorSubtract(self.enemy.s.origin, self.s.origin, vec); + range = Math3D.VectorLength(vec); + + r = Lib.random(); + + if (range <= 125) { + if (r < 0.4) + self.monsterinfo.currentmove = tank_move_attack_chain; + else + self.monsterinfo.currentmove = tank_move_attack_blast; + } else if (range <= 250) { + if (r < 0.5) + self.monsterinfo.currentmove = tank_move_attack_chain; + else + self.monsterinfo.currentmove = tank_move_attack_blast; + } else { + if (r < 0.33) + self.monsterinfo.currentmove = tank_move_attack_chain; + else if (r < 0.66) { + self.monsterinfo.currentmove = tank_move_attack_pre_rocket; + self.pain_debounce_time = GameBase.level.time + 5.0f; // no + // pain + // for + // a + // while + } else + self.monsterinfo.currentmove = tank_move_attack_blast; + } + return true; + } + }; + + // + // death + // + static EntThinkAdapter tank_dead = new EntThinkAdapter() { + public boolean think(edict_t self) { + Math3D.VectorSet(self.mins, -16, -16, -16); + Math3D.VectorSet(self.maxs, 16, 16, -0); + self.movetype = Defines.MOVETYPE_TOSS; + self.svflags |= Defines.SVF_DEADMONSTER; + self.nextthink = 0; + GameBase.gi.linkentity(self); + return true; + } + }; + + static mframe_t tank_frames_death1[] = new mframe_t[] { + new mframe_t(GameAI.ai_move, -7, null), + 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, 6, null), + new mframe_t(GameAI.ai_move, 1, null), + new mframe_t(GameAI.ai_move, 1, null), + 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, -2, 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, 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, -4, null), + new mframe_t(GameAI.ai_move, -6, null), + new mframe_t(GameAI.ai_move, -4, null), + new mframe_t(GameAI.ai_move, -5, null), + new mframe_t(GameAI.ai_move, -7, null), + new mframe_t(GameAI.ai_move, -15, tank_thud), + new mframe_t(GameAI.ai_move, -5, 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 tank_move_death = new mmove_t(FRAME_death101, + FRAME_death132, tank_frames_death1, tank_dead); + + static EntDieAdapter tank_die = new EntDieAdapter() { + 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 < 1 /* 4 */; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_meat/tris.md2", damage, + Defines.GIB_ORGANIC); + for (n = 0; n < 4; n++) + GameAI.ThrowGib(self, + "models/objects/gibs/sm_metal/tris.md2", damage, + Defines.GIB_METALLIC); + GameAI.ThrowGib(self, "models/objects/gibs/chest/tris.md2", + damage, Defines.GIB_ORGANIC); + GameAI.ThrowHead(self, "models/objects/gibs/gear/tris.md2", + damage, Defines.GIB_METALLIC); + self.deadflag = Defines.DEAD_DEAD; + return; + } + + if (self.deadflag == Defines.DEAD_DEAD) + return; + + // regular death + GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_die, 1, + Defines.ATTN_NORM, 0); + self.deadflag = Defines.DEAD_DEAD; + self.takedamage = Defines.DAMAGE_YES; + + self.monsterinfo.currentmove = tank_move_death; + + } + }; + + // + // monster_tank + // + + /* + * QUAKED monster_tank (1 .5 0) (-32 -32 -16) (32 32 72) Ambush + * Trigger_Spawn Sight + */ + /* + * QUAKED monster_tank_commander (1 .5 0) (-32 -32 -16) (32 32 72) Ambush + * Trigger_Spawn Sight + */ + public static EntThinkAdapter SP_monster_tank = new EntThinkAdapter() { + public boolean think(edict_t self) { + if (GameBase.deathmatch.value != 0) { + GameUtil.G_FreeEdict(self); + return true; + } + + self.s.modelindex = GameBase.gi + .modelindex("models/monsters/tank/tris.md2"); + Math3D.VectorSet(self.mins, -32, -32, -16); + Math3D.VectorSet(self.maxs, 32, 32, 72); + self.movetype = Defines.MOVETYPE_STEP; + self.solid = Defines.SOLID_BBOX; + + sound_pain = GameBase.gi.soundindex("tank/tnkpain2.wav"); + sound_thud = GameBase.gi.soundindex("tank/tnkdeth2.wav"); + sound_idle = GameBase.gi.soundindex("tank/tnkidle1.wav"); + sound_die = GameBase.gi.soundindex("tank/death.wav"); + sound_step = GameBase.gi.soundindex("tank/step.wav"); + sound_windup = GameBase.gi.soundindex("tank/tnkatck4.wav"); + sound_strike = GameBase.gi.soundindex("tank/tnkatck5.wav"); + sound_sight = GameBase.gi.soundindex("tank/sight1.wav"); + + GameBase.gi.soundindex("tank/tnkatck1.wav"); + GameBase.gi.soundindex("tank/tnkatk2a.wav"); + GameBase.gi.soundindex("tank/tnkatk2b.wav"); + GameBase.gi.soundindex("tank/tnkatk2c.wav"); + GameBase.gi.soundindex("tank/tnkatk2d.wav"); + GameBase.gi.soundindex("tank/tnkatk2e.wav"); + GameBase.gi.soundindex("tank/tnkatck3.wav"); + + if (Lib.strcmp(self.classname, "monster_tank_commander") == 0) { + self.health = 1000; + self.gib_health = -225; + } else { + self.health = 750; + self.gib_health = -200; + } + + self.mass = 500; + + self.pain = tank_pain; + self.die = tank_die; + self.monsterinfo.stand = tank_stand; + self.monsterinfo.walk = tank_walk; + self.monsterinfo.run = tank_run; + self.monsterinfo.dodge = null; + self.monsterinfo.attack = tank_attack; + self.monsterinfo.melee = null; + self.monsterinfo.sight = tank_sight; + self.monsterinfo.idle = tank_idle; + + GameBase.gi.linkentity(self); + + self.monsterinfo.currentmove = tank_move_stand; + self.monsterinfo.scale = MODEL_SCALE; + + GameAI.walkmonster_start.think(self); + + if (Lib.strcmp(self.classname, "monster_tank_commander") == 0) + self.s.skinnum = 2; + return true; + } + }; + +}
\ No newline at end of file |