/* * $Header: /HexenWorld/Siege/crossbow.hc 38 6/16/98 12:00p Ggribb $ */ /* ============================================================================== Q:\art\models\weapons\crossbow\final\crossbow.hc ============================================================================== */ // For building the model $cd Q:\art\models\weapons\crossbow\final $origin 0 0 0 $base base skin $skin skin $flags 0 // $frame select1 select2 select3 select4 select5 $frame select6 select7 select8 select9 select10 $frame select11 select12 select13 select14 select15 // $frame shoot1 shoot2 shoot3 shoot4 shoot5 $frame shoot6 shoot7 shoot8 shoot9 shoot10 $frame shoot11 shoot12 shoot13 shoot14 shoot15 $frame shoot16 shoot17 shoot18 shoot19 void flashspin () { if(self.lifetime200&&other.thingtype!=THINGTYPE_FLESH)//So it can't break catapults and ballistas and ramparts hitdmg=1; sound(self,CHAN_BODY,"misc/null.wav",1,ATTN_NORM); setsize(self,'0 0 0','0 0 0'); self.takedamage=DAMAGE_NO; self.velocity='0 0 0'; self.movetype=MOVETYPE_NOCLIP; self.solid=SOLID_NOT; self.touch=SUB_Null; self.health=other.health; if(other.thingtype==THINGTYPE_FLESH) sound(self, CHAN_WEAPON, "assassin/arr2flsh.wav", 1, ATTN_NORM); else if(other.thingtype==THINGTYPE_WOOD) sound(self, CHAN_WEAPON, "assassin/arr2wood.wav", 1, ATTN_NORM); else sound(self, CHAN_WEAPON, "weapons/met2stn.wav", 1, ATTN_NORM); MakeFlash(self.origin-v_forward*8); if(other.takedamage) { if(other.solid!=SOLID_BSP) if(self.frags) if(flammable(other)) spawn_burner(other,FALSE); if(other.flags2&FL_ALIVE&&other.classname!="player_sheep") { headdist=vlen(other.origin+other.view_ofs - self.origin); hitspot=self.origin+v_forward*headdist; if(vlen(hitspot-self.origin)<10)//head shot, instant kill { T_Damage(other,self,self.owner,other.health+30); skiprest=TRUE; } } if(!skiprest) if(self.classname=="bolt") { if(other.thingtype==THINGTYPE_FLESH||other.classname=="barrel") T_Damage(other,self,self.owner,hitdmg); else T_Damage(other,self,self.owner,random(2,5)); } else T_Damage(other,self,self.owner,3); SpawnPuff(self.origin+v_forward*8,'0 0 0'-v_forward*24,10,other); if(other.solid!=SOLID_BSP) { //Put it right below view of player if(other.classname=="player") { stickdir_z=other.origin_z+other.proj_ofs_z+ 1; stickdir=other.origin+normalize(self.origin-other.origin)*12; stick=TRUE; setorigin(self,stickdir); } else { rad=(other.maxs_x+other.maxs_z)*0.5; center=(other.absmax+other.absmin)*0.5; stickspot=self.origin+v_forward*other.maxs_x*2; if(vlen(center-stickspot)9) self.frame=0; } if(self.lifetimetime) { missile.frags=TRUE; missile.thingtype=THINGTYPE_METAL; setmodel(missile,"models/flaming.mdl"); missile.speed=random(1100,1400); missile.classname="flarrow"; missile.drawflags(+)MLS_ABSLIGHT|MLS_FIREFLICKER; missile.abslight = .75; } else { missile.classname="bolt"; missile.thingtype=THINGTYPE_WOOD_METAL; setmodel(missile,"models/arrow.mdl"); speed_mod=melee_dmg_mod_for_strength (self.strength); missile.speed=random(1100,1400); } } else { missile.classname="bolt"; missile.thingtype=THINGTYPE_WOOD; setmodel(missile,"models/arrow.mdl"); speed_mod=melee_dmg_mod_for_strength (self.strength); missile.speed=800+100*(random(speed_mod)); } missile.movetype=MOVETYPE_FLYMISSILE; missile.th_die=chunk_death; missile.touch=CB_BoltHit; float num_weap; num_weap=num_for_weap (self.weapon); offset = rate_and_acc_for_weap [(self.playerclass - 1)*6+(num_weap - 1)*2+1]/2; v_offset = v_right*(random(offset)*2 - offset) + v_up*(random(offset)*2 - offset) + v_forward; v_offset = normalize(v_offset); missile.o_angle=missile.velocity=normalize(v_offset)*missile.speed; missile.angles=vectoangles(missile.velocity); if(!powered_up) { missile.think = Missile_Arc; thinktime missile : 0.2; } // missile.lifetime=time+0.2; setsize(missile,'0 0 0','0 0 0'); setorigin(missile,self.origin+self.proj_ofs+v_forward*8); }; void()crossbow_fire; void crossbow_idle(void) { self.th_weapon=crossbow_idle; self.weaponframe=$shoot19; } void crossbow_fire (void) { float num_weap; self.wfs = advanceweaponframe($shoot1,$shoot18); self.th_weapon=crossbow_fire; if(self.button0&&self.weaponframe==$shoot2 &&self.weapon==IT_WEAPON3) self.weaponframe=$shoot1; else if (self.weaponframe == $shoot2) { num_weap = num_for_weap (self.weapon); if(self.playerclass==CLASS_ASSASSIN&&self.weapon==IT_WEAPON3) { sound(self,CHAN_WEAPON,"assassin/firefblt.wav",1,ATTN_NORM); FireCB_Bolt(TRUE); self.attack_finished=time+2;//rate_and_acc_for_weap[(self.playerclass - 1)*6+(num_weap - 1)*2]; } else { sound(self,CHAN_WEAPON,"assassin/firebolt.wav",1,ATTN_NORM); FireCB_Bolt(FALSE); self.attack_finished=time+rate_and_acc_for_weap[(self.playerclass - 1)*6+(num_weap - 1)*2]; } } else if (self.wfs==WF_CYCLE_WRAPPED) crossbow_idle(); } void crossbow_select (void) { //selection sound? self.wfs = advanceweaponframe($select15,$select1); self.weaponmodel = "models/xbow2.mdl"; self.th_weapon=crossbow_select; if (self.weaponframe==$select1) { self.attack_finished = time - 1; crossbow_idle(); } } void crossbow_deselect (void) { self.wfs = advanceweaponframe($select1,$select15); self.th_weapon=crossbow_deselect; if (self.wfs==WF_CYCLE_WRAPPED) W_SetCurrentAmmo(); }