//EW prototypes void() EW_Precache; void() start_praying; void() stop_praying; void() xsniper; void() terminate_xsniper; void(float waypath) player_create_waypoint; void() CreateWayFile; void() OpenWayFile; void() W_Attack2; void() ShowSpawnSpots; /* */ void (entity targ, entity inflictor, entity attacker, float damage) T_Damage; void () player_run; void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage; void() SuperDamageSound; // called by worldspawn void() W_Precache = { precache_sound ("weapons/r_exp3.wav"); // new rocket explosion precache_sound ("weapons/ric1.wav"); // ricochet (used in c code) precache_sound ("weapons/ric2.wav"); // ricochet (used in c code) precache_sound ("weapons/ric3.wav"); // ricochet (used in c code) precache_sound ("weapons/spike2.wav"); // super spikes precache_sound ("weapons/tink1.wav"); // spikes tink (used in c code) precache_sound ("weapons/bounce.wav"); // grenade bounce // Koolio, Eternal War specific weapon precaches EW_Precache(); }; float() crandom = { return 2*(random() - 0.5); }; //============================================================================ vector() wall_velocity = { local vector vel; vel = normalize (self.velocity); vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5)); vel = vel + 2*trace_plane_normal; vel = vel * 200; return vel; }; /* =============================================================================== PLAYER WEAPON USE =============================================================================== */ void() W_SetCurrentAmmo = { //Xsniper, don't show weapon if we are praying if (self.praying == 1) { //self.currentammo = 0; self.oldmodel = self.weaponmodel; self.weaponmodel = ""; //self.weaponframe = 0; return; } //Koolio, added glows //if we are a player if (self.classname == "player") player_run (); // get out of any weapon firing states self.items = self.items - ( self.items & (IT_BOLTS | IT_MANA_BLUE | IT_MANA_GREEN | IT_MANA_GREY) ); if (self.weapon == IT_DAGGER) //Koolio, changed to dagger { self.currentammo = 0; self.weaponmodel = "models/weapons/holy/v_dagger.md2"; self.weaponframe = 5; StandardGlow(); //Sets glow to white } else if (self.weapon == IT_CROSSBOW) //Koolio, changed to crossbow { self.currentammo = self.ammo_bolts; self.weaponmodel = "models/weapons/holy/v_xbow.md2"; self.weaponframe = 4; self.items = self.items | IT_BOLTS; StandardGlow(); //Sets glow to white } else if (self.weapon == IT_TRINITY_BLAST) //Trinity blast { self.currentammo = self.ammo_mana_blue; self.weaponmodel = "models/weapons/holy/v_trinity.mdl"; self.weaponframe = 0; self.items = self.items | IT_MANA_BLUE; ColouredGlow(0,1,0,250); //Sets glow to green } else if (self.weapon == IT_ICE_SHARDS) // Koolio, Iceshards. Uses knife model punch sequence for casting. { self.currentammo = self.ammo_mana_blue; //self.weaponmodel = "models/weapons/holy/v_dagger.md2"; self.weaponmodel = "models/weapons/holy/v_iceblast.mdl"; self.weaponframe = 0; //was 5 self.items = self.items | IT_MANA_BLUE; ColouredGlow(0.2,0.71,0.92,250); //Sets glow to sky-blue } else if (self.weapon == IT_LIGHTNING_ARC) // Koolio, lightning arc { self.currentammo = self.ammo_mana_green; self.weaponmodel = "models/weapons/holy/v_light.md2"; // self.weaponframe = 5; self.weaponframe = 0; self.items = self.items | IT_MANA_GREEN; ColouredGlow(0,0,1,250); //Sets glow to blue } else if (self.weapon == IT_SMITE) //Koolio, changed to smite { self.currentammo = self.ammo_mana_green; self.weaponmodel = "models/weapons/holy/v_dagger.md2"; self.weaponframe = 5; self.items = self.items | IT_MANA_GREEN; ColouredGlow(0.6,0,1,250); //Sets glow to purple } else if (self.weapon == IT_SOUL_DISC) //Koolio, changed to Soul Disc { self.currentammo = self.ammo_mana_grey; self.weaponmodel = "models/weapons/holy/v_souldisc.md2"; self.weaponframe = 0; self.items = self.items | IT_MANA_GREY; ColouredGlow(1,0.55,0,250); //Sets glow to orange } else if (self.weapon == IT_SWORD) { // self.currentammo = self.ammo_mana_grey; self.currentammo = 0; //Koolio, don't look for cells self.weaponmodel = "models/weapons/holy/v_sword.md2"; self.weaponframe = 7; // self.items = self.items | IT_MANA_GREY; ColouredGlow(1,1,0,250); //Sets glow to yellow } else { self.currentammo = 0; self.weaponmodel = ""; self.weaponframe = 0; } }; float() W_BestWeapon = //Koolio, changed to work with the new weapons { local float it; it = self.items; if (self.ammo_mana_grey >= 2 && (it & IT_SOUL_DISC) ) return IT_SOUL_DISC; if (self.ammo_mana_green >= 1 && (it & IT_SMITE) ) return IT_SMITE; if(self.ammo_mana_green >= 1 && (it & IT_LIGHTNING_ARC) ) return IT_LIGHTNING_ARC; if(self.ammo_mana_blue >= 2 && (it & IT_ICE_SHARDS) ) return IT_ICE_SHARDS; if(self.ammo_mana_blue >= 1 && (it & IT_TRINITY_BLAST) ) return IT_TRINITY_BLAST; if(self.ammo_bolts >= 1 && (it & IT_CROSSBOW)) return IT_CROSSBOW; if (it & IT_SWORD) return IT_SWORD; return IT_DAGGER; }; float() W_CheckNoAmmo = { //check ammo for primary attacks if(self.weapon == IT_CROSSBOW && self.currentammo >= 1) return TRUE; if(self.weapon == IT_TRINITY_BLAST && self.currentammo >= 1) return TRUE; if(self.weapon == IT_ICE_SHARDS && self.currentammo >= 2) return TRUE; if(self.weapon == IT_LIGHTNING_ARC && self.currentammo >= 1) return TRUE; if(self.weapon == IT_SMITE && self.currentammo >= 1) return TRUE; if(self.weapon == IT_SOUL_DISC && self.currentammo >= 2) return TRUE; if(self.weapon == IT_SWORD) return TRUE; if (self.weapon == IT_DAGGER) return TRUE; self.weapon = W_BestWeapon (); W_SetCurrentAmmo (); // drop the weapon down return FALSE; }; /* ============ W_Attack An attack impulse can be triggered now ============ */ void() W_Attack = { //attack based on wmode if (self.wmode == 2) { W_Attack2(); return; } local float r; if (!W_CheckNoAmmo ()) return; //Xsniper - don't let us attack if we are praying if (self.praying == 1) return; makevectors (self.v_angle); // calculate forward angle for velocity self.show_hostile = time + 1; // wake monsters up if (self.weapon == IT_DAGGER) { sound (self, CHAN_WEAPON, "weapons/holy/punchmiss.wav", 1, ATTN_NORM); r = random(); if (r < 0.33) player_dagger1 (); else if (r<0.66) player_daggerb1 (); else player_daggerc1 (); self.attack_finished = time + 0.5; } else if (self.weapon == IT_CROSSBOW) //Koolio, changed to crossbow { player_crossbow1(); W_FireCrossbow(); self.attack_finished = time + 0.5; } else if (self.weapon == IT_TRINITY_BLAST) //Koolio, changed to Trinity Blast { player_casttrinblast (); self.attack_finished = time + 0.7; } else if (self.weapon == IT_ICE_SHARDS) //Koolio, changed to iceshards { player_castshards1 (); self.attack_finished = time + 0.45; //Koolio, change? } else if (self.weapon == IT_LIGHTNING_ARC) //Koolio, changed to lightning arc { player_castarc1 (); self.attack_finished = time + 0.7; //Pretty slow refire rate? } else if (self.weapon == IT_SMITE) //Koolio, changed to smite { player_castsmite1(); //W_FireSmite(); self.attack_finished = time + 0.7; //Koolio, maybe use 0.8 like the Quake RL? } else if (self.weapon == IT_SOUL_DISC) //Koolio, changed to Soul Disc { player_castsouldisc1(); // W_FireRocket(); self.attack_finished = time + 0.5; //Refire rate? } else if (self.weapon == IT_SWORD) //Changed to sword { r = random(); if (r < 0.20) player_sword1 (); else if (r<0.4) player_swordb1 (); else if (r<0.6) player_swordc1 (); else if (r<0.8) player_swordd1 (); else player_sworde1 (); self.attack_finished = time + 0.5; } }; float() W_CheckNoAmmo2 = { //check ammo for secondary attacks if(self.weapon == IT_CROSSBOW && self.currentammo >= 3) return TRUE; if(self.weapon == IT_TRINITY_BLAST && self.currentammo >= 3) return TRUE; if(self.weapon == IT_ICE_SHARDS && self.currentammo >= 4) return TRUE; if(self.weapon == IT_LIGHTNING_ARC && self.currentammo >= 10) return TRUE; if(self.weapon == IT_SMITE && self.currentammo >= 2) return TRUE; if(self.weapon == IT_SOUL_DISC && self.currentammo >= 2) return TRUE; if(self.weapon == IT_SWORD) return TRUE; if (self.weapon == IT_DAGGER) return TRUE; // self.weapon = W_BestWeapon (); // W_SetCurrentAmmo (); //change our weapon mode sound (self, CHAN_AUTO, "weapons/xbowclick.wav", 1, ATTN_NORM); self.wmode = set_wmode(1); // drop the weapon down return FALSE; }; /* ============ W_Attack2 Secondary Attack modes ============ */ void() W_Attack2 = { local float r; if (!W_CheckNoAmmo2 ()) return; //Xsniper - don't let us attack if we are praying if (self.praying == 1) return; makevectors (self.v_angle); // calculate forward angle for velocity self.show_hostile = time + 1; // wake monsters up if (self.weapon == IT_DAGGER) { sound (self, CHAN_WEAPON, "weapons/holy/punchmiss.wav", 1, ATTN_NORM); player_daggerd1 (); self.attack_finished = time + 0.5; } else if (self.weapon == IT_CROSSBOW) //Koolio, changed to crossbow { player_crossbow1(); W_FireCrossbow2(); self.attack_finished = time + 0.7; } else if (self.weapon == IT_TRINITY_BLAST) //Koolio, changed to Trinity Blast { player_casttrinblastb (); self.attack_finished = time + 0.7; } else if (self.weapon == IT_ICE_SHARDS) //Koolio, changed to iceshards { player_castshardsb1(); self.attack_finished = time + 0.45; //Koolio, change? } else if (self.weapon == IT_LIGHTNING_ARC) //Koolio, changed to lightning arc { player_castarcb1 (); self.attack_finished = time + 0.7; //Pretty slow refire rate? } else if (self.weapon == IT_SMITE) //Koolio, changed to smite { player_castsmiteb1(); //W_FireSmite(); self.attack_finished = time + 0.7; //Koolio, maybe use 0.8 like the Quake RL? } else if (self.weapon == IT_SOUL_DISC) //Koolio, changed to Soul Disc { player_castsouldiscb1(); // W_FireRocket(); self.attack_finished = time + 0.5; //Refire rate? } else if (self.weapon == IT_SWORD) //Changed to sword { player_swordsec1(); self.attack_finished = time + 1; } }; /* ============ W_ChangeWeapon ============ */ void() W_ChangeWeapon = { local float it, am, fl; it = self.items; am = 0; if (self.impulse == 1) { fl = IT_DAGGER; } else if (self.impulse == 2) { fl = IT_CROSSBOW; if (self.ammo_bolts < 1) am = 1; } else if (self.impulse == 3) { fl = IT_TRINITY_BLAST; if (self.ammo_mana_blue < 1) am = 1; } else if (self.impulse == 4) { fl = IT_ICE_SHARDS; if (self.ammo_mana_blue < 2) am = 1; } else if (self.impulse == 5) { fl = IT_LIGHTNING_ARC; if (self.ammo_mana_green < 1) am = 1; } else if (self.impulse == 6) { fl = IT_SMITE; if (self.ammo_mana_green < 1) am = 1; } else if (self.impulse == 7) { fl = IT_SOUL_DISC; if (self.ammo_mana_grey < 2) am = 1; } else if (self.impulse == 8) { fl = IT_SWORD; //if (self.ammo_mana_grey < 1) //Koolio, don't look for cells // am = 1; } self.impulse = 0; if (!(self.items & fl)) { // don't have it return; } if (am) { // don't have the mana sprint (self, "Not enough mana.\n"); return; } // // set weapon, set ammo // self.weapon = fl; W_SetCurrentAmmo (); }; /* ============ CheatCommand ============ */ void() CheatCommand = { if (deathmatch || coop) { bprint (self.netname); bprint (" tried to cheat in multiplayer, the sucker!\n"); return; } self.ammo_mana_green = 100; self.ammo_mana_blue = 200; self.ammo_bolts = 100; self.items = self.items | IT_DAGGER | IT_CROSSBOW | IT_TRINITY_BLAST | IT_ICE_SHARDS | IT_LIGHTNING_ARC | IT_SMITE | IT_SOUL_DISC | IT_KEY1 | IT_KEY2; self.ammo_mana_grey = 200; self.items = self.items | IT_SWORD; self.weapon = IT_SMITE; self.impulse = 0; W_SetCurrentAmmo (); }; /* ============ CycleWeaponCommand Go to the next weapon with ammo ============ */ void() CycleWeaponCommand = { local float it, am; it = self.items; self.impulse = 0; while (1) { am = 0; if (self.weapon == IT_SWORD) { self.weapon = IT_DAGGER; } else if (self.weapon == IT_DAGGER) { self.weapon = IT_CROSSBOW; if (self.ammo_bolts < 1) am = 1; } else if (self.weapon == IT_CROSSBOW) { self.weapon = IT_TRINITY_BLAST; if (self.ammo_mana_blue < 1) am = 1; } else if (self.weapon == IT_TRINITY_BLAST) { self.weapon = IT_ICE_SHARDS; if (self.ammo_mana_blue < 2) am = 1; } else if (self.weapon == IT_ICE_SHARDS) { self.weapon = IT_LIGHTNING_ARC; if (self.ammo_mana_green < 1) am = 1; } else if (self.weapon == IT_LIGHTNING_ARC) { self.weapon = IT_SMITE; if (self.ammo_mana_green < 1) am = 1; } else if (self.weapon == IT_SMITE) { self.weapon = IT_SOUL_DISC; if (self.ammo_mana_grey < 2) am = 1; } else if (self.weapon == IT_SOUL_DISC) { self.weapon = IT_SWORD; //if (self.ammo_mana_grey < 1) //Koolio, don't look for cells // am = 1; } if ( (it & self.weapon) && am == 0) { W_SetCurrentAmmo (); return; } } }; /* ============ CycleWeaponReverseCommand Go to the prev weapon with ammo ============ */ void() CycleWeaponReverseCommand = { local float it, am; it = self.items; self.impulse = 0; while (1) { am = 0; if (self.weapon == IT_SWORD) { self.weapon = IT_SOUL_DISC; if (self.ammo_mana_grey < 2) am = 1; } else if (self.weapon == IT_SOUL_DISC) { self.weapon = IT_SMITE; if (self.ammo_mana_green < 1) am = 1; } else if (self.weapon == IT_SMITE) { self.weapon = IT_LIGHTNING_ARC; if (self.ammo_mana_green < 1) am = 1; } else if (self.weapon == IT_LIGHTNING_ARC) { self.weapon = IT_ICE_SHARDS; if (self.ammo_mana_blue < 2) am = 1; } else if (self.weapon == IT_ICE_SHARDS) { self.weapon = IT_TRINITY_BLAST; if (self.ammo_mana_blue < 1) am = 1; } else if (self.weapon == IT_TRINITY_BLAST) { self.weapon = IT_CROSSBOW; if (self.ammo_bolts < 1) am = 1; } else if (self.weapon == IT_CROSSBOW) { self.weapon = IT_DAGGER; } else if (self.weapon == IT_DAGGER) { self.weapon = IT_SWORD; //if (self.ammo_mana_grey < 1) //Koolio, don't look for cells // am = 1; } if ( (it & self.weapon) && am == 0) { W_SetCurrentAmmo (); return; } } }; /* ============ ServerflagsCommand Just for development ============ */ void() ServerflagsCommand = { serverflags = serverflags * 2 + 1; }; void() QuadCheat = { if (deathmatch || coop) return; self.super_time = 1; self.super_damage_finished = time + 30; self.items = self.items | IT_QUAD; dprint ("quad cheat\n"); }; /* void() md3Think = { if (self.frame >= 179) self.frame = 0; //go through animation frames self.frame = self.frame + 1; //spin self.angles_y = self.angles_y + 10; self.fixangle = TRUE; self.nextthink = time + 0.1; self.think = md3Think; }; void() md3Test = { local entity bot; // start entity and place it in world bot = spawn(); bot.angles = self.angles; makevectors(self.angles); setorigin (bot, self.origin + (v_forward * 100)); bot.fixangle = TRUE; // set size and shape bot.solid = SOLID_SLIDEBOX; bot.movetype = MOVETYPE_STEP; setmodel (bot, "models/enemies/bossform1.md3"); setsize (bot, '-16 -16 -24', '16 16 40'); // polish him up bot.classname = "md3test"; bot.ideal_yaw = bot.angles * '0 1 0'; bot.yaw_speed = 120; bot.view_ofs = '0 0 22'; // thinking bot.nextthink = time + 0.1 + random(); bot.think = md3Think; }; */ /* ============ ImpulseCommands ============ */ void() FullVersionCommands = { if (self.impulse == 9) CheatCommand (); //md3test //if (self.impulse == 40) // md3Test(); //xsniperbot if (self.impulse == 42) { //don't spawn in single player if (cvar("deathmatch") >= 1) { //only admins allowed if (self.admin == 1) { //don't forget MAX_BOTS if (num_bots < MAX_BOTS) { xsniper(); //increment number of bots num_bots = num_bots + 1; set_numbots(num_bots); } else centerprint(self,"Maximum amount of bots already in server!\n"); } } } if (self.impulse == 43) //create the waypoint file CreateWayFile(); if (self.impulse == 44) //create waypoint on red path player_create_waypoint(0); if (self.impulse == 45) //create waypoint on green path player_create_waypoint(1); if (self.impulse == 46) //create waypoint on blue path player_create_waypoint(2); if (self.impulse == 47) //load up the waypoint file OpenWayFile(); //remove xsniperbot if (self.impulse == 48) { //can't do it if not in multiplayer game if (cvar("deathmatch") >= 1) { //only admins allowed if (self.admin == 1) { terminate_xsniper(); //decrement number of bots num_bots = num_bots - 1; set_numbots(num_bots); } } } if (self.impulse == 49) //show all the spawn spots on the map { if (cvar("deathmatch") <= 0) ShowSpawnSpots(); } if (self.impulse == 255) QuadCheat (); }; void() ImpulseCommands = { if (self.impulse >= 1 && self.impulse <= 8) W_ChangeWeapon (); if (self.impulse == 10) CycleWeaponCommand (); if (self.impulse == 11) ServerflagsCommand (); if (self.impulse == 12) CycleWeaponReverseCommand (); //toggle secondary attack mode if (self.impulse == 30) { //make some noise so we know something is happening sound (self, CHAN_AUTO, "weapons/xbowclick.wav", 1, ATTN_NORM); if (self.wmode == 1) self.wmode = set_wmode(2); else if (self.wmode == 2) self.wmode = set_wmode(1); } //prayer ability if (self.impulse == 60) { //toggle between praying and not praying if ((self.health < 100 || cvar("deathmatch") == 1) && self.praying == 0) start_praying(); else if (self.praying == 1) stop_praying(); else bprint("You are already at full power\n"); } if (gamemode == IT_DAGGER / IT_SMITE) FullVersionCommands(); self.impulse = 0; }; /* ============ W_WeaponFrame Called every frame so impulse events can be handled as well as possible ============ */ void() W_WeaponFrame = { if (time < self.attack_finished) return; if (self.impulse) ImpulseCommands (); // check for attack if (self.button0) { SuperDamageSound (); W_Attack (); } }; /* ======== SuperDamageSound Plays sound if needed ======== */ void() SuperDamageSound = { if (self.super_damage_finished > time) { if (self.super_sound < time) { self.super_sound = time + 1; sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM); } } return; };