0
Files
lwjake2/src/main/java/lwjake2/game/monsters/M_Flipper.java

491 lines
19 KiB
Java

/*
* 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.
*/
package lwjake2.game.monsters;
import lwjake2.Defines;
import lwjake2.game.EntDieAdapter;
import lwjake2.game.EntInteractAdapter;
import lwjake2.game.EntPainAdapter;
import lwjake2.game.EntThinkAdapter;
import lwjake2.game.GameAI;
import lwjake2.game.GameBase;
import lwjake2.game.GameMisc;
import lwjake2.game.GameUtil;
import lwjake2.game.GameWeapon;
import lwjake2.game.edict_t;
import lwjake2.game.mframe_t;
import lwjake2.game.mmove_t;
import lwjake2.util.Lib;
import lwjake2.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_flpbit20 = 19;
public final static int FRAME_flphor01 = 41;
public final static int FRAME_flphor05 = 45;
public final static int FRAME_flphor24 = 64;
public final static int FRAME_flpver01 = 65;
public final static int FRAME_flpver06 = 70;
public final static int FRAME_flpver29 = 93;
public final static int FRAME_flppn101 = 94;
public final static int FRAME_flppn105 = 98;
public final static int FRAME_flppn201 = 99;
public final static int FRAME_flppn205 = 103;
public final static int FRAME_flpdth01 = 104;
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 String getID() { return "flipper_stand"; }
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 String getID() { return "flipper_run_loop"; }
public boolean think(edict_t self) {
self.monsterinfo.currentmove = flipper_move_run_loop;
return true;
}
};
static mframe_t flipper_frames_run_start[] = new mframe_t[] {
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null) };
static mmove_t flipper_move_run_start = new mmove_t(FRAME_flpver01,
FRAME_flpver06, flipper_frames_run_start, flipper_run_loop);
static EntThinkAdapter flipper_run = new EntThinkAdapter() {
public String getID() { return "flipper_run"; }
public boolean think(edict_t self) {
self.monsterinfo.currentmove = flipper_move_run_start;
return true;
}
};
/* Standard Swimming */
static mframe_t flipper_frames_walk[] = new mframe_t[] {
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null),
new mframe_t(GameAI.ai_walk, 4, null) };
static mmove_t flipper_move_walk = new mmove_t(FRAME_flphor01,
FRAME_flphor24, flipper_frames_walk, null);
static EntThinkAdapter flipper_walk = new EntThinkAdapter() {
public String getID() { return "flipper_walk"; }
public boolean think(edict_t self) {
self.monsterinfo.currentmove = flipper_move_walk;
return true;
}
};
static mframe_t flipper_frames_start_run[] = new mframe_t[] {
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, null),
new mframe_t(GameAI.ai_run, 8, flipper_run) };
static mmove_t flipper_move_start_run = new mmove_t(FRAME_flphor01,
FRAME_flphor05, flipper_frames_start_run, null);
static EntThinkAdapter flipper_start_run = new EntThinkAdapter() {
public String getID() { return "flipper_start_run"; }
public boolean think(edict_t self) {
self.monsterinfo.currentmove = flipper_move_start_run;
return true;
}
};
static mframe_t flipper_frames_pain2[] = new mframe_t[] {
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null) };
static mmove_t flipper_move_pain2 = new mmove_t(FRAME_flppn101,
FRAME_flppn105, flipper_frames_pain2, flipper_run);
static mframe_t flipper_frames_pain1[] = new mframe_t[] {
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null) };
static mmove_t flipper_move_pain1 = new mmove_t(FRAME_flppn201,
FRAME_flppn205, flipper_frames_pain1, flipper_run);
static EntThinkAdapter flipper_bite = new EntThinkAdapter() {
public String getID() { return "flipper_bite"; }
public boolean think(edict_t self) {
float[] aim = { 0, 0, 0 };
Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, 0, 0);
GameWeapon.fire_hit(self, aim, 5, 0);
return true;
}
};
static EntThinkAdapter flipper_preattack = new EntThinkAdapter() {
public String getID() { return "flipper_preattack"; }
public boolean think(edict_t self) {
GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_chomp, 1,
Defines.ATTN_NORM, 0);
return true;
}
};
static mframe_t flipper_frames_attack[] = new mframe_t[] {
new mframe_t(GameAI.ai_charge, 0, flipper_preattack),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, flipper_bite),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, null),
new mframe_t(GameAI.ai_charge, 0, flipper_bite),
new mframe_t(GameAI.ai_charge, 0, null) };
static mmove_t flipper_move_attack = new mmove_t(FRAME_flpbit01,
FRAME_flpbit20, flipper_frames_attack, flipper_run);
static EntThinkAdapter flipper_melee = new EntThinkAdapter() {
public String getID() { return "flipper_melee"; }
public boolean think(edict_t self) {
self.monsterinfo.currentmove = flipper_move_attack;
return true;
}
};
static EntPainAdapter flipper_pain = new EntPainAdapter() {
public String getID() { return "flipper_pain"; }
public void pain(edict_t self, edict_t other, float kick, int damage) {
int n;
if (self.health < (self.max_health / 2))
self.s.skinnum = 1;
if (GameBase.level.time < self.pain_debounce_time)
return;
self.pain_debounce_time = GameBase.level.time + 3;
if (GameBase.skill.value == 3)
return; // no pain anims in nightmare
n = (Lib.rand() + 1) % 2;
if (n == 0) {
GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain1, 1,
Defines.ATTN_NORM, 0);
self.monsterinfo.currentmove = flipper_move_pain1;
} else {
GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_pain2, 1,
Defines.ATTN_NORM, 0);
self.monsterinfo.currentmove = flipper_move_pain2;
}
return;
}
};
static EntThinkAdapter flipper_dead = new EntThinkAdapter() {
public String getID() { return "flipper_dead"; }
public boolean think(edict_t self) {
Math3D.VectorSet(self.mins, -16, -16, -24);
Math3D.VectorSet(self.maxs, 16, 16, -8);
self.movetype = Defines.MOVETYPE_TOSS;
self.svflags |= Defines.SVF_DEADMONSTER;
self.nextthink = 0;
GameBase.gi.linkentity(self);
return true;
}
};
static mframe_t flipper_frames_death[] = new mframe_t[] {
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null),
new mframe_t(GameAI.ai_move, 0, null) };
static mmove_t flipper_move_death = new mmove_t(FRAME_flpdth01,
FRAME_flpdth56, flipper_frames_death, flipper_dead);
static EntInteractAdapter flipper_sight = new EntInteractAdapter() {
public String getID() { return "flipper_sight"; }
public boolean interact(edict_t self, edict_t other) {
GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1,
Defines.ATTN_NORM, 0);
return true;
}
};
static EntDieAdapter flipper_die = new EntDieAdapter() {
public String getID() { return "flipper_die"; }
public void die(edict_t self, edict_t inflictor, edict_t attacker,
int damage, float[] point) {
int n;
// check for gib
if (self.health <= self.gib_health) {
GameBase.gi
.sound(self, Defines.CHAN_VOICE, GameBase.gi
.soundindex("misc/udeath.wav"), 1,
Defines.ATTN_NORM, 0);
for (n = 0; n < 2; n++)
GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2",
damage, Defines.GIB_ORGANIC);
for (n = 0; n < 2; n++)
GameMisc.ThrowGib(self,
"models/objects/gibs/sm_meat/tris.md2", damage,
Defines.GIB_ORGANIC);
GameMisc.ThrowHead(self, "models/objects/gibs/sm_meat/tris.md2",
damage, Defines.GIB_ORGANIC);
self.deadflag = Defines.DEAD_DEAD;
return;
}
if (self.deadflag == Defines.DEAD_DEAD)
return;
// regular death
GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death, 1,
Defines.ATTN_NORM, 0);
self.deadflag = Defines.DEAD_DEAD;
self.takedamage = Defines.DAMAGE_YES;
self.monsterinfo.currentmove = flipper_move_death;
}
};
/*
* QUAKED monster_flipper (1 .5 0) (-16 -16 -24) (16 16 32) Ambush
* Trigger_Spawn Sight
*/
public static void SP_monster_flipper(edict_t self) {
if (GameBase.deathmatch.value != 0) {
GameUtil.G_FreeEdict(self);
return;
}
sound_pain1 = GameBase.gi.soundindex("flipper/flppain1.wav");
sound_pain2 = GameBase.gi.soundindex("flipper/flppain2.wav");
sound_death = GameBase.gi.soundindex("flipper/flpdeth1.wav");
sound_chomp = GameBase.gi.soundindex("flipper/flpatck1.wav");
sound_attack = GameBase.gi.soundindex("flipper/flpatck2.wav");
sound_idle = GameBase.gi.soundindex("flipper/flpidle1.wav");
sound_search = GameBase.gi.soundindex("flipper/flpsrch1.wav");
sound_sight = GameBase.gi.soundindex("flipper/flpsght1.wav");
self.movetype = Defines.MOVETYPE_STEP;
self.solid = Defines.SOLID_BBOX;
self.s.modelindex = GameBase.gi
.modelindex("models/monsters/flipper/tris.md2");
Math3D.VectorSet(self.mins, -16, -16, 0);
Math3D.VectorSet(self.maxs, 16, 16, 32);
self.health = 50;
self.gib_health = -30;
self.mass = 100;
self.pain = flipper_pain;
self.die = flipper_die;
self.monsterinfo.stand = flipper_stand;
self.monsterinfo.walk = flipper_walk;
self.monsterinfo.run = flipper_start_run;
self.monsterinfo.melee = flipper_melee;
self.monsterinfo.sight = flipper_sight;
GameBase.gi.linkentity(self);
self.monsterinfo.currentmove = flipper_move_stand;
self.monsterinfo.scale = MODEL_SCALE;
GameAI.swimmonster_start.think(self);
}
}