refactoring
This commit is contained in:
		
							parent
							
								
									10d98c67c0
								
							
						
					
					
						commit
						bdb67729dd
					
				
							
								
								
									
										197
									
								
								fixsrcnames.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										197
									
								
								fixsrcnames.fish
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,197 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set reps \
 | 
				
			||||||
 | 
						WriteByte write_byte \
 | 
				
			||||||
 | 
						WriteChar write_char \
 | 
				
			||||||
 | 
						WriteShort write_short \
 | 
				
			||||||
 | 
						WriteLong write_long \
 | 
				
			||||||
 | 
						WriteCoord write_coord \
 | 
				
			||||||
 | 
						WriteAngle write_angle \
 | 
				
			||||||
 | 
						WriteString write_string \
 | 
				
			||||||
 | 
						WriteEntity write_entity \
 | 
				
			||||||
 | 
						makevectors make_vectors \
 | 
				
			||||||
 | 
						setorigin set_origin \
 | 
				
			||||||
 | 
						setmodel set_model \
 | 
				
			||||||
 | 
						setsize set_size \
 | 
				
			||||||
 | 
						objerror error_obj \
 | 
				
			||||||
 | 
						vlen vec_len \
 | 
				
			||||||
 | 
						vectoyaw vec_yaw \
 | 
				
			||||||
 | 
						traceline trace_line \
 | 
				
			||||||
 | 
						checkclient check_client \
 | 
				
			||||||
 | 
						stuffcmd cmd_client \
 | 
				
			||||||
 | 
						localcmd cmd_server \
 | 
				
			||||||
 | 
						findradius find_radius \
 | 
				
			||||||
 | 
						sprint print_cl \
 | 
				
			||||||
 | 
						bprint print_all \
 | 
				
			||||||
 | 
						dprint print_dbg \
 | 
				
			||||||
 | 
						coredump core_dump \
 | 
				
			||||||
 | 
						traceon trace_on \
 | 
				
			||||||
 | 
						traceoff trace_off \
 | 
				
			||||||
 | 
						eprint print_ent \
 | 
				
			||||||
 | 
						walkmove walk_move \
 | 
				
			||||||
 | 
						droptofloor drop_to_floor \
 | 
				
			||||||
 | 
						lightstyle light_style \
 | 
				
			||||||
 | 
						checkbottom check_bottom \
 | 
				
			||||||
 | 
						pointcontents point_contents \
 | 
				
			||||||
 | 
						nextent next_ent \
 | 
				
			||||||
 | 
						ChangeYaw change_yaw \
 | 
				
			||||||
 | 
						vectoangles vec_to_angles \
 | 
				
			||||||
 | 
						movetogoal move_to_goal \
 | 
				
			||||||
 | 
						makestatic make_static \
 | 
				
			||||||
 | 
						centerprint print_center \
 | 
				
			||||||
 | 
						ambientsound ambient_sound \
 | 
				
			||||||
 | 
						setspawnparms set_spawn_parms \
 | 
				
			||||||
 | 
						infoadd info_add \
 | 
				
			||||||
 | 
						infoget info_get \
 | 
				
			||||||
 | 
						SUB_AttackFinished sub_attack_finished \
 | 
				
			||||||
 | 
						SUB_CalcMove sub_calc_move \
 | 
				
			||||||
 | 
						SUB_CalcMoveEnt sub_calc_move_ent \
 | 
				
			||||||
 | 
						SUB_CalcMoveDone sub_calc_move_done \
 | 
				
			||||||
 | 
						SUB_CalcAngleMove sub_calc_angle_move \
 | 
				
			||||||
 | 
						SUB_CalcAngleMoveDone sub_calc_angle_move_done \
 | 
				
			||||||
 | 
						SUB_CheckRefire sub_check_refire \
 | 
				
			||||||
 | 
						SUB_Null sub_null \
 | 
				
			||||||
 | 
						SUB_PainNull sub_pain_null \
 | 
				
			||||||
 | 
						SUB_UseTargets sub_use_targets \
 | 
				
			||||||
 | 
						SUB_Remove sub_remove \
 | 
				
			||||||
 | 
						T_Heal ent_heal \
 | 
				
			||||||
 | 
						CanHeal can_heal \
 | 
				
			||||||
 | 
						CanDamage can_damage \
 | 
				
			||||||
 | 
						T_Damage ent_damage \
 | 
				
			||||||
 | 
						T_RadiusDamage ent_radius_damage \
 | 
				
			||||||
 | 
						T_MissileTouch ent_missile_touch \
 | 
				
			||||||
 | 
						Key1Name key_1_name \
 | 
				
			||||||
 | 
						Key2Name key_2_name \
 | 
				
			||||||
 | 
						Demon_Melee demon_melee \
 | 
				
			||||||
 | 
						Demon_JumpTouch demon_jump_touch \
 | 
				
			||||||
 | 
						DemonCheckAttack demon_check_attack \
 | 
				
			||||||
 | 
						DogCheckAttack dog_check_attack \
 | 
				
			||||||
 | 
						ShalHome shalrath_home \
 | 
				
			||||||
 | 
						ShalMissile shalrath_missile \
 | 
				
			||||||
 | 
						ShalMissileTouch shalrath_missile_touch \
 | 
				
			||||||
 | 
						ClientObituary client_obituary \
 | 
				
			||||||
 | 
						DeathBubbles death_bubbles \
 | 
				
			||||||
 | 
						ChooseTurn choose_turn \
 | 
				
			||||||
 | 
						LaunchLaser launch_laser \
 | 
				
			||||||
 | 
						SpawnBlood spawn_blood \
 | 
				
			||||||
 | 
						BecomeExplosion become_explosion \
 | 
				
			||||||
 | 
						SameTeam is_same_team \
 | 
				
			||||||
 | 
						DecodeLevelParms decode_level_parms \
 | 
				
			||||||
 | 
						CopyToBodyQue copy_to_body_queue \
 | 
				
			||||||
 | 
						InitBodyQue init_body_queue \
 | 
				
			||||||
 | 
						SuperDamageSound super_damage_sound \
 | 
				
			||||||
 | 
						W_ChangeWeapon wep_change_weapon \
 | 
				
			||||||
 | 
						W_CycleWeaponReverse wep_cycle_weapon_reverse \
 | 
				
			||||||
 | 
						W_CycleWeapon wep_cycle_weapon \
 | 
				
			||||||
 | 
						W_FireAxe wep_fire_axe \
 | 
				
			||||||
 | 
						W_FireShotgun wep_fire_shotgun \
 | 
				
			||||||
 | 
						W_FireSuperShotgun wep_fire_super_shotgun \
 | 
				
			||||||
 | 
						W_FireRocket wep_fire_rocket \
 | 
				
			||||||
 | 
						W_FireLightning wep_fire_lightning \
 | 
				
			||||||
 | 
						W_FireGrenade wep_fire_grenade \
 | 
				
			||||||
 | 
						W_FireSpikes wep_fire_nail \
 | 
				
			||||||
 | 
						W_FireSuperSpikes wep_fire_super_nail \
 | 
				
			||||||
 | 
						W_BestWeapon wep_best_weapon \
 | 
				
			||||||
 | 
						W_SetCurrentAmmo wep_set_current_ammo \
 | 
				
			||||||
 | 
						W_WeaponFrame wep_weapon_frame \
 | 
				
			||||||
 | 
						WizardCheckAttack wiz_check_attack \
 | 
				
			||||||
 | 
						PlayerDie player_die \
 | 
				
			||||||
 | 
						ImpulseCommands impulse_commands \
 | 
				
			||||||
 | 
						anglemod angle_mod \
 | 
				
			||||||
 | 
						HuntTarget hunt_target \
 | 
				
			||||||
 | 
						SightSound sight_sound \
 | 
				
			||||||
 | 
						FoundTarget found_target \
 | 
				
			||||||
 | 
						FindTarget find_target \
 | 
				
			||||||
 | 
						FacingIdeal facing_ideal \
 | 
				
			||||||
 | 
						CheckAnyAttack check_any_attack \
 | 
				
			||||||
 | 
						FindIntermission find_intermission \
 | 
				
			||||||
 | 
						GotoNextMap go_to_next_map \
 | 
				
			||||||
 | 
						ExitIntermission intermission_exit \
 | 
				
			||||||
 | 
						IntermissionThink intermission_think \
 | 
				
			||||||
 | 
						CheckSpawnPoint check_spawn_point \
 | 
				
			||||||
 | 
						SelectSpawnPoint select_spawn_point \
 | 
				
			||||||
 | 
						NextLevel next_level \
 | 
				
			||||||
 | 
						CheckRules check_rules \
 | 
				
			||||||
 | 
						PlayerDeathThink player_death_think \
 | 
				
			||||||
 | 
						PlayerJump player_jump \
 | 
				
			||||||
 | 
						WaterMove water_move \
 | 
				
			||||||
 | 
						CheckWaterJump check_water_jump \
 | 
				
			||||||
 | 
						CheckPowerups check_powerups \
 | 
				
			||||||
 | 
						BothPlayers are_both_players \
 | 
				
			||||||
 | 
						Killed killed \
 | 
				
			||||||
 | 
						T_BeamDamage beam_damage \
 | 
				
			||||||
 | 
						Demon_MeleeAttack demon_melee_attack \
 | 
				
			||||||
 | 
						CheckDemonMelee demon_check_melee \
 | 
				
			||||||
 | 
						CheckDemonJump demon_check_jump \
 | 
				
			||||||
 | 
						Dog_JumpTouch dog_jump_touch \
 | 
				
			||||||
 | 
						CheckDogMelee dog_check_melee \
 | 
				
			||||||
 | 
						CheckDogJump dog_check_jump \
 | 
				
			||||||
 | 
						EntitiesTouching entities_touching \
 | 
				
			||||||
 | 
						LinkDoors link_doors \
 | 
				
			||||||
 | 
						Laser_Touch laser_touch \
 | 
				
			||||||
 | 
						CheckAttack check_attack \
 | 
				
			||||||
 | 
						SoldierCheckAttack army_check_attack \
 | 
				
			||||||
 | 
						ShamCheckAttack sham_check_attack \
 | 
				
			||||||
 | 
						OgreCheckAttack ogre_check_attack \
 | 
				
			||||||
 | 
						CheckForCharge check_for_charge \
 | 
				
			||||||
 | 
						CheckContinueCharge check_continue_charge \
 | 
				
			||||||
 | 
						SUB_regen sub_regen \
 | 
				
			||||||
 | 
						PlaceItem place_item \
 | 
				
			||||||
 | 
						StartItem start_item \
 | 
				
			||||||
 | 
						RankForWeapon wep_rank_for_weapon \
 | 
				
			||||||
 | 
						Deathmatch_Weapon wep_deathmatch_weapon \
 | 
				
			||||||
 | 
						BackpackTouch backpack_touch \
 | 
				
			||||||
 | 
						DropBackpack drop_backpack \
 | 
				
			||||||
 | 
						FireAmbient fire_ambient \
 | 
				
			||||||
 | 
						OgreGrenadeExplode ogre_grenade_explode \
 | 
				
			||||||
 | 
						OgreGrenadeTouch ogre_grenade_touch \
 | 
				
			||||||
 | 
						OgreFireGrenade ogre_fire_grenade \
 | 
				
			||||||
 | 
						PainSound player_pain_sound \
 | 
				
			||||||
 | 
						DeathBubblesSpawn player_death_bubbles_spawn \
 | 
				
			||||||
 | 
						DeathSound player_death_sound \
 | 
				
			||||||
 | 
						PlayerDead player_dead \
 | 
				
			||||||
 | 
						VelocityForDamage player_velocity_for_damage \
 | 
				
			||||||
 | 
						ThrowGib throw_gib \
 | 
				
			||||||
 | 
						ThrowHead throw_head \
 | 
				
			||||||
 | 
						GibPlayer player_gib \
 | 
				
			||||||
 | 
						ShamClaw sham_claw \
 | 
				
			||||||
 | 
						CastLightning sham_cast_lightning \
 | 
				
			||||||
 | 
						SetMovedir set_move_dir \
 | 
				
			||||||
 | 
						InitTrigger init_trigger \
 | 
				
			||||||
 | 
						DelayThink delay_think \
 | 
				
			||||||
 | 
						Tar_JumpTouch tbaby_jump_touch \
 | 
				
			||||||
 | 
						W_Precache wep_precache \
 | 
				
			||||||
 | 
						SpawnMeatSpray spawn_meat_spray \
 | 
				
			||||||
 | 
						SpawnChunk spawn_chunk \
 | 
				
			||||||
 | 
						ClearMultiDamage multi_damage_clear \
 | 
				
			||||||
 | 
						ApplyMultiDamage multi_damage_apply \
 | 
				
			||||||
 | 
						AddMultiDamage multi_damage_add \
 | 
				
			||||||
 | 
						TraceAttack trace_attack \
 | 
				
			||||||
 | 
						FireBullets fire_bullets \
 | 
				
			||||||
 | 
						LightningDamage lightning_damage \
 | 
				
			||||||
 | 
						GrenadeExplode grenade_explode \
 | 
				
			||||||
 | 
						GrenadeTouch grenade_touch \
 | 
				
			||||||
 | 
						W_Attack wep_attack \
 | 
				
			||||||
 | 
						LaunchMissile launch_missile \
 | 
				
			||||||
 | 
						WizardAttackFinished wiz_attack_finished \
 | 
				
			||||||
 | 
						Wiz_FastFire wiz_fast_fire \
 | 
				
			||||||
 | 
						Wiz_StartFast wiz_start_fast \
 | 
				
			||||||
 | 
						Wiz_idlesound wiz_idle_sound \
 | 
				
			||||||
 | 
						Wiz_Pain wiz_pain \
 | 
				
			||||||
 | 
						Wiz_Missile wiz_missile \
 | 
				
			||||||
 | 
						ZombieGrenadeTouch zombie_grenade_touch \
 | 
				
			||||||
 | 
						ZombieFireGrenade zombie_fire_grenade \
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set srcs (find source -type f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for i in (seq 2 2 (count $reps))
 | 
				
			||||||
 | 
						set i2 (math -s0 $i - 1)
 | 
				
			||||||
 | 
						set from $reps[$i2]
 | 
				
			||||||
 | 
						set to $reps[$i]
 | 
				
			||||||
 | 
						echo $i2.$from = $i.$to
 | 
				
			||||||
 | 
						for f in $srcs
 | 
				
			||||||
 | 
							sed -i -e "s/\b$from\b/$to/g" "$f"
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## EOF
 | 
				
			||||||
							
								
								
									
										120
									
								
								source/ai.qc
									
									
									
									
									
								
							
							
						
						
									
										120
									
								
								source/ai.qc
									
									
									
									
									
								
							| 
						 | 
					@ -9,7 +9,7 @@ float(entity enemy) enemy_is_gone = {
 | 
				
			||||||
// as the sight target the next frame so that monsters near that one
 | 
					// as the sight target the next frame so that monsters near that one
 | 
				
			||||||
// will wake up even if they wouldn't have noticed the player
 | 
					// will wake up even if they wouldn't have noticed the player
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
float(float v) anglemod = {
 | 
					float(float v) angle_mod = {
 | 
				
			||||||
	while(v >= 360) {
 | 
						while(v >= 360) {
 | 
				
			||||||
		v = v - 360;
 | 
							v = v - 360;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -40,12 +40,12 @@ The number of seconds to spend standing or bowing for path_stand or path_bow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() movetarget_f = {
 | 
					void() movetarget_f = {
 | 
				
			||||||
	if(!self.targetname) {
 | 
						if(!self.targetname) {
 | 
				
			||||||
		objerror("monster_movetarget: no targetname");
 | 
							error_obj("monster_movetarget: no targetname");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.solid = SOLID_TRIGGER;
 | 
						self.solid = SOLID_TRIGGER;
 | 
				
			||||||
	self.touch = t_movetarget;
 | 
						self.touch = t_movetarget;
 | 
				
			||||||
	setsize(self, '-8 -8 -8', '8 8 8');
 | 
						set_size(self, '-8 -8 -8', '8 8 8');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,9 +83,9 @@ void() t_movetarget = {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE); // play chainsaw drag sound
 | 
							sound(self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE); // play chainsaw drag sound
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//dprint("t_movetarget\n");
 | 
						//print_dbg("t_movetarget\n");
 | 
				
			||||||
	self.goalentity = self.movetarget = find(world, targetname, other.target);
 | 
						self.goalentity = self.movetarget = find(world, targetname, other.target);
 | 
				
			||||||
	self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
 | 
						self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin);
 | 
				
			||||||
	if(!self.movetarget) {
 | 
						if(!self.movetarget) {
 | 
				
			||||||
		self.pausetime = time + 999999;
 | 
							self.pausetime = time + 999999;
 | 
				
			||||||
		self.th_stand();
 | 
							self.th_stand();
 | 
				
			||||||
| 
						 | 
					@ -96,15 +96,15 @@ void() t_movetarget = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() HuntTarget = {
 | 
					void() hunt_target = {
 | 
				
			||||||
	self.goalentity = self.enemy;
 | 
						self.goalentity = self.enemy;
 | 
				
			||||||
	self.think = self.th_run;
 | 
						self.think = self.th_run;
 | 
				
			||||||
	self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
 | 
						self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin);
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
	SUB_AttackFinished(1); // wait a while before first attack
 | 
						sub_attack_finished(1); // wait a while before first attack
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() SightSound = {
 | 
					void() sight_sound = {
 | 
				
			||||||
	string snd;
 | 
						string snd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch(self.classname) {
 | 
						switch(self.classname) {
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ void() SightSound = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, snd, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, snd, 1, ATTN_NORM);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() FoundTarget = {
 | 
					void() found_target = {
 | 
				
			||||||
	if(self.enemy.classname == "player") {
 | 
						if(self.enemy.classname == "player") {
 | 
				
			||||||
		// let other monsters see this monster for a while
 | 
							// let other monsters see this monster for a while
 | 
				
			||||||
		sight_entity = self;
 | 
							sight_entity = self;
 | 
				
			||||||
| 
						 | 
					@ -141,13 +141,13 @@ void() FoundTarget = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.show_hostile = time + 1; // wake up other monsters
 | 
						self.show_hostile = time + 1; // wake up other monsters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SightSound();
 | 
						sight_sound();
 | 
				
			||||||
	HuntTarget();
 | 
						hunt_target();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
===========
 | 
					===========
 | 
				
			||||||
FindTarget
 | 
					find_target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Self is currently not attacking anything, so try to find a target
 | 
					Self is currently not attacking anything, so try to find a target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ checked each frame. This means multi player games will have slightly
 | 
				
			||||||
slower noticing monsters.
 | 
					slower noticing monsters.
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() FindTarget = {
 | 
					float() find_target = {
 | 
				
			||||||
	entity client;
 | 
						entity client;
 | 
				
			||||||
	float r;
 | 
						float r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -178,7 +178,7 @@ float() FindTarget = {
 | 
				
			||||||
			return FALSE;
 | 
								return FALSE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		client = checkclient();
 | 
							client = check_client();
 | 
				
			||||||
		if(!client) {
 | 
							if(!client) {
 | 
				
			||||||
			return FALSE; // current check entity isn't in PVS
 | 
								return FALSE; // current check entity isn't in PVS
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -221,7 +221,7 @@ float() FindTarget = {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FoundTarget();
 | 
						found_target();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return TRUE;
 | 
						return TRUE;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -229,11 +229,11 @@ float() FindTarget = {
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float dist) ai_forward = {
 | 
					void(float dist) ai_forward = {
 | 
				
			||||||
	walkmove(self.angles_y, dist);
 | 
						walk_move(self.angles_y, dist);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float dist) ai_back = {
 | 
					void(float dist) ai_back = {
 | 
				
			||||||
	walkmove((self.angles_y + 180), dist);
 | 
						walk_move((self.angles_y + 180), dist);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -248,10 +248,10 @@ void(float dist) ai_pain = {
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
		float away;
 | 
							float away;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		away = anglemod(vectoyaw(self.origin - self.enemy.origin)
 | 
							away = angle_mod(vec_yaw(self.origin - self.enemy.origin)
 | 
				
			||||||
		+ 180*(random()- 0.5) );
 | 
							+ 180*(random()- 0.5) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		walkmove(away, dist);
 | 
							walk_move(away, dist);
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -263,7 +263,7 @@ stagger back a bit
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float dist) ai_painforward = {
 | 
					void(float dist) ai_painforward = {
 | 
				
			||||||
	walkmove(self.ideal_yaw, dist);
 | 
						walk_move(self.ideal_yaw, dist);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -279,11 +279,11 @@ void(float dist) ai_walk = {
 | 
				
			||||||
	movedist = dist;
 | 
						movedist = dist;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// check for noticing a player
 | 
						// check for noticing a player
 | 
				
			||||||
	if(FindTarget()) {
 | 
						if(find_target()) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	movetogoal(dist);
 | 
						move_to_goal(dist);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -294,7 +294,7 @@ The monster is staying in one place for a while, with slight angle turns
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ai_stand = {
 | 
					void() ai_stand = {
 | 
				
			||||||
	if(FindTarget()) {
 | 
						if(find_target()) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -315,21 +315,21 @@ don't move, but turn towards ideal_yaw
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ai_turn = {
 | 
					void() ai_turn = {
 | 
				
			||||||
	if(FindTarget()) {
 | 
						if(find_target()) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
ChooseTurn
 | 
					choose_turn
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector dest3) ChooseTurn = {
 | 
					void(vector dest3) choose_turn = {
 | 
				
			||||||
	vector dir, newdir;
 | 
						vector dir, newdir;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dir = self.origin - dest3;
 | 
						dir = self.origin - dest3;
 | 
				
			||||||
| 
						 | 
					@ -347,19 +347,19 @@ void(vector dest3) ChooseTurn = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dir_z = 0;
 | 
						dir_z = 0;
 | 
				
			||||||
	self.ideal_yaw = vectoyaw(dir);
 | 
						self.ideal_yaw = vec_yaw(dir);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
FacingIdeal
 | 
					facing_ideal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() FacingIdeal = {
 | 
					float() facing_ideal = {
 | 
				
			||||||
	float delta;
 | 
						float delta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = anglemod(self.angles_y - self.ideal_yaw);
 | 
						delta = angle_mod(self.angles_y - self.ideal_yaw);
 | 
				
			||||||
	if(delta > 45 && delta < 315) {
 | 
						if(delta > 45 && delta < 315) {
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -368,29 +368,19 @@ float() FacingIdeal = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() CheckAnyAttack = {
 | 
					float() check_any_attack = {
 | 
				
			||||||
	if(!enemy_vis) {
 | 
						if(!enemy_vis) {
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.classname == "monster_army") {
 | 
						switch(self.classname) {
 | 
				
			||||||
		return SoldierCheckAttack();
 | 
							case "monster_army":     return army_check_attack();
 | 
				
			||||||
 | 
							case "monster_ogre":     return ogre_check_attack();
 | 
				
			||||||
 | 
							case "monster_shambler": return sham_check_attack();
 | 
				
			||||||
 | 
							case "monster_demon1":   return demon_check_attack();
 | 
				
			||||||
 | 
							case "monster_dog":      return dog_check_attack();
 | 
				
			||||||
 | 
							case "monster_wizard":   return wiz_check_attack();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.classname == "monster_ogre") {
 | 
						return check_attack();
 | 
				
			||||||
		return OgreCheckAttack();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(self.classname == "monster_shambler") {
 | 
					 | 
				
			||||||
		return ShamCheckAttack();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(self.classname == "monster_demon1") {
 | 
					 | 
				
			||||||
		return DemonCheckAttack();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(self.classname == "monster_dog") {
 | 
					 | 
				
			||||||
		return DogCheckAttack();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(self.classname == "monster_wizard") {
 | 
					 | 
				
			||||||
		return WizardCheckAttack();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return CheckAttack();
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -402,9 +392,9 @@ Turn and close until within an angle to launch a melee attack
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ai_run_melee = {
 | 
					void() ai_run_melee = {
 | 
				
			||||||
	self.ideal_yaw = enemy_yaw;
 | 
						self.ideal_yaw = enemy_yaw;
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(FacingIdeal()) {
 | 
						if(facing_ideal()) {
 | 
				
			||||||
		self.th_melee();
 | 
							self.th_melee();
 | 
				
			||||||
		self.attack_state = AS_STRAIGHT;
 | 
							self.attack_state = AS_STRAIGHT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -419,8 +409,8 @@ Turn in place until within an angle to launch a missile attack
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ai_run_missile = {
 | 
					void() ai_run_missile = {
 | 
				
			||||||
	self.ideal_yaw = enemy_yaw;
 | 
						self.ideal_yaw = enemy_yaw;
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
	if(FacingIdeal()) {
 | 
						if(facing_ideal()) {
 | 
				
			||||||
		self.th_missile();
 | 
							self.th_missile();
 | 
				
			||||||
		self.attack_state = AS_STRAIGHT;
 | 
							self.attack_state = AS_STRAIGHT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -437,20 +427,20 @@ void() ai_run_slide = {
 | 
				
			||||||
	float ofs;
 | 
						float ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.ideal_yaw = enemy_yaw;
 | 
						self.ideal_yaw = enemy_yaw;
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
	if(self.lefty) {
 | 
						if(self.lefty) {
 | 
				
			||||||
		ofs = 90;
 | 
							ofs = 90;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		ofs = -90;
 | 
							ofs = -90;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(walkmove(self.ideal_yaw + ofs, movedist)) {
 | 
						if(walk_move(self.ideal_yaw + ofs, movedist)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.lefty = 1 - self.lefty;
 | 
						self.lefty = 1 - self.lefty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	walkmove(self.ideal_yaw - ofs, movedist);
 | 
						walk_move(self.ideal_yaw - ofs, movedist);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -471,7 +461,7 @@ void(float dist) ai_run = {
 | 
				
			||||||
		self.enemy = world;
 | 
							self.enemy = world;
 | 
				
			||||||
		if(!enemy_is_gone(self.oldenemy)) {
 | 
							if(!enemy_is_gone(self.oldenemy)) {
 | 
				
			||||||
			self.enemy = self.oldenemy;
 | 
								self.enemy = self.oldenemy;
 | 
				
			||||||
			HuntTarget();
 | 
								hunt_target();
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if(self.movetarget) {
 | 
								if(self.movetarget) {
 | 
				
			||||||
				self.th_walk();
 | 
									self.th_walk();
 | 
				
			||||||
| 
						 | 
					@ -492,27 +482,27 @@ void(float dist) ai_run = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// look for other coop players
 | 
						// look for other coop players
 | 
				
			||||||
	if(coop && self.search_time < time) {
 | 
						if(coop && self.search_time < time) {
 | 
				
			||||||
		if(FindTarget()) {
 | 
							if(find_target()) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	enemy_infront = infront(self.enemy);
 | 
						enemy_infront = infront(self.enemy);
 | 
				
			||||||
	enemy_range = range(self.enemy);
 | 
						enemy_range = range(self.enemy);
 | 
				
			||||||
	enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
 | 
						enemy_yaw = vec_yaw(self.enemy.origin - self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.attack_state == AS_MISSILE) {
 | 
						if(self.attack_state == AS_MISSILE) {
 | 
				
			||||||
		//dprint("ai_run_missile\n");
 | 
							//print_dbg("ai_run_missile\n");
 | 
				
			||||||
		ai_run_missile();
 | 
							ai_run_missile();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.attack_state == AS_MELEE) {
 | 
						if(self.attack_state == AS_MELEE) {
 | 
				
			||||||
		//dprint("ai_run_melee\n");
 | 
							//print_dbg("ai_run_melee\n");
 | 
				
			||||||
		ai_run_melee();
 | 
							ai_run_melee();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(CheckAnyAttack()) {
 | 
						if(check_any_attack()) {
 | 
				
			||||||
		return; // beginning an attack
 | 
							return; // beginning an attack
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -522,6 +512,6 @@ void(float dist) ai_run = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// head straight in
 | 
						// head straight in
 | 
				
			||||||
	movetogoal(dist); // done in C code...
 | 
						move_to_goal(dist); // done in C code...
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,17 +165,17 @@ void() boss_death7 = [$death7, boss_death8] {};
 | 
				
			||||||
void() boss_death8 = [$death8, boss_death9] {};
 | 
					void() boss_death8 = [$death8, boss_death9] {};
 | 
				
			||||||
void() boss_death9 = [$death9, boss_death10] {
 | 
					void() boss_death9 = [$death9, boss_death10] {
 | 
				
			||||||
	sound(self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_LAVASPLASH);
 | 
						write_byte(MSG_BROADCAST, TE_LAVASPLASH);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() boss_death10 = [$death9, boss_death10] {
 | 
					void() boss_death10 = [$death9, boss_death10] {
 | 
				
			||||||
	killed_monsters = killed_monsters + 1;
 | 
						killed_monsters = killed_monsters + 1;
 | 
				
			||||||
	WriteByte(MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
 | 
						write_byte(MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,14 +184,14 @@ void(vector p) boss_missile = {
 | 
				
			||||||
	vector org, vec, d;
 | 
						vector org, vec, d;
 | 
				
			||||||
	float t;
 | 
						float t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	offang = vectoangles(self.enemy.origin - self.origin);
 | 
						offang = vec_to_angles(self.enemy.origin - self.origin);
 | 
				
			||||||
	makevectors(offang);
 | 
						make_vectors(offang);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	org = self.origin + p_x * v_forward + p_y * v_right + p_z*'0 0 1';
 | 
						org = self.origin + p_x * v_forward + p_y * v_right + p_z*'0 0 1';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// lead the player on hard mode
 | 
						// lead the player on hard mode
 | 
				
			||||||
	if(skill > 1) {
 | 
						if(skill > 1) {
 | 
				
			||||||
		t = vlen(self.enemy.origin - org) / 300;
 | 
							t = vec_len(self.enemy.origin - org) / 300;
 | 
				
			||||||
		vec = self.enemy.velocity;
 | 
							vec = self.enemy.velocity;
 | 
				
			||||||
		vec_z = 0;
 | 
							vec_z = 0;
 | 
				
			||||||
		d = self.enemy.origin + t * vec;
 | 
							d = self.enemy.origin + t * vec;
 | 
				
			||||||
| 
						 | 
					@ -202,11 +202,11 @@ void(vector p) boss_missile = {
 | 
				
			||||||
	vec = normalize(d - org);
 | 
						vec = normalize(d - org);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	launch_spike(org, vec);
 | 
						launch_spike(org, vec);
 | 
				
			||||||
	setmodel(newmis, "progs/lavaball.mdl");
 | 
						set_model(newmis, "progs/lavaball.mdl");
 | 
				
			||||||
	newmis.avelocity = '200 100 300';
 | 
						newmis.avelocity = '200 100 300';
 | 
				
			||||||
	setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	newmis.velocity = vec * 300;
 | 
						newmis.velocity = vec * 300;
 | 
				
			||||||
	newmis.touch = T_MissileTouch; // rocket explosion
 | 
						newmis.touch = ent_missile_touch; // rocket explosion
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// check for dead enemy
 | 
						// check for dead enemy
 | 
				
			||||||
| 
						 | 
					@ -220,8 +220,8 @@ void() boss_awake = {
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
	self.takedamage = DAMAGE_NO;
 | 
						self.takedamage = DAMAGE_NO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/boss.mdl");
 | 
						set_model(self, "progs/boss.mdl");
 | 
				
			||||||
	setsize(self, '-128 -128 -24', '128 128 256');
 | 
						set_size(self, '-128 -128 -24', '128 128 256');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(skill == 0) {
 | 
						if(skill == 0) {
 | 
				
			||||||
		self.health = 1;
 | 
							self.health = 1;
 | 
				
			||||||
| 
						 | 
					@ -231,11 +231,11 @@ void() boss_awake = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.enemy = activator;
 | 
						self.enemy = activator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_LAVASPLASH);
 | 
						write_byte(MSG_BROADCAST, TE_LAVASPLASH);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.yaw_speed = 20;
 | 
						self.yaw_speed = 20;
 | 
				
			||||||
	boss_rise1();
 | 
						boss_rise1();
 | 
				
			||||||
| 
						 | 
					@ -290,15 +290,15 @@ void() lightning_fire = {
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
	self.think = lightning_fire;
 | 
						self.think = lightning_fire;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_ALL, SVC_TEMPENTITY);
 | 
						write_byte(MSG_ALL, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_ALL, TE_LIGHTNING3);
 | 
						write_byte(MSG_ALL, TE_LIGHTNING3);
 | 
				
			||||||
	WriteEntity(MSG_ALL, world);
 | 
						write_entity(MSG_ALL, world);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p1_x);
 | 
						write_coord(MSG_ALL, p1_x);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p1_y);
 | 
						write_coord(MSG_ALL, p1_y);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p1_z);
 | 
						write_coord(MSG_ALL, p1_z);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p2_x);
 | 
						write_coord(MSG_ALL, p2_x);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p2_y);
 | 
						write_coord(MSG_ALL, p2_y);
 | 
				
			||||||
	WriteCoord(MSG_ALL, p2_z);
 | 
						write_coord(MSG_ALL, p2_z);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() lightning_use = {
 | 
					void() lightning_use = {
 | 
				
			||||||
| 
						 | 
					@ -309,14 +309,14 @@ void() lightning_use = {
 | 
				
			||||||
	le1 = find(world, target, "lightning");
 | 
						le1 = find(world, target, "lightning");
 | 
				
			||||||
	le2 = find(le1, target, "lightning");
 | 
						le2 = find(le1, target, "lightning");
 | 
				
			||||||
	if(!le1 || !le2) {
 | 
						if(!le1 || !le2) {
 | 
				
			||||||
		dprint("missing lightning targets\n");
 | 
							print_dbg("missing lightning targets\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if((le1.state != STATE_TOP && le1.state != STATE_BOTTOM)
 | 
						if((le1.state != STATE_TOP && le1.state != STATE_BOTTOM)
 | 
				
			||||||
			|| (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
 | 
								|| (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
 | 
				
			||||||
			|| (le1.state != le2.state)) {
 | 
								|| (le1.state != le2.state)) {
 | 
				
			||||||
		// dprint("not aligned\n");
 | 
							// print_dbg("not aligned\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@ void() button_wait = {
 | 
				
			||||||
	self.nextthink = self.ltime + self.wait;
 | 
						self.nextthink = self.ltime + self.wait;
 | 
				
			||||||
	self.think = button_return;
 | 
						self.think = button_return;
 | 
				
			||||||
	activator = self.enemy;
 | 
						activator = self.enemy;
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
	self.frame = 1; // use alternate textures
 | 
						self.frame = 1; // use alternate textures
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ void() button_done = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() button_return = {
 | 
					void() button_return = {
 | 
				
			||||||
	self.state = STATE_DOWN;
 | 
						self.state = STATE_DOWN;
 | 
				
			||||||
	SUB_CalcMove(self.pos1, self.speed, button_done);
 | 
						sub_calc_move(self.pos1, self.speed, button_done);
 | 
				
			||||||
	self.frame = 0; // use normal textures
 | 
						self.frame = 0; // use normal textures
 | 
				
			||||||
	if(self.health) {
 | 
						if(self.health) {
 | 
				
			||||||
		self.takedamage = DAMAGE_YES; // can be shot again
 | 
							self.takedamage = DAMAGE_YES; // can be shot again
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ void() button_fire = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.state = STATE_UP;
 | 
						self.state = STATE_UP;
 | 
				
			||||||
	SUB_CalcMove(self.pos2, self.speed, button_wait);
 | 
						sub_calc_move(self.pos2, self.speed, button_wait);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() button_use = {
 | 
					void() button_use = {
 | 
				
			||||||
| 
						 | 
					@ -92,11 +92,11 @@ void() func_button = {
 | 
				
			||||||
		self.noise = "buttons/switch04.wav";
 | 
							self.noise = "buttons/switch04.wav";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SetMovedir();
 | 
						set_move_dir();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH;
 | 
						self.movetype = MOVETYPE_PUSH;
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.blocked = button_blocked;
 | 
						self.blocked = button_blocked;
 | 
				
			||||||
	self.use = button_use;
 | 
						self.use = button_use;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										477
									
								
								source/client.qc
									
									
									
									
									
								
							
							
						
						
									
										477
									
								
								source/client.qc
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -1,12 +1,12 @@
 | 
				
			||||||
// combat.qc: entity-entity damage functions
 | 
					// combat.qc: entity-entity damage functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(entity targ, entity attacker) SameTeam = {
 | 
					float(entity targ, entity attacker) is_same_team = {
 | 
				
			||||||
	return targ != attacker &&
 | 
						return targ != attacker &&
 | 
				
			||||||
	       targ.team > 0 &&
 | 
						       targ.team > 0 &&
 | 
				
			||||||
	       targ.team == attacker.team;
 | 
						       targ.team == attacker.team;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(entity targ, entity attacker) BothPlayers = {
 | 
					float(entity targ, entity attacker) are_both_players = {
 | 
				
			||||||
	return targ != attacker &&
 | 
						return targ != attacker &&
 | 
				
			||||||
	       targ.classname == "player" &&
 | 
						       targ.classname == "player" &&
 | 
				
			||||||
	       attacker.classname == "player";
 | 
						       attacker.classname == "player";
 | 
				
			||||||
| 
						 | 
					@ -14,16 +14,16 @@ float(entity targ, entity attacker) BothPlayers = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
CanDamage
 | 
					can_damage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Returns true if the inflictor can directly damage the target. Used for
 | 
					Returns true if the inflictor can directly damage the target. Used for
 | 
				
			||||||
explosions and melee attacks.
 | 
					explosions and melee attacks.
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float(entity targ, entity inflictor) CanDamage = {
 | 
					float(entity targ, entity inflictor) can_damage = {
 | 
				
			||||||
	// bmodels need special checking because their origin is 0,0,0
 | 
						// bmodels need special checking because their origin is 0,0,0
 | 
				
			||||||
	if(targ.movetype == MOVETYPE_PUSH) {
 | 
						if(targ.movetype == MOVETYPE_PUSH) {
 | 
				
			||||||
		traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
 | 
							trace_line(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
 | 
				
			||||||
		if(trace_fraction == 1) {
 | 
							if(trace_fraction == 1) {
 | 
				
			||||||
			return TRUE;
 | 
								return TRUE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -33,23 +33,23 @@ float(entity targ, entity inflictor) CanDamage = {
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(inflictor.origin, targ.origin, TRUE, self);
 | 
						trace_line(inflictor.origin, targ.origin, TRUE, self);
 | 
				
			||||||
	if(trace_fraction == 1) {
 | 
						if(trace_fraction == 1) {
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
 | 
						trace_line(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
 | 
				
			||||||
	if(trace_fraction == 1) {
 | 
						if(trace_fraction == 1) {
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
 | 
						trace_line(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
 | 
				
			||||||
	if(trace_fraction == 1) {
 | 
						if(trace_fraction == 1) {
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
 | 
						trace_line(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
 | 
				
			||||||
	if(trace_fraction == 1) {
 | 
						if(trace_fraction == 1) {
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
 | 
						trace_line(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
 | 
				
			||||||
	if(trace_fraction == 1) {
 | 
						if(trace_fraction == 1) {
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -59,10 +59,10 @@ float(entity targ, entity inflictor) CanDamage = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
Killed
 | 
					killed
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity targ, entity attacker) Killed = {
 | 
					void(entity targ, entity attacker) killed = {
 | 
				
			||||||
	entity oself;
 | 
						entity oself;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	oself = self;
 | 
						oself = self;
 | 
				
			||||||
| 
						 | 
					@ -84,13 +84,13 @@ void(entity targ, entity attacker) Killed = {
 | 
				
			||||||
	// bump the monster counter
 | 
						// bump the monster counter
 | 
				
			||||||
	if(self.flags & FL_MONSTER) {
 | 
						if(self.flags & FL_MONSTER) {
 | 
				
			||||||
		killed_monsters = killed_monsters + 1;
 | 
							killed_monsters = killed_monsters + 1;
 | 
				
			||||||
		WriteByte(MSG_ALL, SVC_KILLEDMONSTER);
 | 
							write_byte(MSG_ALL, SVC_KILLEDMONSTER);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ClientObituary(self, attacker);
 | 
						client_obituary(self, attacker);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.takedamage = DAMAGE_NO;
 | 
						self.takedamage = DAMAGE_NO;
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	monster_death_use();
 | 
						monster_death_use();
 | 
				
			||||||
	self.th_die();
 | 
						self.th_die();
 | 
				
			||||||
| 
						 | 
					@ -100,24 +100,24 @@ void(entity targ, entity attacker) Killed = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
T_Damage
 | 
					ent_damage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The damage is coming from inflictor, but get mad at attacker
 | 
					The damage is coming from inflictor, but get mad at attacker
 | 
				
			||||||
This should be the only function that ever reduces health.
 | 
					This should be the only function that ever reduces health.
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = {
 | 
					void(entity targ, entity inflictor, entity attacker, float damage) ent_damage = {
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
	entity oldself;
 | 
						entity oldself;
 | 
				
			||||||
	float save;
 | 
						float save;
 | 
				
			||||||
	float take;
 | 
						float take;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// team play damage avoidance
 | 
						// team play damage avoidance
 | 
				
			||||||
	if(teamplay == 1 && SameTeam(targ, attacker)) {
 | 
						if(teamplay == 1 && is_same_team(targ, attacker)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(teamplay == 3 && BothPlayers(targ, attacker)) {
 | 
						if(teamplay == 3 && are_both_players(targ, attacker)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -177,7 +177,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = {
 | 
				
			||||||
	targ.health = targ.health - take;
 | 
						targ.health = targ.health - take;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(targ.health <= 0) {
 | 
						if(targ.health <= 0) {
 | 
				
			||||||
		Killed(targ, attacker);
 | 
							killed(targ, attacker);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,7 +194,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = {
 | 
				
			||||||
					self.oldenemy = self.enemy;
 | 
										self.oldenemy = self.enemy;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				self.enemy = attacker;
 | 
									self.enemy = attacker;
 | 
				
			||||||
				FoundTarget();
 | 
									found_target();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -212,21 +212,21 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
T_RadiusDamage
 | 
					ent_radius_damage
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage = {
 | 
					void(entity inflictor, entity attacker, float damage, entity ignore) ent_radius_damage = {
 | 
				
			||||||
	float points;
 | 
						float points;
 | 
				
			||||||
	entity head;
 | 
						entity head;
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	head = findradius(inflictor.origin, damage + 40);
 | 
						head = find_radius(inflictor.origin, damage + 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while(head) {
 | 
						while(head) {
 | 
				
			||||||
		if(head != ignore) {
 | 
							if(head != ignore) {
 | 
				
			||||||
			if(head.takedamage) {
 | 
								if(head.takedamage) {
 | 
				
			||||||
				org = head.origin + (head.mins + head.maxs) * 0.5;
 | 
									org = head.origin + (head.mins + head.maxs) * 0.5;
 | 
				
			||||||
				points = 0.5 * vlen(inflictor.origin - org);
 | 
									points = 0.5 * vec_len(inflictor.origin - org);
 | 
				
			||||||
				if(points < 0) {
 | 
									if(points < 0) {
 | 
				
			||||||
					points = 0;
 | 
										points = 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -235,12 +235,12 @@ void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDam
 | 
				
			||||||
					points = points * 0.5;
 | 
										points = points * 0.5;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if(points > 0) {
 | 
									if(points > 0) {
 | 
				
			||||||
					if(CanDamage(head, inflictor)) {
 | 
										if(can_damage(head, inflictor)) {
 | 
				
			||||||
						// shambler takes half damage from all explosions
 | 
											// shambler takes half damage from all explosions
 | 
				
			||||||
						if(head.classname == "monster_shambler") {
 | 
											if(head.classname == "monster_shambler") {
 | 
				
			||||||
							T_Damage(head, inflictor, attacker, points * 0.5);
 | 
												ent_damage(head, inflictor, attacker, points * 0.5);
 | 
				
			||||||
						} else {
 | 
											} else {
 | 
				
			||||||
							T_Damage(head, inflictor, attacker, points);
 | 
												ent_damage(head, inflictor, attacker, points);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -252,18 +252,18 @@ void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDam
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
T_BeamDamage
 | 
					beam_damage
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity attacker, float damage) T_BeamDamage = {
 | 
					void(entity attacker, float damage) beam_damage = {
 | 
				
			||||||
	float points;
 | 
						float points;
 | 
				
			||||||
	entity head;
 | 
						entity head;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	head = findradius(attacker.origin, damage + 40);
 | 
						head = find_radius(attacker.origin, damage + 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while(head) {
 | 
						while(head) {
 | 
				
			||||||
		if(head.takedamage) {
 | 
							if(head.takedamage) {
 | 
				
			||||||
			points = 0.5 * vlen(attacker.origin - head.origin);
 | 
								points = 0.5 * vec_len(attacker.origin - head.origin);
 | 
				
			||||||
			if(points < 0) {
 | 
								if(points < 0) {
 | 
				
			||||||
				points = 0;
 | 
									points = 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -272,11 +272,11 @@ void(entity attacker, float damage) T_BeamDamage = {
 | 
				
			||||||
				points = points * 0.5;
 | 
									points = points * 0.5;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if(points > 0) {
 | 
								if(points > 0) {
 | 
				
			||||||
				if(CanDamage(head, attacker)) {
 | 
									if(can_damage(head, attacker)) {
 | 
				
			||||||
					if(head.classname == "monster_shambler") {
 | 
										if(head.classname == "monster_shambler") {
 | 
				
			||||||
						T_Damage(head, attacker, attacker, points * 0.5);
 | 
											ent_damage(head, attacker, attacker, points * 0.5);
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						T_Damage(head, attacker, attacker, points);
 | 
											ent_damage(head, attacker, attacker, points);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ float(entity targ) range = {
 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r = vlen(spot1 - spot2);
 | 
						r = vec_len(spot1 - spot2);
 | 
				
			||||||
	if(r < 120) {
 | 
						if(r < 120) {
 | 
				
			||||||
		return RANGE_MELEE;
 | 
							return RANGE_MELEE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ float(entity targ) visible = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
	traceline(spot1, spot2, TRUE, self); // see through other monsters
 | 
						trace_line(spot1, spot2, TRUE, self); // see through other monsters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(trace_inopen && trace_inwater) {
 | 
						if(trace_inopen && trace_inwater) {
 | 
				
			||||||
		return FALSE; // sight line crossed contents
 | 
							return FALSE; // sight line crossed contents
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ float(entity targ) infront = {
 | 
				
			||||||
	vector vec;
 | 
						vector vec;
 | 
				
			||||||
	float dot;
 | 
						float dot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	vec = normalize(targ.origin - self.origin);
 | 
						vec = normalize(targ.origin - self.origin);
 | 
				
			||||||
	dot = vec * v_forward;
 | 
						dot = vec * v_forward;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										212
									
								
								source/defs.qc
									
									
									
									
									
								
							
							
						
						
									
										212
									
								
								source/defs.qc
									
									
									
									
									
								
							| 
						 | 
					@ -34,9 +34,9 @@ float killed_monsters; // number of monsters killed
 | 
				
			||||||
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
 | 
					float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// global variables set by built in functions
 | 
					// global variables set by built in functions
 | 
				
			||||||
vector v_forward, v_up, v_right; // set by makevectors()
 | 
					vector v_forward, v_up, v_right; // set by make_vectors()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// set by traceline / tracebox
 | 
					// set by trace_line / tracebox
 | 
				
			||||||
float trace_allsolid;
 | 
					float trace_allsolid;
 | 
				
			||||||
float trace_startsolid;
 | 
					float trace_startsolid;
 | 
				
			||||||
float trace_fraction;
 | 
					float trace_fraction;
 | 
				
			||||||
| 
						 | 
					@ -188,17 +188,17 @@ void end_sys_fields; // flag for structure dumping
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// builtin functions ---------------------------------------------------------|
 | 
					// builtin functions ---------------------------------------------------------|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(vector ang) makevectors = #1; // sets v_forward, etc globals
 | 
					void(vector ang) make_vectors = #1; // sets v_forward, etc globals
 | 
				
			||||||
void(entity e, vector o) setorigin = #2;
 | 
					void(entity e, vector o) set_origin = #2;
 | 
				
			||||||
void(entity e, string m) setmodel = #3; // set movetype and solid first
 | 
					void(entity e, string m) set_model = #3; // set movetype and solid first
 | 
				
			||||||
void(entity e, vector min, vector max) setsize = #4;
 | 
					void(entity e, vector min, vector max) set_size = #4;
 | 
				
			||||||
float() random = #7; // returns 0 - 1
 | 
					float() random = #7; // returns 0 - 1
 | 
				
			||||||
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
 | 
					void(entity e, float chan, string samp, float vol, float atten) sound = #8;
 | 
				
			||||||
vector(vector v) normalize = #9;
 | 
					vector(vector v) normalize = #9;
 | 
				
			||||||
[[noreturn]] void(string e) error = #10;
 | 
					[[noreturn]] void(string e) error = #10;
 | 
				
			||||||
[[noreturn]] void(string e) objerror = #11;
 | 
					[[noreturn]] void(string e) error_obj = #11;
 | 
				
			||||||
float(vector v) vlen = #12;
 | 
					float(vector v) vec_len = #12;
 | 
				
			||||||
float(vector v) vectoyaw = #13;
 | 
					float(vector v) vec_yaw = #13;
 | 
				
			||||||
entity() spawn = #14;
 | 
					entity() spawn = #14;
 | 
				
			||||||
void(entity e) remove = #15;
 | 
					void(entity e) remove = #15;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,76 +208,76 @@ void(entity e) remove = #15;
 | 
				
			||||||
 * forent->owner == test, or test->owner == forent
 | 
					 * forent->owner == test, or test->owner == forent
 | 
				
			||||||
 * a forent of world is ignored
 | 
					 * a forent of world is ignored
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
 | 
					void(vector v1, vector v2, float nomonsters, entity forent) trace_line = #16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
entity() checkclient = #17; // returns a client to look for
 | 
					entity() check_client = #17; // returns a client to look for
 | 
				
			||||||
entity(entity start, .string fld, string match) find = #18;
 | 
					entity(entity start, .string fld, string match) find = #18;
 | 
				
			||||||
string(string s) precache_sound = #19;
 | 
					string(string s) precache_sound = #19;
 | 
				
			||||||
string(string s) precache_model = #20;
 | 
					string(string s) precache_model = #20;
 | 
				
			||||||
void(entity client, string s) stuffcmd = #21;
 | 
					void(entity client, string s) cmd_client = #21;
 | 
				
			||||||
entity(vector org, float rad) findradius = #22;
 | 
					entity(vector org, float rad) find_radius = #22;
 | 
				
			||||||
void(string... s) bprint = #23;
 | 
					void(string... s) print_all = #23;
 | 
				
			||||||
void(entity client, string... s) sprint = #24;
 | 
					void(entity client, string... s) print_cl = #24;
 | 
				
			||||||
void(string... s) dprint = #25;
 | 
					void(string... s) print_dbg = #25;
 | 
				
			||||||
string(float f) ftos = #26;
 | 
					string(float f) ftos = #26;
 | 
				
			||||||
string(vector v) vtos = #27;
 | 
					string(vector v) vtos = #27;
 | 
				
			||||||
void() coredump = #28; // prints all edicts
 | 
					void() core_dump = #28; // prints all edicts
 | 
				
			||||||
void() traceon = #29; // turns statment trace on
 | 
					void() trace_on = #29; // turns statment trace on
 | 
				
			||||||
void() traceoff = #30;
 | 
					void() trace_off = #30;
 | 
				
			||||||
void(entity e) eprint = #31; // prints an entire edict
 | 
					void(entity e) print_ent = #31; // prints an entire edict
 | 
				
			||||||
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
 | 
					float(float yaw, float dist) walk_move = #32; // returns TRUE or FALSE
 | 
				
			||||||
float() droptofloor = #34; // TRUE if landed on floor
 | 
					float() drop_to_floor = #34; // TRUE if landed on floor
 | 
				
			||||||
void(float style, string value) lightstyle = #35;
 | 
					void(float style, string value) light_style = #35;
 | 
				
			||||||
float(float v) rint = #36; // round to nearest int
 | 
					float(float v) rint = #36; // round to nearest int
 | 
				
			||||||
float(float v) floor = #37; // largest integer <= v
 | 
					float(float v) floor = #37; // largest integer <= v
 | 
				
			||||||
float(float v) ceil = #38; // smallest integer >= v
 | 
					float(float v) ceil = #38; // smallest integer >= v
 | 
				
			||||||
float(entity e) checkbottom = #40; // true if self is on ground
 | 
					float(entity e) check_bottom = #40; // true if self is on ground
 | 
				
			||||||
float(vector v) pointcontents = #41; // returns a CONTENT_*
 | 
					float(vector v) point_contents = #41; // returns a CONTENT_*
 | 
				
			||||||
float(float f) fabs = #43;
 | 
					float(float f) fabs = #43;
 | 
				
			||||||
vector(entity e, float speed) aim = #44; // returns the shooting vector
 | 
					vector(entity e, float speed) aim = #44; // returns the shooting vector
 | 
				
			||||||
float(string s) cvar = #45; // return cvar.value
 | 
					float(string s) cvar = #45; // return cvar.value
 | 
				
			||||||
void(string s) localcmd = #46; // put string into que
 | 
					void(string s) cmd_server = #46; // put string into que
 | 
				
			||||||
entity(entity e) nextent = #47; // for looping through all ents
 | 
					entity(entity e) next_ent = #47; // for looping through all ents
 | 
				
			||||||
// start a particle effect
 | 
					// start a particle effect
 | 
				
			||||||
void(vector o, vector d, float color, float count) particle = #48;
 | 
					void(vector o, vector d, float color, float count) particle = #48;
 | 
				
			||||||
void() ChangeYaw = #49; // turn towards self.ideal_yaw at self.yaw_speed
 | 
					void() change_yaw = #49; // turn towards self.ideal_yaw at self.yaw_speed
 | 
				
			||||||
vector(vector v) vectoangles = #51;
 | 
					vector(vector v) vec_to_angles = #51;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// direct client message generation
 | 
					// direct client message generation
 | 
				
			||||||
void(float to, float f) WriteByte = #52;
 | 
					void(float to, float f) write_byte = #52;
 | 
				
			||||||
void(float to, float f) WriteChar = #53;
 | 
					void(float to, float f) write_char = #53;
 | 
				
			||||||
void(float to, float f) WriteShort = #54;
 | 
					void(float to, float f) write_short = #54;
 | 
				
			||||||
void(float to, float f) WriteLong = #55;
 | 
					void(float to, float f) write_long = #55;
 | 
				
			||||||
void(float to, float f) WriteCoord = #56;
 | 
					void(float to, float f) write_coord = #56;
 | 
				
			||||||
void(float to, float f) WriteAngle = #57;
 | 
					void(float to, float f) write_angle = #57;
 | 
				
			||||||
void(float to, string s) WriteString = #58;
 | 
					void(float to, string s) write_string = #58;
 | 
				
			||||||
void(float to, entity s) WriteEntity = #59;
 | 
					void(float to, entity s) write_entity = #59;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float step) movetogoal = #67;
 | 
					void(float step) move_to_goal = #67;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
string(string s) precache_file = #68; // no effect except for -copy
 | 
					string(string s) precache_file = #68; // no effect except for -copy
 | 
				
			||||||
void(entity e) makestatic = #69;
 | 
					void(entity e) make_static = #69;
 | 
				
			||||||
void(string s) changelevel = #70;
 | 
					void(string s) change_level = #70;
 | 
				
			||||||
void(string var, string val) cvar_set = #72; // sets cvar.value
 | 
					void(string var, string val) cvar_set = #72; // sets cvar.value
 | 
				
			||||||
void(entity client, string... s) centerprint = #73; // sprint, but in middle
 | 
					void(entity client, string... s) print_center = #73; // print_cl, but in middle
 | 
				
			||||||
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
 | 
					void(vector pos, string samp, float vol, float atten) ambient_sound = #74;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
string(string s) precache_model2 = #75; // registered version only
 | 
					string(string s) precache_model2 = #75; // registered version only
 | 
				
			||||||
string(string s) precache_sound2 = #76; // registered version only
 | 
					string(string s) precache_sound2 = #76; // registered version only
 | 
				
			||||||
string(string s) precache_file2 = #77; // registered version only
 | 
					string(string s) precache_file2 = #77; // registered version only
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// set parm1... to the values at level start for coop respawn
 | 
					// set parm1... to the values at level start for coop respawn
 | 
				
			||||||
void(entity e) setspawnparms = #78;
 | 
					void(entity e) set_spawn_parms = #78;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(string s) checkextension = #99;
 | 
					float(string s) check_extension = #99;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(string str, string sub, float startpos) strstrofs = #221;
 | 
					float(string str, string sub, float startpos) strstrofs = #221;
 | 
				
			||||||
float(string str, float ofs) str2chr = #222;
 | 
					float(string str, float ofs) str2chr = #222;
 | 
				
			||||||
string(float... c) chr2str = #223;
 | 
					string(float... c) chr2str = #223;
 | 
				
			||||||
string(float ccase, float calpha, float cnum, string... s) strconv = #224;
 | 
					string(float ccase, float calpha, float cnum, string... s) strconv = #224;
 | 
				
			||||||
string(float chars, string... s) strpad = #225;
 | 
					string(float chars, string... s) strpad = #225;
 | 
				
			||||||
string(string info, string key, string... value) infoadd = #226;
 | 
					string(string info, string key, string... value) info_add = #226;
 | 
				
			||||||
string(string info, string key) infoget = #227;
 | 
					string(string info, string key) info_get = #227;
 | 
				
			||||||
float(string s1, string s2, float len) strncmp = #228;
 | 
					float(string s1, string s2, float len) strncmp = #228;
 | 
				
			||||||
float(string s1, string s2) strcasecmp = #229;
 | 
					float(string s1, string s2) strcasecmp = #229;
 | 
				
			||||||
float(string s1, string s2, float len) strncasecmp = #230;
 | 
					float(string s1, string s2, float len) strncasecmp = #230;
 | 
				
			||||||
| 
						 | 
					@ -569,6 +569,10 @@ enum {
 | 
				
			||||||
	SIGIL_4 = 8,
 | 
						SIGIL_4 = 8,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum {
 | 
				
			||||||
 | 
						CHANGELEVEL_NO_INTERMISSION = 1,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// super co-op additions
 | 
					// super co-op additions
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	PRO_NONE,
 | 
						PRO_NONE,
 | 
				
			||||||
| 
						 | 
					@ -614,7 +618,7 @@ entity newmis; // launch_spike sets this after spawning it
 | 
				
			||||||
 | 
					
 | 
				
			||||||
entity activator; // the entity that activated a trigger or brush
 | 
					entity activator; // the entity that activated a trigger or brush
 | 
				
			||||||
 | 
					
 | 
				
			||||||
entity damage_attacker; // set by T_Damage
 | 
					entity damage_attacker; // set by ent_damage
 | 
				
			||||||
float framecount;
 | 
					float framecount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float skill;
 | 
					float skill;
 | 
				
			||||||
| 
						 | 
					@ -778,66 +782,62 @@ float ext_strings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// functions -----------------------------------------------------------------|
 | 
					// functions -----------------------------------------------------------------|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// subs.qc
 | 
					void(float normal) sub_attack_finished;
 | 
				
			||||||
void(float normal) SUB_AttackFinished;
 | 
					void(vector tdest, float tspeed, void() func) sub_calc_move;
 | 
				
			||||||
void(vector tdest, float tspeed, void() func) SUB_CalcMove;
 | 
					void(entity ent, vector tdest, float tspeed, void() func) sub_calc_move_ent;
 | 
				
			||||||
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
 | 
					void(vector destangle, float tspeed, void() func) sub_calc_angle_move;
 | 
				
			||||||
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
 | 
					void() sub_calc_move_done;
 | 
				
			||||||
void() SUB_CalcMoveDone;
 | 
					void() sub_calc_angle_move_done;
 | 
				
			||||||
void() SUB_CalcAngleMoveDone;
 | 
					void(void() thinkst) sub_check_refire;
 | 
				
			||||||
void(void() thinkst) SUB_CheckRefire;
 | 
					void() sub_null;
 | 
				
			||||||
void() SUB_Null;
 | 
					void(entity attacker, float damage) sub_pain_null;
 | 
				
			||||||
void(entity attacker, float damage) SUB_PainNull;
 | 
					void() sub_use_targets;
 | 
				
			||||||
void() SUB_UseTargets;
 | 
					void() sub_remove;
 | 
				
			||||||
void() SUB_Remove;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// combat.qc
 | 
					float(entity e, float healamount, float ignore) ent_heal;
 | 
				
			||||||
float(entity e, float healamount, float ignore) T_Heal; // health function
 | 
					float(entity targ, entity inflictor) can_damage;
 | 
				
			||||||
float(entity targ, entity inflictor) CanDamage;
 | 
					void() ent_missile_touch;
 | 
				
			||||||
void() T_MissileTouch;
 | 
					void(entity bomb, entity attacker, float rad, entity ignore) ent_radius_damage;
 | 
				
			||||||
void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
 | 
					void(entity targ, entity inflictor, entity attacker, float damage) ent_damage;
 | 
				
			||||||
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
 | 
					 | 
				
			||||||
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// weapons.qc
 | 
					void(float wep) wep_change_weapon;
 | 
				
			||||||
void(float wep) W_ChangeWeapon;
 | 
					void() wep_cycle_weapon_reverse;
 | 
				
			||||||
void() W_CycleWeaponReverse;
 | 
					void() wep_cycle_weapon;
 | 
				
			||||||
void() W_CycleWeapon;
 | 
					void() wep_fire_axe;
 | 
				
			||||||
void() W_FireAxe;
 | 
					void() wep_fire_shotgun;
 | 
				
			||||||
void() W_FireShotgun;
 | 
					void() wep_fire_super_shotgun;
 | 
				
			||||||
void() W_FireSuperShotgun;
 | 
					void() wep_fire_rocket;
 | 
				
			||||||
void() W_FireRocket;
 | 
					void() wep_fire_lightning;
 | 
				
			||||||
void() W_FireLightning;
 | 
					void() wep_fire_grenade;
 | 
				
			||||||
void() W_FireGrenade;
 | 
					void(float ox) wep_fire_nail;
 | 
				
			||||||
void(float ox) W_FireSpikes;
 | 
					void() wep_fire_super_nail;
 | 
				
			||||||
void() W_FireSuperSpikes;
 | 
					float() wep_best_weapon;
 | 
				
			||||||
float() W_BestWeapon;
 | 
					void() wep_set_current_ammo;
 | 
				
			||||||
void() W_SetCurrentAmmo;
 | 
					void() wep_weapon_frame;
 | 
				
			||||||
void() W_WeaponFrame;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// items.qc
 | 
					string() key_1_name;
 | 
				
			||||||
string() Key1Name;
 | 
					string() key_2_name;
 | 
				
			||||||
string() Key2Name;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() army_fire;
 | 
					void() army_fire;
 | 
				
			||||||
 | 
					float() army_check_attack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() DemonCheckAttack;
 | 
					float() demon_check_attack;
 | 
				
			||||||
void() Demon_JumpTouch;
 | 
					void() demon_jump_touch;
 | 
				
			||||||
void(float side) Demon_Melee;
 | 
					void(float side) demon_melee;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() DogCheckAttack;
 | 
					float() dog_check_attack;
 | 
				
			||||||
void() dog_leap1;
 | 
					void() dog_leap1;
 | 
				
			||||||
void() dog_run1;
 | 
					void() dog_run1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ShalHome;
 | 
					void() shalrath_home;
 | 
				
			||||||
void() ShalMissile;
 | 
					void() shalrath_missile;
 | 
				
			||||||
void() ShalMissileTouch;
 | 
					void() shalrath_missile_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(entity targ, entity attacker) SameTeam;
 | 
					float(entity targ, entity attacker) is_same_team;
 | 
				
			||||||
void() DecodeLevelParms;
 | 
					void() decode_level_parms;
 | 
				
			||||||
void(entity ent) CopyToBodyQue;
 | 
					void(entity ent) copy_to_body_queue;
 | 
				
			||||||
void() InitBodyQue;
 | 
					void() init_body_queue;
 | 
				
			||||||
void() SuperDamageSound;
 | 
					void() super_damage_sound;
 | 
				
			||||||
void() ai_face;
 | 
					void() ai_face;
 | 
				
			||||||
void() armor_touch;
 | 
					void() armor_touch;
 | 
				
			||||||
void() bubble_bob;
 | 
					void() bubble_bob;
 | 
				
			||||||
| 
						 | 
					@ -876,18 +876,19 @@ void() t_movetarget;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() train_next;
 | 
					void() train_next;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(entity targ, entity attacker) ClientObituary;
 | 
					void(entity targ, entity attacker) client_obituary;
 | 
				
			||||||
void(float num_bubbles) DeathBubbles;
 | 
					void(float num_bubbles) death_bubbles;
 | 
				
			||||||
void(vector dest) ChooseTurn;
 | 
					void(vector dest) choose_turn;
 | 
				
			||||||
void(vector org, vector vec) LaunchLaser;
 | 
					void(vector org, vector vec) launch_laser;
 | 
				
			||||||
void(vector org, vector vel, float damage) SpawnBlood;
 | 
					void(vector org, vector vel, float damage) spawn_blood;
 | 
				
			||||||
void() BecomeExplosion;
 | 
					void() become_explosion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() hknight_char_a1;
 | 
					void() hknight_char_a1;
 | 
				
			||||||
void() hknight_run1;
 | 
					void() hknight_run1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ogre_smash1;
 | 
					void() ogre_smash1;
 | 
				
			||||||
void() ogre_swing1;
 | 
					void() ogre_swing1;
 | 
				
			||||||
 | 
					float() ogre_check_attack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_center_touch;
 | 
					void() plat_center_touch;
 | 
				
			||||||
void() plat_crush;
 | 
					void() plat_crush;
 | 
				
			||||||
| 
						 | 
					@ -902,7 +903,7 @@ void() knight_bow6;
 | 
				
			||||||
void() knight_runatk1;
 | 
					void() knight_runatk1;
 | 
				
			||||||
void() knight_walk1;
 | 
					void() knight_walk1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() PlayerDie;
 | 
					void() player_die;
 | 
				
			||||||
void() player_axe1;
 | 
					void() player_axe1;
 | 
				
			||||||
void() player_axeb1;
 | 
					void() player_axeb1;
 | 
				
			||||||
void() player_axec1;
 | 
					void() player_axec1;
 | 
				
			||||||
| 
						 | 
					@ -926,11 +927,12 @@ void() sham_smash1;
 | 
				
			||||||
void() sham_swingl1;
 | 
					void() sham_swingl1;
 | 
				
			||||||
void() sham_swingr1;
 | 
					void() sham_swingr1;
 | 
				
			||||||
void() sham_swingr1;
 | 
					void() sham_swingr1;
 | 
				
			||||||
 | 
					float() sham_check_attack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() tbaby_jump1;
 | 
					void() tbaby_jump1;
 | 
				
			||||||
void() tbaby_jump5;
 | 
					void() tbaby_jump5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() WizardCheckAttack;
 | 
					float() wiz_check_attack;
 | 
				
			||||||
void() wiz_run1;
 | 
					void() wiz_run1;
 | 
				
			||||||
void() wiz_side1;
 | 
					void() wiz_side1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -943,6 +945,6 @@ void() func_train_find;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(vector p) boss_missile;
 | 
					void(vector p) boss_missile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ImpulseCommands;
 | 
					void() impulse_commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// EOF
 | 
					// EOF
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,8 +71,8 @@ void() demon1_jump3 = [ $leap3, demon1_jump4 ] {ai_face();};
 | 
				
			||||||
void() demon1_jump4 = [ $leap4, demon1_jump5 ] {
 | 
					void() demon1_jump4 = [ $leap4, demon1_jump5 ] {
 | 
				
			||||||
	ai_face();
 | 
						ai_face();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = Demon_JumpTouch;
 | 
						self.touch = demon_jump_touch;
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	self.origin_z = self.origin_z + 1;
 | 
						self.origin_z = self.origin_z + 1;
 | 
				
			||||||
	self.velocity = v_forward * 600 + '0 0 250';
 | 
						self.velocity = v_forward * 600 + '0 0 250';
 | 
				
			||||||
	if(self.flags & FL_ONGROUND) {
 | 
						if(self.flags & FL_ONGROUND) {
 | 
				
			||||||
| 
						 | 
					@ -96,13 +96,13 @@ void() demon1_atta1 = [ $attacka1, demon1_atta2 ] {ai_charge(4);};
 | 
				
			||||||
void() demon1_atta2 = [ $attacka2, demon1_atta3 ] {ai_charge(0);};
 | 
					void() demon1_atta2 = [ $attacka2, demon1_atta3 ] {ai_charge(0);};
 | 
				
			||||||
void() demon1_atta3 = [ $attacka3, demon1_atta4 ] {ai_charge(0);};
 | 
					void() demon1_atta3 = [ $attacka3, demon1_atta4 ] {ai_charge(0);};
 | 
				
			||||||
void() demon1_atta4 = [ $attacka4, demon1_atta5 ] {ai_charge(1);};
 | 
					void() demon1_atta4 = [ $attacka4, demon1_atta5 ] {ai_charge(1);};
 | 
				
			||||||
void() demon1_atta5 = [ $attacka5, demon1_atta6 ] {ai_charge(2); Demon_Melee(200);};
 | 
					void() demon1_atta5 = [ $attacka5, demon1_atta6 ] {ai_charge(2); demon_melee(200);};
 | 
				
			||||||
void() demon1_atta6 = [ $attacka6, demon1_atta7 ] {ai_charge(1);};
 | 
					void() demon1_atta6 = [ $attacka6, demon1_atta7 ] {ai_charge(1);};
 | 
				
			||||||
void() demon1_atta7 = [ $attacka7, demon1_atta8 ] {ai_charge(6);};
 | 
					void() demon1_atta7 = [ $attacka7, demon1_atta8 ] {ai_charge(6);};
 | 
				
			||||||
void() demon1_atta8 = [ $attacka8, demon1_atta9 ] {ai_charge(8);};
 | 
					void() demon1_atta8 = [ $attacka8, demon1_atta9 ] {ai_charge(8);};
 | 
				
			||||||
void() demon1_atta9 = [ $attacka9, demon1_atta10] {ai_charge(4);};
 | 
					void() demon1_atta9 = [ $attacka9, demon1_atta10] {ai_charge(4);};
 | 
				
			||||||
void() demon1_atta10 = [ $attacka10, demon1_atta11] {ai_charge(2);};
 | 
					void() demon1_atta10 = [ $attacka10, demon1_atta11] {ai_charge(2);};
 | 
				
			||||||
void() demon1_atta11 = [ $attacka11, demon1_atta12] {Demon_Melee(-200);};
 | 
					void() demon1_atta11 = [ $attacka11, demon1_atta12] {demon_melee(-200);};
 | 
				
			||||||
void() demon1_atta12 = [ $attacka12, demon1_atta13] {ai_charge(5);};
 | 
					void() demon1_atta12 = [ $attacka12, demon1_atta13] {ai_charge(5);};
 | 
				
			||||||
void() demon1_atta13 = [ $attacka13, demon1_atta14] {ai_charge(8);};
 | 
					void() demon1_atta13 = [ $attacka13, demon1_atta14] {ai_charge(8);};
 | 
				
			||||||
void() demon1_atta14 = [ $attacka14, demon1_atta15] {ai_charge(4);};
 | 
					void() demon1_atta14 = [ $attacka14, demon1_atta15] {ai_charge(4);};
 | 
				
			||||||
| 
						 | 
					@ -116,7 +116,7 @@ void() demon1_pain5 = [ $pain5, demon1_pain6 ] {};
 | 
				
			||||||
void() demon1_pain6 = [ $pain6, demon1_run1 ] {};
 | 
					void() demon1_pain6 = [ $pain6, demon1_run1 ] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(entity attacker, float damage) demon1_pain = {
 | 
					void(entity attacker, float damage) demon1_pain = {
 | 
				
			||||||
	if(self.touch == Demon_JumpTouch) {
 | 
						if(self.touch == demon_jump_touch) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,10 +151,10 @@ void() demon_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -80) {
 | 
						if(self.health < -80) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_demon.mdl", self.health);
 | 
							throw_head("progs/h_demon.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ void() demon_die = {
 | 
				
			||||||
	demon1_die1();
 | 
						demon1_die1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Demon_MeleeAttack = {
 | 
					void() demon_melee_attack = {
 | 
				
			||||||
	demon1_atta1();
 | 
						demon1_atta1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,16 +187,16 @@ void() monster_demon1 = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/demon.mdl");
 | 
						set_model(self, "progs/demon.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-32 -32 -24', '32 32 64');
 | 
						set_size(self, '-32 -32 -24', '32 32 64');
 | 
				
			||||||
	self.health = 300;
 | 
						self.health = 300;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = demon1_stand1;
 | 
						self.th_stand = demon1_stand1;
 | 
				
			||||||
	self.th_walk = demon1_walk1;
 | 
						self.th_walk = demon1_walk1;
 | 
				
			||||||
	self.th_run = demon1_run1;
 | 
						self.th_run = demon1_run1;
 | 
				
			||||||
	self.th_die = demon_die;
 | 
						self.th_die = demon_die;
 | 
				
			||||||
	self.th_melee = Demon_MeleeAttack; // one of two attacks
 | 
						self.th_melee = demon_melee_attack; // one of two attacks
 | 
				
			||||||
	self.th_missile = demon1_jump1; // jump attack
 | 
						self.th_missile = demon1_jump1; // jump attack
 | 
				
			||||||
	self.th_pain = demon1_pain;
 | 
						self.th_pain = demon1_pain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -213,12 +213,12 @@ DEMON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
CheckDemonMelee
 | 
					demon_check_melee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Returns TRUE if a melee attack would hit right now
 | 
					Returns TRUE if a melee attack would hit right now
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() CheckDemonMelee = {
 | 
					float() demon_check_melee = {
 | 
				
			||||||
	if(enemy_range == RANGE_MELEE) {
 | 
						if(enemy_range == RANGE_MELEE) {
 | 
				
			||||||
		// FIXME: check canreach
 | 
							// FIXME: check canreach
 | 
				
			||||||
		self.attack_state = AS_MELEE;
 | 
							self.attack_state = AS_MELEE;
 | 
				
			||||||
| 
						 | 
					@ -229,11 +229,11 @@ float() CheckDemonMelee = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
CheckDemonJump
 | 
					demon_check_jump
 | 
				
			||||||
 | 
					
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() CheckDemonJump = {
 | 
					float() demon_check_jump = {
 | 
				
			||||||
	vector dist;
 | 
						vector dist;
 | 
				
			||||||
	float d;
 | 
						float d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -250,7 +250,7 @@ float() CheckDemonJump = {
 | 
				
			||||||
	dist = self.enemy.origin - self.origin;
 | 
						dist = self.enemy.origin - self.origin;
 | 
				
			||||||
	dist_z = 0;
 | 
						dist_z = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d = vlen(dist);
 | 
						d = vec_len(dist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(d < 100) {
 | 
						if(d < 100) {
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
| 
						 | 
					@ -265,16 +265,16 @@ float() CheckDemonJump = {
 | 
				
			||||||
	return TRUE;
 | 
						return TRUE;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() DemonCheckAttack = {
 | 
					float() demon_check_attack = {
 | 
				
			||||||
	vector vec;
 | 
						vector vec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if close enough for slashing, go for it
 | 
						// if close enough for slashing, go for it
 | 
				
			||||||
	if(CheckDemonMelee()) {
 | 
						if(demon_check_melee()) {
 | 
				
			||||||
		self.attack_state = AS_MELEE;
 | 
							self.attack_state = AS_MELEE;
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(CheckDemonJump()) {
 | 
						if(demon_check_jump()) {
 | 
				
			||||||
		self.attack_state = AS_MISSILE;
 | 
							self.attack_state = AS_MISSILE;
 | 
				
			||||||
		sound(self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
| 
						 | 
					@ -285,31 +285,31 @@ float() DemonCheckAttack = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//===========================================================================
 | 
					//===========================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float side) Demon_Melee = {
 | 
					void(float side) demon_melee = {
 | 
				
			||||||
	float ldmg;
 | 
						float ldmg;
 | 
				
			||||||
	vector delta;
 | 
						vector delta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ai_face();
 | 
						ai_face();
 | 
				
			||||||
	walkmove(self.ideal_yaw, 12); // allow a little closing
 | 
						walk_move(self.ideal_yaw, 12); // allow a little closing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 100) {
 | 
						if(vec_len(delta) > 100) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!CanDamage(self.enemy, self)) {
 | 
						if(!can_damage(self.enemy, self)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
 | 
				
			||||||
	ldmg = 10 + 5 * random();
 | 
						ldmg = 10 + 5 * random();
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	SpawnMeatSpray(self.origin + v_forward * 16, side * v_right);
 | 
						spawn_meat_spray(self.origin + v_forward * 16, side * v_right);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Demon_JumpTouch = {
 | 
					void() demon_jump_touch = {
 | 
				
			||||||
	float ldmg;
 | 
						float ldmg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.health <= 0) {
 | 
						if(self.health <= 0) {
 | 
				
			||||||
| 
						 | 
					@ -317,17 +317,17 @@ void() Demon_JumpTouch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		if(vlen(self.velocity) > 400) {
 | 
							if(vec_len(self.velocity) > 400) {
 | 
				
			||||||
			ldmg = 40 + 10 * random();
 | 
								ldmg = 40 + 10 * random();
 | 
				
			||||||
			T_Damage(other, self, self, ldmg);
 | 
								ent_damage(other, self, self, ldmg);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!checkbottom(self)) {
 | 
						if(!check_bottom(self)) {
 | 
				
			||||||
		if(self.flags & FL_ONGROUND) {
 | 
							if(self.flags & FL_ONGROUND) {
 | 
				
			||||||
			// jump randomly to not get hung up
 | 
								// jump randomly to not get hung up
 | 
				
			||||||
			//dprint("popjump\n");
 | 
								//print_dbg("popjump\n");
 | 
				
			||||||
			self.touch = SUB_Null;
 | 
								self.touch = sub_null;
 | 
				
			||||||
			self.think = demon1_jump1;
 | 
								self.think = demon1_jump1;
 | 
				
			||||||
			self.nextthink = time + 0.1;
 | 
								self.nextthink = time + 0.1;
 | 
				
			||||||
			// self.velocity_x = (random() - 0.5) * 600;
 | 
								// self.velocity_x = (random() - 0.5) * 600;
 | 
				
			||||||
| 
						 | 
					@ -338,7 +338,7 @@ void() Demon_JumpTouch = {
 | 
				
			||||||
		return; // not on ground yet
 | 
							return; // not on ground yet
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	self.think = demon1_jump11;
 | 
						self.think = demon1_jump11;
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,21 +41,21 @@ void() dog_bite = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ai_charge(10);
 | 
						ai_charge(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!CanDamage(self.enemy, self)) {
 | 
						if(!can_damage(self.enemy, self)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 100) {
 | 
						if(vec_len(delta) > 100) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 8;
 | 
						ldmg = (random() + random() + random()) * 8;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Dog_JumpTouch = {
 | 
					void() dog_jump_touch = {
 | 
				
			||||||
	float ldmg;
 | 
						float ldmg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.health <= 0) {
 | 
						if(self.health <= 0) {
 | 
				
			||||||
| 
						 | 
					@ -63,17 +63,17 @@ void() Dog_JumpTouch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		if(vlen(self.velocity) > 300) {
 | 
							if(vec_len(self.velocity) > 300) {
 | 
				
			||||||
			ldmg = 10 + 10 * random();
 | 
								ldmg = 10 + 10 * random();
 | 
				
			||||||
			T_Damage(other, self, self, ldmg);
 | 
								ent_damage(other, self, self, ldmg);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!checkbottom(self)) {
 | 
						if(!check_bottom(self)) {
 | 
				
			||||||
		if(self.flags & FL_ONGROUND) {
 | 
							if(self.flags & FL_ONGROUND) {
 | 
				
			||||||
			// jump randomly to not get hung up
 | 
								// jump randomly to not get hung up
 | 
				
			||||||
			//dprint("popjump\n");
 | 
								//print_dbg("popjump\n");
 | 
				
			||||||
			self.touch = SUB_Null;
 | 
								self.touch = sub_null;
 | 
				
			||||||
			self.think = dog_leap1;
 | 
								self.think = dog_leap1;
 | 
				
			||||||
			self.nextthink = time + 0.1;
 | 
								self.nextthink = time + 0.1;
 | 
				
			||||||
			// self.velocity_x = (random() - 0.5) * 600;
 | 
								// self.velocity_x = (random() - 0.5) * 600;
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ void() Dog_JumpTouch = {
 | 
				
			||||||
		return; // not on ground yet
 | 
							return; // not on ground yet
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	self.think = dog_run1;
 | 
						self.think = dog_run1;
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -147,8 +147,8 @@ void() dog_leap1 = [ $leap1, dog_leap2 ] {ai_face();};
 | 
				
			||||||
void() dog_leap2 = [ $leap2, dog_leap3 ] {
 | 
					void() dog_leap2 = [ $leap2, dog_leap3 ] {
 | 
				
			||||||
	ai_face();
 | 
						ai_face();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = Dog_JumpTouch;
 | 
						self.touch = dog_jump_touch;
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	self.origin_z = self.origin_z + 1;
 | 
						self.origin_z = self.origin_z + 1;
 | 
				
			||||||
	self.velocity = v_forward * 300 + '0 0 200';
 | 
						self.velocity = v_forward * 300 + '0 0 200';
 | 
				
			||||||
	if(self.flags & FL_ONGROUND) {
 | 
						if(self.flags & FL_ONGROUND) {
 | 
				
			||||||
| 
						 | 
					@ -222,10 +222,10 @@ void() dog_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -35) {
 | 
						if(self.health < -35) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		ThrowHead("progs/h_dog.mdl", self.health);
 | 
							throw_head("progs/h_dog.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -244,12 +244,12 @@ void() dog_die = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
CheckDogMelee
 | 
					dog_check_melee
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Returns TRUE if a melee attack would hit right now
 | 
					Returns TRUE if a melee attack would hit right now
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() CheckDogMelee = {
 | 
					float() dog_check_melee = {
 | 
				
			||||||
	if(enemy_range == RANGE_MELEE) {
 | 
						if(enemy_range == RANGE_MELEE) {
 | 
				
			||||||
		// FIXME: check canreach
 | 
							// FIXME: check canreach
 | 
				
			||||||
		self.attack_state = AS_MELEE;
 | 
							self.attack_state = AS_MELEE;
 | 
				
			||||||
| 
						 | 
					@ -260,11 +260,11 @@ float() CheckDogMelee = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
CheckDogJump
 | 
					dog_check_jump
 | 
				
			||||||
 | 
					
 | 
				
			||||||
==============
 | 
					==============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() CheckDogJump = {
 | 
					float() dog_check_jump = {
 | 
				
			||||||
	vector dist;
 | 
						vector dist;
 | 
				
			||||||
	float d;
 | 
						float d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -281,7 +281,7 @@ float() CheckDogJump = {
 | 
				
			||||||
	dist = self.enemy.origin - self.origin;
 | 
						dist = self.enemy.origin - self.origin;
 | 
				
			||||||
	dist_z = 0;
 | 
						dist_z = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d = vlen(dist);
 | 
						d = vec_len(dist);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(d < 80) {
 | 
						if(d < 80) {
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
| 
						 | 
					@ -294,16 +294,16 @@ float() CheckDogJump = {
 | 
				
			||||||
	return TRUE;
 | 
						return TRUE;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() DogCheckAttack = {
 | 
					float() dog_check_attack = {
 | 
				
			||||||
	vector vec;
 | 
						vector vec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if close enough for slashing, go for it
 | 
						// if close enough for slashing, go for it
 | 
				
			||||||
	if(CheckDogMelee()) {
 | 
						if(dog_check_melee()) {
 | 
				
			||||||
		self.attack_state = AS_MELEE;
 | 
							self.attack_state = AS_MELEE;
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(CheckDogJump()) {
 | 
						if(dog_check_jump()) {
 | 
				
			||||||
		self.attack_state = AS_MISSILE;
 | 
							self.attack_state = AS_MISSILE;
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -333,9 +333,9 @@ void() monster_dog = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/dog.mdl");
 | 
						set_model(self, "progs/dog.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-32 -32 -24', '32 32 40');
 | 
						set_size(self, '-32 -32 -24', '32 32 40');
 | 
				
			||||||
	self.health = 25;
 | 
						self.health = 25;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = dog_stand1;
 | 
						self.th_stand = dog_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ THINK FUNCTIONS
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() door_blocked = {
 | 
					void() door_blocked = {
 | 
				
			||||||
	T_Damage(other, self, self, self.dmg);
 | 
						ent_damage(other, self, self, self.dmg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if a door has a negative wait, it would never come back if blocked,
 | 
						// if a door has a negative wait, it would never come back if blocked,
 | 
				
			||||||
	// so let it just squash the object to death real fast
 | 
						// so let it just squash the object to death real fast
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ void() door_go_down = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.state = STATE_DOWN;
 | 
						self.state = STATE_DOWN;
 | 
				
			||||||
	SUB_CalcMove(self.pos1, self.speed, door_hit_bottom);
 | 
						sub_calc_move(self.pos1, self.speed, door_hit_bottom);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() door_go_up = {
 | 
					void() door_go_up = {
 | 
				
			||||||
| 
						 | 
					@ -74,9 +74,9 @@ void() door_go_up = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
				
			||||||
	self.state = STATE_UP;
 | 
						self.state = STATE_UP;
 | 
				
			||||||
	SUB_CalcMove(self.pos2, self.speed, door_hit_top);
 | 
						sub_calc_move(self.pos2, self.speed, door_hit_top);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -92,7 +92,7 @@ void() door_fire = {
 | 
				
			||||||
	entity starte;
 | 
						entity starte;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.owner != self) {
 | 
						if(self.owner != self) {
 | 
				
			||||||
		objerror("door_fire: self.owner != self");
 | 
							error_obj("door_fire: self.owner != self");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// play use key sound
 | 
						// play use key sound
 | 
				
			||||||
| 
						 | 
					@ -182,7 +182,7 @@ void() door_touch = {
 | 
				
			||||||
	self.owner.attack_finished = time + 2;
 | 
						self.owner.attack_finished = time + 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.owner.message != string_null) {
 | 
						if(self.owner.message != string_null) {
 | 
				
			||||||
		centerprint(other, self.owner.message);
 | 
							print_center(other, self.owner.message);
 | 
				
			||||||
		sound(other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
 | 
							sound(other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,17 +194,17 @@ void() door_touch = {
 | 
				
			||||||
	// FIXME: blink key on player's status bar
 | 
						// FIXME: blink key on player's status bar
 | 
				
			||||||
	if((self.items & other.items) != self.items) {
 | 
						if((self.items & other.items) != self.items) {
 | 
				
			||||||
		switch(self.owner.items) {
 | 
							switch(self.owner.items) {
 | 
				
			||||||
			case IT_KEY1: centerprint(other, "You need the ", Key1Name()); break;
 | 
								case IT_KEY1: print_center(other, "You need the ", key_1_name()); break;
 | 
				
			||||||
			case IT_KEY2: centerprint(other, "You need the ", Key2Name()); break;
 | 
								case IT_KEY2: print_center(other, "You need the ", key_2_name()); break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	other.items = other.items - self.items;
 | 
						other.items = other.items - self.items;
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	if(self.enemy) {
 | 
						if(self.enemy) {
 | 
				
			||||||
		self.enemy.touch = SUB_Null; // get paired door
 | 
							self.enemy.touch = sub_null; // get paired door
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	door_use();
 | 
						door_use();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -229,11 +229,11 @@ entity(vector fmins, vector fmaxs) spawn_field = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t1 = fmins;
 | 
						t1 = fmins;
 | 
				
			||||||
	t2 = fmaxs;
 | 
						t2 = fmaxs;
 | 
				
			||||||
	setsize(trigger, t1 - '60 60 8', t2 + '60 60 8');
 | 
						set_size(trigger, t1 - '60 60 8', t2 + '60 60 8');
 | 
				
			||||||
	return(trigger);
 | 
						return(trigger);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(entity e1, entity e2) EntitiesTouching = {
 | 
					float(entity e1, entity e2) entities_touching = {
 | 
				
			||||||
	if(e1.mins_x > e2.maxs_x) {
 | 
						if(e1.mins_x > e2.maxs_x) {
 | 
				
			||||||
		return FALSE;
 | 
							return FALSE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -257,11 +257,11 @@ float(entity e1, entity e2) EntitiesTouching = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
LinkDoors
 | 
					link_doors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() LinkDoors = {
 | 
					void() link_doors = {
 | 
				
			||||||
	entity t, starte;
 | 
						entity t, starte;
 | 
				
			||||||
	vector cmins, cmaxs;
 | 
						vector cmins, cmaxs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -308,9 +308,9 @@ void() LinkDoors = {
 | 
				
			||||||
			self.owner.trigger_field = spawn_field(cmins, cmaxs);
 | 
								self.owner.trigger_field = spawn_field(cmins, cmaxs);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(EntitiesTouching(self, t)) {
 | 
							if(entities_touching(self, t)) {
 | 
				
			||||||
			if(t.enemy) {
 | 
								if(t.enemy) {
 | 
				
			||||||
				objerror("cross connected doors");
 | 
									error_obj("cross connected doors");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			self.enemy = t;
 | 
								self.enemy = t;
 | 
				
			||||||
			self = t;
 | 
								self = t;
 | 
				
			||||||
| 
						 | 
					@ -414,13 +414,13 @@ void() func_door = {
 | 
				
			||||||
		self.noise2 = "doors/ddoor1.wav";
 | 
							self.noise2 = "doors/ddoor1.wav";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SetMovedir();
 | 
						set_move_dir();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.max_health = self.health;
 | 
						self.max_health = self.health;
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH;
 | 
						self.movetype = MOVETYPE_PUSH;
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
	self.classname = "door";
 | 
						self.classname = "door";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.blocked = door_blocked;
 | 
						self.blocked = door_blocked;
 | 
				
			||||||
| 
						 | 
					@ -452,7 +452,7 @@ void() func_door = {
 | 
				
			||||||
	// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
 | 
						// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
 | 
				
			||||||
	// but spawn in the open position
 | 
						// but spawn in the open position
 | 
				
			||||||
	if(self.spawnflags & DOOR_START_OPEN) {
 | 
						if(self.spawnflags & DOOR_START_OPEN) {
 | 
				
			||||||
		setorigin(self, self.pos2);
 | 
							set_origin(self, self.pos2);
 | 
				
			||||||
		self.pos2 = self.pos1;
 | 
							self.pos2 = self.pos1;
 | 
				
			||||||
		self.pos1 = self.origin;
 | 
							self.pos1 = self.origin;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -470,9 +470,9 @@ void() func_door = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = door_touch;
 | 
						self.touch = door_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// LinkDoors can't be done until all of the doors have been spawned, so
 | 
						// link_doors can't be done until all of the doors have been spawned, so
 | 
				
			||||||
	// the sizes can be detected properly.
 | 
						// the sizes can be detected properly.
 | 
				
			||||||
	self.think = LinkDoors;
 | 
						self.think = link_doors;
 | 
				
			||||||
	self.nextthink = self.ltime + 0.1;
 | 
						self.nextthink = self.ltime + 0.1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -496,10 +496,10 @@ void() fd_secret_use = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.message = string_null; // no more message
 | 
						self.message = string_null; // no more message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!(self.spawnflags & SECRET_NO_SHOOT)) {
 | 
						if(!(self.spawnflags & SECRET_NO_SHOOT)) {
 | 
				
			||||||
		self.th_pain = SUB_PainNull;
 | 
							self.th_pain = sub_pain_null;
 | 
				
			||||||
		self.takedamage = DAMAGE_NO;
 | 
							self.takedamage = DAMAGE_NO;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
| 
						 | 
					@ -510,7 +510,7 @@ void() fd_secret_use = {
 | 
				
			||||||
	self.nextthink = self.ltime + 0.1;
 | 
						self.nextthink = self.ltime + 0.1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
 | 
						temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
 | 
				
			||||||
	makevectors(self.mangle);
 | 
						make_vectors(self.mangle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!self.t_width) {
 | 
						if(!self.t_width) {
 | 
				
			||||||
		if(self.spawnflags & SECRET_1ST_DOWN) {
 | 
							if(self.spawnflags & SECRET_1ST_DOWN) {
 | 
				
			||||||
| 
						 | 
					@ -531,7 +531,7 @@ void() fd_secret_use = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.dest2 = self.dest1 + v_forward * self.t_length;
 | 
						self.dest2 = self.dest1 + v_forward * self.t_length;
 | 
				
			||||||
	SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
 | 
						sub_calc_move(self.dest1, self.speed, fd_secret_move1);
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void(entity attacker, float damage) fd_secret_pain = {fd_secret_use();};
 | 
					void(entity attacker, float damage) fd_secret_pain = {fd_secret_use();};
 | 
				
			||||||
| 
						 | 
					@ -546,7 +546,7 @@ void() fd_secret_move1 = {
 | 
				
			||||||
// Start moving sideways w/sound...
 | 
					// Start moving sideways w/sound...
 | 
				
			||||||
void() fd_secret_move2 = {
 | 
					void() fd_secret_move2 = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
				
			||||||
	SUB_CalcMove(self.dest2, self.speed, fd_secret_move3);
 | 
						sub_calc_move(self.dest2, self.speed, fd_secret_move3);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Wait here until time to go back...
 | 
					// Wait here until time to go back...
 | 
				
			||||||
| 
						 | 
					@ -561,7 +561,7 @@ void() fd_secret_move3 = {
 | 
				
			||||||
// Move backward...
 | 
					// Move backward...
 | 
				
			||||||
void() fd_secret_move4 = {
 | 
					void() fd_secret_move4 = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
				
			||||||
	SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
 | 
						sub_calc_move(self.dest1, self.speed, fd_secret_move5);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Wait 1 second...
 | 
					// Wait 1 second...
 | 
				
			||||||
| 
						 | 
					@ -573,7 +573,7 @@ void() fd_secret_move5 = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() fd_secret_move6 = {
 | 
					void() fd_secret_move6 = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
 | 
				
			||||||
	SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done);
 | 
						sub_calc_move(self.oldorigin, self.speed, fd_secret_done);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() fd_secret_done = {
 | 
					void() fd_secret_done = {
 | 
				
			||||||
| 
						 | 
					@ -590,7 +590,7 @@ void() secret_blocked = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.attack_finished = time + 0.5;
 | 
						self.attack_finished = time + 0.5;
 | 
				
			||||||
	T_Damage(other, self, self, self.dmg);
 | 
						ent_damage(other, self, self, self.dmg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -611,7 +611,7 @@ void() secret_touch = {
 | 
				
			||||||
	self.attack_finished = time + 2;
 | 
						self.attack_finished = time + 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.message) {
 | 
						if(self.message) {
 | 
				
			||||||
		centerprint(other, self.message);
 | 
							print_center(other, self.message);
 | 
				
			||||||
		sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
 | 
							sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -670,8 +670,8 @@ void() func_door_secret = {
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH;
 | 
						self.movetype = MOVETYPE_PUSH;
 | 
				
			||||||
	self.classname = "door";
 | 
						self.classname = "door";
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = secret_touch;
 | 
						self.touch = secret_touch;
 | 
				
			||||||
	self.blocked = secret_blocked;
 | 
						self.blocked = secret_blocked;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,14 +31,14 @@ $frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8
 | 
				
			||||||
$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
 | 
					$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
 | 
				
			||||||
$frame paind17 paind18 paind19
 | 
					$frame paind17 paind18 paind19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Laser_Touch = {
 | 
					void() laser_touch = {
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(pointcontents(self.origin) == CONTENT_SKY) {
 | 
						if(point_contents(self.origin) == CONTENT_SKY) {
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -47,20 +47,20 @@ void() Laser_Touch = {
 | 
				
			||||||
	org = self.origin - 8 * normalize(self.velocity);
 | 
						org = self.origin - 8 * normalize(self.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.health) {
 | 
						if(other.health) {
 | 
				
			||||||
		SpawnBlood(org, self.velocity * 0.2, 15);
 | 
							spawn_blood(org, self.velocity * 0.2, 15);
 | 
				
			||||||
		T_Damage(other, self, self.owner, 15);
 | 
							ent_damage(other, self, self.owner, 15);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
							write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, TE_GUNSHOT);
 | 
							write_byte(MSG_BROADCAST, TE_GUNSHOT);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_x);
 | 
							write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_y);
 | 
							write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_z);
 | 
							write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(vector org, vector vec_to) LaunchLaser = {
 | 
					void(vector org, vector vec_to) launch_laser = {
 | 
				
			||||||
	vector vec;
 | 
						vector vec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.classname == "monster_enforcer") {
 | 
						if(self.classname == "monster_enforcer") {
 | 
				
			||||||
| 
						 | 
					@ -75,17 +75,17 @@ void(vector org, vector vec_to) LaunchLaser = {
 | 
				
			||||||
	newmis.solid = SOLID_BBOX;
 | 
						newmis.solid = SOLID_BBOX;
 | 
				
			||||||
	newmis.effects = EF_DIMLIGHT;
 | 
						newmis.effects = EF_DIMLIGHT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(newmis, "progs/laser.mdl");
 | 
						set_model(newmis, "progs/laser.mdl");
 | 
				
			||||||
	setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setorigin(newmis, org);
 | 
						set_origin(newmis, org);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newmis.velocity = vec * 600;
 | 
						newmis.velocity = vec * 600;
 | 
				
			||||||
	newmis.angles = vectoangles(newmis.velocity);
 | 
						newmis.angles = vec_to_angles(newmis.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newmis.nextthink = time + 5;
 | 
						newmis.nextthink = time + 5;
 | 
				
			||||||
	newmis.think = SUB_Remove;
 | 
						newmis.think = sub_remove;
 | 
				
			||||||
	newmis.touch = Laser_Touch;
 | 
						newmis.touch = laser_touch;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,11 +93,11 @@ void() enforcer_fire = {
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.effects = self.effects | EF_MUZZLEFLASH;
 | 
						self.effects = self.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
 | 
						org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LaunchLaser(org, self.enemy.origin - self.origin);
 | 
						launch_laser(org, self.enemy.origin - self.origin);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -160,7 +160,7 @@ void() enf_atk11 = [ $attack7, enf_atk12 ] {ai_face();};
 | 
				
			||||||
void() enf_atk12 = [ $attack8, enf_atk13 ] {ai_face();};
 | 
					void() enf_atk12 = [ $attack8, enf_atk13 ] {ai_face();};
 | 
				
			||||||
void() enf_atk13 = [ $attack9, enf_atk14 ] {ai_face();};
 | 
					void() enf_atk13 = [ $attack9, enf_atk14 ] {ai_face();};
 | 
				
			||||||
void() enf_atk14 = [ $attack10, enf_run1 ] {ai_face();
 | 
					void() enf_atk14 = [ $attack10, enf_run1 ] {ai_face();
 | 
				
			||||||
		 SUB_CheckRefire(enf_atk1);
 | 
							 sub_check_refire(enf_atk1);
 | 
				
			||||||
					 };
 | 
										 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() enf_paina1 = [ $paina1, enf_paina2 ] {};
 | 
					void() enf_paina1 = [ $paina1, enf_paina2 ] {};
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ void(entity attacker, float damage) enf_pain = {
 | 
				
			||||||
void() enf_die1 = [ $death1, enf_die2 ] {};
 | 
					void() enf_die1 = [ $death1, enf_die2 ] {};
 | 
				
			||||||
void() enf_die2 = [ $death2, enf_die3 ] {};
 | 
					void() enf_die2 = [ $death2, enf_die3 ] {};
 | 
				
			||||||
void() enf_die3 = [ $death3, enf_die4 ]
 | 
					void() enf_die3 = [ $death3, enf_die4 ]
 | 
				
			||||||
{self.solid = SOLID_NOT; self.ammo_cells = 5; DropBackpack();};
 | 
					{self.solid = SOLID_NOT; self.ammo_cells = 5; drop_backpack();};
 | 
				
			||||||
void() enf_die4 = [ $death4, enf_die5 ] {ai_forward(14);};
 | 
					void() enf_die4 = [ $death4, enf_die5 ] {ai_forward(14);};
 | 
				
			||||||
void() enf_die5 = [ $death5, enf_die6 ] {ai_forward(2);};
 | 
					void() enf_die5 = [ $death5, enf_die6 ] {ai_forward(2);};
 | 
				
			||||||
void() enf_die6 = [ $death6, enf_die7 ] {};
 | 
					void() enf_die6 = [ $death6, enf_die7 ] {};
 | 
				
			||||||
| 
						 | 
					@ -257,7 +257,7 @@ void() enf_fdie1 = [ $fdeath1, enf_fdie2 ] {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() enf_fdie2 = [ $fdeath2, enf_fdie3 ] {};
 | 
					void() enf_fdie2 = [ $fdeath2, enf_fdie3 ] {};
 | 
				
			||||||
void() enf_fdie3 = [ $fdeath3, enf_fdie4 ]
 | 
					void() enf_fdie3 = [ $fdeath3, enf_fdie4 ]
 | 
				
			||||||
{self.solid = SOLID_NOT; self.ammo_cells = 5; DropBackpack();};
 | 
					{self.solid = SOLID_NOT; self.ammo_cells = 5; drop_backpack();};
 | 
				
			||||||
void() enf_fdie4 = [ $fdeath4, enf_fdie5 ] {};
 | 
					void() enf_fdie4 = [ $fdeath4, enf_fdie5 ] {};
 | 
				
			||||||
void() enf_fdie5 = [ $fdeath5, enf_fdie6 ] {};
 | 
					void() enf_fdie5 = [ $fdeath5, enf_fdie6 ] {};
 | 
				
			||||||
void() enf_fdie6 = [ $fdeath6, enf_fdie7 ] {};
 | 
					void() enf_fdie6 = [ $fdeath6, enf_fdie7 ] {};
 | 
				
			||||||
| 
						 | 
					@ -271,10 +271,10 @@ void() enf_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -35) {
 | 
						if(self.health < -35) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_mega.mdl", self.health);
 | 
							throw_head("progs/h_mega.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -313,9 +313,9 @@ void() monster_enforcer = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/enforcer.mdl");
 | 
						set_model(self, "progs/enforcer.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 80;
 | 
						self.health = 80;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = enf_stand1;
 | 
						self.th_stand = enf_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										226
									
								
								source/fight.qc
									
									
									
									
									
								
							
							
						
						
									
										226
									
								
								source/fight.qc
									
									
									
									
									
								
							| 
						 | 
					@ -13,7 +13,7 @@ void() knight_attack = {
 | 
				
			||||||
	float len;
 | 
						float len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// decide if now is a good swing time
 | 
						// decide if now is a good swing time
 | 
				
			||||||
	len = vlen(self.enemy.origin + self.enemy.view_ofs - (self.origin + self.view_ofs));
 | 
						len = vec_len(self.enemy.origin + self.enemy.view_ofs - (self.origin + self.view_ofs));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(len < 80) {
 | 
						if(len < 80) {
 | 
				
			||||||
		knight_atk1();
 | 
							knight_atk1();
 | 
				
			||||||
| 
						 | 
					@ -26,13 +26,13 @@ void() knight_attack = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
===========
 | 
					===========
 | 
				
			||||||
CheckAttack
 | 
					check_attack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The player is in view, so decide to move or launch an attack
 | 
					The player is in view, so decide to move or launch an attack
 | 
				
			||||||
Returns FALSE if movement should continue
 | 
					Returns FALSE if movement should continue
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() CheckAttack = {
 | 
					float() check_attack = {
 | 
				
			||||||
	vector spot1, spot2;
 | 
						vector spot1, spot2;
 | 
				
			||||||
	entity targ;
 | 
						entity targ;
 | 
				
			||||||
	float chance;
 | 
						float chance;
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ float() CheckAttack = {
 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(spot1, spot2, FALSE, self);
 | 
						trace_line(spot1, spot2, FALSE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(trace_ent != targ) {
 | 
						if(trace_ent != targ) {
 | 
				
			||||||
		return FALSE; // don't have a clear shot
 | 
							return FALSE; // don't have a clear shot
 | 
				
			||||||
| 
						 | 
					@ -99,7 +99,7 @@ float() CheckAttack = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(random() < chance) {
 | 
						if(random() < chance) {
 | 
				
			||||||
		self.th_missile();
 | 
							self.th_missile();
 | 
				
			||||||
		SUB_AttackFinished(2 * random());
 | 
							sub_attack_finished(2 * random());
 | 
				
			||||||
		return TRUE;
 | 
							return TRUE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,8 +114,8 @@ Stay facing the enemy
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ai_face = {
 | 
					void() ai_face = {
 | 
				
			||||||
	self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
 | 
						self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin);
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -127,7 +127,7 @@ The monster is in a melee attack, so get as close as possible to .enemy
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float d) ai_charge = {
 | 
					void(float d) ai_charge = {
 | 
				
			||||||
	ai_face();
 | 
						ai_face();
 | 
				
			||||||
	movetogoal(d); // done in C code...
 | 
						move_to_goal(d); // done in C code...
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ai_charge_side = {
 | 
					void() ai_charge_side = {
 | 
				
			||||||
| 
						 | 
					@ -136,14 +136,14 @@ void() ai_charge_side = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// aim to the left of the enemy for a flyby
 | 
						// aim to the left of the enemy for a flyby
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
 | 
						self.ideal_yaw = vec_yaw(self.enemy.origin - self.origin);
 | 
				
			||||||
	ChangeYaw();
 | 
						change_yaw();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	dtemp = self.enemy.origin - 30 * v_right;
 | 
						dtemp = self.enemy.origin - 30 * v_right;
 | 
				
			||||||
	heading = vectoyaw(dtemp - self.origin);
 | 
						heading = vec_yaw(dtemp - self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	walkmove(heading, 20);
 | 
						walk_move(heading, 20);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -162,12 +162,12 @@ void() ai_melee = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 60) {
 | 
						if(vec_len(delta) > 60) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 3;
 | 
						ldmg = (random() + random() + random()) * 3;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ai_melee_side = {
 | 
					void() ai_melee_side = {
 | 
				
			||||||
| 
						 | 
					@ -182,203 +182,13 @@ void() ai_melee_side = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 60) {
 | 
						if(vec_len(delta) > 60) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!CanDamage(self.enemy, self)) {
 | 
						if(!can_damage(self.enemy, self)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 3;
 | 
						ldmg = (random() + random() + random()) * 3;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//=============================================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
===========
 | 
					 | 
				
			||||||
SoldierCheckAttack
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The player is in view, so decide to move or launch an attack
 | 
					 | 
				
			||||||
Returns FALSE if movement should continue
 | 
					 | 
				
			||||||
============
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
float() SoldierCheckAttack = {
 | 
					 | 
				
			||||||
	vector spot1, spot2;
 | 
					 | 
				
			||||||
	entity targ;
 | 
					 | 
				
			||||||
	float chance;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	targ = self.enemy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// see if any entities are in the way of the shot
 | 
					 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
					 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	traceline(spot1, spot2, FALSE, self);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_inopen && trace_inwater) {
 | 
					 | 
				
			||||||
		return FALSE; // sight line crossed contents
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_ent != targ) {
 | 
					 | 
				
			||||||
		return FALSE; // don't have a clear shot
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// missile attack
 | 
					 | 
				
			||||||
	if(time < self.attack_finished) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_FAR) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_MELEE) {
 | 
					 | 
				
			||||||
		chance = 0.9;
 | 
					 | 
				
			||||||
	} else if(enemy_range == RANGE_NEAR) {
 | 
					 | 
				
			||||||
		chance = 0.4;
 | 
					 | 
				
			||||||
	} else if(enemy_range == RANGE_MID) {
 | 
					 | 
				
			||||||
		chance = 0.05;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		chance = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(random() < chance) {
 | 
					 | 
				
			||||||
		self.th_missile();
 | 
					 | 
				
			||||||
		SUB_AttackFinished(1 + random());
 | 
					 | 
				
			||||||
		if(random() < 0.3) {
 | 
					 | 
				
			||||||
			self.lefty = !self.lefty;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return TRUE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return FALSE;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
//=============================================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
===========
 | 
					 | 
				
			||||||
ShamCheckAttack
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The player is in view, so decide to move or launch an attack
 | 
					 | 
				
			||||||
Returns FALSE if movement should continue
 | 
					 | 
				
			||||||
============
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
float() ShamCheckAttack = {
 | 
					 | 
				
			||||||
	vector spot1, spot2;
 | 
					 | 
				
			||||||
	entity targ;
 | 
					 | 
				
			||||||
	float chance;
 | 
					 | 
				
			||||||
	float enemy_yaw;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_MELEE) {
 | 
					 | 
				
			||||||
		if(CanDamage(self.enemy, self)) {
 | 
					 | 
				
			||||||
			self.attack_state = AS_MELEE;
 | 
					 | 
				
			||||||
			return TRUE;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(time < self.attack_finished) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(!enemy_vis) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	targ = self.enemy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// see if any entities are in the way of the shot
 | 
					 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
					 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(vlen(spot1 - spot2) > 600) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	traceline(spot1, spot2, FALSE, self);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_inopen && trace_inwater) {
 | 
					 | 
				
			||||||
		return FALSE; // sight line crossed contents
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_ent != targ) {
 | 
					 | 
				
			||||||
		return FALSE; // don't have a clear shot
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// missile attack
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_FAR) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	self.attack_state = AS_MISSILE;
 | 
					 | 
				
			||||||
	SUB_AttackFinished(2 + 2 * random());
 | 
					 | 
				
			||||||
	return TRUE;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//============================================================================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
===========
 | 
					 | 
				
			||||||
OgreCheckAttack
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The player is in view, so decide to move or launch an attack
 | 
					 | 
				
			||||||
Returns FALSE if movement should continue
 | 
					 | 
				
			||||||
============
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
float() OgreCheckAttack = {
 | 
					 | 
				
			||||||
	vector spot1, spot2;
 | 
					 | 
				
			||||||
	entity targ;
 | 
					 | 
				
			||||||
	float chance;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_MELEE) {
 | 
					 | 
				
			||||||
		if(CanDamage(self.enemy, self)) {
 | 
					 | 
				
			||||||
			self.attack_state = AS_MELEE;
 | 
					 | 
				
			||||||
			return TRUE;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(time < self.attack_finished) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(!enemy_vis) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	targ = self.enemy;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// see if any entities are in the way of the shot
 | 
					 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
					 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	traceline(spot1, spot2, FALSE, self);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_inopen && trace_inwater) {
 | 
					 | 
				
			||||||
		return FALSE; // sight line crossed contents
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(trace_ent != targ) {
 | 
					 | 
				
			||||||
		return FALSE; // don't have a clear shot
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// missile attack
 | 
					 | 
				
			||||||
	if(time < self.attack_finished) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(enemy_range == RANGE_FAR) {
 | 
					 | 
				
			||||||
		return FALSE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	else if(enemy_range == RANGE_NEAR) {
 | 
					 | 
				
			||||||
		chance = 0.10;
 | 
					 | 
				
			||||||
	} else if(enemy_range == RANGE_MID) {
 | 
					 | 
				
			||||||
		chance = 0.05;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		chance = 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	self.attack_state = AS_MISSILE;
 | 
					 | 
				
			||||||
	SUB_AttackFinished(1 + 2 * random());
 | 
					 | 
				
			||||||
	return TRUE;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,13 +82,13 @@ void() fish_melee = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 60) {
 | 
						if(vec_len(delta) > 60) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
 | 
				
			||||||
	ldmg = (random() + random()) * 3;
 | 
						ldmg = (random() + random()) * 3;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() f_attack1 = [ $attack1, f_attack2 ] {ai_charge(10);};
 | 
					void() f_attack1 = [ $attack1, f_attack2 ] {ai_charge(10);};
 | 
				
			||||||
| 
						 | 
					@ -167,9 +167,9 @@ void() monster_fish = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/fish.mdl");
 | 
						set_model(self, "progs/fish.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 24');
 | 
						set_size(self, '-16 -16 -24', '16 16 24');
 | 
				
			||||||
	self.health = 25;
 | 
						self.health = 25;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = f_stand1;
 | 
						self.th_stand = f_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,10 +55,10 @@ void(float offset) hknight_shot = {
 | 
				
			||||||
	vector offang;
 | 
						vector offang;
 | 
				
			||||||
	vector org, vec;
 | 
						vector org, vec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	offang = vectoangles(self.enemy.origin - self.origin);
 | 
						offang = vec_to_angles(self.enemy.origin - self.origin);
 | 
				
			||||||
	offang_y = offang_y + offset * 6;
 | 
						offang_y = offang_y + offset * 6;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(offang);
 | 
						make_vectors(offang);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	org = self.origin + self.mins + self.size * 0.5 + v_forward * 20;
 | 
						org = self.origin + self.mins + self.size * 0.5 + v_forward * 20;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,13 +68,13 @@ void(float offset) hknight_shot = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	launch_spike(org, vec);
 | 
						launch_spike(org, vec);
 | 
				
			||||||
	newmis.classname = "knightspike";
 | 
						newmis.classname = "knightspike";
 | 
				
			||||||
	setmodel(newmis, "progs/k_spike.mdl");
 | 
						set_model(newmis, "progs/k_spike.mdl");
 | 
				
			||||||
	setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	newmis.velocity = vec * 300;
 | 
						newmis.velocity = vec * 300;
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() CheckForCharge = {
 | 
					void() check_for_charge = {
 | 
				
			||||||
	// check for mad charge
 | 
						// check for mad charge
 | 
				
			||||||
	if(!enemy_vis) {
 | 
						if(!enemy_vis) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -85,19 +85,19 @@ void() CheckForCharge = {
 | 
				
			||||||
	if(fabs(self.origin_z - self.enemy.origin_z) > 20) {
 | 
						if(fabs(self.origin_z - self.enemy.origin_z) > 20) {
 | 
				
			||||||
		return; // too much height change
 | 
							return; // too much height change
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(vlen(self.origin - self.enemy.origin) < 80) {
 | 
						if(vec_len(self.origin - self.enemy.origin) < 80) {
 | 
				
			||||||
		return; // use regular attack
 | 
							return; // use regular attack
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// charge
 | 
						// charge
 | 
				
			||||||
	SUB_AttackFinished(2);
 | 
						sub_attack_finished(2);
 | 
				
			||||||
	hknight_char_a1();
 | 
						hknight_char_a1();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() CheckContinueCharge = {
 | 
					void() check_continue_charge = {
 | 
				
			||||||
	if(time > self.attack_finished) {
 | 
						if(time > self.attack_finished) {
 | 
				
			||||||
		SUB_AttackFinished(3);
 | 
							sub_attack_finished(3);
 | 
				
			||||||
		hknight_run1();
 | 
							hknight_run1();
 | 
				
			||||||
		return; // done charging
 | 
							return; // done charging
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -151,7 +151,7 @@ void() hknight_walk20 = [ $walk20, hknight_walk1 ] {ai_walk(2);};
 | 
				
			||||||
void() hknight_run1 = [ $run1, hknight_run2 ] {
 | 
					void() hknight_run1 = [ $run1, hknight_run2 ] {
 | 
				
			||||||
	hknight_idle_sound();
 | 
						hknight_idle_sound();
 | 
				
			||||||
	ai_run(20);
 | 
						ai_run(20);
 | 
				
			||||||
	CheckForCharge();
 | 
						check_for_charge();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() hknight_run2 = [ $run2, hknight_run3 ] {ai_run(25);};
 | 
					void() hknight_run2 = [ $run2, hknight_run3 ] {ai_run(25);};
 | 
				
			||||||
void() hknight_run3 = [ $run3, hknight_run4 ] {ai_run(18);};
 | 
					void() hknight_run3 = [ $run3, hknight_run4 ] {ai_run(18);};
 | 
				
			||||||
| 
						 | 
					@ -200,10 +200,10 @@ void() hknight_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -40) {
 | 
						if(self.health < -40) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_hellkn.mdl", self.health);
 | 
							throw_head("progs/h_hellkn.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,7 +285,7 @@ void() hknight_char_a16 = [ $char_a16, hknight_run1 ] {ai_charge(13);};
 | 
				
			||||||
//===========================================================================
 | 
					//===========================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() hknight_char_b1 = [ $char_b1, hknight_char_b2 ]
 | 
					void() hknight_char_b1 = [ $char_b1, hknight_char_b2 ]
 | 
				
			||||||
{CheckContinueCharge(); ai_charge(23); ai_melee();};
 | 
					{check_continue_charge(); ai_charge(23); ai_melee();};
 | 
				
			||||||
void() hknight_char_b2 = [ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
 | 
					void() hknight_char_b2 = [ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
 | 
				
			||||||
void() hknight_char_b3 = [ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
 | 
					void() hknight_char_b3 = [ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
 | 
				
			||||||
void() hknight_char_b4 = [ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
 | 
					void() hknight_char_b4 = [ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
 | 
				
			||||||
| 
						 | 
					@ -408,9 +408,9 @@ void() monster_hell_knight = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/hknight.mdl");
 | 
						set_model(self, "progs/hknight.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 250;
 | 
						self.health = 250;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = hknight_stand1;
 | 
						self.th_stand = hknight_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										324
									
								
								source/items.qc
									
									
									
									
									
								
							
							
						
						
									
										324
									
								
								source/items.qc
									
									
									
									
									
								
							| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
// items.qc: items the player can pick up
 | 
					// items.qc: items the player can pick up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
string() Key1Name = {
 | 
					string() key_1_name = {
 | 
				
			||||||
	switch(world.worldtype) {
 | 
						switch(world.worldtype) {
 | 
				
			||||||
		case WORLD_MEDIEVAL:
 | 
							case WORLD_MEDIEVAL:
 | 
				
			||||||
			return "silver key";
 | 
								return "silver key";
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,7 @@ string() Key1Name = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
string() Key2Name = {
 | 
					string() key_2_name = {
 | 
				
			||||||
	switch(world.worldtype) {
 | 
						switch(world.worldtype) {
 | 
				
			||||||
		case WORLD_MEDIEVAL:
 | 
							case WORLD_MEDIEVAL:
 | 
				
			||||||
			return "gold key";
 | 
								return "gold key";
 | 
				
			||||||
| 
						 | 
					@ -30,11 +30,11 @@ string() Key2Name = {
 | 
				
			||||||
BE .8 .3 .4 IN COLOR */
 | 
					BE .8 .3 .4 IN COLOR */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() SUB_regen = {
 | 
					void() sub_regen = {
 | 
				
			||||||
	self.model = self.mdl; // restore original model
 | 
						self.model = self.mdl; // restore original model
 | 
				
			||||||
	self.solid = SOLID_TRIGGER; // allow it to be touched again
 | 
						self.solid = SOLID_TRIGGER; // allow it to be touched again
 | 
				
			||||||
	sound(self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound
 | 
						sound(self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ void() SUB_regen = {
 | 
				
			||||||
prints a warning message when spawned
 | 
					prints a warning message when spawned
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() noclass = {
 | 
					void() noclass = {
 | 
				
			||||||
	dprint("noclass spawned at", vtos(self.origin), "\n");
 | 
						print_dbg("noclass spawned at", vtos(self.origin), "\n");
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,12 +51,12 @@ void() noclass = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
PlaceItem
 | 
					place_item
 | 
				
			||||||
 | 
					
 | 
				
			||||||
plants the object on the floor
 | 
					plants the object on the floor
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() PlaceItem = {
 | 
					void() place_item = {
 | 
				
			||||||
	float oldz;
 | 
						float oldz;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.mdl = self.model; // so it can be restored on respawn
 | 
						self.mdl = self.model; // so it can be restored on respawn
 | 
				
			||||||
| 
						 | 
					@ -66,8 +66,8 @@ void() PlaceItem = {
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.origin_z = self.origin_z + 6;
 | 
						self.origin_z = self.origin_z + 6;
 | 
				
			||||||
	oldz = self.origin_z;
 | 
						oldz = self.origin_z;
 | 
				
			||||||
	if(!droptofloor()) {
 | 
						if(!drop_to_floor()) {
 | 
				
			||||||
		dprint("Bonus item fell out of level at ", vtos(self.origin), "\n");
 | 
							print_dbg("Bonus item fell out of level at ", vtos(self.origin), "\n");
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -75,14 +75,14 @@ void() PlaceItem = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
StartItem
 | 
					start_item
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sets the clipping size and plants the object on the floor
 | 
					Sets the clipping size and plants the object on the floor
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() StartItem = {
 | 
					void() start_item = {
 | 
				
			||||||
	self.nextthink = time + 0.2; // items start after other solids
 | 
						self.nextthink = time + 0.2; // items start after other solids
 | 
				
			||||||
	self.think = PlaceItem;
 | 
						self.think = place_item;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -93,10 +93,10 @@ HEALTH BOX
 | 
				
			||||||
=========================================================================
 | 
					=========================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// T_Heal: add health to an entity, limiting health to max_health
 | 
					// ent_heal: add health to an entity, limiting health to max_health
 | 
				
			||||||
// "ignore" will ignore max_health limit
 | 
					// "ignore" will ignore max_health limit
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
float(entity e, float healamount, float ignore) T_Heal = {
 | 
					float(entity e, float healamount, float ignore) ent_heal = {
 | 
				
			||||||
	if(e.health <= 0 || (!ignore && e.health >= other.max_health)) {
 | 
						if(e.health <= 0 || (!ignore && e.health >= other.max_health)) {
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -126,27 +126,27 @@ void() item_health = {
 | 
				
			||||||
	if(self.spawnflags & HEALTH_ROTTEN) {
 | 
						if(self.spawnflags & HEALTH_ROTTEN) {
 | 
				
			||||||
		precache_model("maps/b_bh10.bsp");
 | 
							precache_model("maps/b_bh10.bsp");
 | 
				
			||||||
		precache_sound("items/r_item1.wav");
 | 
							precache_sound("items/r_item1.wav");
 | 
				
			||||||
		setmodel(self, "maps/b_bh10.bsp");
 | 
							set_model(self, "maps/b_bh10.bsp");
 | 
				
			||||||
		self.noise = "items/r_item1.wav";
 | 
							self.noise = "items/r_item1.wav";
 | 
				
			||||||
		self.healamount = 15;
 | 
							self.healamount = 15;
 | 
				
			||||||
		self.healtype = 0;
 | 
							self.healtype = 0;
 | 
				
			||||||
	} else if(self.spawnflags & HEALTH_MEGA) {
 | 
						} else if(self.spawnflags & HEALTH_MEGA) {
 | 
				
			||||||
		precache_model("maps/b_bh100.bsp");
 | 
							precache_model("maps/b_bh100.bsp");
 | 
				
			||||||
		precache_sound("items/r_item2.wav");
 | 
							precache_sound("items/r_item2.wav");
 | 
				
			||||||
		setmodel(self, "maps/b_bh100.bsp");
 | 
							set_model(self, "maps/b_bh100.bsp");
 | 
				
			||||||
		self.noise = "items/r_item2.wav";
 | 
							self.noise = "items/r_item2.wav";
 | 
				
			||||||
		self.healamount = 100;
 | 
							self.healamount = 100;
 | 
				
			||||||
		self.healtype = 2;
 | 
							self.healtype = 2;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		precache_model("maps/b_bh25.bsp");
 | 
							precache_model("maps/b_bh25.bsp");
 | 
				
			||||||
		precache_sound("items/health1.wav");
 | 
							precache_sound("items/health1.wav");
 | 
				
			||||||
		setmodel(self, "maps/b_bh25.bsp");
 | 
							set_model(self, "maps/b_bh25.bsp");
 | 
				
			||||||
		self.noise = "items/health1.wav";
 | 
							self.noise = "items/health1.wav";
 | 
				
			||||||
		self.healamount = 25;
 | 
							self.healamount = 25;
 | 
				
			||||||
		self.healtype = 1;
 | 
							self.healtype = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	setsize(self, VEC_ORIGIN, '32 32 56');
 | 
						set_size(self, VEC_ORIGIN, '32 32 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,19 +158,19 @@ void() health_touch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.healtype == 2) { // Megahealth? Ignore max_health...
 | 
						if(self.healtype == 2) { // Megahealth? Ignore max_health...
 | 
				
			||||||
		if(other.health >= 250 || !T_Heal(other, self.healamount, TRUE)) {
 | 
							if(other.health >= 250 || !ent_heal(other, self.healamount, TRUE)) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if(!T_Heal(other, self.healamount, FALSE)) {
 | 
						} else if(!ent_heal(other, self.healamount, FALSE)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You receive ", ftos(self.healamount),  " health\n");
 | 
						print_cl(other, "You receive ", ftos(self.healamount),  " health\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// health touch sound
 | 
						// health touch sound
 | 
				
			||||||
	sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.model = string_null;
 | 
						self.model = string_null;
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
| 
						 | 
					@ -186,12 +186,12 @@ void() health_touch = {
 | 
				
			||||||
			if(deathmatch) {
 | 
								if(deathmatch) {
 | 
				
			||||||
				self.nextthink = time + 20;
 | 
									self.nextthink = time + 20;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			self.think = SUB_regen;
 | 
								self.think = sub_regen;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() item_megahealth_rot = {
 | 
					void() item_megahealth_rot = {
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,7 @@ void() item_megahealth_rot = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(deathmatch == 1) { // deathmatch 2 is silly old rules
 | 
						if(deathmatch == 1) { // deathmatch 2 is silly old rules
 | 
				
			||||||
		self.nextthink = time + 20;
 | 
							self.nextthink = time + 20;
 | 
				
			||||||
		self.think = SUB_regen;
 | 
							self.think = sub_regen;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -259,15 +259,15 @@ void() armor_touch = {
 | 
				
			||||||
	if(deathmatch == 1) {
 | 
						if(deathmatch == 1) {
 | 
				
			||||||
		self.nextthink = time + 20;
 | 
							self.nextthink = time + 20;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.think = SUB_regen;
 | 
						self.think = sub_regen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You got armor\n");
 | 
						print_cl(other, "You got armor\n");
 | 
				
			||||||
	// armor touch sound
 | 
						// armor touch sound
 | 
				
			||||||
	sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,10 +277,10 @@ void() armor_touch = {
 | 
				
			||||||
void() item_armor1 = {
 | 
					void() item_armor1 = {
 | 
				
			||||||
	self.touch = armor_touch;
 | 
						self.touch = armor_touch;
 | 
				
			||||||
	precache_model("progs/armor.mdl");
 | 
						precache_model("progs/armor.mdl");
 | 
				
			||||||
	setmodel(self, "progs/armor.mdl");
 | 
						set_model(self, "progs/armor.mdl");
 | 
				
			||||||
	self.skin = 0;
 | 
						self.skin = 0;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_armor2(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED item_armor2(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -289,10 +289,10 @@ void() item_armor1 = {
 | 
				
			||||||
void() item_armor2 = {
 | 
					void() item_armor2 = {
 | 
				
			||||||
	self.touch = armor_touch;
 | 
						self.touch = armor_touch;
 | 
				
			||||||
	precache_model("progs/armor.mdl");
 | 
						precache_model("progs/armor.mdl");
 | 
				
			||||||
	setmodel(self, "progs/armor.mdl");
 | 
						set_model(self, "progs/armor.mdl");
 | 
				
			||||||
	self.skin = 1;
 | 
						self.skin = 1;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_armorInv(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED item_armorInv(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -301,10 +301,10 @@ void() item_armor2 = {
 | 
				
			||||||
void() item_armorInv = {
 | 
					void() item_armorInv = {
 | 
				
			||||||
	self.touch = armor_touch;
 | 
						self.touch = armor_touch;
 | 
				
			||||||
	precache_model("progs/armor.mdl");
 | 
						precache_model("progs/armor.mdl");
 | 
				
			||||||
	setmodel(self, "progs/armor.mdl");
 | 
						set_model(self, "progs/armor.mdl");
 | 
				
			||||||
	self.skin = 2;
 | 
						self.skin = 2;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -331,7 +331,7 @@ void(entity e) bound_ammo = {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float(float w) RankForWeapon = {
 | 
					float(float w) wep_rank_for_weapon = {
 | 
				
			||||||
	switch(w) {
 | 
						switch(w) {
 | 
				
			||||||
		case IT_LIGHTNING:        return 1;
 | 
							case IT_LIGHTNING:        return 1;
 | 
				
			||||||
		case IT_ROCKET_LAUNCHER:  return 2;
 | 
							case IT_ROCKET_LAUNCHER:  return 2;
 | 
				
			||||||
| 
						 | 
					@ -345,17 +345,17 @@ float(float w) RankForWeapon = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
Deathmatch_Weapon
 | 
					wep_deathmatch_weapon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Deathmatch weapon change rules for picking up a weapon
 | 
					Deathmatch weapon change rules for picking up a weapon
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float old, float new) Deathmatch_Weapon = {
 | 
					void(float old, float new) wep_deathmatch_weapon = {
 | 
				
			||||||
	float or, nr;
 | 
						float or, nr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// change self.weapon if desired
 | 
						// change self.weapon if desired
 | 
				
			||||||
	or = RankForWeapon(self.weapon);
 | 
						or = wep_rank_for_weapon(self.weapon);
 | 
				
			||||||
	nr = RankForWeapon(new);
 | 
						nr = wep_rank_for_weapon(new);
 | 
				
			||||||
	if(nr < or) {
 | 
						if(nr < or) {
 | 
				
			||||||
		self.weapon = new;
 | 
							self.weapon = new;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -379,7 +379,7 @@ void() weapon_touch = {
 | 
				
			||||||
	// better
 | 
						// better
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = other;
 | 
						self = other;
 | 
				
			||||||
	best = W_BestWeapon();
 | 
						best = wep_best_weapon();
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	leave = (deathmatch == 2 || coop);
 | 
						leave = (deathmatch == 2 || coop);
 | 
				
			||||||
| 
						 | 
					@ -434,13 +434,13 @@ void() weapon_touch = {
 | 
				
			||||||
			other.ammo_cells = other.ammo_cells + 15;
 | 
								other.ammo_cells = other.ammo_cells + 15;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			objerror("weapon_touch: unknown classname");
 | 
								error_obj("weapon_touch: unknown classname");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You got the ", self.netname, "\n");
 | 
						print_cl(other, "You got the ", self.netname, "\n");
 | 
				
			||||||
	// weapon touch sound
 | 
						// weapon touch sound
 | 
				
			||||||
	sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bound_ammo(other);
 | 
						bound_ammo(other);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -454,10 +454,10 @@ void() weapon_touch = {
 | 
				
			||||||
	if(!deathmatch) {
 | 
						if(!deathmatch) {
 | 
				
			||||||
		self.weapon = new;
 | 
							self.weapon = new;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		Deathmatch_Weapon(old, new);
 | 
							wep_deathmatch_weapon(old, new);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	W_SetCurrentAmmo();
 | 
						wep_set_current_ammo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -471,10 +471,10 @@ void() weapon_touch = {
 | 
				
			||||||
	if(deathmatch == 1) {
 | 
						if(deathmatch == 1) {
 | 
				
			||||||
		self.nextthink = time + 30;
 | 
							self.nextthink = time + 30;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.think = SUB_regen;
 | 
						self.think = sub_regen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -483,12 +483,12 @@ void() weapon_touch = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_supershotgun = {
 | 
					void() weapon_supershotgun = {
 | 
				
			||||||
	precache_model("progs/g_shot.mdl");
 | 
						precache_model("progs/g_shot.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_shot.mdl");
 | 
						set_model(self, "progs/g_shot.mdl");
 | 
				
			||||||
	self.weapon = IT_SUPER_SHOTGUN;
 | 
						self.weapon = IT_SUPER_SHOTGUN;
 | 
				
			||||||
	self.netname = WEPNAME_SUPER_SHOTGUN;
 | 
						self.netname = WEPNAME_SUPER_SHOTGUN;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED weapon_nailgun(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED weapon_nailgun(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -496,12 +496,12 @@ void() weapon_supershotgun = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_nailgun = {
 | 
					void() weapon_nailgun = {
 | 
				
			||||||
	precache_model("progs/g_nail.mdl");
 | 
						precache_model("progs/g_nail.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_nail.mdl");
 | 
						set_model(self, "progs/g_nail.mdl");
 | 
				
			||||||
	self.weapon = IT_NAILGUN;
 | 
						self.weapon = IT_NAILGUN;
 | 
				
			||||||
	self.netname = WEPNAME_NAILGUN;
 | 
						self.netname = WEPNAME_NAILGUN;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED weapon_supernailgun(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED weapon_supernailgun(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -509,12 +509,12 @@ void() weapon_nailgun = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_supernailgun = {
 | 
					void() weapon_supernailgun = {
 | 
				
			||||||
	precache_model("progs/g_nail2.mdl");
 | 
						precache_model("progs/g_nail2.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_nail2.mdl");
 | 
						set_model(self, "progs/g_nail2.mdl");
 | 
				
			||||||
	self.weapon = IT_SUPER_NAILGUN;
 | 
						self.weapon = IT_SUPER_NAILGUN;
 | 
				
			||||||
	self.netname = WEPNAME_SUPER_NAILGUN;
 | 
						self.netname = WEPNAME_SUPER_NAILGUN;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED weapon_grenadelauncher(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED weapon_grenadelauncher(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -522,12 +522,12 @@ void() weapon_supernailgun = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_grenadelauncher = {
 | 
					void() weapon_grenadelauncher = {
 | 
				
			||||||
	precache_model("progs/g_rock.mdl");
 | 
						precache_model("progs/g_rock.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_rock.mdl");
 | 
						set_model(self, "progs/g_rock.mdl");
 | 
				
			||||||
	self.weapon = 3;
 | 
						self.weapon = 3;
 | 
				
			||||||
	self.netname = WEPNAME_GRENADE_LAUNCHER;
 | 
						self.netname = WEPNAME_GRENADE_LAUNCHER;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED weapon_rocketlauncher(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
					/*QUAKED weapon_rocketlauncher(0 .5 .8) (-16 -16 0) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -535,12 +535,12 @@ void() weapon_grenadelauncher = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_rocketlauncher = {
 | 
					void() weapon_rocketlauncher = {
 | 
				
			||||||
	precache_model("progs/g_rock2.mdl");
 | 
						precache_model("progs/g_rock2.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_rock2.mdl");
 | 
						set_model(self, "progs/g_rock2.mdl");
 | 
				
			||||||
	self.weapon = 3;
 | 
						self.weapon = 3;
 | 
				
			||||||
	self.netname = WEPNAME_ROCKET_LAUNCHER;
 | 
						self.netname = WEPNAME_ROCKET_LAUNCHER;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -549,12 +549,12 @@ void() weapon_rocketlauncher = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() weapon_lightning = {
 | 
					void() weapon_lightning = {
 | 
				
			||||||
	precache_model("progs/g_light.mdl");
 | 
						precache_model("progs/g_light.mdl");
 | 
				
			||||||
	setmodel(self, "progs/g_light.mdl");
 | 
						set_model(self, "progs/g_light.mdl");
 | 
				
			||||||
	self.weapon = 3;
 | 
						self.weapon = 3;
 | 
				
			||||||
	self.netname = WEPNAME_LIGHTNING;
 | 
						self.netname = WEPNAME_LIGHTNING;
 | 
				
			||||||
	self.touch = weapon_touch;
 | 
						self.touch = weapon_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -576,7 +576,7 @@ void(.float ammo, float max) distribute_ammo = {
 | 
				
			||||||
			bound_ammo(pl);
 | 
								bound_ammo(pl);
 | 
				
			||||||
			stemp = self;
 | 
								stemp = self;
 | 
				
			||||||
			self = pl;
 | 
								self = pl;
 | 
				
			||||||
			W_SetCurrentAmmo();
 | 
								wep_set_current_ammo();
 | 
				
			||||||
			self = stemp;
 | 
								self = stemp;
 | 
				
			||||||
			pl = find(pl, classname, "player");
 | 
								pl = find(pl, classname, "player");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -601,7 +601,7 @@ void() ammo_touch = {
 | 
				
			||||||
	// better
 | 
						// better
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = other;
 | 
						self = other;
 | 
				
			||||||
	best = W_BestWeapon();
 | 
						best = wep_best_weapon();
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch(self.weapon) {
 | 
						switch(self.weapon) {
 | 
				
			||||||
| 
						 | 
					@ -619,25 +619,25 @@ void() ammo_touch = {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You got the ", self.netname, "\n");
 | 
						print_cl(other, "You got the ", self.netname, "\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// ammo touch sound
 | 
						// ammo touch sound
 | 
				
			||||||
	sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// change to a better weapon if appropriate
 | 
						// change to a better weapon if appropriate
 | 
				
			||||||
	if(other.weapon == best) {
 | 
						if(other.weapon == best) {
 | 
				
			||||||
		stemp = self;
 | 
							stemp = self;
 | 
				
			||||||
		self = other;
 | 
							self = other;
 | 
				
			||||||
		self.weapon = W_BestWeapon();
 | 
							self.weapon = wep_best_weapon();
 | 
				
			||||||
		W_SetCurrentAmmo();
 | 
							wep_set_current_ammo();
 | 
				
			||||||
		self = stemp;
 | 
							self = stemp;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if changed current ammo, update it
 | 
						// if changed current ammo, update it
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = other;
 | 
						self = other;
 | 
				
			||||||
	W_SetCurrentAmmo();
 | 
						wep_set_current_ammo();
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// remove it in single player, or setup for respawning in deathmatch
 | 
						// remove it in single player, or setup for respawning in deathmatch
 | 
				
			||||||
| 
						 | 
					@ -646,10 +646,10 @@ void() ammo_touch = {
 | 
				
			||||||
	if(deathmatch == 1) {
 | 
						if(deathmatch == 1) {
 | 
				
			||||||
		self.nextthink = time + 30;
 | 
							self.nextthink = time + 30;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.think = SUB_regen;
 | 
						self.think = sub_regen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big
 | 
					/*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big
 | 
				
			||||||
| 
						 | 
					@ -659,17 +659,17 @@ void() item_shells = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.spawnflags & AMMO_BIG) {
 | 
						if(self.spawnflags & AMMO_BIG) {
 | 
				
			||||||
		precache_model("maps/b_shell1.bsp");
 | 
							precache_model("maps/b_shell1.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_shell1.bsp");
 | 
							set_model(self, "maps/b_shell1.bsp");
 | 
				
			||||||
		self.aflag = 40;
 | 
							self.aflag = 40;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		precache_model("maps/b_shell0.bsp");
 | 
							precache_model("maps/b_shell0.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_shell0.bsp");
 | 
							set_model(self, "maps/b_shell0.bsp");
 | 
				
			||||||
		self.aflag = 20;
 | 
							self.aflag = 20;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.weapon = 1;
 | 
						self.weapon = 1;
 | 
				
			||||||
	self.netname = "shells";
 | 
						self.netname = "shells";
 | 
				
			||||||
	setsize(self, VEC_ORIGIN, '32 32 56');
 | 
						set_size(self, VEC_ORIGIN, '32 32 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big
 | 
					/*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big
 | 
				
			||||||
| 
						 | 
					@ -679,17 +679,17 @@ void() item_spikes = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.spawnflags & AMMO_BIG) {
 | 
						if(self.spawnflags & AMMO_BIG) {
 | 
				
			||||||
		precache_model("maps/b_nail1.bsp");
 | 
							precache_model("maps/b_nail1.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_nail1.bsp");
 | 
							set_model(self, "maps/b_nail1.bsp");
 | 
				
			||||||
		self.aflag = 50;
 | 
							self.aflag = 50;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		precache_model("maps/b_nail0.bsp");
 | 
							precache_model("maps/b_nail0.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_nail0.bsp");
 | 
							set_model(self, "maps/b_nail0.bsp");
 | 
				
			||||||
		self.aflag = 25;
 | 
							self.aflag = 25;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.weapon = 2;
 | 
						self.weapon = 2;
 | 
				
			||||||
	self.netname = "nails";
 | 
						self.netname = "nails";
 | 
				
			||||||
	setsize(self, VEC_ORIGIN, '32 32 56');
 | 
						set_size(self, VEC_ORIGIN, '32 32 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big
 | 
					/*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big
 | 
				
			||||||
| 
						 | 
					@ -699,17 +699,17 @@ void() item_rockets = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.spawnflags & AMMO_BIG) {
 | 
						if(self.spawnflags & AMMO_BIG) {
 | 
				
			||||||
		precache_model("maps/b_rock1.bsp");
 | 
							precache_model("maps/b_rock1.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_rock1.bsp");
 | 
							set_model(self, "maps/b_rock1.bsp");
 | 
				
			||||||
		self.aflag = 10;
 | 
							self.aflag = 10;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		precache_model("maps/b_rock0.bsp");
 | 
							precache_model("maps/b_rock0.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_rock0.bsp");
 | 
							set_model(self, "maps/b_rock0.bsp");
 | 
				
			||||||
		self.aflag = 5;
 | 
							self.aflag = 5;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.weapon = 3;
 | 
						self.weapon = 3;
 | 
				
			||||||
	self.netname = "rockets";
 | 
						self.netname = "rockets";
 | 
				
			||||||
	setsize(self, VEC_ORIGIN, '32 32 56');
 | 
						set_size(self, VEC_ORIGIN, '32 32 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -721,17 +721,17 @@ void() item_cells = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.spawnflags & AMMO_BIG) {
 | 
						if(self.spawnflags & AMMO_BIG) {
 | 
				
			||||||
		precache_model("maps/b_batt1.bsp");
 | 
							precache_model("maps/b_batt1.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_batt1.bsp");
 | 
							set_model(self, "maps/b_batt1.bsp");
 | 
				
			||||||
		self.aflag = 12;
 | 
							self.aflag = 12;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		precache_model("maps/b_batt0.bsp");
 | 
							precache_model("maps/b_batt0.bsp");
 | 
				
			||||||
		setmodel(self, "maps/b_batt0.bsp");
 | 
							set_model(self, "maps/b_batt0.bsp");
 | 
				
			||||||
		self.aflag = 6;
 | 
							self.aflag = 6;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.weapon = 4;
 | 
						self.weapon = 4;
 | 
				
			||||||
	self.netname = "cells";
 | 
						self.netname = "cells";
 | 
				
			||||||
	setsize(self, VEC_ORIGIN, '32 32 56');
 | 
						set_size(self, VEC_ORIGIN, '32 32 56');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -752,10 +752,10 @@ void() key_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You got the ", self.netname, "\n");
 | 
						print_cl(other, "You got the ", self.netname, "\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
	other.items = other.items | self.items;
 | 
						other.items = other.items | self.items;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!coop) {
 | 
						if(!coop) {
 | 
				
			||||||
| 
						 | 
					@ -764,7 +764,7 @@ void() key_touch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -797,26 +797,26 @@ following:
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() item_key1 = {
 | 
					void() item_key1 = {
 | 
				
			||||||
	self.netname = Key1Name();
 | 
						self.netname = key_1_name();
 | 
				
			||||||
	switch(world.worldtype) {
 | 
						switch(world.worldtype) {
 | 
				
			||||||
		case WORLD_MEDIEVAL:
 | 
							case WORLD_MEDIEVAL:
 | 
				
			||||||
			precache_model("progs/w_s_key.mdl");
 | 
								precache_model("progs/w_s_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/w_s_key.mdl");
 | 
								set_model(self, "progs/w_s_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case WORLD_METAL:
 | 
							case WORLD_METAL:
 | 
				
			||||||
			precache_model("progs/m_s_key.mdl");
 | 
								precache_model("progs/m_s_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/m_s_key.mdl");
 | 
								set_model(self, "progs/m_s_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case WORLD_BASE:
 | 
							case WORLD_BASE:
 | 
				
			||||||
			precache_model2("progs/b_s_key.mdl");
 | 
								precache_model2("progs/b_s_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/b_s_key.mdl");
 | 
								set_model(self, "progs/b_s_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	key_setsounds();
 | 
						key_setsounds();
 | 
				
			||||||
	self.touch = key_touch;
 | 
						self.touch = key_touch;
 | 
				
			||||||
	self.items = IT_KEY1;
 | 
						self.items = IT_KEY1;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_key2(0 .5 .8) (-16 -16 -24) (16 16 32)
 | 
					/*QUAKED item_key2(0 .5 .8) (-16 -16 -24) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -831,26 +831,26 @@ following:
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() item_key2 = {
 | 
					void() item_key2 = {
 | 
				
			||||||
	self.netname = Key2Name();
 | 
						self.netname = key_2_name();
 | 
				
			||||||
	switch(world.worldtype) {
 | 
						switch(world.worldtype) {
 | 
				
			||||||
		case WORLD_MEDIEVAL:
 | 
							case WORLD_MEDIEVAL:
 | 
				
			||||||
			precache_model("progs/w_g_key.mdl");
 | 
								precache_model("progs/w_g_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/w_g_key.mdl");
 | 
								set_model(self, "progs/w_g_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case WORLD_METAL:
 | 
							case WORLD_METAL:
 | 
				
			||||||
			precache_model("progs/m_g_key.mdl");
 | 
								precache_model("progs/m_g_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/m_g_key.mdl");
 | 
								set_model(self, "progs/m_g_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case WORLD_BASE:
 | 
							case WORLD_BASE:
 | 
				
			||||||
			precache_model2("progs/b_g_key.mdl");
 | 
								precache_model2("progs/b_g_key.mdl");
 | 
				
			||||||
			setmodel(self, "progs/b_g_key.mdl");
 | 
								set_model(self, "progs/b_g_key.mdl");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	key_setsounds();
 | 
						key_setsounds();
 | 
				
			||||||
	self.touch = key_touch;
 | 
						self.touch = key_touch;
 | 
				
			||||||
	self.items = IT_KEY2;
 | 
						self.items = IT_KEY2;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -871,17 +871,17 @@ void() sigil_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	centerprint(other, "You got the rune!");
 | 
						print_center(other, "You got the rune!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	self.model = string_null;
 | 
						self.model = string_null;
 | 
				
			||||||
	serverflags = serverflags | (self.spawnflags & 15);
 | 
						serverflags = serverflags | (self.spawnflags & 15);
 | 
				
			||||||
	self.classname = string_null; // so rune doors won't find it
 | 
						self.classname = string_null; // so rune doors won't find it
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -891,7 +891,7 @@ End of level sigil, pick up to end episode and return to jrstart.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() item_sigil = {
 | 
					void() item_sigil = {
 | 
				
			||||||
	if(!self.spawnflags) {
 | 
						if(!self.spawnflags) {
 | 
				
			||||||
		objerror("no spawnflags");
 | 
							error_obj("no spawnflags");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	precache_sound("misc/runekey.wav");
 | 
						precache_sound("misc/runekey.wav");
 | 
				
			||||||
| 
						 | 
					@ -899,24 +899,24 @@ void() item_sigil = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.spawnflags & SIGIL_1) {
 | 
						if(self.spawnflags & SIGIL_1) {
 | 
				
			||||||
		precache_model("progs/end1.mdl");
 | 
							precache_model("progs/end1.mdl");
 | 
				
			||||||
		setmodel(self, "progs/end1.mdl");
 | 
							set_model(self, "progs/end1.mdl");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.spawnflags & SIGIL_2) {
 | 
						if(self.spawnflags & SIGIL_2) {
 | 
				
			||||||
		precache_model2("progs/end2.mdl");
 | 
							precache_model2("progs/end2.mdl");
 | 
				
			||||||
		setmodel(self, "progs/end2.mdl");
 | 
							set_model(self, "progs/end2.mdl");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.spawnflags & SIGIL_3) {
 | 
						if(self.spawnflags & SIGIL_3) {
 | 
				
			||||||
		precache_model2("progs/end3.mdl");
 | 
							precache_model2("progs/end3.mdl");
 | 
				
			||||||
		setmodel(self, "progs/end3.mdl");
 | 
							set_model(self, "progs/end3.mdl");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.spawnflags & SIGIL_4) {
 | 
						if(self.spawnflags & SIGIL_4) {
 | 
				
			||||||
		precache_model2("progs/end4.mdl");
 | 
							precache_model2("progs/end4.mdl");
 | 
				
			||||||
		setmodel(self, "progs/end4.mdl");
 | 
							set_model(self, "progs/end4.mdl");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = sigil_touch;
 | 
						self.touch = sigil_touch;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -935,7 +935,7 @@ void() powerup_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "You got the ", self.netname, "\n");
 | 
						print_cl(other, "You got the ", self.netname, "\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(deathmatch) {
 | 
						if(deathmatch) {
 | 
				
			||||||
		self.mdl = self.model;
 | 
							self.mdl = self.model;
 | 
				
			||||||
| 
						 | 
					@ -945,11 +945,11 @@ void() powerup_touch = {
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			self.nextthink = time + 60;
 | 
								self.nextthink = time + 60;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		self.think = SUB_regen;
 | 
							self.think = sub_regen;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
						sound(other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	other.items = other.items | self.items;
 | 
						other.items = other.items | self.items;
 | 
				
			||||||
	self.model = string_null;
 | 
						self.model = string_null;
 | 
				
			||||||
| 
						 | 
					@ -976,7 +976,7 @@ void() powerup_touch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = other;
 | 
						activator = other;
 | 
				
			||||||
	SUB_UseTargets(); // fire all targets / killtargets
 | 
						sub_use_targets(); // fire all targets / killtargets
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -992,11 +992,11 @@ void() item_artifact_invulnerability = {
 | 
				
			||||||
	precache_sound("items/protect2.wav");
 | 
						precache_sound("items/protect2.wav");
 | 
				
			||||||
	precache_sound("items/protect3.wav");
 | 
						precache_sound("items/protect3.wav");
 | 
				
			||||||
	self.noise = "items/protect.wav";
 | 
						self.noise = "items/protect.wav";
 | 
				
			||||||
	setmodel(self, "progs/invulner.mdl");
 | 
						set_model(self, "progs/invulner.mdl");
 | 
				
			||||||
	self.netname = "Pentagram of Protection";
 | 
						self.netname = "Pentagram of Protection";
 | 
				
			||||||
	self.items = IT_INVULNERABILITY;
 | 
						self.items = IT_INVULNERABILITY;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED item_artifact_envirosuit(0 .5 .8) (-16 -16 -24) (16 16 32)
 | 
					/*QUAKED item_artifact_envirosuit(0 .5 .8) (-16 -16 -24) (16 16 32)
 | 
				
			||||||
| 
						 | 
					@ -1009,11 +1009,11 @@ void() item_artifact_envirosuit = {
 | 
				
			||||||
	precache_sound("items/suit.wav");
 | 
						precache_sound("items/suit.wav");
 | 
				
			||||||
	precache_sound("items/suit2.wav");
 | 
						precache_sound("items/suit2.wav");
 | 
				
			||||||
	self.noise = "items/suit.wav";
 | 
						self.noise = "items/suit.wav";
 | 
				
			||||||
	setmodel(self, "progs/suit.mdl");
 | 
						set_model(self, "progs/suit.mdl");
 | 
				
			||||||
	self.netname = "Biosuit";
 | 
						self.netname = "Biosuit";
 | 
				
			||||||
	self.items = IT_SUIT;
 | 
						self.items = IT_SUIT;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1028,11 +1028,11 @@ void() item_artifact_invisibility = {
 | 
				
			||||||
	precache_sound("items/inv2.wav");
 | 
						precache_sound("items/inv2.wav");
 | 
				
			||||||
	precache_sound("items/inv3.wav");
 | 
						precache_sound("items/inv3.wav");
 | 
				
			||||||
	self.noise = "items/inv1.wav";
 | 
						self.noise = "items/inv1.wav";
 | 
				
			||||||
	setmodel(self, "progs/invisibl.mdl");
 | 
						set_model(self, "progs/invisibl.mdl");
 | 
				
			||||||
	self.netname = "Ring of Shadows";
 | 
						self.netname = "Ring of Shadows";
 | 
				
			||||||
	self.items = IT_INVISIBILITY;
 | 
						self.items = IT_INVISIBILITY;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1047,11 +1047,11 @@ void() item_artifact_super_damage = {
 | 
				
			||||||
	precache_sound("items/damage2.wav");
 | 
						precache_sound("items/damage2.wav");
 | 
				
			||||||
	precache_sound("items/damage3.wav");
 | 
						precache_sound("items/damage3.wav");
 | 
				
			||||||
	self.noise = "items/damage.wav";
 | 
						self.noise = "items/damage.wav";
 | 
				
			||||||
	setmodel(self, "progs/quaddama.mdl");
 | 
						set_model(self, "progs/quaddama.mdl");
 | 
				
			||||||
	self.netname = "Quad Damage";
 | 
						self.netname = "Quad Damage";
 | 
				
			||||||
	self.items = IT_QUAD;
 | 
						self.items = IT_QUAD;
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 32');
 | 
						set_size(self, '-16 -16 -24', '16 16 32');
 | 
				
			||||||
	StartItem();
 | 
						start_item();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1064,7 +1064,7 @@ PLAYER BACKPACKS
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() BackpackTouch = {
 | 
					void() backpack_touch = {
 | 
				
			||||||
	float best, old, new;
 | 
						float best, old, new;
 | 
				
			||||||
	entity stemp;
 | 
						entity stemp;
 | 
				
			||||||
	float acount;
 | 
						float acount;
 | 
				
			||||||
| 
						 | 
					@ -1074,18 +1074,18 @@ void() BackpackTouch = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	acount = 0;
 | 
						acount = 0;
 | 
				
			||||||
	sprint(other, "You get ");
 | 
						print_cl(other, "You get ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.weapon && (other.items & self.weapon) == 0) {
 | 
						if(self.weapon && (other.items & self.weapon) == 0) {
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, "the ", self.netname);
 | 
							print_cl(other, "the ", self.netname);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if the player was using their best weapon, change up to the new one if
 | 
						// if the player was using their best weapon, change up to the new one if
 | 
				
			||||||
	// better
 | 
						// better
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = other;
 | 
						self = other;
 | 
				
			||||||
	best = W_BestWeapon();
 | 
						best = wep_best_weapon();
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// change weapons
 | 
						// change weapons
 | 
				
			||||||
| 
						 | 
					@ -1105,51 +1105,51 @@ void() BackpackTouch = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.ammo_shells) {
 | 
						if(self.ammo_shells) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, ftos(self.ammo_shells), " shells");
 | 
							print_cl(other, ftos(self.ammo_shells), " shells");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.ammo_nails) {
 | 
						if(self.ammo_nails) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, ftos(self.ammo_nails), " nails");
 | 
							print_cl(other, ftos(self.ammo_nails), " nails");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.ammo_rockets) {
 | 
						if(self.ammo_rockets) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, ftos(self.ammo_rockets), " rockets");
 | 
							print_cl(other, ftos(self.ammo_rockets), " rockets");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.ammo_cells) {
 | 
						if(self.ammo_cells) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, ftos(self.ammo_cells), " cells");
 | 
							print_cl(other, ftos(self.ammo_cells), " cells");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.items & IT_KEY1) {
 | 
						if(self.items & IT_KEY1) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, Key1Name());
 | 
							print_cl(other, key_1_name());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(self.items & IT_KEY2) {
 | 
						if(self.items & IT_KEY2) {
 | 
				
			||||||
		if(acount) {
 | 
							if(acount) {
 | 
				
			||||||
			sprint(other, ", ");
 | 
								print_cl(other, ", ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		acount = 1;
 | 
							acount = 1;
 | 
				
			||||||
		sprint(other, Key2Name());
 | 
							print_cl(other, key_2_name());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprint(other, "\n");
 | 
						print_cl(other, "\n");
 | 
				
			||||||
	// backpack touch sound
 | 
						// backpack touch sound
 | 
				
			||||||
	sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
 | 
						sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
 | 
				
			||||||
	stuffcmd(other, "bf\n");
 | 
						cmd_client(other, "bf\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// remove the backpack, change self to the player
 | 
						// remove the backpack, change self to the player
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
| 
						 | 
					@ -1159,18 +1159,18 @@ void() BackpackTouch = {
 | 
				
			||||||
	if(!deathmatch) {
 | 
						if(!deathmatch) {
 | 
				
			||||||
		self.weapon = new;
 | 
							self.weapon = new;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		Deathmatch_Weapon(old, new);
 | 
							wep_deathmatch_weapon(old, new);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	W_SetCurrentAmmo();
 | 
						wep_set_current_ammo();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
===============
 | 
					===============
 | 
				
			||||||
DropBackpack
 | 
					drop_backpack
 | 
				
			||||||
===============
 | 
					===============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
entity() DropBackpack = {
 | 
					entity() drop_backpack = {
 | 
				
			||||||
	entity item;
 | 
						entity item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	item = spawn();
 | 
						item = spawn();
 | 
				
			||||||
| 
						 | 
					@ -1220,12 +1220,12 @@ entity() DropBackpack = {
 | 
				
			||||||
	item.flags = FL_ITEM;
 | 
						item.flags = FL_ITEM;
 | 
				
			||||||
	item.solid = SOLID_TRIGGER;
 | 
						item.solid = SOLID_TRIGGER;
 | 
				
			||||||
	item.movetype = MOVETYPE_TOSS;
 | 
						item.movetype = MOVETYPE_TOSS;
 | 
				
			||||||
	setmodel(item, "progs/backpack.mdl");
 | 
						set_model(item, "progs/backpack.mdl");
 | 
				
			||||||
	setsize(item, '-16 -16 0', '16 16 56');
 | 
						set_size(item, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	item.touch = BackpackTouch;
 | 
						item.touch = backpack_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	item.nextthink = time + 120; // remove after 2 minutes
 | 
						item.nextthink = time + 120; // remove after 2 minutes
 | 
				
			||||||
	item.think = SUB_Remove;
 | 
						item.think = sub_remove;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return item;
 | 
						return item;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,10 +205,10 @@ void() knight_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -40) {
 | 
						if(self.health < -40) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_knight.mdl", self.health);
 | 
							throw_head("progs/h_knight.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,9 +241,9 @@ void() monster_knight = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/knight.mdl");
 | 
						set_model(self, "progs/knight.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 75;
 | 
						self.health = 75;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = knight_stand1;
 | 
						self.th_stand = knight_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										122
									
								
								source/misc.qc
									
									
									
									
									
								
							
							
						
						
									
										122
									
								
								source/misc.qc
									
									
									
									
									
								
							| 
						 | 
					@ -17,10 +17,10 @@ void() info_notnull = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() light_use = {
 | 
					void() light_use = {
 | 
				
			||||||
	if(self.spawnflags & LIGHT_START_OFF) {
 | 
						if(self.spawnflags & LIGHT_START_OFF) {
 | 
				
			||||||
		lightstyle(self.style, "m");
 | 
							light_style(self.style, "m");
 | 
				
			||||||
		self.spawnflags = self.spawnflags - LIGHT_START_OFF;
 | 
							self.spawnflags = self.spawnflags - LIGHT_START_OFF;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		lightstyle(self.style, "a");
 | 
							light_style(self.style, "a");
 | 
				
			||||||
		self.spawnflags = self.spawnflags + LIGHT_START_OFF;
 | 
							self.spawnflags = self.spawnflags + LIGHT_START_OFF;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -41,9 +41,9 @@ void() light = {
 | 
				
			||||||
	if(self.style >= 32) {
 | 
						if(self.style >= 32) {
 | 
				
			||||||
		self.use = light_use;
 | 
							self.use = light_use;
 | 
				
			||||||
		if(self.spawnflags & LIGHT_START_OFF) {
 | 
							if(self.spawnflags & LIGHT_START_OFF) {
 | 
				
			||||||
			lightstyle(self.style, "a");
 | 
								light_style(self.style, "a");
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			lightstyle(self.style, "m");
 | 
								light_style(self.style, "m");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -59,14 +59,14 @@ void() light_fluoro = {
 | 
				
			||||||
	if(self.style >= 32) {
 | 
						if(self.style >= 32) {
 | 
				
			||||||
		self.use = light_use;
 | 
							self.use = light_use;
 | 
				
			||||||
		if(self.spawnflags & LIGHT_START_OFF) {
 | 
							if(self.spawnflags & LIGHT_START_OFF) {
 | 
				
			||||||
			lightstyle(self.style, "a");
 | 
								light_style(self.style, "a");
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			lightstyle(self.style, "m");
 | 
								light_style(self.style, "m");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	precache_sound("ambience/fl_hum1.wav");
 | 
						precache_sound("ambience/fl_hum1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_fluorospark(0 1 0) (-8 -8 -8) (8 8 8)
 | 
					/*QUAKED light_fluorospark(0 1 0) (-8 -8 -8) (8 8 8)
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ void() light_fluorospark = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	precache_sound("ambience/buzz1.wav");
 | 
						precache_sound("ambience/buzz1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_globe(0 1 0) (-8 -8 -8) (8 8 8)
 | 
					/*QUAKED light_globe(0 1 0) (-8 -8 -8) (8 8 8)
 | 
				
			||||||
| 
						 | 
					@ -91,14 +91,14 @@ Default style is 0
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() light_globe = {
 | 
					void() light_globe = {
 | 
				
			||||||
	precache_model("progs/s_light.spr");
 | 
						precache_model("progs/s_light.spr");
 | 
				
			||||||
	setmodel(self, "progs/s_light.spr");
 | 
						set_model(self, "progs/s_light.spr");
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() FireAmbient = {
 | 
					void() fire_ambient = {
 | 
				
			||||||
	precache_sound("ambience/fire1.wav");
 | 
						precache_sound("ambience/fire1.wav");
 | 
				
			||||||
	// attenuate fast
 | 
						// attenuate fast
 | 
				
			||||||
	ambientsound(self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_torch_small_walltorch(0 .5 0) (-10 -10 -20) (10 10 20)
 | 
					/*QUAKED light_torch_small_walltorch(0 .5 0) (-10 -10 -20) (10 10 20)
 | 
				
			||||||
| 
						 | 
					@ -108,9 +108,9 @@ Default style is 0
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() light_torch_small_walltorch = {
 | 
					void() light_torch_small_walltorch = {
 | 
				
			||||||
	precache_model("progs/flame.mdl");
 | 
						precache_model("progs/flame.mdl");
 | 
				
			||||||
	setmodel(self, "progs/flame.mdl");
 | 
						set_model(self, "progs/flame.mdl");
 | 
				
			||||||
	FireAmbient();
 | 
						fire_ambient();
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_flame_large_yellow(0 1 0) (-10 -10 -12) (12 12 18)
 | 
					/*QUAKED light_flame_large_yellow(0 1 0) (-10 -10 -12) (12 12 18)
 | 
				
			||||||
| 
						 | 
					@ -118,10 +118,10 @@ Large yellow flame ball
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() light_flame_large_yellow = {
 | 
					void() light_flame_large_yellow = {
 | 
				
			||||||
	precache_model("progs/flame2.mdl");
 | 
						precache_model("progs/flame2.mdl");
 | 
				
			||||||
	setmodel(self, "progs/flame2.mdl");
 | 
						set_model(self, "progs/flame2.mdl");
 | 
				
			||||||
	self.frame = 1;
 | 
						self.frame = 1;
 | 
				
			||||||
	FireAmbient();
 | 
						fire_ambient();
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_flame_small_yellow(0 1 0) (-8 -8 -8) (8 8 8) START_OFF
 | 
					/*QUAKED light_flame_small_yellow(0 1 0) (-8 -8 -8) (8 8 8) START_OFF
 | 
				
			||||||
| 
						 | 
					@ -129,9 +129,9 @@ Small yellow flame ball
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() light_flame_small_yellow = {
 | 
					void() light_flame_small_yellow = {
 | 
				
			||||||
	precache_model("progs/flame2.mdl");
 | 
						precache_model("progs/flame2.mdl");
 | 
				
			||||||
	setmodel(self, "progs/flame2.mdl");
 | 
						set_model(self, "progs/flame2.mdl");
 | 
				
			||||||
	FireAmbient();
 | 
						fire_ambient();
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED light_flame_small_white(0 1 0) (-10 -10 -40) (10 10 40) START_OFF
 | 
					/*QUAKED light_flame_small_white(0 1 0) (-10 -10 -40) (10 10 40) START_OFF
 | 
				
			||||||
| 
						 | 
					@ -139,9 +139,9 @@ Small white flame ball
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() light_flame_small_white = {
 | 
					void() light_flame_small_white = {
 | 
				
			||||||
	precache_model("progs/flame2.mdl");
 | 
						precache_model("progs/flame2.mdl");
 | 
				
			||||||
	setmodel(self, "progs/flame2.mdl");
 | 
						set_model(self, "progs/flame2.mdl");
 | 
				
			||||||
	FireAmbient();
 | 
						fire_ambient();
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -171,11 +171,11 @@ void() fire_fly = {
 | 
				
			||||||
	fireball.velocity_y = (random() * 100) - 50;
 | 
						fireball.velocity_y = (random() * 100) - 50;
 | 
				
			||||||
	fireball.velocity_z = self.speed + (random() * 200);
 | 
						fireball.velocity_z = self.speed + (random() * 200);
 | 
				
			||||||
	fireball.classname = "fireball";
 | 
						fireball.classname = "fireball";
 | 
				
			||||||
	setmodel(fireball, "progs/lavaball.mdl");
 | 
						set_model(fireball, "progs/lavaball.mdl");
 | 
				
			||||||
	setsize(fireball, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(fireball, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(fireball, self.origin);
 | 
						set_origin(fireball, self.origin);
 | 
				
			||||||
	fireball.nextthink = time + 5;
 | 
						fireball.nextthink = time + 5;
 | 
				
			||||||
	fireball.think = SUB_Remove;
 | 
						fireball.think = sub_remove;
 | 
				
			||||||
	fireball.touch = fire_touch;
 | 
						fireball.touch = fire_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.nextthink = time + (random() * 5) + 3;
 | 
						self.nextthink = time + (random() * 5) + 3;
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,7 @@ void() fire_fly = {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() fire_touch = {
 | 
					void() fire_touch = {
 | 
				
			||||||
	T_Damage(other, self, self, 20);
 | 
						ent_damage(other, self, self, 20);
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -193,12 +193,12 @@ void() barrel_explode = {
 | 
				
			||||||
	self.takedamage = DAMAGE_NO;
 | 
						self.takedamage = DAMAGE_NO;
 | 
				
			||||||
	self.classname = "explo_box";
 | 
						self.classname = "explo_box";
 | 
				
			||||||
	// did say self.owner
 | 
						// did say self.owner
 | 
				
			||||||
	T_RadiusDamage(self, self, 160, world);
 | 
						ent_radius_damage(self, self, 160, world);
 | 
				
			||||||
	sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
				
			||||||
	particle(self.origin, VEC_ORIGIN, 75, 255);
 | 
						particle(self.origin, VEC_ORIGIN, 75, 255);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.origin_z = self.origin_z + 32;
 | 
						self.origin_z = self.origin_z + 32;
 | 
				
			||||||
	BecomeExplosion();
 | 
						become_explosion();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -212,7 +212,7 @@ void() misc_explobox = {
 | 
				
			||||||
	self.solid = SOLID_BBOX;
 | 
						self.solid = SOLID_BBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	precache_model("maps/b_explob.bsp");
 | 
						precache_model("maps/b_explob.bsp");
 | 
				
			||||||
	setmodel(self, "maps/b_explob.bsp");
 | 
						set_model(self, "maps/b_explob.bsp");
 | 
				
			||||||
	precache_sound("weapons/r_exp3.wav");
 | 
						precache_sound("weapons/r_exp3.wav");
 | 
				
			||||||
	self.health = 20;
 | 
						self.health = 20;
 | 
				
			||||||
	self.th_die = barrel_explode;
 | 
						self.th_die = barrel_explode;
 | 
				
			||||||
| 
						 | 
					@ -220,9 +220,9 @@ void() misc_explobox = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.origin_z = self.origin_z + 2;
 | 
						self.origin_z = self.origin_z + 2;
 | 
				
			||||||
	oldz = self.origin_z;
 | 
						oldz = self.origin_z;
 | 
				
			||||||
	droptofloor();
 | 
						drop_to_floor();
 | 
				
			||||||
	if(oldz - self.origin_z > 250) {
 | 
						if(oldz - self.origin_z > 250) {
 | 
				
			||||||
		dprint("item fell out of level at ", vtos(self.origin), "\n");
 | 
							print_dbg("item fell out of level at ", vtos(self.origin), "\n");
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ void() misc_explobox2 = {
 | 
				
			||||||
	self.solid = SOLID_BBOX;
 | 
						self.solid = SOLID_BBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	precache_model2("maps/b_exbox2.bsp");
 | 
						precache_model2("maps/b_exbox2.bsp");
 | 
				
			||||||
	setmodel(self, "maps/b_exbox2.bsp");
 | 
						set_model(self, "maps/b_exbox2.bsp");
 | 
				
			||||||
	precache_sound("weapons/r_exp3.wav");
 | 
						precache_sound("weapons/r_exp3.wav");
 | 
				
			||||||
	self.health = 20;
 | 
						self.health = 20;
 | 
				
			||||||
	self.th_die = barrel_explode;
 | 
						self.th_die = barrel_explode;
 | 
				
			||||||
| 
						 | 
					@ -247,9 +247,9 @@ void() misc_explobox2 = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.origin_z = self.origin_z + 2;
 | 
						self.origin_z = self.origin_z + 2;
 | 
				
			||||||
	oldz = self.origin_z;
 | 
						oldz = self.origin_z;
 | 
				
			||||||
	droptofloor();
 | 
						drop_to_floor();
 | 
				
			||||||
	if(oldz - self.origin_z > 250) {
 | 
						if(oldz - self.origin_z > 250) {
 | 
				
			||||||
		dprint("item fell out of level at ", vtos(self.origin), "\n");
 | 
							print_dbg("item fell out of level at ", vtos(self.origin), "\n");
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -259,7 +259,7 @@ void() misc_explobox2 = {
 | 
				
			||||||
void() spikeshooter_use = {
 | 
					void() spikeshooter_use = {
 | 
				
			||||||
	if(self.spawnflags & SPIKESHOOTER_LASER) {
 | 
						if(self.spawnflags & SPIKESHOOTER_LASER) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
 | 
				
			||||||
		LaunchLaser(self.origin, self.movedir);
 | 
							launch_laser(self.origin, self.movedir);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
 | 
				
			||||||
		launch_spike(self.origin, self.movedir);
 | 
							launch_spike(self.origin, self.movedir);
 | 
				
			||||||
| 
						 | 
					@ -282,7 +282,7 @@ Laser is only for REGISTERED.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() trap_spikeshooter = {
 | 
					void() trap_spikeshooter = {
 | 
				
			||||||
	SetMovedir();
 | 
						set_move_dir();
 | 
				
			||||||
	self.use = spikeshooter_use;
 | 
						self.use = spikeshooter_use;
 | 
				
			||||||
	if(self.spawnflags & SPIKESHOOTER_LASER) {
 | 
						if(self.spawnflags & SPIKESHOOTER_LASER) {
 | 
				
			||||||
		precache_model2("progs/laser.mdl");
 | 
							precache_model2("progs/laser.mdl");
 | 
				
			||||||
| 
						 | 
					@ -334,8 +334,8 @@ void() make_bubbles = {
 | 
				
			||||||
	entity bubble;
 | 
						entity bubble;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bubble = spawn();
 | 
						bubble = spawn();
 | 
				
			||||||
	setmodel(bubble, "progs/s_bubble.spr");
 | 
						set_model(bubble, "progs/s_bubble.spr");
 | 
				
			||||||
	setorigin(bubble, self.origin);
 | 
						set_origin(bubble, self.origin);
 | 
				
			||||||
	bubble.movetype = MOVETYPE_NOCLIP;
 | 
						bubble.movetype = MOVETYPE_NOCLIP;
 | 
				
			||||||
	bubble.solid = SOLID_NOT;
 | 
						bubble.solid = SOLID_NOT;
 | 
				
			||||||
	bubble.velocity = '0 0 15';
 | 
						bubble.velocity = '0 0 15';
 | 
				
			||||||
| 
						 | 
					@ -345,7 +345,7 @@ void() make_bubbles = {
 | 
				
			||||||
	bubble.classname = "bubble";
 | 
						bubble.classname = "bubble";
 | 
				
			||||||
	bubble.frame = 0;
 | 
						bubble.frame = 0;
 | 
				
			||||||
	bubble.cnt = 0;
 | 
						bubble.cnt = 0;
 | 
				
			||||||
	setsize(bubble, '-8 -8 -8', '8 8 8');
 | 
						set_size(bubble, '-8 -8 -8', '8 8 8');
 | 
				
			||||||
	self.nextthink = time + random() + 0.5;
 | 
						self.nextthink = time + random() + 0.5;
 | 
				
			||||||
	self.think = make_bubbles;
 | 
						self.think = make_bubbles;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -353,8 +353,8 @@ void() make_bubbles = {
 | 
				
			||||||
void() bubble_split = {
 | 
					void() bubble_split = {
 | 
				
			||||||
	entity bubble;
 | 
						entity bubble;
 | 
				
			||||||
	bubble = spawn();
 | 
						bubble = spawn();
 | 
				
			||||||
	setmodel(bubble, "progs/s_bubble.spr");
 | 
						set_model(bubble, "progs/s_bubble.spr");
 | 
				
			||||||
	setorigin(bubble, self.origin);
 | 
						set_origin(bubble, self.origin);
 | 
				
			||||||
	bubble.movetype = MOVETYPE_NOCLIP;
 | 
						bubble.movetype = MOVETYPE_NOCLIP;
 | 
				
			||||||
	bubble.solid = SOLID_NOT;
 | 
						bubble.solid = SOLID_NOT;
 | 
				
			||||||
	bubble.velocity = self.velocity;
 | 
						bubble.velocity = self.velocity;
 | 
				
			||||||
| 
						 | 
					@ -364,7 +364,7 @@ void() bubble_split = {
 | 
				
			||||||
	bubble.classname = "bubble";
 | 
						bubble.classname = "bubble";
 | 
				
			||||||
	bubble.frame = 1;
 | 
						bubble.frame = 1;
 | 
				
			||||||
	bubble.cnt = 10;
 | 
						bubble.cnt = 10;
 | 
				
			||||||
	setsize(bubble, '-8 -8 -8', '8 8 8');
 | 
						set_size(bubble, '-8 -8 -8', '8 8 8');
 | 
				
			||||||
	self.frame = 1;
 | 
						self.frame = 1;
 | 
				
			||||||
	self.cnt = 10;
 | 
						self.cnt = 10;
 | 
				
			||||||
	if(self.waterlevel != 3) {
 | 
						if(self.waterlevel != 3) {
 | 
				
			||||||
| 
						 | 
					@ -374,7 +374,7 @@ void() bubble_split = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() bubble_remove = {
 | 
					void() bubble_remove = {
 | 
				
			||||||
	if(other.classname == self.classname) {
 | 
						if(other.classname == self.classname) {
 | 
				
			||||||
		// dprint("bump");
 | 
							// print_dbg("bump");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
| 
						 | 
					@ -437,7 +437,7 @@ void() viewthing = {
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	precache_model("progs/player.mdl");
 | 
						precache_model("progs/player.mdl");
 | 
				
			||||||
	setmodel(self, "progs/player.mdl");
 | 
						set_model(self, "progs/player.mdl");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -461,7 +461,7 @@ void() func_wall = {
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
						self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.use = func_wall_use;
 | 
						self.use = func_wall_use;
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED func_illusionary(0 .5 .8) ?
 | 
					/*QUAKED func_illusionary(0 .5 .8) ?
 | 
				
			||||||
| 
						 | 
					@ -471,8 +471,8 @@ void() func_illusionary = {
 | 
				
			||||||
	self.angles = VEC_ORIGIN;
 | 
						self.angles = VEC_ORIGIN;
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
	makestatic(self);
 | 
						make_static(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4
 | 
					/*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4
 | 
				
			||||||
| 
						 | 
					@ -487,7 +487,7 @@ void() func_episodegate = {
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
						self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.use = func_wall_use;
 | 
						self.use = func_wall_use;
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED func_bossgate(0 .5 .8) ?
 | 
					/*QUAKED func_bossgate(0 .5 .8) ?
 | 
				
			||||||
| 
						 | 
					@ -501,7 +501,7 @@ void() func_bossgate = {
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
						self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.use = func_wall_use;
 | 
						self.use = func_wall_use;
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -509,57 +509,57 @@ void() func_bossgate = {
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_suck_wind = {
 | 
					void() ambient_suck_wind = {
 | 
				
			||||||
	precache_sound("ambience/suck1.wav");
 | 
						precache_sound("ambience/suck1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED ambient_drone(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_drone(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_drone = {
 | 
					void() ambient_drone = {
 | 
				
			||||||
	precache_sound("ambience/drone6.wav");
 | 
						precache_sound("ambience/drone6.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED ambient_flouro_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_flouro_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_flouro_buzz = {
 | 
					void() ambient_flouro_buzz = {
 | 
				
			||||||
	precache_sound("ambience/buzz1.wav");
 | 
						precache_sound("ambience/buzz1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_drip(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_drip(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_drip = {
 | 
					void() ambient_drip = {
 | 
				
			||||||
	precache_sound("ambience/drip1.wav");
 | 
						precache_sound("ambience/drip1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_comp_hum(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_comp_hum(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_comp_hum = {
 | 
					void() ambient_comp_hum = {
 | 
				
			||||||
	precache_sound("ambience/comp1.wav");
 | 
						precache_sound("ambience/comp1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_thunder(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_thunder(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_thunder = {
 | 
					void() ambient_thunder = {
 | 
				
			||||||
	precache_sound("ambience/thunder1.wav");
 | 
						precache_sound("ambience/thunder1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_light_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_light_buzz(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_light_buzz = {
 | 
					void() ambient_light_buzz = {
 | 
				
			||||||
	precache_sound("ambience/fl_hum1.wav");
 | 
						precache_sound("ambience/fl_hum1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_swamp1(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_swamp1(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_swamp1 = {
 | 
					void() ambient_swamp1 = {
 | 
				
			||||||
	precache_sound("ambience/swamp1.wav");
 | 
						precache_sound("ambience/swamp1.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
/*QUAKED ambient_swamp2(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
					/*QUAKED ambient_swamp2(0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ambient_swamp2 = {
 | 
					void() ambient_swamp2 = {
 | 
				
			||||||
	precache_sound("ambience/swamp2.wav");
 | 
						precache_sound("ambience/swamp2.wav");
 | 
				
			||||||
	ambientsound(self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
 | 
						ambient_sound(self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ void() monster_use = {
 | 
				
			||||||
	// heard
 | 
						// heard
 | 
				
			||||||
	self.enemy = activator;
 | 
						self.enemy = activator;
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
	self.think = FoundTarget;
 | 
						self.think = found_target;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ void() monster_death_use = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = self.enemy;
 | 
						activator = self.enemy;
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -77,10 +77,10 @@ void() walkmonster_start_go = {
 | 
				
			||||||
	entity etemp;
 | 
						entity etemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.origin_z = self.origin_z + 1; // raise off floor a bit
 | 
						self.origin_z = self.origin_z + 1; // raise off floor a bit
 | 
				
			||||||
	droptofloor();
 | 
						drop_to_floor();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!walkmove(0, 0)) {
 | 
						if(!walk_move(0, 0)) {
 | 
				
			||||||
		dprint("walkmonster in wall at: ", vtos(self.origin), "\n");
 | 
							print_dbg("walkmonster in wall at: ", vtos(self.origin), "\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.takedamage = DAMAGE_AIM;
 | 
						self.takedamage = DAMAGE_AIM;
 | 
				
			||||||
| 
						 | 
					@ -96,11 +96,11 @@ void() walkmonster_start_go = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.target) {
 | 
						if(self.target) {
 | 
				
			||||||
		self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
							self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
				
			||||||
		self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
 | 
							self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin);
 | 
				
			||||||
		if(!self.movetarget) {
 | 
							if(!self.movetarget) {
 | 
				
			||||||
			dprint("Monster can't find target at ", vtos(self.origin), "\n");
 | 
								print_dbg("Monster can't find target at ", vtos(self.origin), "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// this used to be an objerror
 | 
							// this used to be an error_obj
 | 
				
			||||||
		if(self.movetarget.classname == "path_corner") {
 | 
							if(self.movetarget.classname == "path_corner") {
 | 
				
			||||||
			self.th_walk();
 | 
								self.th_walk();
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -138,16 +138,16 @@ void() flymonster_start_go = {
 | 
				
			||||||
	self.flags = self.flags | FL_FLY;
 | 
						self.flags = self.flags | FL_FLY;
 | 
				
			||||||
	self.flags = self.flags | FL_MONSTER;
 | 
						self.flags = self.flags | FL_MONSTER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!walkmove(0, 0)) {
 | 
						if(!walk_move(0, 0)) {
 | 
				
			||||||
		dprint("flymonster in wall at: ", vtos(self.origin), "\n");
 | 
							print_dbg("flymonster in wall at: ", vtos(self.origin), "\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.target) {
 | 
						if(self.target) {
 | 
				
			||||||
		self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
							self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
				
			||||||
		if(!self.movetarget) {
 | 
							if(!self.movetarget) {
 | 
				
			||||||
			dprint("Monster can't find target at ", vtos(self.origin), "\n");
 | 
								print_dbg("Monster can't find target at ", vtos(self.origin), "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// this used to be an objerror
 | 
							// this used to be an error_obj
 | 
				
			||||||
		if(self.movetarget.classname == "path_corner") {
 | 
							if(self.movetarget.classname == "path_corner") {
 | 
				
			||||||
			self.th_walk();
 | 
								self.th_walk();
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -189,10 +189,10 @@ void() swimmonster_start_go = {
 | 
				
			||||||
	if(self.target) {
 | 
						if(self.target) {
 | 
				
			||||||
		self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
							self.goalentity = self.movetarget = find(world, targetname, self.target);
 | 
				
			||||||
		if(!self.movetarget) {
 | 
							if(!self.movetarget) {
 | 
				
			||||||
			dprint("Monster can't find target at ", vtos(self.origin), "\n");
 | 
								print_dbg("Monster can't find target at ", vtos(self.origin), "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// this used to be an objerror
 | 
							// this used to be an error_obj
 | 
				
			||||||
		self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
 | 
							self.ideal_yaw = vec_yaw(self.goalentity.origin - self.origin);
 | 
				
			||||||
		self.th_walk();
 | 
							self.th_walk();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		self.pausetime = 99999999;
 | 
							self.pausetime = 99999999;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										138
									
								
								source/ogre.qc
									
									
									
									
									
								
							
							
						
						
									
										138
									
								
								source/ogre.qc
									
									
									
									
									
								
							| 
						 | 
					@ -41,31 +41,99 @@ $frame bdeath7 bdeath8 bdeath9 bdeath10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
 | 
					$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					===========
 | 
				
			||||||
 | 
					ogre_check_attack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The player is in view, so decide to move or launch an attack
 | 
				
			||||||
 | 
					Returns FALSE if movement should continue
 | 
				
			||||||
 | 
					============
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					float() ogre_check_attack = {
 | 
				
			||||||
 | 
						vector spot1, spot2;
 | 
				
			||||||
 | 
						entity targ;
 | 
				
			||||||
 | 
						float chance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_MELEE) {
 | 
				
			||||||
 | 
							if(can_damage(self.enemy, self)) {
 | 
				
			||||||
 | 
								self.attack_state = AS_MELEE;
 | 
				
			||||||
 | 
								return TRUE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(time < self.attack_finished) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(!enemy_vis) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						targ = self.enemy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// see if any entities are in the way of the shot
 | 
				
			||||||
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						trace_line(spot1, spot2, FALSE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_inopen && trace_inwater) {
 | 
				
			||||||
 | 
							return FALSE; // sight line crossed contents
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_ent != targ) {
 | 
				
			||||||
 | 
							return FALSE; // don't have a clear shot
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// missile attack
 | 
				
			||||||
 | 
						if(time < self.attack_finished) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_FAR) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else if(enemy_range == RANGE_NEAR) {
 | 
				
			||||||
 | 
							chance = 0.10;
 | 
				
			||||||
 | 
						} else if(enemy_range == RANGE_MID) {
 | 
				
			||||||
 | 
							chance = 0.05;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							chance = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						self.attack_state = AS_MISSILE;
 | 
				
			||||||
 | 
						sub_attack_finished(1 + 2 * random());
 | 
				
			||||||
 | 
						return TRUE;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() OgreGrenadeExplode = {
 | 
					void() ogre_grenade_explode = {
 | 
				
			||||||
	T_RadiusDamage(self, self.owner, 40, world);
 | 
						ent_radius_damage(self, self.owner, 40, world);
 | 
				
			||||||
	sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_EXPLOSION);
 | 
						write_byte(MSG_BROADCAST, TE_EXPLOSION);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	setmodel(self, "progs/s_explod.spr");
 | 
						set_model(self, "progs/s_explod.spr");
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	s_explode1();
 | 
						s_explode1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() OgreGrenadeTouch = {
 | 
					void() ogre_grenade_touch = {
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(other.takedamage == DAMAGE_AIM) {
 | 
						if(other.takedamage == DAMAGE_AIM) {
 | 
				
			||||||
		OgreGrenadeExplode();
 | 
							ogre_grenade_explode();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
 | 
						sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
 | 
				
			||||||
| 
						 | 
					@ -76,10 +144,10 @@ void() OgreGrenadeTouch = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
OgreFireGrenade
 | 
					ogre_fire_grenade
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() OgreFireGrenade = {
 | 
					void() ogre_fire_grenade = {
 | 
				
			||||||
	entity missile, mpuff;
 | 
						entity missile, mpuff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.effects = self.effects | EF_MUZZLEFLASH;
 | 
						self.effects = self.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
| 
						 | 
					@ -93,7 +161,7 @@ void() OgreFireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile speed
 | 
						// set missile speed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.velocity = normalize(self.enemy.origin - self.origin);
 | 
						missile.velocity = normalize(self.enemy.origin - self.origin);
 | 
				
			||||||
	missile.velocity = missile.velocity * 600;
 | 
						missile.velocity = missile.velocity * 600;
 | 
				
			||||||
| 
						 | 
					@ -101,17 +169,17 @@ void() OgreFireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.avelocity = '300 300 300';
 | 
						missile.avelocity = '300 300 300';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.angles = vectoangles(missile.velocity);
 | 
						missile.angles = vec_to_angles(missile.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.touch = OgreGrenadeTouch;
 | 
						missile.touch = ogre_grenade_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 2.5;
 | 
						missile.nextthink = time + 2.5;
 | 
				
			||||||
	missile.think = OgreGrenadeExplode;
 | 
						missile.think = ogre_grenade_explode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(missile, "progs/grenade.mdl");
 | 
						set_model(missile, "progs/grenade.mdl");
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, self.origin);
 | 
						set_origin(missile, self.origin);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
| 
						 | 
					@ -130,7 +198,7 @@ void(float side) chainsaw = {
 | 
				
			||||||
	if(!self.enemy) {
 | 
						if(!self.enemy) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!CanDamage(self.enemy, self)) {
 | 
						if(!can_damage(self.enemy, self)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,19 +206,19 @@ void(float side) chainsaw = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 100) {
 | 
						if(vec_len(delta) > 100) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 4;
 | 
						ldmg = (random() + random() + random()) * 4;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(side) {
 | 
						if(side) {
 | 
				
			||||||
		makevectors(self.angles);
 | 
							make_vectors(self.angles);
 | 
				
			||||||
		if(side == 1) {
 | 
							if(side == 1) {
 | 
				
			||||||
			SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
								spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			SpawnMeatSpray(self.origin + v_forward * 16, side * v_right);
 | 
								spawn_meat_spray(self.origin + v_forward * 16, side * v_right);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -250,7 +318,7 @@ void() ogre_smash14 = [ $smash14, ogre_run1 ] {ai_charge(12);};
 | 
				
			||||||
void() ogre_nail1 = [ $shoot1, ogre_nail2 ] {ai_face();};
 | 
					void() ogre_nail1 = [ $shoot1, ogre_nail2 ] {ai_face();};
 | 
				
			||||||
void() ogre_nail2 = [ $shoot2, ogre_nail3 ] {ai_face();};
 | 
					void() ogre_nail2 = [ $shoot2, ogre_nail3 ] {ai_face();};
 | 
				
			||||||
void() ogre_nail3 = [ $shoot2, ogre_nail4 ] {ai_face();};
 | 
					void() ogre_nail3 = [ $shoot2, ogre_nail4 ] {ai_face();};
 | 
				
			||||||
void() ogre_nail4 = [ $shoot3, ogre_nail5 ] {ai_face(); OgreFireGrenade();};
 | 
					void() ogre_nail4 = [ $shoot3, ogre_nail5 ] {ai_face(); ogre_fire_grenade();};
 | 
				
			||||||
void() ogre_nail5 = [ $shoot4, ogre_nail6 ] {ai_face();};
 | 
					void() ogre_nail5 = [ $shoot4, ogre_nail6 ] {ai_face();};
 | 
				
			||||||
void() ogre_nail6 = [ $shoot5, ogre_nail7 ] {ai_face();};
 | 
					void() ogre_nail6 = [ $shoot5, ogre_nail7 ] {ai_face();};
 | 
				
			||||||
void() ogre_nail7 = [ $shoot6, ogre_run1 ] {ai_face();};
 | 
					void() ogre_nail7 = [ $shoot6, ogre_run1 ] {ai_face();};
 | 
				
			||||||
| 
						 | 
					@ -340,7 +408,7 @@ void() ogre_die2 = [ $death2, ogre_die3 ] {};
 | 
				
			||||||
void() ogre_die3 = [ $death3, ogre_die4 ] {
 | 
					void() ogre_die3 = [ $death3, ogre_die4 ] {
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	self.ammo_rockets = 2;
 | 
						self.ammo_rockets = 2;
 | 
				
			||||||
	DropBackpack();
 | 
						drop_backpack();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() ogre_die4 = [ $death4, ogre_die5 ] {};
 | 
					void() ogre_die4 = [ $death4, ogre_die5 ] {};
 | 
				
			||||||
void() ogre_die5 = [ $death5, ogre_die6 ] {};
 | 
					void() ogre_die5 = [ $death5, ogre_die6 ] {};
 | 
				
			||||||
| 
						 | 
					@ -359,7 +427,7 @@ void() ogre_bdie2 = [ $bdeath2, ogre_bdie3 ] {ai_forward(5);};
 | 
				
			||||||
void() ogre_bdie3 = [ $bdeath3, ogre_bdie4 ] {
 | 
					void() ogre_bdie3 = [ $bdeath3, ogre_bdie4 ] {
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	self.ammo_rockets = 2;
 | 
						self.ammo_rockets = 2;
 | 
				
			||||||
	DropBackpack();
 | 
						drop_backpack();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() ogre_bdie4 = [ $bdeath4, ogre_bdie5 ] {ai_forward(1);};
 | 
					void() ogre_bdie4 = [ $bdeath4, ogre_bdie5 ] {ai_forward(1);};
 | 
				
			||||||
void() ogre_bdie5 = [ $bdeath5, ogre_bdie6 ] {ai_forward(3);};
 | 
					void() ogre_bdie5 = [ $bdeath5, ogre_bdie6 ] {ai_forward(3);};
 | 
				
			||||||
| 
						 | 
					@ -373,10 +441,10 @@ void() ogre_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -80) {
 | 
						if(self.health < -80) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_ogre.mdl", self.health);
 | 
							throw_head("progs/h_ogre.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -420,9 +488,9 @@ void() monster_ogre = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/ogre.mdl");
 | 
						set_model(self, "progs/ogre.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-32 -32 -24', '32 32 64');
 | 
						set_size(self, '-32 -32 -24', '32 32 64');
 | 
				
			||||||
	self.health = 200;
 | 
						self.health = 200;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = ogre_stand1;
 | 
						self.th_stand = ogre_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,30 +65,30 @@ void() old_idle44 = [ $old44, old_idle45 ] {};
 | 
				
			||||||
void() old_idle45 = [ $old45, old_idle46 ] {};
 | 
					void() old_idle45 = [ $old45, old_idle46 ] {};
 | 
				
			||||||
void() old_idle46 = [ $old46, old_idle1 ] {};
 | 
					void() old_idle46 = [ $old46, old_idle1 ] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() old_thrash1 = [ $shake1, old_thrash2 ] {lightstyle(0, "m");};
 | 
					void() old_thrash1 = [ $shake1, old_thrash2 ] {light_style(0, "m");};
 | 
				
			||||||
void() old_thrash2 = [ $shake2, old_thrash3 ] {lightstyle(0, "k");};
 | 
					void() old_thrash2 = [ $shake2, old_thrash3 ] {light_style(0, "k");};
 | 
				
			||||||
void() old_thrash3 = [ $shake3, old_thrash4 ] {lightstyle(0, "k");};
 | 
					void() old_thrash3 = [ $shake3, old_thrash4 ] {light_style(0, "k");};
 | 
				
			||||||
void() old_thrash4 = [ $shake4, old_thrash5 ] {lightstyle(0, "i");};
 | 
					void() old_thrash4 = [ $shake4, old_thrash5 ] {light_style(0, "i");};
 | 
				
			||||||
void() old_thrash5 = [ $shake5, old_thrash6 ] {lightstyle(0, "g");};
 | 
					void() old_thrash5 = [ $shake5, old_thrash6 ] {light_style(0, "g");};
 | 
				
			||||||
void() old_thrash6 = [ $shake6, old_thrash7 ] {lightstyle(0, "e");};
 | 
					void() old_thrash6 = [ $shake6, old_thrash7 ] {light_style(0, "e");};
 | 
				
			||||||
void() old_thrash7 = [ $shake7, old_thrash8 ] {lightstyle(0, "c");};
 | 
					void() old_thrash7 = [ $shake7, old_thrash8 ] {light_style(0, "c");};
 | 
				
			||||||
void() old_thrash8 = [ $shake8, old_thrash9 ] {lightstyle(0, "a");};
 | 
					void() old_thrash8 = [ $shake8, old_thrash9 ] {light_style(0, "a");};
 | 
				
			||||||
void() old_thrash9 = [ $shake9, old_thrash10 ] {lightstyle(0, "c");};
 | 
					void() old_thrash9 = [ $shake9, old_thrash10 ] {light_style(0, "c");};
 | 
				
			||||||
void() old_thrash10 = [ $shake10, old_thrash11 ] {lightstyle(0, "e");};
 | 
					void() old_thrash10 = [ $shake10, old_thrash11 ] {light_style(0, "e");};
 | 
				
			||||||
void() old_thrash11 = [ $shake11, old_thrash12 ] {lightstyle(0, "g");};
 | 
					void() old_thrash11 = [ $shake11, old_thrash12 ] {light_style(0, "g");};
 | 
				
			||||||
void() old_thrash12 = [ $shake12, old_thrash13 ] {lightstyle(0, "i");};
 | 
					void() old_thrash12 = [ $shake12, old_thrash13 ] {light_style(0, "i");};
 | 
				
			||||||
void() old_thrash13 = [ $shake13, old_thrash14 ] {lightstyle(0, "k");};
 | 
					void() old_thrash13 = [ $shake13, old_thrash14 ] {light_style(0, "k");};
 | 
				
			||||||
void() old_thrash14 = [ $shake14, old_thrash15 ] {lightstyle(0, "m");};
 | 
					void() old_thrash14 = [ $shake14, old_thrash15 ] {light_style(0, "m");};
 | 
				
			||||||
void() old_thrash15 = [ $shake15, old_thrash16 ] {lightstyle(0, "m");
 | 
					void() old_thrash15 = [ $shake15, old_thrash16 ] {light_style(0, "m");
 | 
				
			||||||
		 self.cnt = self.cnt + 1;
 | 
							 self.cnt = self.cnt + 1;
 | 
				
			||||||
if(self.cnt != 3) {
 | 
					if(self.cnt != 3) {
 | 
				
			||||||
self.think = old_thrash1;
 | 
					self.think = old_thrash1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
						 };
 | 
											 };
 | 
				
			||||||
void() old_thrash16 = [ $shake16, old_thrash17 ] {lightstyle(0, "g");};
 | 
					void() old_thrash16 = [ $shake16, old_thrash17 ] {light_style(0, "g");};
 | 
				
			||||||
void() old_thrash17 = [ $shake17, old_thrash18 ] {lightstyle(0, "c");};
 | 
					void() old_thrash17 = [ $shake17, old_thrash18 ] {light_style(0, "c");};
 | 
				
			||||||
void() old_thrash18 = [ $shake18, old_thrash19 ] {lightstyle(0, "b");};
 | 
					void() old_thrash18 = [ $shake18, old_thrash19 ] {light_style(0, "b");};
 | 
				
			||||||
void() old_thrash19 = [ $shake19, old_thrash20 ] {lightstyle(0, "a");};
 | 
					void() old_thrash19 = [ $shake19, old_thrash20 ] {light_style(0, "a");};
 | 
				
			||||||
void() old_thrash20 = [ $shake20, old_thrash20 ] {finale_4();};
 | 
					void() old_thrash20 = [ $shake20, old_thrash20 ] {finale_4();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -111,8 +111,8 @@ void() finale_1 = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	remove(pl);
 | 
						remove(pl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_ALL, SVC_FINALE);
 | 
						write_byte(MSG_ALL, SVC_FINALE);
 | 
				
			||||||
	WriteString(MSG_ALL, string_null);
 | 
						write_string(MSG_ALL, string_null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pl = find(world, classname, "player");
 | 
						pl = find(world, classname, "player");
 | 
				
			||||||
	while(pl != world) {
 | 
						while(pl != world) {
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ void() finale_1 = {
 | 
				
			||||||
		pl.movetype   = MOVETYPE_NONE;
 | 
							pl.movetype   = MOVETYPE_NONE;
 | 
				
			||||||
		pl.modelindex = 0;
 | 
							pl.modelindex = 0;
 | 
				
			||||||
		pl.spectating = SPECTATING_FINALE;
 | 
							pl.spectating = SPECTATING_FINALE;
 | 
				
			||||||
		setorigin(pl, pos.origin);
 | 
							set_origin(pl, pos.origin);
 | 
				
			||||||
		pl = find(pl, classname, "player");
 | 
							pl = find(pl, classname, "player");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,11 +145,11 @@ void() finale_2 = {
 | 
				
			||||||
	// start a teleport splash inside shub
 | 
						// start a teleport splash inside shub
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	o = shub.origin - '0 100 0';
 | 
						o = shub.origin - '0 100 0';
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_TELEPORT);
 | 
						write_byte(MSG_BROADCAST, TE_TELEPORT);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, o_x);
 | 
						write_coord(MSG_BROADCAST, o_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, o_y);
 | 
						write_coord(MSG_BROADCAST, o_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, o_z);
 | 
						write_coord(MSG_BROADCAST, o_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
 | 
						sound(shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -161,10 +161,19 @@ void() finale_3 = {
 | 
				
			||||||
	// start shub thrashing wildly
 | 
						// start shub thrashing wildly
 | 
				
			||||||
	shub.think = old_thrash1;
 | 
						shub.think = old_thrash1;
 | 
				
			||||||
	sound(shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM);
 | 
						sound(shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM);
 | 
				
			||||||
	lightstyle(0, "abcdefghijklmlkjihgfedcb");
 | 
						light_style(0, "abcdefghijklmlkjihgfedcb");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() finale_4 = {
 | 
					void() finale_4 = {
 | 
				
			||||||
 | 
						const string FINALE_SHUB =
 | 
				
			||||||
 | 
							"Congratulations and well done! You have\n"
 | 
				
			||||||
 | 
							"beaten the hideous Shub-Niggurath, and\n"
 | 
				
			||||||
 | 
							"her hundreds of ugly changelings and\n"
 | 
				
			||||||
 | 
							"monsters. You have proven that your\n"
 | 
				
			||||||
 | 
							"skill and your cunning are greater than\n"
 | 
				
			||||||
 | 
							"all the powers of Quake. You are the\n"
 | 
				
			||||||
 | 
							"master now. Id Software salutes you.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// throw tons of meat chunks
 | 
						// throw tons of meat chunks
 | 
				
			||||||
	vector oldo;
 | 
						vector oldo;
 | 
				
			||||||
	float x, y, z;
 | 
						float x, y, z;
 | 
				
			||||||
| 
						 | 
					@ -186,11 +195,11 @@ void() finale_4 = {
 | 
				
			||||||
				self.origin_z = oldo_z + z;
 | 
									self.origin_z = oldo_z + z;
 | 
				
			||||||
				r = random();
 | 
									r = random();
 | 
				
			||||||
				if(r < 0.3) {
 | 
									if(r < 0.3) {
 | 
				
			||||||
					ThrowGib("progs/gib1.mdl", -999);
 | 
										throw_gib("progs/gib1.mdl", -999);
 | 
				
			||||||
				} else if(r < 0.6) {
 | 
									} else if(r < 0.6) {
 | 
				
			||||||
					ThrowGib("progs/gib2.mdl", -999);
 | 
										throw_gib("progs/gib2.mdl", -999);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					ThrowGib("progs/gib3.mdl", -999);
 | 
										throw_gib("progs/gib3.mdl", -999);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				y = y + 32;
 | 
									y = y + 32;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -198,25 +207,26 @@ void() finale_4 = {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		z = z + 96;
 | 
							z = z + 96;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// start the end text
 | 
						// start the end text
 | 
				
			||||||
	WriteByte(MSG_ALL, SVC_FINALE);
 | 
						write_byte(MSG_ALL, SVC_FINALE);
 | 
				
			||||||
	WriteString(MSG_ALL, "Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you.");
 | 
						write_string(MSG_ALL, FINALE_SHUB);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// put a player model down
 | 
						// put a player model down
 | 
				
			||||||
	n = spawn();
 | 
						n = spawn();
 | 
				
			||||||
	setmodel(n, "progs/player.mdl");
 | 
						set_model(n, "progs/player.mdl");
 | 
				
			||||||
	oldo = oldo - '32 264 0';
 | 
						oldo = oldo - '32 264 0';
 | 
				
			||||||
	setorigin(n, oldo);
 | 
						set_origin(n, oldo);
 | 
				
			||||||
	n.angles = '0 290 0';
 | 
						n.angles = '0 290 0';
 | 
				
			||||||
	n.frame = 1;
 | 
						n.frame = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// change cd track
 | 
						// change cd track
 | 
				
			||||||
	WriteByte(MSG_ALL, SVC_CDTRACK);
 | 
						write_byte(MSG_ALL, SVC_CDTRACK);
 | 
				
			||||||
	WriteByte(MSG_ALL, 3);
 | 
						write_byte(MSG_ALL, 3);
 | 
				
			||||||
	WriteByte(MSG_ALL, 3);
 | 
						write_byte(MSG_ALL, 3);
 | 
				
			||||||
	lightstyle(0, "m");
 | 
						light_style(0, "m");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -245,8 +255,8 @@ void() monster_oldone = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/oldone.mdl");
 | 
						set_model(self, "progs/oldone.mdl");
 | 
				
			||||||
	setsize(self, '-160 -128 -24', '160 128 256');
 | 
						set_size(self, '-160 -128 -24', '160 128 256');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.health = 40000; // kill by telefrag
 | 
						self.health = 40000; // kill by telefrag
 | 
				
			||||||
	self.think = old_idle1;
 | 
						self.think = old_idle1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ void() plat_spawn_inside_trigger = {
 | 
				
			||||||
		tmax_y = tmin_y + 1;
 | 
							tmax_y = tmin_y + 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(trigger, tmin, tmax);
 | 
						set_size(trigger, tmin, tmax);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_hit_top = {
 | 
					void() plat_hit_top = {
 | 
				
			||||||
| 
						 | 
					@ -47,13 +47,13 @@ void() plat_hit_bottom = {
 | 
				
			||||||
void() plat_go_down = {
 | 
					void() plat_go_down = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
	self.state = STATE_DOWN;
 | 
						self.state = STATE_DOWN;
 | 
				
			||||||
	SUB_CalcMove(self.pos2, self.speed, plat_hit_bottom);
 | 
						sub_calc_move(self.pos2, self.speed, plat_hit_bottom);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_go_up = {
 | 
					void() plat_go_up = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
 | 
				
			||||||
	self.state = STATE_UP;
 | 
						self.state = STATE_UP;
 | 
				
			||||||
	SUB_CalcMove(self.pos1, self.speed, plat_hit_top);
 | 
						sub_calc_move(self.pos1, self.speed, plat_hit_top);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_center_touch = {
 | 
					void() plat_center_touch = {
 | 
				
			||||||
| 
						 | 
					@ -82,7 +82,7 @@ void() plat_outside_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//dprint("plat_outside_touch\n");
 | 
						//print_dbg("plat_outside_touch\n");
 | 
				
			||||||
	self = self.enemy;
 | 
						self = self.enemy;
 | 
				
			||||||
	if(self.state == STATE_TOP) {
 | 
						if(self.state == STATE_TOP) {
 | 
				
			||||||
		plat_go_down();
 | 
							plat_go_down();
 | 
				
			||||||
| 
						 | 
					@ -97,23 +97,23 @@ void() plat_trigger_use = {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_crush = {
 | 
					void() plat_crush = {
 | 
				
			||||||
	//dprint("plat_crush\n");
 | 
						//print_dbg("plat_crush\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	T_Damage(other, self, self, 1);
 | 
						ent_damage(other, self, self, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.state == STATE_UP) {
 | 
						if(self.state == STATE_UP) {
 | 
				
			||||||
		plat_go_down();
 | 
							plat_go_down();
 | 
				
			||||||
	} else if(self.state == STATE_DOWN) {
 | 
						} else if(self.state == STATE_DOWN) {
 | 
				
			||||||
		plat_go_up();
 | 
							plat_go_up();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		objerror("plat_crush: bad self.state\n");
 | 
							error_obj("plat_crush: bad self.state\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() plat_use = {
 | 
					void() plat_use = {
 | 
				
			||||||
	self.use = SUB_Null;
 | 
						self.use = sub_null;
 | 
				
			||||||
	if(self.state != STATE_UP) {
 | 
						if(self.state != STATE_UP) {
 | 
				
			||||||
		objerror("plat_use: not in up state");
 | 
							error_obj("plat_use: not in up state");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	plat_go_down();
 | 
						plat_go_down();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -166,9 +166,9 @@ void() func_plat = {
 | 
				
			||||||
	self.classname = "plat";
 | 
						self.classname = "plat";
 | 
				
			||||||
	self.solid = SOLID_BSP;
 | 
						self.solid = SOLID_BSP;
 | 
				
			||||||
	self.movetype = MOVETYPE_PUSH;
 | 
						self.movetype = MOVETYPE_PUSH;
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
	setsize(self, self.mins, self.maxs);
 | 
						set_size(self, self.mins, self.maxs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.blocked = plat_crush;
 | 
						self.blocked = plat_crush;
 | 
				
			||||||
	if(!self.speed) {
 | 
						if(!self.speed) {
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ void() func_plat = {
 | 
				
			||||||
		self.state = STATE_UP;
 | 
							self.state = STATE_UP;
 | 
				
			||||||
		self.use = plat_use;
 | 
							self.use = plat_use;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		setorigin(self, self.pos2);
 | 
							set_origin(self, self.pos2);
 | 
				
			||||||
		self.state = STATE_BOTTOM;
 | 
							self.state = STATE_BOTTOM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -204,7 +204,7 @@ void() train_blocked = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.attack_finished = time + 0.5;
 | 
						self.attack_finished = time + 0.5;
 | 
				
			||||||
	T_Damage(other, self, self, self.dmg);
 | 
						ent_damage(other, self, self, self.dmg);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() train_use = {
 | 
					void() train_use = {
 | 
				
			||||||
	if(self.think != func_train_find) {
 | 
						if(self.think != func_train_find) {
 | 
				
			||||||
| 
						 | 
					@ -230,7 +230,7 @@ void() train_next = {
 | 
				
			||||||
	targ = find(world, targetname, self.target);
 | 
						targ = find(world, targetname, self.target);
 | 
				
			||||||
	self.target = targ.target;
 | 
						self.target = targ.target;
 | 
				
			||||||
	if(!self.target) {
 | 
						if(!self.target) {
 | 
				
			||||||
		objerror("train_next: no next target");
 | 
							error_obj("train_next: no next target");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(targ.wait) {
 | 
						if(targ.wait) {
 | 
				
			||||||
		self.wait = targ.wait;
 | 
							self.wait = targ.wait;
 | 
				
			||||||
| 
						 | 
					@ -238,7 +238,7 @@ void() train_next = {
 | 
				
			||||||
		self.wait = 0;
 | 
							self.wait = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
 | 
				
			||||||
	SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait);
 | 
						sub_calc_move(targ.origin - self.mins, self.speed, train_wait);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() func_train_find = {
 | 
					void() func_train_find = {
 | 
				
			||||||
| 
						 | 
					@ -246,7 +246,7 @@ void() func_train_find = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	targ = find(world, targetname, self.target);
 | 
						targ = find(world, targetname, self.target);
 | 
				
			||||||
	self.target = targ.target;
 | 
						self.target = targ.target;
 | 
				
			||||||
	setorigin(self, targ.origin - self.mins);
 | 
						set_origin(self, targ.origin - self.mins);
 | 
				
			||||||
	if(!self.targetname) {
 | 
						if(!self.targetname) {
 | 
				
			||||||
		// not triggered, so start immediately
 | 
							// not triggered, so start immediately
 | 
				
			||||||
		self.nextthink = self.ltime + 0.1;
 | 
							self.nextthink = self.ltime + 0.1;
 | 
				
			||||||
| 
						 | 
					@ -270,7 +270,7 @@ void() func_train = {
 | 
				
			||||||
		self.speed = 100;
 | 
							self.speed = 100;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!self.target) {
 | 
						if(!self.target) {
 | 
				
			||||||
		objerror("func_train without a target");
 | 
							error_obj("func_train without a target");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!self.dmg) {
 | 
						if(!self.dmg) {
 | 
				
			||||||
		self.dmg = 2;
 | 
							self.dmg = 2;
 | 
				
			||||||
| 
						 | 
					@ -297,9 +297,9 @@ void() func_train = {
 | 
				
			||||||
	self.use = train_use;
 | 
						self.use = train_use;
 | 
				
			||||||
	self.classname = "train";
 | 
						self.classname = "train";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, self.model);
 | 
						set_model(self, self.model);
 | 
				
			||||||
	setsize(self, self.mins, self.maxs);
 | 
						set_size(self, self.mins, self.maxs);
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// start trains on the second frame, to make sure their targets have had
 | 
						// start trains on the second frame, to make sure their targets have had
 | 
				
			||||||
	// a chance to spawn
 | 
						// a chance to spawn
 | 
				
			||||||
| 
						 | 
					@ -315,7 +315,7 @@ void() misc_teleporttrain = {
 | 
				
			||||||
		self.speed = 100;
 | 
							self.speed = 100;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!self.target) {
 | 
						if(!self.target) {
 | 
				
			||||||
		objerror("func_train without a target");
 | 
							error_obj("func_train without a target");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.cnt = 1;
 | 
						self.cnt = 1;
 | 
				
			||||||
| 
						 | 
					@ -331,9 +331,9 @@ void() misc_teleporttrain = {
 | 
				
			||||||
	precache_sound("misc/null.wav");
 | 
						precache_sound("misc/null.wav");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	precache_model2("progs/teleport.mdl");
 | 
						precache_model2("progs/teleport.mdl");
 | 
				
			||||||
	setmodel(self, "progs/teleport.mdl");
 | 
						set_model(self, "progs/teleport.mdl");
 | 
				
			||||||
	setsize(self, self.mins, self.maxs);
 | 
						set_size(self, self.mins, self.maxs);
 | 
				
			||||||
	setorigin(self, self.origin);
 | 
						set_origin(self, self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// start trains on the second frame, to make sure their targets have had
 | 
						// start trains on the second frame, to make sure their targets have had
 | 
				
			||||||
	// a chance to spawn
 | 
						// a chance to spawn
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										108
									
								
								source/player.qc
									
									
									
									
									
								
							
							
						
						
									
										108
									
								
								source/player.qc
									
									
									
									
									
								
							| 
						 | 
					@ -129,22 +129,22 @@ void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe = 6;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe = 1;};
 | 
					void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe = 1;};
 | 
				
			||||||
void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe = 2;};
 | 
					void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe = 2;};
 | 
				
			||||||
void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe = 3; W_FireAxe();};
 | 
					void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe = 3; wep_fire_axe();};
 | 
				
			||||||
void() player_axe4 = [$axatt4, player_run ] {self.weaponframe = 4;};
 | 
					void() player_axe4 = [$axatt4, player_run ] {self.weaponframe = 4;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe = 5;};
 | 
					void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe = 5;};
 | 
				
			||||||
void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe = 6;};
 | 
					void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe = 6;};
 | 
				
			||||||
void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe = 7; W_FireAxe();};
 | 
					void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe = 7; wep_fire_axe();};
 | 
				
			||||||
void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe = 8;};
 | 
					void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe = 8;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe = 1;};
 | 
					void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe = 1;};
 | 
				
			||||||
void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe = 2;};
 | 
					void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe = 2;};
 | 
				
			||||||
void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe = 3; W_FireAxe();};
 | 
					void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe = 3; wep_fire_axe();};
 | 
				
			||||||
void() player_axec4 = [$axattc4, player_run ] {self.weaponframe = 4;};
 | 
					void() player_axec4 = [$axattc4, player_run ] {self.weaponframe = 4;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe = 5;};
 | 
					void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe = 5;};
 | 
				
			||||||
void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe = 6;};
 | 
					void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe = 6;};
 | 
				
			||||||
void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe = 7; W_FireAxe();};
 | 
					void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe = 7; wep_fire_axe();};
 | 
				
			||||||
void() player_axed4 = [$axattd4, player_run ] {self.weaponframe = 8;};
 | 
					void() player_axed4 = [$axattd4, player_run ] {self.weaponframe = 8;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
| 
						 | 
					@ -160,8 +160,8 @@ void() player_nail1 = [$nailatt1, player_nail2 ] {
 | 
				
			||||||
	if(self.weaponframe == 9) {
 | 
						if(self.weaponframe == 9) {
 | 
				
			||||||
		self.weaponframe = 1;
 | 
							self.weaponframe = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	SuperDamageSound();
 | 
						super_damage_sound();
 | 
				
			||||||
	W_FireSpikes(4);
 | 
						wep_fire_nail(4);
 | 
				
			||||||
	self.attack_finished = time + 0.2;
 | 
						self.attack_finished = time + 0.2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() player_nail2 = [$nailatt2, player_nail1 ] {
 | 
					void() player_nail2 = [$nailatt2, player_nail1 ] {
 | 
				
			||||||
| 
						 | 
					@ -175,8 +175,8 @@ void() player_nail2 = [$nailatt2, player_nail1 ] {
 | 
				
			||||||
	if(self.weaponframe == 9) {
 | 
						if(self.weaponframe == 9) {
 | 
				
			||||||
		self.weaponframe = 1;
 | 
							self.weaponframe = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	SuperDamageSound();
 | 
						super_damage_sound();
 | 
				
			||||||
	W_FireSpikes(-4);
 | 
						wep_fire_nail(-4);
 | 
				
			||||||
	self.attack_finished = time + 0.2;
 | 
						self.attack_finished = time + 0.2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -193,8 +193,8 @@ void() player_light1 = [$light1, player_light2 ] {
 | 
				
			||||||
	if(self.weaponframe == 5) {
 | 
						if(self.weaponframe == 5) {
 | 
				
			||||||
		self.weaponframe = 1;
 | 
							self.weaponframe = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	SuperDamageSound();
 | 
						super_damage_sound();
 | 
				
			||||||
	W_FireLightning();
 | 
						wep_fire_lightning();
 | 
				
			||||||
	self.attack_finished = time + 0.2;
 | 
						self.attack_finished = time + 0.2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() player_light2 = [$light2, player_light1 ] {
 | 
					void() player_light2 = [$light2, player_light1 ] {
 | 
				
			||||||
| 
						 | 
					@ -208,8 +208,8 @@ void() player_light2 = [$light2, player_light1 ] {
 | 
				
			||||||
	if(self.weaponframe == 5) {
 | 
						if(self.weaponframe == 5) {
 | 
				
			||||||
		self.weaponframe = 1;
 | 
							self.weaponframe = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	SuperDamageSound();
 | 
						super_damage_sound();
 | 
				
			||||||
	W_FireLightning();
 | 
						wep_fire_lightning();
 | 
				
			||||||
	self.attack_finished = time + 0.2;
 | 
						self.attack_finished = time + 0.2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,7 +224,7 @@ void() player_rocket4 = [$rockatt4, player_rocket5 ] {self.weaponframe = 4;};
 | 
				
			||||||
void() player_rocket5 = [$rockatt5, player_rocket6 ] {self.weaponframe = 5;};
 | 
					void() player_rocket5 = [$rockatt5, player_rocket6 ] {self.weaponframe = 5;};
 | 
				
			||||||
void() player_rocket6 = [$rockatt6, player_run ] {self.weaponframe = 6;};
 | 
					void() player_rocket6 = [$rockatt6, player_run ] {self.weaponframe = 6;};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() PainSound = {
 | 
					void() player_pain_sound = {
 | 
				
			||||||
	float rs;
 | 
						float rs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.health < 0) {
 | 
						if(self.health < 0) {
 | 
				
			||||||
| 
						 | 
					@ -238,7 +238,7 @@ void() PainSound = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// water pain sounds
 | 
						// water pain sounds
 | 
				
			||||||
	if(self.watertype == CONTENT_WATER && self.waterlevel == 3) {
 | 
						if(self.watertype == CONTENT_WATER && self.waterlevel == 3) {
 | 
				
			||||||
		DeathBubbles(1);
 | 
							death_bubbles(1);
 | 
				
			||||||
		if(random() > 0.5) {
 | 
							if(random() > 0.5) {
 | 
				
			||||||
			sound(self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
 | 
								sound(self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -303,14 +303,14 @@ void() PainSound = {
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_pain1 = [ $pain1, player_pain2 ] {PainSound(); self.weaponframe = 0;};
 | 
					void() player_pain1 = [ $pain1, player_pain2 ] {player_pain_sound(); self.weaponframe = 0;};
 | 
				
			||||||
void() player_pain2 = [ $pain2, player_pain3 ] {};
 | 
					void() player_pain2 = [ $pain2, player_pain3 ] {};
 | 
				
			||||||
void() player_pain3 = [ $pain3, player_pain4 ] {};
 | 
					void() player_pain3 = [ $pain3, player_pain4 ] {};
 | 
				
			||||||
void() player_pain4 = [ $pain4, player_pain5 ] {};
 | 
					void() player_pain4 = [ $pain4, player_pain5 ] {};
 | 
				
			||||||
void() player_pain5 = [ $pain5, player_pain6 ] {};
 | 
					void() player_pain5 = [ $pain5, player_pain6 ] {};
 | 
				
			||||||
void() player_pain6 = [ $pain6, player_run ] {};
 | 
					void() player_pain6 = [ $pain6, player_run ] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound(); self.weaponframe = 0;};
 | 
					void() player_axpain1 = [ $axpain1, player_axpain2 ] {player_pain_sound(); self.weaponframe = 0;};
 | 
				
			||||||
void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
 | 
					void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
 | 
				
			||||||
void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
 | 
					void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
 | 
				
			||||||
void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
 | 
					void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
 | 
				
			||||||
| 
						 | 
					@ -333,14 +333,14 @@ void(entity attacker, float damage) player_pain = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() DeathBubblesSpawn = {
 | 
					void() player_death_bubbles_spawn = {
 | 
				
			||||||
	entity bubble;
 | 
						entity bubble;
 | 
				
			||||||
	if(self.owner.waterlevel != 3) {
 | 
						if(self.owner.waterlevel != 3) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	bubble = spawn();
 | 
						bubble = spawn();
 | 
				
			||||||
	setmodel(bubble, "progs/s_bubble.spr");
 | 
						set_model(bubble, "progs/s_bubble.spr");
 | 
				
			||||||
	setorigin(bubble, self.owner.origin + '0 0 24');
 | 
						set_origin(bubble, self.owner.origin + '0 0 24');
 | 
				
			||||||
	bubble.movetype = MOVETYPE_NOCLIP;
 | 
						bubble.movetype = MOVETYPE_NOCLIP;
 | 
				
			||||||
	bubble.solid = SOLID_NOT;
 | 
						bubble.solid = SOLID_NOT;
 | 
				
			||||||
	bubble.velocity = '0 0 15';
 | 
						bubble.velocity = '0 0 15';
 | 
				
			||||||
| 
						 | 
					@ -349,36 +349,36 @@ void() DeathBubblesSpawn = {
 | 
				
			||||||
	bubble.classname = "bubble";
 | 
						bubble.classname = "bubble";
 | 
				
			||||||
	bubble.frame = 0;
 | 
						bubble.frame = 0;
 | 
				
			||||||
	bubble.cnt = 0;
 | 
						bubble.cnt = 0;
 | 
				
			||||||
	setsize(bubble, '-8 -8 -8', '8 8 8');
 | 
						set_size(bubble, '-8 -8 -8', '8 8 8');
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
	self.think = DeathBubblesSpawn;
 | 
						self.think = player_death_bubbles_spawn;
 | 
				
			||||||
	self.air_finished = self.air_finished + 1;
 | 
						self.air_finished = self.air_finished + 1;
 | 
				
			||||||
	if(self.air_finished >= self.bubble_count) {
 | 
						if(self.air_finished >= self.bubble_count) {
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float num_bubbles) DeathBubbles = {
 | 
					void(float num_bubbles) death_bubbles = {
 | 
				
			||||||
	entity bubble_spawner;
 | 
						entity bubble_spawner;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bubble_spawner = spawn();
 | 
						bubble_spawner = spawn();
 | 
				
			||||||
	setorigin(bubble_spawner, self.origin);
 | 
						set_origin(bubble_spawner, self.origin);
 | 
				
			||||||
	bubble_spawner.movetype = MOVETYPE_NONE;
 | 
						bubble_spawner.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	bubble_spawner.solid = SOLID_NOT;
 | 
						bubble_spawner.solid = SOLID_NOT;
 | 
				
			||||||
	bubble_spawner.nextthink = time + 0.1;
 | 
						bubble_spawner.nextthink = time + 0.1;
 | 
				
			||||||
	bubble_spawner.think = DeathBubblesSpawn;
 | 
						bubble_spawner.think = player_death_bubbles_spawn;
 | 
				
			||||||
	bubble_spawner.air_finished = 0;
 | 
						bubble_spawner.air_finished = 0;
 | 
				
			||||||
	bubble_spawner.owner = self;
 | 
						bubble_spawner.owner = self;
 | 
				
			||||||
	bubble_spawner.bubble_count = num_bubbles;
 | 
						bubble_spawner.bubble_count = num_bubbles;
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() DeathSound = {
 | 
					void() player_death_sound = {
 | 
				
			||||||
	float rs;
 | 
						float rs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// water death sounds
 | 
						// water death sounds
 | 
				
			||||||
	if(self.waterlevel == 3) {
 | 
						if(self.waterlevel == 3) {
 | 
				
			||||||
		DeathBubbles(20);
 | 
							death_bubbles(20);
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
 | 
							sound(self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -404,13 +404,13 @@ void() DeathSound = {
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() PlayerDead = {
 | 
					void() player_dead = {
 | 
				
			||||||
	self.nextthink = -1;
 | 
						self.nextthink = -1;
 | 
				
			||||||
	// allow respawn after a certain time
 | 
						// allow respawn after a certain time
 | 
				
			||||||
	self.deadflag = DEAD_DEAD;
 | 
						self.deadflag = DEAD_DEAD;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vector(float dm) VelocityForDamage = {
 | 
					vector(float dm) player_velocity_for_damage = {
 | 
				
			||||||
	vector v;
 | 
						vector v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v_x = 100 * crandom();
 | 
						v_x = 100 * crandom();
 | 
				
			||||||
| 
						 | 
					@ -418,10 +418,10 @@ vector(float dm) VelocityForDamage = {
 | 
				
			||||||
	v_z = 200 + 100 * random();
 | 
						v_z = 200 + 100 * random();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(dm > -50) {
 | 
						if(dm > -50) {
 | 
				
			||||||
		// dprint("level 1\n");
 | 
							// print_dbg("level 1\n");
 | 
				
			||||||
		v = v * 0.7;
 | 
							v = v * 0.7;
 | 
				
			||||||
	} else if(dm > -200) {
 | 
						} else if(dm > -200) {
 | 
				
			||||||
		// dprint("level 3\n");
 | 
							// print_dbg("level 3\n");
 | 
				
			||||||
		v = v * 2;
 | 
							v = v * 2;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		v = v * 10;
 | 
							v = v * 10;
 | 
				
			||||||
| 
						 | 
					@ -430,46 +430,46 @@ vector(float dm) VelocityForDamage = {
 | 
				
			||||||
	return v;
 | 
						return v;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(string gibname, float dm) ThrowGib = {
 | 
					void(string gibname, float dm) throw_gib = {
 | 
				
			||||||
	entity new;
 | 
						entity new;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	new = spawn();
 | 
						new = spawn();
 | 
				
			||||||
	new.origin = self.origin;
 | 
						new.origin = self.origin;
 | 
				
			||||||
	setmodel(new, gibname);
 | 
						set_model(new, gibname);
 | 
				
			||||||
	setsize(new, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(new, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	new.velocity = VelocityForDamage(dm);
 | 
						new.velocity = player_velocity_for_damage(dm);
 | 
				
			||||||
	new.movetype = MOVETYPE_BOUNCE;
 | 
						new.movetype = MOVETYPE_BOUNCE;
 | 
				
			||||||
	new.solid = SOLID_NOT;
 | 
						new.solid = SOLID_NOT;
 | 
				
			||||||
	new.avelocity_x = random() * 600;
 | 
						new.avelocity_x = random() * 600;
 | 
				
			||||||
	new.avelocity_y = random() * 600;
 | 
						new.avelocity_y = random() * 600;
 | 
				
			||||||
	new.avelocity_z = random() * 600;
 | 
						new.avelocity_z = random() * 600;
 | 
				
			||||||
	new.think = SUB_Remove;
 | 
						new.think = sub_remove;
 | 
				
			||||||
	new.ltime = time;
 | 
						new.ltime = time;
 | 
				
			||||||
	new.nextthink = time + 10 + random() * 10;
 | 
						new.nextthink = time + 10 + random() * 10;
 | 
				
			||||||
	new.frame = 0;
 | 
						new.frame = 0;
 | 
				
			||||||
	new.flags = 0;
 | 
						new.flags = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(string gibname, float dm) ThrowHead = {
 | 
					void(string gibname, float dm) throw_head = {
 | 
				
			||||||
	setmodel(self, gibname);
 | 
						set_model(self, gibname);
 | 
				
			||||||
	self.frame = 0;
 | 
						self.frame = 0;
 | 
				
			||||||
	self.nextthink = -1;
 | 
						self.nextthink = -1;
 | 
				
			||||||
	self.movetype = MOVETYPE_BOUNCE;
 | 
						self.movetype = MOVETYPE_BOUNCE;
 | 
				
			||||||
	self.takedamage = DAMAGE_NO;
 | 
						self.takedamage = DAMAGE_NO;
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	self.view_ofs = '0 0 8';
 | 
						self.view_ofs = '0 0 8';
 | 
				
			||||||
	setsize(self, '-16 -16 0', '16 16 56');
 | 
						set_size(self, '-16 -16 0', '16 16 56');
 | 
				
			||||||
	self.velocity = VelocityForDamage(dm);
 | 
						self.velocity = player_velocity_for_damage(dm);
 | 
				
			||||||
	self.origin_z = self.origin_z - 24;
 | 
						self.origin_z = self.origin_z - 24;
 | 
				
			||||||
	self.flags = self.flags - (self.flags & FL_ONGROUND);
 | 
						self.flags = self.flags - (self.flags & FL_ONGROUND);
 | 
				
			||||||
	self.avelocity = crandom() * '0 600 0';
 | 
						self.avelocity = crandom() * '0 600 0';
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() GibPlayer = {
 | 
					void() player_gib = {
 | 
				
			||||||
	ThrowHead("progs/h_player.mdl", self.health);
 | 
						throw_head("progs/h_player.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib1.mdl", self.health);
 | 
						throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib2.mdl", self.health);
 | 
						throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib3.mdl", self.health);
 | 
						throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.deadflag = DEAD_DEAD;
 | 
						self.deadflag = DEAD_DEAD;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -490,7 +490,7 @@ void() GibPlayer = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() PlayerDie = {
 | 
					void() player_die = {
 | 
				
			||||||
	float i;
 | 
						float i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.items = self.items - (self.items & IT_INVISIBILITY);
 | 
						self.items = self.items - (self.items & IT_INVISIBILITY);
 | 
				
			||||||
| 
						 | 
					@ -501,7 +501,7 @@ void() PlayerDie = {
 | 
				
			||||||
	self.modelindex = modelindex_player; // don't use eyes
 | 
						self.modelindex = modelindex_player; // don't use eyes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(deathmatch || coop) {
 | 
						if(deathmatch || coop) {
 | 
				
			||||||
		DropBackpack();
 | 
							drop_backpack();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.weaponmodel = string_null;
 | 
						self.weaponmodel = string_null;
 | 
				
			||||||
| 
						 | 
					@ -515,11 +515,11 @@ void() PlayerDie = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.health < -40) {
 | 
						if(self.health < -40) {
 | 
				
			||||||
		GibPlayer();
 | 
							player_gib();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DeathSound();
 | 
						player_death_sound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.angles_x = 0;
 | 
						self.angles_x = 0;
 | 
				
			||||||
	self.angles_z = 0;
 | 
						self.angles_z = 0;
 | 
				
			||||||
| 
						 | 
					@ -567,7 +567,7 @@ void() player_diea7 = [ $deatha7, player_diea8 ] {};
 | 
				
			||||||
void() player_diea8 = [ $deatha8, player_diea9 ] {};
 | 
					void() player_diea8 = [ $deatha8, player_diea9 ] {};
 | 
				
			||||||
void() player_diea9 = [ $deatha9, player_diea10 ] {};
 | 
					void() player_diea9 = [ $deatha9, player_diea10 ] {};
 | 
				
			||||||
void() player_diea10 = [ $deatha10, player_diea11 ] {};
 | 
					void() player_diea10 = [ $deatha10, player_diea11 ] {};
 | 
				
			||||||
void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
 | 
					void() player_diea11 = [ $deatha11, player_diea11 ] {player_dead();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
 | 
					void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
 | 
				
			||||||
void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
 | 
					void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -577,7 +577,7 @@ void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
 | 
				
			||||||
void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
 | 
					void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
 | 
				
			||||||
void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
 | 
					void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
 | 
				
			||||||
void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
 | 
					void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
 | 
				
			||||||
void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
 | 
					void() player_dieb9 = [ $deathb9, player_dieb9 ] {player_dead();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_diec1 = [ $deathc1, player_diec2 ] {};
 | 
					void() player_diec1 = [ $deathc1, player_diec2 ] {};
 | 
				
			||||||
void() player_diec2 = [ $deathc2, player_diec3 ] {};
 | 
					void() player_diec2 = [ $deathc2, player_diec3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -593,7 +593,7 @@ void() player_diec11 = [ $deathc11, player_diec12 ] {};
 | 
				
			||||||
void() player_diec12 = [ $deathc12, player_diec13 ] {};
 | 
					void() player_diec12 = [ $deathc12, player_diec13 ] {};
 | 
				
			||||||
void() player_diec13 = [ $deathc13, player_diec14 ] {};
 | 
					void() player_diec13 = [ $deathc13, player_diec14 ] {};
 | 
				
			||||||
void() player_diec14 = [ $deathc14, player_diec15 ] {};
 | 
					void() player_diec14 = [ $deathc14, player_diec15 ] {};
 | 
				
			||||||
void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
 | 
					void() player_diec15 = [ $deathc15, player_diec15 ] {player_dead();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_died1 = [ $deathd1, player_died2 ] {};
 | 
					void() player_died1 = [ $deathd1, player_died2 ] {};
 | 
				
			||||||
void() player_died2 = [ $deathd2, player_died3 ] {};
 | 
					void() player_died2 = [ $deathd2, player_died3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -603,7 +603,7 @@ void() player_died5 = [ $deathd5, player_died6 ] {};
 | 
				
			||||||
void() player_died6 = [ $deathd6, player_died7 ] {};
 | 
					void() player_died6 = [ $deathd6, player_died7 ] {};
 | 
				
			||||||
void() player_died7 = [ $deathd7, player_died8 ] {};
 | 
					void() player_died7 = [ $deathd7, player_died8 ] {};
 | 
				
			||||||
void() player_died8 = [ $deathd8, player_died9 ] {};
 | 
					void() player_died8 = [ $deathd8, player_died9 ] {};
 | 
				
			||||||
void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
 | 
					void() player_died9 = [ $deathd9, player_died9 ] {player_dead();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_diee1 = [ $deathe1, player_diee2 ] {};
 | 
					void() player_diee1 = [ $deathe1, player_diee2 ] {};
 | 
				
			||||||
void() player_diee2 = [ $deathe2, player_diee3 ] {};
 | 
					void() player_diee2 = [ $deathe2, player_diee3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -613,7 +613,7 @@ void() player_diee5 = [ $deathe5, player_diee6 ] {};
 | 
				
			||||||
void() player_diee6 = [ $deathe6, player_diee7 ] {};
 | 
					void() player_diee6 = [ $deathe6, player_diee7 ] {};
 | 
				
			||||||
void() player_diee7 = [ $deathe7, player_diee8 ] {};
 | 
					void() player_diee7 = [ $deathe7, player_diee8 ] {};
 | 
				
			||||||
void() player_diee8 = [ $deathe8, player_diee9 ] {};
 | 
					void() player_diee8 = [ $deathe8, player_diee9 ] {};
 | 
				
			||||||
void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
 | 
					void() player_diee9 = [ $deathe9, player_diee9 ] {player_dead();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
 | 
					void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
 | 
				
			||||||
void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
 | 
					void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -623,4 +623,4 @@ void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
 | 
				
			||||||
void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
 | 
					void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
 | 
				
			||||||
void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
 | 
					void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
 | 
				
			||||||
void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
 | 
					void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
 | 
				
			||||||
void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
 | 
					void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {player_dead();};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ void() shal_attack5 = [ $attack5, shal_attack6 ] {ai_face();};
 | 
				
			||||||
void() shal_attack6 = [ $attack6, shal_attack7 ] {ai_face();};
 | 
					void() shal_attack6 = [ $attack6, shal_attack7 ] {ai_face();};
 | 
				
			||||||
void() shal_attack7 = [ $attack7, shal_attack8 ] {ai_face();};
 | 
					void() shal_attack7 = [ $attack7, shal_attack8 ] {ai_face();};
 | 
				
			||||||
void() shal_attack8 = [ $attack8, shal_attack9 ] {ai_face();};
 | 
					void() shal_attack8 = [ $attack8, shal_attack9 ] {ai_face();};
 | 
				
			||||||
void() shal_attack9 = [ $attack9, shal_attack10 ] {ShalMissile();};
 | 
					void() shal_attack9 = [ $attack9, shal_attack10 ] {shalrath_missile();};
 | 
				
			||||||
void() shal_attack10 = [ $attack10, shal_attack11 ] {ai_face();};
 | 
					void() shal_attack10 = [ $attack10, shal_attack11 ] {ai_face();};
 | 
				
			||||||
void() shal_attack11 = [ $attack11, shal_run1 ] {};
 | 
					void() shal_attack11 = [ $attack11, shal_run1 ] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,10 +97,10 @@ void() shalrath_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -90) {
 | 
						if(self.health < -90) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_shal.mdl", self.health);
 | 
							throw_head("progs/h_shal.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,16 +112,16 @@ void() shalrath_die = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
ShalMissile
 | 
					shalrath_missile
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() ShalMissile = {
 | 
					void() shalrath_missile = {
 | 
				
			||||||
	entity missile;
 | 
						entity missile;
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
	float dist, flytime;
 | 
						float dist, flytime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
 | 
						dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
 | 
				
			||||||
	dist = vlen(self.enemy.origin - self.origin);
 | 
						dist = vec_len(self.enemy.origin - self.origin);
 | 
				
			||||||
	flytime = dist * 0.002;
 | 
						flytime = dist * 0.002;
 | 
				
			||||||
	if(flytime < 0.1) {
 | 
						if(flytime < 0.1) {
 | 
				
			||||||
		flytime = 0.1;
 | 
							flytime = 0.1;
 | 
				
			||||||
| 
						 | 
					@ -135,20 +135,20 @@ void() ShalMissile = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.solid = SOLID_BBOX;
 | 
						missile.solid = SOLID_BBOX;
 | 
				
			||||||
	missile.movetype = MOVETYPE_FLYMISSILE;
 | 
						missile.movetype = MOVETYPE_FLYMISSILE;
 | 
				
			||||||
	setmodel(missile, "progs/v_spike.mdl");
 | 
						set_model(missile, "progs/v_spike.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.origin = self.origin + '0 0 10';
 | 
						missile.origin = self.origin + '0 0 10';
 | 
				
			||||||
	missile.velocity = dir * 400;
 | 
						missile.velocity = dir * 400;
 | 
				
			||||||
	missile.avelocity = '300 300 300';
 | 
						missile.avelocity = '300 300 300';
 | 
				
			||||||
	missile.nextthink = flytime + time;
 | 
						missile.nextthink = flytime + time;
 | 
				
			||||||
	missile.think = ShalHome;
 | 
						missile.think = shalrath_home;
 | 
				
			||||||
	missile.enemy = self.enemy;
 | 
						missile.enemy = self.enemy;
 | 
				
			||||||
	missile.touch = ShalMissileTouch;
 | 
						missile.touch = shalrath_missile_touch;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ShalHome = {
 | 
					void() shalrath_home = {
 | 
				
			||||||
	vector dir, vtemp;
 | 
						vector dir, vtemp;
 | 
				
			||||||
	vtemp = self.enemy.origin + '0 0 10';
 | 
						vtemp = self.enemy.origin + '0 0 10';
 | 
				
			||||||
	if(self.enemy.health < 1) {
 | 
						if(self.enemy.health < 1) {
 | 
				
			||||||
| 
						 | 
					@ -162,29 +162,29 @@ void() ShalHome = {
 | 
				
			||||||
		self.velocity = dir * 250;
 | 
							self.velocity = dir * 250;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.nextthink = time + 0.2;
 | 
						self.nextthink = time + 0.2;
 | 
				
			||||||
	self.think = ShalHome;
 | 
						self.think = shalrath_home;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ShalMissileTouch = {
 | 
					void() shalrath_missile_touch = {
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.classname == "monster_zombie") {
 | 
						if(other.classname == "monster_zombie") {
 | 
				
			||||||
		T_Damage(other, self, self, 110);
 | 
							ent_damage(other, self, self, 110);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	T_RadiusDamage(self, self.owner, 40, world);
 | 
						ent_radius_damage(self, self.owner, 40, world);
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_EXPLOSION);
 | 
						write_byte(MSG_BROADCAST, TE_EXPLOSION);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	setmodel(self, "progs/s_explod.spr");
 | 
						set_model(self, "progs/s_explod.spr");
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	s_explode1();
 | 
						s_explode1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -212,8 +212,8 @@ void() monster_shalrath = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/shalrath.mdl");
 | 
						set_model(self, "progs/shalrath.mdl");
 | 
				
			||||||
	setsize(self, '-32 -32 -24', '32 32 64');
 | 
						set_size(self, '-32 -32 -24', '32 32 64');
 | 
				
			||||||
	self.health = 400;
 | 
						self.health = 400;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = shal_stand;
 | 
						self.th_stand = shal_stand;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,6 +30,65 @@ $frame pain1 pain2 pain3 pain4 pain5 pain6
 | 
				
			||||||
$frame death1 death2 death3 death4 death5 death6
 | 
					$frame death1 death2 death3 death4 death5 death6
 | 
				
			||||||
$frame death7 death8 death9 death10 death11
 | 
					$frame death7 death8 death9 death10 death11
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					===========
 | 
				
			||||||
 | 
					sham_check_attack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The player is in view, so decide to move or launch an attack
 | 
				
			||||||
 | 
					Returns FALSE if movement should continue
 | 
				
			||||||
 | 
					============
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					float() sham_check_attack = {
 | 
				
			||||||
 | 
						vector spot1, spot2;
 | 
				
			||||||
 | 
						entity targ;
 | 
				
			||||||
 | 
						float chance;
 | 
				
			||||||
 | 
						float enemy_yaw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_MELEE) {
 | 
				
			||||||
 | 
							if(can_damage(self.enemy, self)) {
 | 
				
			||||||
 | 
								self.attack_state = AS_MELEE;
 | 
				
			||||||
 | 
								return TRUE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(time < self.attack_finished) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(!enemy_vis) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						targ = self.enemy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// see if any entities are in the way of the shot
 | 
				
			||||||
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(vec_len(spot1 - spot2) > 600) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						trace_line(spot1, spot2, FALSE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_inopen && trace_inwater) {
 | 
				
			||||||
 | 
							return FALSE; // sight line crossed contents
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_ent != targ) {
 | 
				
			||||||
 | 
							return FALSE; // don't have a clear shot
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// missile attack
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_FAR) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						self.attack_state = AS_MISSILE;
 | 
				
			||||||
 | 
						sub_attack_finished(2 + 2 * random());
 | 
				
			||||||
 | 
						return TRUE;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() sham_stand1 = [ $stand1, sham_stand2 ] {ai_stand();};
 | 
					void() sham_stand1 = [ $stand1, sham_stand2 ] {ai_stand();};
 | 
				
			||||||
void() sham_stand2 = [ $stand2, sham_stand3 ] {ai_stand();};
 | 
					void() sham_stand2 = [ $stand2, sham_stand3 ] {ai_stand();};
 | 
				
			||||||
void() sham_stand3 = [ $stand3, sham_stand4 ] {ai_stand();};
 | 
					void() sham_stand3 = [ $stand3, sham_stand4 ] {ai_stand();};
 | 
				
			||||||
| 
						 | 
					@ -99,24 +158,24 @@ void() sham_smash10 = [ $smash10, sham_smash11 ] {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 100) {
 | 
						if(vec_len(delta) > 100) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!CanDamage(self.enemy, self)) {
 | 
						if(!can_damage(self.enemy, self)) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 40;
 | 
						ldmg = (random() + random() + random()) * 40;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
	sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
						spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
				
			||||||
	SpawnMeatSpray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
						spawn_meat_spray(self.origin + v_forward * 16, crandom() * 100 * v_right);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() sham_smash11 = [ $smash11, sham_smash12 ] {ai_charge(5);};
 | 
					void() sham_smash11 = [ $smash11, sham_smash12 ] {ai_charge(5);};
 | 
				
			||||||
void() sham_smash12 = [ $smash12, sham_run1 ] {ai_charge(4);};
 | 
					void() sham_smash12 = [ $smash12, sham_run1 ] {ai_charge(4);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float side) ShamClaw = {
 | 
					void(float side) sham_claw = {
 | 
				
			||||||
	vector delta;
 | 
						vector delta;
 | 
				
			||||||
	float ldmg;
 | 
						float ldmg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,17 +186,17 @@ void(float side) ShamClaw = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delta = self.enemy.origin - self.origin;
 | 
						delta = self.enemy.origin - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(vlen(delta) > 100) {
 | 
						if(vec_len(delta) > 100) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ldmg = (random() + random() + random()) * 20;
 | 
						ldmg = (random() + random() + random()) * 20;
 | 
				
			||||||
	T_Damage(self.enemy, self, self, ldmg);
 | 
						ent_damage(self.enemy, self, self, ldmg);
 | 
				
			||||||
	sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(side) {
 | 
						if(side) {
 | 
				
			||||||
		makevectors(self.angles);
 | 
							make_vectors(self.angles);
 | 
				
			||||||
		SpawnMeatSpray(self.origin + v_forward * 16, side * v_right);
 | 
							spawn_meat_spray(self.origin + v_forward * 16, side * v_right);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,7 +209,7 @@ void() sham_swingl3 = [ $swingl3, sham_swingl4 ] {ai_charge(7);};
 | 
				
			||||||
void() sham_swingl4 = [ $swingl4, sham_swingl5 ] {ai_charge(3);};
 | 
					void() sham_swingl4 = [ $swingl4, sham_swingl5 ] {ai_charge(3);};
 | 
				
			||||||
void() sham_swingl5 = [ $swingl5, sham_swingl6 ] {ai_charge(7);};
 | 
					void() sham_swingl5 = [ $swingl5, sham_swingl6 ] {ai_charge(7);};
 | 
				
			||||||
void() sham_swingl6 = [ $swingl6, sham_swingl7 ] {ai_charge(9);};
 | 
					void() sham_swingl6 = [ $swingl6, sham_swingl7 ] {ai_charge(9);};
 | 
				
			||||||
void() sham_swingl7 = [ $swingl7, sham_swingl8 ] {ai_charge(5); ShamClaw(250);};
 | 
					void() sham_swingl7 = [ $swingl7, sham_swingl8 ] {ai_charge(5); sham_claw(250);};
 | 
				
			||||||
void() sham_swingl8 = [ $swingl8, sham_swingl9 ] {ai_charge(4);};
 | 
					void() sham_swingl8 = [ $swingl8, sham_swingl9 ] {ai_charge(4);};
 | 
				
			||||||
void() sham_swingl9 = [ $swingl9, sham_run1 ] {
 | 
					void() sham_swingl9 = [ $swingl9, sham_run1 ] {
 | 
				
			||||||
	ai_charge(8);
 | 
						ai_charge(8);
 | 
				
			||||||
| 
						 | 
					@ -168,7 +227,7 @@ void() sham_swingr3 = [ $swingr3, sham_swingr4 ] {ai_charge(14);};
 | 
				
			||||||
void() sham_swingr4 = [ $swingr4, sham_swingr5 ] {ai_charge(7);};
 | 
					void() sham_swingr4 = [ $swingr4, sham_swingr5 ] {ai_charge(7);};
 | 
				
			||||||
void() sham_swingr5 = [ $swingr5, sham_swingr6 ] {ai_charge(3);};
 | 
					void() sham_swingr5 = [ $swingr5, sham_swingr6 ] {ai_charge(3);};
 | 
				
			||||||
void() sham_swingr6 = [ $swingr6, sham_swingr7 ] {ai_charge(6);};
 | 
					void() sham_swingr6 = [ $swingr6, sham_swingr7 ] {ai_charge(6);};
 | 
				
			||||||
void() sham_swingr7 = [ $swingr7, sham_swingr8 ] {ai_charge(6); ShamClaw(-250);};
 | 
					void() sham_swingr7 = [ $swingr7, sham_swingr8 ] {ai_charge(6); sham_claw(-250);};
 | 
				
			||||||
void() sham_swingr8 = [ $swingr8, sham_swingr9 ] {ai_charge(3);};
 | 
					void() sham_swingr8 = [ $swingr8, sham_swingr9 ] {ai_charge(3);};
 | 
				
			||||||
void() sham_swingr9 = [ $swingr9, sham_run1 ] {ai_charge(1);
 | 
					void() sham_swingr9 = [ $swingr9, sham_run1 ] {ai_charge(1);
 | 
				
			||||||
		 ai_charge(10);
 | 
							 ai_charge(10);
 | 
				
			||||||
| 
						 | 
					@ -192,7 +251,7 @@ void() sham_melee = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() CastLightning = {
 | 
					void() sham_cast_lightning = {
 | 
				
			||||||
	vector org, dir;
 | 
						vector org, dir;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.effects = self.effects | EF_MUZZLEFLASH;
 | 
						self.effects = self.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
| 
						 | 
					@ -204,19 +263,19 @@ void() CastLightning = {
 | 
				
			||||||
	dir = self.enemy.origin + '0 0 16' - org;
 | 
						dir = self.enemy.origin + '0 0 16' - org;
 | 
				
			||||||
	dir = normalize(dir);
 | 
						dir = normalize(dir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(org, self.origin + dir * 600, TRUE, self);
 | 
						trace_line(org, self.origin + dir * 600, TRUE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_LIGHTNING1);
 | 
						write_byte(MSG_BROADCAST, TE_LIGHTNING1);
 | 
				
			||||||
	WriteEntity(MSG_BROADCAST, self);
 | 
						write_entity(MSG_BROADCAST, self);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_x);
 | 
						write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_y);
 | 
						write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_z);
 | 
						write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_x);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_y);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_z);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LightningDamage(org, trace_endpos, self, 10);
 | 
						lightning_damage(org, trace_endpos, self, 10);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() sham_magic1 = [ $magic1, sham_magic2 ] {ai_face();
 | 
					void() sham_magic1 = [ $magic1, sham_magic2 ] {ai_face();
 | 
				
			||||||
| 
						 | 
					@ -231,11 +290,11 @@ void() sham_magic3 = [ $magic3, sham_magic4 ] {ai_face();
 | 
				
			||||||
		 ai_face();
 | 
							 ai_face();
 | 
				
			||||||
		 self.owner = spawn();
 | 
							 self.owner = spawn();
 | 
				
			||||||
		 o = self.owner;
 | 
							 o = self.owner;
 | 
				
			||||||
		 setmodel(o, "progs/s_light.mdl");
 | 
							 set_model(o, "progs/s_light.mdl");
 | 
				
			||||||
		 setorigin(o, self.origin);
 | 
							 set_origin(o, self.origin);
 | 
				
			||||||
		 o.angles = self.angles;
 | 
							 o.angles = self.angles;
 | 
				
			||||||
		 o.nextthink = time + 0.7;
 | 
							 o.nextthink = time + 0.7;
 | 
				
			||||||
		 o.think = SUB_Remove;
 | 
							 o.think = sub_remove;
 | 
				
			||||||
					 };
 | 
										 };
 | 
				
			||||||
void() sham_magic4 = [ $magic4, sham_magic5 ] {
 | 
					void() sham_magic4 = [ $magic4, sham_magic5 ] {
 | 
				
			||||||
	self.effects = self.effects | EF_MUZZLEFLASH;
 | 
						self.effects = self.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
| 
						 | 
					@ -247,16 +306,16 @@ void() sham_magic5 = [ $magic5, sham_magic6 ] {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() sham_magic6 = [ $magic6, sham_magic9 ] {
 | 
					void() sham_magic6 = [ $magic6, sham_magic9 ] {
 | 
				
			||||||
	remove(self.owner);
 | 
						remove(self.owner);
 | 
				
			||||||
	CastLightning();
 | 
						sham_cast_lightning();
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() sham_magic9 = [ $magic9, sham_magic10 ]
 | 
					void() sham_magic9 = [ $magic9, sham_magic10 ]
 | 
				
			||||||
{CastLightning();};
 | 
					{sham_cast_lightning();};
 | 
				
			||||||
void() sham_magic10 = [ $magic10, sham_magic11 ]
 | 
					void() sham_magic10 = [ $magic10, sham_magic11 ]
 | 
				
			||||||
{CastLightning();};
 | 
					{sham_cast_lightning();};
 | 
				
			||||||
void() sham_magic11 = [ $magic11, sham_magic12 ] {
 | 
					void() sham_magic11 = [ $magic11, sham_magic12 ] {
 | 
				
			||||||
	if(skill == 3) {
 | 
						if(skill == 3) {
 | 
				
			||||||
		CastLightning();
 | 
							sham_cast_lightning();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() sham_magic12 = [ $magic12, sham_run1 ] {};
 | 
					void() sham_magic12 = [ $magic12, sham_run1 ] {};
 | 
				
			||||||
| 
						 | 
					@ -306,10 +365,10 @@ void() sham_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -60) {
 | 
						if(self.health < -60) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_shams.mdl", self.health);
 | 
							throw_head("progs/h_shams.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -344,9 +403,9 @@ void() monster_shambler = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
	setmodel(self, "progs/shambler.mdl");
 | 
						set_model(self, "progs/shambler.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-32 -32 -24', '32 32 64');
 | 
						set_size(self, '-32 -32 -24', '32 32 64');
 | 
				
			||||||
	self.health = 600;
 | 
						self.health = 600;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = sham_stand1;
 | 
						self.th_stand = sham_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,68 @@ $frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8
 | 
				
			||||||
$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
 | 
					$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
 | 
				
			||||||
$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24
 | 
					$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					===========
 | 
				
			||||||
 | 
					army_check_attack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The player is in view, so decide to move or launch an attack
 | 
				
			||||||
 | 
					Returns FALSE if movement should continue
 | 
				
			||||||
 | 
					============
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					float() army_check_attack = {
 | 
				
			||||||
 | 
						vector spot1, spot2;
 | 
				
			||||||
 | 
						entity targ;
 | 
				
			||||||
 | 
						float chance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						targ = self.enemy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// see if any entities are in the way of the shot
 | 
				
			||||||
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						trace_line(spot1, spot2, FALSE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_inopen && trace_inwater) {
 | 
				
			||||||
 | 
							return FALSE; // sight line crossed contents
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(trace_ent != targ) {
 | 
				
			||||||
 | 
							return FALSE; // don't have a clear shot
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// missile attack
 | 
				
			||||||
 | 
						if(time < self.attack_finished) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_FAR) {
 | 
				
			||||||
 | 
							return FALSE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(enemy_range == RANGE_MELEE) {
 | 
				
			||||||
 | 
							chance = 0.9;
 | 
				
			||||||
 | 
						} else if(enemy_range == RANGE_NEAR) {
 | 
				
			||||||
 | 
							chance = 0.4;
 | 
				
			||||||
 | 
						} else if(enemy_range == RANGE_MID) {
 | 
				
			||||||
 | 
							chance = 0.05;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							chance = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(random() < chance) {
 | 
				
			||||||
 | 
							self.th_missile();
 | 
				
			||||||
 | 
							sub_attack_finished(1 + random());
 | 
				
			||||||
 | 
							if(random() < 0.3) {
 | 
				
			||||||
 | 
								self.lefty = !self.lefty;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return TRUE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return FALSE;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============================================================================
 | 
					==============================================================================
 | 
				
			||||||
SOLDIER CODE
 | 
					SOLDIER CODE
 | 
				
			||||||
| 
						 | 
					@ -99,7 +161,7 @@ void() army_atk5 = [ $shoot5, army_atk6 ] {ai_face();
 | 
				
			||||||
		 self.effects = self.effects | EF_MUZZLEFLASH;
 | 
							 self.effects = self.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
					 };
 | 
										 };
 | 
				
			||||||
void() army_atk6 = [ $shoot6, army_atk7 ] {ai_face();};
 | 
					void() army_atk6 = [ $shoot6, army_atk7 ] {ai_face();};
 | 
				
			||||||
void() army_atk7 = [ $shoot7, army_atk8 ] {ai_face(); SUB_CheckRefire(army_atk1);};
 | 
					void() army_atk7 = [ $shoot7, army_atk8 ] {ai_face(); sub_check_refire(army_atk1);};
 | 
				
			||||||
void() army_atk8 = [ $shoot8, army_atk9 ] {ai_face();};
 | 
					void() army_atk8 = [ $shoot8, army_atk9 ] {ai_face();};
 | 
				
			||||||
void() army_atk9 = [ $shoot9, army_run1 ] {ai_face();};
 | 
					void() army_atk9 = [ $shoot9, army_run1 ] {ai_face();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -177,14 +239,14 @@ void() army_fire = {
 | 
				
			||||||
	dir = en.origin - en.velocity * 0.2;
 | 
						dir = en.origin - en.velocity * 0.2;
 | 
				
			||||||
	dir = normalize(dir - self.origin);
 | 
						dir = normalize(dir - self.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FireBullets(4, dir, '0.1 0.1 0');
 | 
						fire_bullets(4, dir, '0.1 0.1 0');
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() army_die1 = [ $death1, army_die2 ] {};
 | 
					void() army_die1 = [ $death1, army_die2 ] {};
 | 
				
			||||||
void() army_die2 = [ $death2, army_die3 ] {};
 | 
					void() army_die2 = [ $death2, army_die3 ] {};
 | 
				
			||||||
void() army_die3 = [ $death3, army_die4 ]
 | 
					void() army_die3 = [ $death3, army_die4 ]
 | 
				
			||||||
{self.solid = SOLID_NOT; self.ammo_shells = 5; DropBackpack();};
 | 
					{self.solid = SOLID_NOT; self.ammo_shells = 5; drop_backpack();};
 | 
				
			||||||
void() army_die4 = [ $death4, army_die5 ] {};
 | 
					void() army_die4 = [ $death4, army_die5 ] {};
 | 
				
			||||||
void() army_die5 = [ $death5, army_die6 ] {};
 | 
					void() army_die5 = [ $death5, army_die6 ] {};
 | 
				
			||||||
void() army_die6 = [ $death6, army_die7 ] {};
 | 
					void() army_die6 = [ $death6, army_die7 ] {};
 | 
				
			||||||
| 
						 | 
					@ -196,7 +258,7 @@ void() army_die10 = [ $death10, army_die10 ] {};
 | 
				
			||||||
void() army_cdie1 = [ $deathc1, army_cdie2 ] {};
 | 
					void() army_cdie1 = [ $deathc1, army_cdie2 ] {};
 | 
				
			||||||
void() army_cdie2 = [ $deathc2, army_cdie3 ] {ai_back(5);};
 | 
					void() army_cdie2 = [ $deathc2, army_cdie3 ] {ai_back(5);};
 | 
				
			||||||
void() army_cdie3 = [ $deathc3, army_cdie4 ]
 | 
					void() army_cdie3 = [ $deathc3, army_cdie4 ]
 | 
				
			||||||
{self.solid = SOLID_NOT; self.ammo_shells = 5; DropBackpack(); ai_back(4);};
 | 
					{self.solid = SOLID_NOT; self.ammo_shells = 5; drop_backpack(); ai_back(4);};
 | 
				
			||||||
void() army_cdie4 = [ $deathc4, army_cdie5 ] {ai_back(13);};
 | 
					void() army_cdie4 = [ $deathc4, army_cdie5 ] {ai_back(13);};
 | 
				
			||||||
void() army_cdie5 = [ $deathc5, army_cdie6 ] {ai_back(3);};
 | 
					void() army_cdie5 = [ $deathc5, army_cdie6 ] {ai_back(3);};
 | 
				
			||||||
void() army_cdie6 = [ $deathc6, army_cdie7 ] {ai_back(4);};
 | 
					void() army_cdie6 = [ $deathc6, army_cdie7 ] {ai_back(4);};
 | 
				
			||||||
| 
						 | 
					@ -210,10 +272,10 @@ void() army_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -35) {
 | 
						if(self.health < -35) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_guard.mdl", self.health);
 | 
							throw_head("progs/h_guard.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib1.mdl", self.health);
 | 
							throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib3.mdl", self.health);
 | 
							throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -251,9 +313,9 @@ void() monster_army = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/soldier.mdl");
 | 
						set_model(self, "progs/soldier.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 30;
 | 
						self.health = 30;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = army_stand1;
 | 
						self.th_stand = army_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +1,20 @@
 | 
				
			||||||
// subs.qc: subroutines for think frames
 | 
					// subs.qc: subroutines for think frames
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() SUB_Null = {};
 | 
					void() sub_null = {};
 | 
				
			||||||
void(entity attacker, float damage) SUB_PainNull = {};
 | 
					void(entity attacker, float damage) sub_pain_null = {};
 | 
				
			||||||
void() SUB_Remove = {remove(self);};
 | 
					void() sub_remove = {remove(self);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
QuakeEd only writes a single float for angles(bad idea), so up and down are
 | 
					QuakeEd only writes a single float for angles(bad idea), so up and down are
 | 
				
			||||||
just constant angles.
 | 
					just constant angles.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() SetMovedir = {
 | 
					void() set_move_dir = {
 | 
				
			||||||
	if(self.angles == '0 -1 0') {
 | 
						if(self.angles == '0 -1 0') {
 | 
				
			||||||
		self.movedir = '0 0 1';
 | 
							self.movedir = '0 0 1';
 | 
				
			||||||
	} else if(self.angles == '0 -2 0') {
 | 
						} else if(self.angles == '0 -2 0') {
 | 
				
			||||||
		self.movedir = '0 0 -1';
 | 
							self.movedir = '0 0 -1';
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		makevectors(self.angles);
 | 
							make_vectors(self.angles);
 | 
				
			||||||
		self.movedir = v_forward;
 | 
							self.movedir = v_forward;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,17 +23,17 @@ void() SetMovedir = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
InitTrigger
 | 
					init_trigger
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() InitTrigger = {
 | 
					void() init_trigger = {
 | 
				
			||||||
	// trigger angles are used for one-way touches. An angle of 0 is assumed
 | 
						// trigger angles are used for one-way touches. An angle of 0 is assumed
 | 
				
			||||||
	// to mean no restrictions, so use a yaw of 360 instead.
 | 
						// to mean no restrictions, so use a yaw of 360 instead.
 | 
				
			||||||
	if(self.angles != VEC_ORIGIN) {
 | 
						if(self.angles != VEC_ORIGIN) {
 | 
				
			||||||
		SetMovedir();
 | 
							set_move_dir();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.solid = SOLID_TRIGGER;
 | 
						self.solid = SOLID_TRIGGER;
 | 
				
			||||||
	setmodel(self, self.model); // set size and link into world
 | 
						set_model(self, self.model); // set size and link into world
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	self.modelindex = 0;
 | 
						self.modelindex = 0;
 | 
				
			||||||
	self.model = string_null;
 | 
						self.model = string_null;
 | 
				
			||||||
| 
						 | 
					@ -41,32 +41,32 @@ void() InitTrigger = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
SUB_CalcMove
 | 
					sub_calc_move
 | 
				
			||||||
 | 
					
 | 
				
			||||||
calculate self.velocity and self.nextthink to reach dest from
 | 
					calculate self.velocity and self.nextthink to reach dest from
 | 
				
			||||||
self.origin traveling at speed
 | 
					self.origin traveling at speed
 | 
				
			||||||
===============
 | 
					===============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt = {
 | 
					void(entity ent, vector tdest, float tspeed, void() func) sub_calc_move_ent = {
 | 
				
			||||||
	entity stemp;
 | 
						entity stemp;
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = ent;
 | 
						self = ent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SUB_CalcMove(tdest, tspeed, func);
 | 
						sub_calc_move(tdest, tspeed, func);
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(vector tdest, float tspeed, void() func) SUB_CalcMove = {
 | 
					void(vector tdest, float tspeed, void() func) sub_calc_move = {
 | 
				
			||||||
	vector vdestdelta;
 | 
						vector vdestdelta;
 | 
				
			||||||
	float len, traveltime;
 | 
						float len, traveltime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!tspeed) {
 | 
						if(!tspeed) {
 | 
				
			||||||
		objerror("No speed is defined!");
 | 
							error_obj("No speed is defined!");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.think1 = func;
 | 
						self.think1 = func;
 | 
				
			||||||
	self.finaldest = tdest;
 | 
						self.finaldest = tdest;
 | 
				
			||||||
	self.think = SUB_CalcMoveDone;
 | 
						self.think = sub_calc_move_done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(tdest == self.origin) {
 | 
						if(tdest == self.origin) {
 | 
				
			||||||
		self.velocity = VEC_ORIGIN;
 | 
							self.velocity = VEC_ORIGIN;
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = {
 | 
				
			||||||
	vdestdelta = tdest - self.origin;
 | 
						vdestdelta = tdest - self.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// calculate length of vector
 | 
						// calculate length of vector
 | 
				
			||||||
	len = vlen(vdestdelta);
 | 
						len = vec_len(vdestdelta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// divide by speed to get time to reach dest
 | 
						// divide by speed to get time to reach dest
 | 
				
			||||||
	traveltime = len / tspeed;
 | 
						traveltime = len / tspeed;
 | 
				
			||||||
| 
						 | 
					@ -101,8 +101,8 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = {
 | 
				
			||||||
After moving, set origin to exact final destination
 | 
					After moving, set origin to exact final destination
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() SUB_CalcMoveDone = {
 | 
					void() sub_calc_move_done = {
 | 
				
			||||||
	setorigin(self, self.finaldest);
 | 
						set_origin(self, self.finaldest);
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.nextthink = -1;
 | 
						self.nextthink = -1;
 | 
				
			||||||
	if(self.think1) {
 | 
						if(self.think1) {
 | 
				
			||||||
| 
						 | 
					@ -112,7 +112,7 @@ void() SUB_CalcMoveDone = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
SUB_CalcAngleMove
 | 
					sub_calc_angle_move
 | 
				
			||||||
 | 
					
 | 
				
			||||||
calculate self.avelocity and self.nextthink to reach destangle from
 | 
					calculate self.avelocity and self.nextthink to reach destangle from
 | 
				
			||||||
self.angles rotating
 | 
					self.angles rotating
 | 
				
			||||||
| 
						 | 
					@ -120,27 +120,27 @@ self.angles rotating
 | 
				
			||||||
The calling function should make sure self.think is valid
 | 
					The calling function should make sure self.think is valid
 | 
				
			||||||
===============
 | 
					===============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt = {
 | 
					void(entity ent, vector destangle, float tspeed, void() func) sub_calc_angle_moveEnt = {
 | 
				
			||||||
	entity stemp;
 | 
						entity stemp;
 | 
				
			||||||
	stemp = self;
 | 
						stemp = self;
 | 
				
			||||||
	self = ent;
 | 
						self = ent;
 | 
				
			||||||
	SUB_CalcAngleMove(destangle, tspeed, func);
 | 
						sub_calc_angle_move(destangle, tspeed, func);
 | 
				
			||||||
	self = stemp;
 | 
						self = stemp;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = {
 | 
					void(vector destangle, float tspeed, void() func) sub_calc_angle_move = {
 | 
				
			||||||
	vector destdelta;
 | 
						vector destdelta;
 | 
				
			||||||
	float len, traveltime;
 | 
						float len, traveltime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!tspeed) {
 | 
						if(!tspeed) {
 | 
				
			||||||
		objerror("No speed is defined!");
 | 
							error_obj("No speed is defined!");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set destdelta to the vector needed to move
 | 
						// set destdelta to the vector needed to move
 | 
				
			||||||
	destdelta = destangle - self.angles;
 | 
						destdelta = destangle - self.angles;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// calculate length of vector
 | 
						// calculate length of vector
 | 
				
			||||||
	len = vlen(destdelta);
 | 
						len = vec_len(destdelta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// divide by speed to get time to reach dest
 | 
						// divide by speed to get time to reach dest
 | 
				
			||||||
	traveltime = len / tspeed;
 | 
						traveltime = len / tspeed;
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.think1 = func;
 | 
						self.think1 = func;
 | 
				
			||||||
	self.finalangle = destangle;
 | 
						self.finalangle = destangle;
 | 
				
			||||||
	self.think = SUB_CalcAngleMoveDone;
 | 
						self.think = sub_calc_angle_move_done;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -161,7 +161,7 @@ void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = {
 | 
				
			||||||
After rotating, set angle to exact final angle
 | 
					After rotating, set angle to exact final angle
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() SUB_CalcAngleMoveDone = {
 | 
					void() sub_calc_angle_move_done = {
 | 
				
			||||||
	self.angles = self.finalangle;
 | 
						self.angles = self.finalangle;
 | 
				
			||||||
	self.avelocity = VEC_ORIGIN;
 | 
						self.avelocity = VEC_ORIGIN;
 | 
				
			||||||
	self.nextthink = -1;
 | 
						self.nextthink = -1;
 | 
				
			||||||
| 
						 | 
					@ -172,20 +172,20 @@ void() SUB_CalcAngleMoveDone = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() DelayThink = {
 | 
					void() delay_think = {
 | 
				
			||||||
	activator = self.enemy;
 | 
						activator = self.enemy;
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
==============================
 | 
					==============================
 | 
				
			||||||
SUB_UseTargets
 | 
					sub_use_targets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
the global "activator" should be set to the entity that initiated the firing.
 | 
					the global "activator" should be set to the entity that initiated the firing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If self.delay is set, a DelayedUse entity will be created that will actually
 | 
					If self.delay is set, a DelayedUse entity will be created that will actually
 | 
				
			||||||
do the SUB_UseTargets after that many seconds have passed.
 | 
					do the sub_use_targets after that many seconds have passed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Centerprints any self.message to the activator.
 | 
					Centerprints any self.message to the activator.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -197,7 +197,7 @@ match(string)self.target and call their .use function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
==============================
 | 
					==============================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() SUB_UseTargets = {
 | 
					void() sub_use_targets = {
 | 
				
			||||||
	entity t, stemp, otemp, act;
 | 
						entity t, stemp, otemp, act;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
| 
						 | 
					@ -208,7 +208,7 @@ void() SUB_UseTargets = {
 | 
				
			||||||
		t = spawn();
 | 
							t = spawn();
 | 
				
			||||||
		t.classname = "DelayedUse";
 | 
							t.classname = "DelayedUse";
 | 
				
			||||||
		t.nextthink = time + self.delay;
 | 
							t.nextthink = time + self.delay;
 | 
				
			||||||
		t.think = DelayThink;
 | 
							t.think = delay_think;
 | 
				
			||||||
		t.enemy = activator;
 | 
							t.enemy = activator;
 | 
				
			||||||
		t.message = self.message;
 | 
							t.message = self.message;
 | 
				
			||||||
		t.killtarget = self.killtarget;
 | 
							t.killtarget = self.killtarget;
 | 
				
			||||||
| 
						 | 
					@ -220,7 +220,7 @@ void() SUB_UseTargets = {
 | 
				
			||||||
	// print the message
 | 
						// print the message
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	if(activator.classname == "player" && self.message != string_null) {
 | 
						if(activator.classname == "player" && self.message != string_null) {
 | 
				
			||||||
		centerprint(activator, self.message);
 | 
							print_center(activator, self.message);
 | 
				
			||||||
		if(!self.noise) {
 | 
							if(!self.noise) {
 | 
				
			||||||
			sound(activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
 | 
								sound(activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -255,7 +255,7 @@ void() SUB_UseTargets = {
 | 
				
			||||||
			otemp = other;
 | 
								otemp = other;
 | 
				
			||||||
			self = t;
 | 
								self = t;
 | 
				
			||||||
			other = stemp;
 | 
								other = stemp;
 | 
				
			||||||
			if(self.use != SUB_Null) {
 | 
								if(self.use != sub_null) {
 | 
				
			||||||
				if(self.use) {
 | 
									if(self.use) {
 | 
				
			||||||
					self.use();
 | 
										self.use();
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -275,14 +275,14 @@ some monsters refire twice automatically
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float normal) SUB_AttackFinished = {
 | 
					void(float normal) sub_attack_finished = {
 | 
				
			||||||
	self.cnt = 0; // refire count for nightmare
 | 
						self.cnt = 0; // refire count for nightmare
 | 
				
			||||||
	if(skill != 3) {
 | 
						if(skill != 3) {
 | 
				
			||||||
		self.attack_finished = time + normal;
 | 
							self.attack_finished = time + normal;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(void() thinkst) SUB_CheckRefire = {
 | 
					void(void() thinkst) sub_check_refire = {
 | 
				
			||||||
	if(skill != 3) {
 | 
						if(skill != 3) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,24 +78,24 @@ void() tbaby_run25 = [ $run25, tbaby_run1 ] {ai_run(2);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//============================================================================
 | 
					//============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Tar_JumpTouch = {
 | 
					void() tbaby_jump_touch = {
 | 
				
			||||||
	float ldmg;
 | 
						float ldmg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.takedamage && other.classname != self.classname) {
 | 
						if(other.takedamage && other.classname != self.classname) {
 | 
				
			||||||
		if(vlen(self.velocity) > 400) {
 | 
							if(vec_len(self.velocity) > 400) {
 | 
				
			||||||
			ldmg = 10 + 10 * random();
 | 
								ldmg = 10 + 10 * random();
 | 
				
			||||||
			T_Damage(other, self, self, ldmg);
 | 
								ent_damage(other, self, self, ldmg);
 | 
				
			||||||
			sound(self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
 | 
								sound(self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		sound(self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!checkbottom(self)) {
 | 
						if(!check_bottom(self)) {
 | 
				
			||||||
		if(self.flags & FL_ONGROUND) {
 | 
							if(self.flags & FL_ONGROUND) {
 | 
				
			||||||
			// jump randomly to not get hung up
 | 
								// jump randomly to not get hung up
 | 
				
			||||||
			//dprint("popjump\n");
 | 
								//print_dbg("popjump\n");
 | 
				
			||||||
			self.touch = SUB_Null;
 | 
								self.touch = sub_null;
 | 
				
			||||||
			self.think = tbaby_run1;
 | 
								self.think = tbaby_run1;
 | 
				
			||||||
			self.movetype = MOVETYPE_STEP;
 | 
								self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
			self.nextthink = time + 0.1;
 | 
								self.nextthink = time + 0.1;
 | 
				
			||||||
| 
						 | 
					@ -107,7 +107,7 @@ void() Tar_JumpTouch = {
 | 
				
			||||||
		return; // not on ground yet
 | 
							return; // not on ground yet
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	self.think = tbaby_jump1;
 | 
						self.think = tbaby_jump1;
 | 
				
			||||||
	self.nextthink = time + 0.1;
 | 
						self.nextthink = time + 0.1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ void() tbaby_fly3 = [ $fly3, tbaby_fly4 ] {};
 | 
				
			||||||
void() tbaby_fly4 = [ $fly4, tbaby_fly1 ] {
 | 
					void() tbaby_fly4 = [ $fly4, tbaby_fly1 ] {
 | 
				
			||||||
	self.cnt = self.cnt + 1;
 | 
						self.cnt = self.cnt + 1;
 | 
				
			||||||
	if(self.cnt == 4) {
 | 
						if(self.cnt == 4) {
 | 
				
			||||||
		//dprint("spawn hop\n");
 | 
							//print_dbg("spawn hop\n");
 | 
				
			||||||
		tbaby_jump5();
 | 
							tbaby_jump5();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -129,8 +129,8 @@ void() tbaby_jump3 = [ $jump3, tbaby_jump4 ] {ai_face();};
 | 
				
			||||||
void() tbaby_jump4 = [ $jump4, tbaby_jump5 ] {ai_face();};
 | 
					void() tbaby_jump4 = [ $jump4, tbaby_jump5 ] {ai_face();};
 | 
				
			||||||
void() tbaby_jump5 = [ $jump5, tbaby_jump6 ] {
 | 
					void() tbaby_jump5 = [ $jump5, tbaby_jump6 ] {
 | 
				
			||||||
	self.movetype = MOVETYPE_BOUNCE;
 | 
						self.movetype = MOVETYPE_BOUNCE;
 | 
				
			||||||
	self.touch = Tar_JumpTouch;
 | 
						self.touch = tbaby_jump_touch;
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
	self.origin_z = self.origin_z + 1;
 | 
						self.origin_z = self.origin_z + 1;
 | 
				
			||||||
	self.velocity = v_forward * 600 + '0 0 200';
 | 
						self.velocity = v_forward * 600 + '0 0 200';
 | 
				
			||||||
	self.velocity_z = self.velocity_z + random() * 150;
 | 
						self.velocity_z = self.velocity_z + random() * 150;
 | 
				
			||||||
| 
						 | 
					@ -148,18 +148,18 @@ void() tbaby_die1 = [ $exp, tbaby_die2 ] {
 | 
				
			||||||
	self.takedamage = DAMAGE_NO;
 | 
						self.takedamage = DAMAGE_NO;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
void() tbaby_die2 = [ $exp, tbaby_run1 ] {
 | 
					void() tbaby_die2 = [ $exp, tbaby_run1 ] {
 | 
				
			||||||
	T_RadiusDamage(self, self, 120, world);
 | 
						ent_radius_damage(self, self, 120, world);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
 | 
				
			||||||
	self.origin = self.origin - 8 * normalize(self.velocity);
 | 
						self.origin = self.origin - 8 * normalize(self.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_TAREXPLOSION);
 | 
						write_byte(MSG_BROADCAST, TE_TAREXPLOSION);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BecomeExplosion();
 | 
						become_explosion();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
| 
						 | 
					@ -181,9 +181,9 @@ void() monster_tarbaby = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/tarbaby.mdl");
 | 
						set_model(self, "progs/tarbaby.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 80;
 | 
						self.health = 80;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = tbaby_stand1;
 | 
						self.th_stand = tbaby_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ void() multi_trigger = {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		found_secrets = found_secrets + 1;
 | 
							found_secrets = found_secrets + 1;
 | 
				
			||||||
		WriteByte(MSG_ALL, SVC_FOUNDSECRET);
 | 
							write_byte(MSG_ALL, SVC_FOUNDSECRET);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.noise) {
 | 
						if(self.noise) {
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ void() multi_trigger = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activator = self.enemy;
 | 
						activator = self.enemy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.wait > 0) {
 | 
						if(self.wait > 0) {
 | 
				
			||||||
		self.think = multi_wait;
 | 
							self.think = multi_wait;
 | 
				
			||||||
| 
						 | 
					@ -48,9 +48,9 @@ void() multi_trigger = {
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// we can't just remove(self) here, because this is a touch function
 | 
							// we can't just remove(self) here, because this is a touch function
 | 
				
			||||||
		// called wheil C code is looping through area links...
 | 
							// called wheil C code is looping through area links...
 | 
				
			||||||
		self.touch = SUB_Null;
 | 
							self.touch = sub_null;
 | 
				
			||||||
		self.nextthink = time + 0.1;
 | 
							self.nextthink = time + 0.1;
 | 
				
			||||||
		self.think = SUB_Remove;
 | 
							self.think = sub_remove;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +71,7 @@ void() multi_touch = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if the trigger has an angles field, check player's facing direction
 | 
						// if the trigger has an angles field, check player's facing direction
 | 
				
			||||||
	if(self.movedir != VEC_ORIGIN) {
 | 
						if(self.movedir != VEC_ORIGIN) {
 | 
				
			||||||
		makevectors(other.angles);
 | 
							make_vectors(other.angles);
 | 
				
			||||||
		if(v_forward * self.movedir < 0) {
 | 
							if(v_forward * self.movedir < 0) {
 | 
				
			||||||
			return; // not facing the right way
 | 
								return; // not facing the right way
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -111,17 +111,17 @@ void() trigger_multiple = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.use = multi_use;
 | 
						self.use = multi_use;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.health) {
 | 
						if(self.health) {
 | 
				
			||||||
		if(self.spawnflags & MULTIPLE_NOTOUCH) {
 | 
							if(self.spawnflags & MULTIPLE_NOTOUCH) {
 | 
				
			||||||
			objerror("health and notouch don't make sense\n");
 | 
								error_obj("health and notouch don't make sense\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		self.max_health = self.health;
 | 
							self.max_health = self.health;
 | 
				
			||||||
		self.th_die = multi_killed;
 | 
							self.th_die = multi_killed;
 | 
				
			||||||
		self.takedamage = DAMAGE_YES;
 | 
							self.takedamage = DAMAGE_YES;
 | 
				
			||||||
		self.solid = SOLID_BBOX;
 | 
							self.solid = SOLID_BBOX;
 | 
				
			||||||
		setorigin(self, self.origin); // make sure it links into the world
 | 
							set_origin(self, self.origin); // make sure it links into the world
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if(!(self.spawnflags & MULTIPLE_NOTOUCH)) {
 | 
							if(!(self.spawnflags & MULTIPLE_NOTOUCH)) {
 | 
				
			||||||
			self.touch = multi_touch;
 | 
								self.touch = multi_touch;
 | 
				
			||||||
| 
						 | 
					@ -153,7 +153,7 @@ void() trigger_once = {
 | 
				
			||||||
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
 | 
					This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() trigger_relay = {
 | 
					void() trigger_relay = {
 | 
				
			||||||
	self.use = SUB_UseTargets;
 | 
						self.use = sub_use_targets;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
| 
						 | 
					@ -200,20 +200,20 @@ void() counter_use = {
 | 
				
			||||||
		if(activator.classname == "player"
 | 
							if(activator.classname == "player"
 | 
				
			||||||
				&& (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
 | 
									&& (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
 | 
				
			||||||
			if(self.count >= 4) {
 | 
								if(self.count >= 4) {
 | 
				
			||||||
				centerprint(activator, "There are more to go...");
 | 
									print_center(activator, "There are more to go...");
 | 
				
			||||||
			} else if(self.count == 3) {
 | 
								} else if(self.count == 3) {
 | 
				
			||||||
				centerprint(activator, "Only 3 more to go...");
 | 
									print_center(activator, "Only 3 more to go...");
 | 
				
			||||||
			} else if(self.count == 2) {
 | 
								} else if(self.count == 2) {
 | 
				
			||||||
				centerprint(activator, "Only 2 more to go...");
 | 
									print_center(activator, "Only 2 more to go...");
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				centerprint(activator, "Only 1 more to go...");
 | 
									print_center(activator, "Only 1 more to go...");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
 | 
						if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
 | 
				
			||||||
		centerprint(activator, "Sequence completed!");
 | 
							print_center(activator, "Sequence completed!");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.enemy = activator;
 | 
						self.enemy = activator;
 | 
				
			||||||
	multi_trigger();
 | 
						multi_trigger();
 | 
				
			||||||
| 
						 | 
					@ -272,11 +272,11 @@ void(vector org) spawn_tfog = {
 | 
				
			||||||
	s.nextthink = time + 0.2;
 | 
						s.nextthink = time + 0.2;
 | 
				
			||||||
	s.think = play_teleport;
 | 
						s.think = play_teleport;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_TELEPORT);
 | 
						write_byte(MSG_BROADCAST, TE_TELEPORT);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_x);
 | 
						write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_y);
 | 
						write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_z);
 | 
						write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() tdeath_touch = {
 | 
					void() tdeath_touch = {
 | 
				
			||||||
| 
						 | 
					@ -291,13 +291,13 @@ void() tdeath_touch = {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(self.owner.classname != "player") {
 | 
							if(self.owner.classname != "player") {
 | 
				
			||||||
			// other monsters explode themselves
 | 
								// other monsters explode themselves
 | 
				
			||||||
			T_Damage(self.owner, self, self, 50000);
 | 
								ent_damage(self.owner, self, self, 50000);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other.health) {
 | 
						if(other.health) {
 | 
				
			||||||
		T_Damage(other, self, self, 50000);
 | 
							ent_damage(other, self, self, 50000);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -309,11 +309,11 @@ void(vector org, entity death_owner) spawn_tdeath = {
 | 
				
			||||||
	death.movetype = MOVETYPE_NONE;
 | 
						death.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	death.solid = SOLID_TRIGGER;
 | 
						death.solid = SOLID_TRIGGER;
 | 
				
			||||||
	death.angles = VEC_ORIGIN;
 | 
						death.angles = VEC_ORIGIN;
 | 
				
			||||||
	setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
 | 
						set_size(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
 | 
				
			||||||
	setorigin(death, org);
 | 
						set_origin(death, org);
 | 
				
			||||||
	death.touch = tdeath_touch;
 | 
						death.touch = tdeath_touch;
 | 
				
			||||||
	death.nextthink = time + 0.2;
 | 
						death.nextthink = time + 0.2;
 | 
				
			||||||
	death.think = SUB_Remove;
 | 
						death.think = sub_remove;
 | 
				
			||||||
	death.owner = death_owner;
 | 
						death.owner = death_owner;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	force_retouch = 2; // make sure even still objects get hit
 | 
						force_retouch = 2; // make sure even still objects get hit
 | 
				
			||||||
| 
						 | 
					@ -340,18 +340,18 @@ void() teleport_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SUB_UseTargets();
 | 
						sub_use_targets();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// put a tfog where the player was
 | 
						// put a tfog where the player was
 | 
				
			||||||
	spawn_tfog(other.origin);
 | 
						spawn_tfog(other.origin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t = find(world, targetname, self.target);
 | 
						t = find(world, targetname, self.target);
 | 
				
			||||||
	if(!t) {
 | 
						if(!t) {
 | 
				
			||||||
		objerror("couldn't find target");
 | 
							error_obj("couldn't find target");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// spawn a tfog flash in front of the destination
 | 
						// spawn a tfog flash in front of the destination
 | 
				
			||||||
	makevectors(t.mangle);
 | 
						make_vectors(t.mangle);
 | 
				
			||||||
	org = t.origin + 32 * v_forward;
 | 
						org = t.origin + 32 * v_forward;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spawn_tfog(org);
 | 
						spawn_tfog(org);
 | 
				
			||||||
| 
						 | 
					@ -364,7 +364,7 @@ void() teleport_touch = {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setorigin(other, t.origin);
 | 
						set_origin(other, t.origin);
 | 
				
			||||||
	other.angles = t.mangle;
 | 
						other.angles = t.mangle;
 | 
				
			||||||
	if(other.classname == "player") {
 | 
						if(other.classname == "player") {
 | 
				
			||||||
		other.fixangle = 1; // turn this way immediately
 | 
							other.fixangle = 1; // turn this way immediately
 | 
				
			||||||
| 
						 | 
					@ -387,14 +387,14 @@ void() info_teleport_destination = {
 | 
				
			||||||
	self.model = string_null;
 | 
						self.model = string_null;
 | 
				
			||||||
	self.origin = self.origin + '0 0 27';
 | 
						self.origin = self.origin + '0 0 27';
 | 
				
			||||||
	if(!self.targetname) {
 | 
						if(!self.targetname) {
 | 
				
			||||||
		objerror("no targetname");
 | 
							error_obj("no targetname");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() teleport_use = {
 | 
					void() teleport_use = {
 | 
				
			||||||
	self.nextthink = time + 0.2;
 | 
						self.nextthink = time + 0.2;
 | 
				
			||||||
	force_retouch = 2; // make sure even still objects get hit
 | 
						force_retouch = 2; // make sure even still objects get hit
 | 
				
			||||||
	self.think = SUB_Null;
 | 
						self.think = sub_null;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*QUAKED trigger_teleport(.5 .5 .5) ? PLAYER_ONLY SILENT
 | 
					/*QUAKED trigger_teleport(.5 .5 .5) ? PLAYER_ONLY SILENT
 | 
				
			||||||
| 
						 | 
					@ -405,18 +405,18 @@ If the trigger_teleport has a targetname, it will only teleport entities when it
 | 
				
			||||||
void() trigger_teleport = {
 | 
					void() trigger_teleport = {
 | 
				
			||||||
	vector o;
 | 
						vector o;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	self.touch = teleport_touch;
 | 
						self.touch = teleport_touch;
 | 
				
			||||||
	// find the destination
 | 
						// find the destination
 | 
				
			||||||
	if(!self.target) {
 | 
						if(!self.target) {
 | 
				
			||||||
		objerror("no target");
 | 
							error_obj("no target");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	self.use = teleport_use;
 | 
						self.use = teleport_use;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!(self.spawnflags & TELE_SILENT)) {
 | 
						if(!(self.spawnflags & TELE_SILENT)) {
 | 
				
			||||||
		precache_sound("ambience/hum1.wav");
 | 
							precache_sound("ambience/hum1.wav");
 | 
				
			||||||
		o = (self.mins + self.maxs) * 0.5;
 | 
							o = (self.mins + self.maxs) * 0.5;
 | 
				
			||||||
		ambientsound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC);
 | 
							ambient_sound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -441,7 +441,7 @@ sets skill level to the value of "message".
 | 
				
			||||||
Only used on start map.
 | 
					Only used on start map.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() trigger_setskill = {
 | 
					void() trigger_setskill = {
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	self.touch = trigger_skill_touch;
 | 
						self.touch = trigger_skill_touch;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -464,11 +464,11 @@ void() trigger_onlyregistered_touch = {
 | 
				
			||||||
	self.attack_finished = time + 2;
 | 
						self.attack_finished = time + 2;
 | 
				
			||||||
	if(cvar("registered")) {
 | 
						if(cvar("registered")) {
 | 
				
			||||||
		self.message = string_null;
 | 
							self.message = string_null;
 | 
				
			||||||
		SUB_UseTargets();
 | 
							sub_use_targets();
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if(self.message != string_null) {
 | 
							if(self.message != string_null) {
 | 
				
			||||||
			centerprint(other, self.message);
 | 
								print_center(other, self.message);
 | 
				
			||||||
			sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
 | 
								sound(other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -479,7 +479,7 @@ Only fires if playing the registered version, otherwise prints the message
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() trigger_onlyregistered = {
 | 
					void() trigger_onlyregistered = {
 | 
				
			||||||
	precache_sound("misc/talk.wav");
 | 
						precache_sound("misc/talk.wav");
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	self.touch = trigger_onlyregistered_touch;
 | 
						self.touch = trigger_onlyregistered_touch;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -493,7 +493,7 @@ void() hurt_on = {
 | 
				
			||||||
void() hurt_touch = {
 | 
					void() hurt_touch = {
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		self.solid = SOLID_NOT;
 | 
							self.solid = SOLID_NOT;
 | 
				
			||||||
		T_Damage(other, self, self, self.dmg);
 | 
							ent_damage(other, self, self, self.dmg);
 | 
				
			||||||
		self.think = hurt_on;
 | 
							self.think = hurt_on;
 | 
				
			||||||
		self.nextthink = time + 1;
 | 
							self.nextthink = time + 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -507,7 +507,7 @@ set dmg to damage amount
 | 
				
			||||||
defalt dmg = 5
 | 
					defalt dmg = 5
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() trigger_hurt = {
 | 
					void() trigger_hurt = {
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	self.touch = hurt_touch;
 | 
						self.touch = hurt_touch;
 | 
				
			||||||
	if(!self.dmg) {
 | 
						if(!self.dmg) {
 | 
				
			||||||
		self.dmg = 5;
 | 
							self.dmg = 5;
 | 
				
			||||||
| 
						 | 
					@ -537,7 +537,7 @@ void() trigger_push_touch = {
 | 
				
			||||||
Pushes the player
 | 
					Pushes the player
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() trigger_push = {
 | 
					void() trigger_push = {
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	precache_sound("ambience/windfly.wav");
 | 
						precache_sound("ambience/windfly.wav");
 | 
				
			||||||
	self.touch = trigger_push_touch;
 | 
						self.touch = trigger_push_touch;
 | 
				
			||||||
	if(!self.speed) {
 | 
						if(!self.speed) {
 | 
				
			||||||
| 
						 | 
					@ -580,7 +580,7 @@ void() trigger_monsterjump = {
 | 
				
			||||||
	if(self.angles == VEC_ORIGIN) {
 | 
						if(self.angles == VEC_ORIGIN) {
 | 
				
			||||||
		self.angles = '0 360 0';
 | 
							self.angles = '0 360 0';
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	InitTrigger();
 | 
						init_trigger();
 | 
				
			||||||
	self.touch = trigger_monsterjump_touch;
 | 
						self.touch = trigger_monsterjump_touch;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
// weapons.qc: weapon functions
 | 
					// weapons.qc: weapon functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// called by worldspawn
 | 
					// called by worldspawn
 | 
				
			||||||
void() W_Precache = {
 | 
					void() wep_precache = {
 | 
				
			||||||
	precache_sound("weapons/r_exp3.wav"); // new rocket explosion
 | 
						precache_sound("weapons/r_exp3.wav"); // new rocket explosion
 | 
				
			||||||
	precache_sound("weapons/rocket1i.wav"); // spike gun
 | 
						precache_sound("weapons/rocket1i.wav"); // spike gun
 | 
				
			||||||
	precache_sound("weapons/sgun1.wav");
 | 
						precache_sound("weapons/sgun1.wav");
 | 
				
			||||||
| 
						 | 
					@ -18,16 +18,16 @@ void() W_Precache = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
W_FireAxe
 | 
					wep_fire_axe
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_FireAxe = {
 | 
					void() wep_fire_axe = {
 | 
				
			||||||
	vector source;
 | 
						vector source;
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle);
 | 
						make_vectors(self.v_angle);
 | 
				
			||||||
	source = self.origin + '0 0 16';
 | 
						source = self.origin + '0 0 16';
 | 
				
			||||||
	traceline(source, source + v_forward * 64, FALSE, self);
 | 
						trace_line(source, source + v_forward * 64, FALSE, self);
 | 
				
			||||||
	if(trace_fraction == 1.0) {
 | 
						if(trace_fraction == 1.0) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -36,16 +36,16 @@ void() W_FireAxe = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(trace_ent.takedamage) {
 | 
						if(trace_ent.takedamage) {
 | 
				
			||||||
		trace_ent.axhitme = 1;
 | 
							trace_ent.axhitme = 1;
 | 
				
			||||||
		SpawnBlood(org, VEC_ORIGIN, 20);
 | 
							spawn_blood(org, VEC_ORIGIN, 20);
 | 
				
			||||||
		T_Damage(trace_ent, self, self, 20);
 | 
							ent_damage(trace_ent, self, self, 20);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// hit wall
 | 
							// hit wall
 | 
				
			||||||
		sound(self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
							write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, TE_GUNSHOT);
 | 
							write_byte(MSG_BROADCAST, TE_GUNSHOT);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_x);
 | 
							write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_y);
 | 
							write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_z);
 | 
							write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,10 +64,10 @@ vector() wall_velocity = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
SpawnMeatSpray
 | 
					spawn_meat_spray
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector org, vector vel) SpawnMeatSpray = {
 | 
					void(vector org, vector vel) spawn_meat_spray = {
 | 
				
			||||||
	entity missile, mpuff;
 | 
						entity missile, mpuff;
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,7 +76,7 @@ void(vector org, vector vel) SpawnMeatSpray = {
 | 
				
			||||||
	missile.movetype = MOVETYPE_BOUNCE;
 | 
						missile.movetype = MOVETYPE_BOUNCE;
 | 
				
			||||||
	missile.solid = SOLID_NOT;
 | 
						missile.solid = SOLID_NOT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.velocity = vel;
 | 
						missile.velocity = vel;
 | 
				
			||||||
	missile.velocity_z = missile.velocity_z + 250 + 50 * random();
 | 
						missile.velocity_z = missile.velocity_z + 250 + 50 * random();
 | 
				
			||||||
| 
						 | 
					@ -85,19 +85,19 @@ void(vector org, vector vel) SpawnMeatSpray = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 1;
 | 
						missile.nextthink = time + 1;
 | 
				
			||||||
	missile.think = SUB_Remove;
 | 
						missile.think = sub_remove;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(missile, "progs/zom_gib.mdl");
 | 
						set_model(missile, "progs/zom_gib.mdl");
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, org);
 | 
						set_origin(missile, org);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
SpawnBlood
 | 
					spawn_blood
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector org, vector vel, float damage) SpawnBlood = {
 | 
					void(vector org, vector vel, float damage) spawn_blood = {
 | 
				
			||||||
	particle(org, vel * 0.1, 73, damage * 2);
 | 
						particle(org, vel * 0.1, 73, damage * 2);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,15 +110,15 @@ void(float damage) spawn_touchblood = {
 | 
				
			||||||
	vector vel;
 | 
						vector vel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vel = wall_velocity() * 0.2;
 | 
						vel = wall_velocity() * 0.2;
 | 
				
			||||||
	SpawnBlood(self.origin + vel * 0.01, vel, damage);
 | 
						spawn_blood(self.origin + vel * 0.01, vel, damage);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
SpawnChunk
 | 
					spawn_chunk
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector org, vector vel) SpawnChunk = {
 | 
					void(vector org, vector vel) spawn_chunk = {
 | 
				
			||||||
	particle(org, vel * 0.02, 0, 10);
 | 
						particle(org, vel * 0.02, 0, 10);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,25 +132,25 @@ Collects multiple small damages into a single damage
 | 
				
			||||||
==============================================================================
 | 
					==============================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ClearMultiDamage = {
 | 
					void() multi_damage_clear = {
 | 
				
			||||||
	multi_ent = world;
 | 
						multi_ent = world;
 | 
				
			||||||
	multi_damage = 0;
 | 
						multi_damage = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ApplyMultiDamage = {
 | 
					void() multi_damage_apply = {
 | 
				
			||||||
	if(!multi_ent) {
 | 
						if(!multi_ent) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	T_Damage(multi_ent, self, self, multi_damage);
 | 
						ent_damage(multi_ent, self, self, multi_damage);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(entity hit, float damage) AddMultiDamage = {
 | 
					void(entity hit, float damage) multi_damage_add = {
 | 
				
			||||||
	if(!hit) {
 | 
						if(!hit) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(hit != multi_ent) {
 | 
						if(hit != multi_ent) {
 | 
				
			||||||
		ApplyMultiDamage();
 | 
							multi_damage_apply();
 | 
				
			||||||
		multi_damage = damage;
 | 
							multi_damage = damage;
 | 
				
			||||||
		multi_ent = hit;
 | 
							multi_ent = hit;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -168,10 +168,10 @@ BULLETS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
TraceAttack
 | 
					trace_attack
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float damage, vector dir) TraceAttack = {
 | 
					void(float damage, vector dir) trace_attack = {
 | 
				
			||||||
	vector vel, org;
 | 
						vector vel, org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vel = normalize(dir + v_up * crandom() + v_right * crandom());
 | 
						vel = normalize(dir + v_up * crandom() + v_right * crandom());
 | 
				
			||||||
| 
						 | 
					@ -181,52 +181,52 @@ void(float damage, vector dir) TraceAttack = {
 | 
				
			||||||
	org = trace_endpos - dir * 4;
 | 
						org = trace_endpos - dir * 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(trace_ent.takedamage) {
 | 
						if(trace_ent.takedamage) {
 | 
				
			||||||
		SpawnBlood(org, vel * 0.2, damage);
 | 
							spawn_blood(org, vel * 0.2, damage);
 | 
				
			||||||
		AddMultiDamage(trace_ent, damage);
 | 
							multi_damage_add(trace_ent, damage);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
							write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, TE_GUNSHOT);
 | 
							write_byte(MSG_BROADCAST, TE_GUNSHOT);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_x);
 | 
							write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_y);
 | 
							write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, org_z);
 | 
							write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
FireBullets
 | 
					fire_bullets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Used by shotgun, super shotgun, and enemy soldier firing
 | 
					Used by shotgun, super shotgun, and enemy soldier firing
 | 
				
			||||||
Go to the trouble of combining multiple pellets into a single damage call.
 | 
					Go to the trouble of combining multiple pellets into a single damage call.
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float shotcount, vector dir, vector spread) FireBullets = {
 | 
					void(float shotcount, vector dir, vector spread) fire_bullets = {
 | 
				
			||||||
	vector direction;
 | 
						vector direction;
 | 
				
			||||||
	vector src;
 | 
						vector src;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle);
 | 
						make_vectors(self.v_angle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	src = self.origin + v_forward * 10;
 | 
						src = self.origin + v_forward * 10;
 | 
				
			||||||
	src_z = self.absmin_z + self.size_z * 0.7;
 | 
						src_z = self.absmin_z + self.size_z * 0.7;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ClearMultiDamage();
 | 
						multi_damage_clear();
 | 
				
			||||||
	while(shotcount > 0) {
 | 
						while(shotcount > 0) {
 | 
				
			||||||
		direction = dir + crandom() * spread_x * v_right + crandom() * spread_y * v_up;
 | 
							direction = dir + crandom() * spread_x * v_right + crandom() * spread_y * v_up;
 | 
				
			||||||
		traceline(src, src + direction * 2048, FALSE, self);
 | 
							trace_line(src, src + direction * 2048, FALSE, self);
 | 
				
			||||||
		if(trace_fraction != 1.0) {
 | 
							if(trace_fraction != 1.0) {
 | 
				
			||||||
			TraceAttack(4, direction);
 | 
								trace_attack(4, direction);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		shotcount = shotcount - 1;
 | 
							shotcount = shotcount - 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ApplyMultiDamage();
 | 
						multi_damage_apply();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
W_FireShotgun
 | 
					wep_fire_shotgun
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_FireShotgun = {
 | 
					void() wep_fire_shotgun = {
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);
 | 
				
			||||||
| 
						 | 
					@ -235,19 +235,19 @@ void() W_FireShotgun = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.currentammo = self.ammo_shells = self.ammo_shells - 1;
 | 
						self.currentammo = self.ammo_shells = self.ammo_shells - 1;
 | 
				
			||||||
	dir = aim(self, 100000);
 | 
						dir = aim(self, 100000);
 | 
				
			||||||
	FireBullets(6, dir, '0.04 0.04 0');
 | 
						fire_bullets(6, dir, '0.04 0.04 0');
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
W_FireSuperShotgun
 | 
					wep_fire_super_shotgun
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_FireSuperShotgun = {
 | 
					void() wep_fire_super_shotgun = {
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.currentammo == 1) {
 | 
						if(self.currentammo == 1) {
 | 
				
			||||||
		W_FireShotgun();
 | 
							wep_fire_shotgun();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,7 +257,7 @@ void() W_FireSuperShotgun = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.currentammo = self.ammo_shells = self.ammo_shells - 2;
 | 
						self.currentammo = self.ammo_shells = self.ammo_shells - 2;
 | 
				
			||||||
	dir = aim(self, 100000);
 | 
						dir = aim(self, 100000);
 | 
				
			||||||
	FireBullets(14, dir, '0.14 0.08 0');
 | 
						fire_bullets(14, dir, '0.14 0.08 0');
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -273,25 +273,25 @@ void() s_explode2 = [1, s_explode3] {};
 | 
				
			||||||
void() s_explode3 = [2, s_explode4] {};
 | 
					void() s_explode3 = [2, s_explode4] {};
 | 
				
			||||||
void() s_explode4 = [3, s_explode5] {};
 | 
					void() s_explode4 = [3, s_explode5] {};
 | 
				
			||||||
void() s_explode5 = [4, s_explode6] {};
 | 
					void() s_explode5 = [4, s_explode6] {};
 | 
				
			||||||
void() s_explode6 = [5, SUB_Remove] {};
 | 
					void() s_explode6 = [5, sub_remove] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() BecomeExplosion = {
 | 
					void() become_explosion = {
 | 
				
			||||||
	self.movetype = MOVETYPE_NONE;
 | 
						self.movetype = MOVETYPE_NONE;
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.touch = SUB_Null;
 | 
						self.touch = sub_null;
 | 
				
			||||||
	setmodel(self, "progs/s_explod.spr");
 | 
						set_model(self, "progs/s_explod.spr");
 | 
				
			||||||
	self.solid = SOLID_NOT;
 | 
						self.solid = SOLID_NOT;
 | 
				
			||||||
	s_explode1();
 | 
						s_explode1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() T_MissileTouch = {
 | 
					void() ent_missile_touch = {
 | 
				
			||||||
	float damg;
 | 
						float damg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(pointcontents(self.origin) == CONTENT_SKY) {
 | 
						if(point_contents(self.origin) == CONTENT_SKY) {
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -302,32 +302,32 @@ void() T_MissileTouch = {
 | 
				
			||||||
		if(other.classname == "monster_shambler") {
 | 
							if(other.classname == "monster_shambler") {
 | 
				
			||||||
			damg = damg * 0.5; // mostly immune
 | 
								damg = damg * 0.5; // mostly immune
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		T_Damage(other, self, self.owner, damg);
 | 
							ent_damage(other, self, self.owner, damg);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// don't do radius damage to the other, because all the damage
 | 
						// don't do radius damage to the other, because all the damage
 | 
				
			||||||
	// was done in the impact
 | 
						// was done in the impact
 | 
				
			||||||
	T_RadiusDamage(self, self.owner, 120, other);
 | 
						ent_radius_damage(self, self.owner, 120, other);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
						// sound(self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
 | 
				
			||||||
	self.origin = self.origin - 8 * normalize(self.velocity);
 | 
						self.origin = self.origin - 8 * normalize(self.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_EXPLOSION);
 | 
						write_byte(MSG_BROADCAST, TE_EXPLOSION);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BecomeExplosion();
 | 
						become_explosion();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
W_FireRocket
 | 
					wep_fire_rocket
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_FireRocket = {
 | 
					void() wep_fire_rocket = {
 | 
				
			||||||
	entity missile, mpuff;
 | 
						entity missile, mpuff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 | 
						self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 | 
				
			||||||
| 
						 | 
					@ -344,20 +344,20 @@ void() W_FireRocket = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile speed
 | 
						// set missile speed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle);
 | 
						make_vectors(self.v_angle);
 | 
				
			||||||
	missile.velocity = aim(self, 1000);
 | 
						missile.velocity = aim(self, 1000);
 | 
				
			||||||
	missile.velocity = missile.velocity * 1000;
 | 
						missile.velocity = missile.velocity * 1000;
 | 
				
			||||||
	missile.angles = vectoangles(missile.velocity);
 | 
						missile.angles = vec_to_angles(missile.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.touch = T_MissileTouch;
 | 
						missile.touch = ent_missile_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 5;
 | 
						missile.nextthink = time + 5;
 | 
				
			||||||
	missile.think = SUB_Remove;
 | 
						missile.think = sub_remove;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(missile, "progs/missile.mdl");
 | 
						set_model(missile, "progs/missile.mdl");
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, self.origin + v_forward * 8 + '0 0 16');
 | 
						set_origin(missile, self.origin + v_forward * 8 + '0 0 16');
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -370,10 +370,10 @@ LIGHTNING
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
LightningDamage
 | 
					lightning_damage
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector p1, vector p2, entity from, float damage) LightningDamage = {
 | 
					void(vector p1, vector p2, entity from, float damage) lightning_damage = {
 | 
				
			||||||
	entity e1, e2;
 | 
						entity e1, e2;
 | 
				
			||||||
	vector f;
 | 
						vector f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -386,39 +386,37 @@ void(vector p1, vector p2, entity from, float damage) LightningDamage = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	e1 = e2 = world;
 | 
						e1 = e2 = world;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(p1, p2, FALSE, self);
 | 
						trace_line(p1, p2, FALSE, self);
 | 
				
			||||||
	if(trace_ent.takedamage) {
 | 
						if(trace_ent.takedamage) {
 | 
				
			||||||
		particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
							particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
				
			||||||
		T_Damage(trace_ent, from, from, damage);
 | 
							ent_damage(trace_ent, from, from, damage);
 | 
				
			||||||
		if(self.classname == "player") {
 | 
							if(self.classname == "player" && other.classname == "player") {
 | 
				
			||||||
			if(other.classname == "player") {
 | 
					 | 
				
			||||||
			trace_ent.velocity_z = trace_ent.velocity_z + 400;
 | 
								trace_ent.velocity_z = trace_ent.velocity_z + 400;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	e1 = trace_ent;
 | 
						e1 = trace_ent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(p1 + f, p2 + f, FALSE, self);
 | 
						trace_line(p1 + f, p2 + f, FALSE, self);
 | 
				
			||||||
	if(trace_ent != e1 && trace_ent.takedamage) {
 | 
						if(trace_ent != e1 && trace_ent.takedamage) {
 | 
				
			||||||
		particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
							particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
				
			||||||
		T_Damage(trace_ent, from, from, damage);
 | 
							ent_damage(trace_ent, from, from, damage);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	e2 = trace_ent;
 | 
						e2 = trace_ent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(p1 - f, p2 - f, FALSE, self);
 | 
						trace_line(p1 - f, p2 - f, FALSE, self);
 | 
				
			||||||
	if(trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage) {
 | 
						if(trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage) {
 | 
				
			||||||
		particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
							particle(trace_endpos, '0 0 100', 225, damage * 4);
 | 
				
			||||||
		T_Damage(trace_ent, from, from, damage);
 | 
							ent_damage(trace_ent, from, from, damage);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() W_FireLightning = {
 | 
					void() wep_fire_lightning = {
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
	float cells;
 | 
						float cells;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.ammo_cells < 1) {
 | 
						if(self.ammo_cells < 1) {
 | 
				
			||||||
		self.weapon = W_BestWeapon();
 | 
							self.weapon = wep_best_weapon();
 | 
				
			||||||
		W_SetCurrentAmmo();
 | 
							wep_set_current_ammo();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -426,8 +424,8 @@ void() W_FireLightning = {
 | 
				
			||||||
	if(self.waterlevel > 1) {
 | 
						if(self.waterlevel > 1) {
 | 
				
			||||||
		cells = self.ammo_cells;
 | 
							cells = self.ammo_cells;
 | 
				
			||||||
		self.ammo_cells = 0;
 | 
							self.ammo_cells = 0;
 | 
				
			||||||
		W_SetCurrentAmmo();
 | 
							wep_set_current_ammo();
 | 
				
			||||||
		T_RadiusDamage(self, self, 35 * cells, world);
 | 
							ent_radius_damage(self, self, 35 * cells, world);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -441,41 +439,41 @@ void() W_FireLightning = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	org = self.origin + '0 0 16';
 | 
						org = self.origin + '0 0 16';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(org, org + v_forward * 600, TRUE, self);
 | 
						trace_line(org, org + v_forward * 600, TRUE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_LIGHTNING2);
 | 
						write_byte(MSG_BROADCAST, TE_LIGHTNING2);
 | 
				
			||||||
	WriteEntity(MSG_BROADCAST, self);
 | 
						write_entity(MSG_BROADCAST, self);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_x);
 | 
						write_coord(MSG_BROADCAST, org_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_y);
 | 
						write_coord(MSG_BROADCAST, org_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, org_z);
 | 
						write_coord(MSG_BROADCAST, org_z);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_x);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_y);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, trace_endpos_z);
 | 
						write_coord(MSG_BROADCAST, trace_endpos_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LightningDamage(self.origin, trace_endpos + v_forward * 4, self, 30);
 | 
						lightning_damage(self.origin, trace_endpos + v_forward * 4, self, 30);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() GrenadeExplode = {
 | 
					void() grenade_explode = {
 | 
				
			||||||
	T_RadiusDamage(self, self.owner, 120, world);
 | 
						ent_radius_damage(self, self.owner, 120, world);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
						write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
	WriteByte(MSG_BROADCAST, TE_EXPLOSION);
 | 
						write_byte(MSG_BROADCAST, TE_EXPLOSION);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
						write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
						write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
	WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
						write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BecomeExplosion();
 | 
						become_explosion();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() GrenadeTouch = {
 | 
					void() grenade_touch = {
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(other.takedamage == DAMAGE_AIM) {
 | 
						if(other.takedamage == DAMAGE_AIM) {
 | 
				
			||||||
		GrenadeExplode();
 | 
							grenade_explode();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
 | 
						sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
 | 
				
			||||||
| 
						 | 
					@ -486,10 +484,10 @@ void() GrenadeTouch = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
W_FireGrenade
 | 
					wep_fire_grenade
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_FireGrenade = {
 | 
					void() wep_fire_grenade = {
 | 
				
			||||||
	entity missile, mpuff;
 | 
						entity missile, mpuff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 | 
						self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 | 
				
			||||||
| 
						 | 
					@ -506,7 +504,7 @@ void() W_FireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile speed
 | 
						// set missile speed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle);
 | 
						make_vectors(self.v_angle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.v_angle_x) {
 | 
						if(self.v_angle_x) {
 | 
				
			||||||
		missile.velocity = v_forward * 600 + v_up * 200 + crandom() * v_right * 10 + crandom() * v_up * 10;
 | 
							missile.velocity = v_forward * 600 + v_up * 200 + crandom() * v_right * 10 + crandom() * v_up * 10;
 | 
				
			||||||
| 
						 | 
					@ -518,17 +516,17 @@ void() W_FireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.avelocity = '300 300 300';
 | 
						missile.avelocity = '300 300 300';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.angles = vectoangles(missile.velocity);
 | 
						missile.angles = vec_to_angles(missile.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.touch = GrenadeTouch;
 | 
						missile.touch = grenade_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 2.5;
 | 
						missile.nextthink = time + 2.5;
 | 
				
			||||||
	missile.think = GrenadeExplode;
 | 
						missile.think = grenade_explode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(missile, "progs/grenade.mdl");
 | 
						set_model(missile, "progs/grenade.mdl");
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, self.origin);
 | 
						set_origin(missile, self.origin);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//=============================================================================
 | 
					//=============================================================================
 | 
				
			||||||
| 
						 | 
					@ -546,20 +544,20 @@ void(vector org, vector dir) launch_spike = {
 | 
				
			||||||
	newmis.movetype = MOVETYPE_FLYMISSILE;
 | 
						newmis.movetype = MOVETYPE_FLYMISSILE;
 | 
				
			||||||
	newmis.solid = SOLID_BBOX;
 | 
						newmis.solid = SOLID_BBOX;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newmis.angles = vectoangles(dir);
 | 
						newmis.angles = vec_to_angles(dir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newmis.touch = spike_touch;
 | 
						newmis.touch = spike_touch;
 | 
				
			||||||
	newmis.classname = "spike";
 | 
						newmis.classname = "spike";
 | 
				
			||||||
	newmis.think = SUB_Remove;
 | 
						newmis.think = sub_remove;
 | 
				
			||||||
	newmis.nextthink = time + 6;
 | 
						newmis.nextthink = time + 6;
 | 
				
			||||||
	setmodel(newmis, "progs/spike.mdl");
 | 
						set_model(newmis, "progs/spike.mdl");
 | 
				
			||||||
	setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(newmis, org);
 | 
						set_origin(newmis, org);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newmis.velocity = dir * 1000;
 | 
						newmis.velocity = dir * 1000;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() W_FireSuperSpikes = {
 | 
					void() wep_fire_super_nail = {
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
	entity old;
 | 
						entity old;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,25 +567,25 @@ void() W_FireSuperSpikes = {
 | 
				
			||||||
	dir = aim(self, 1000);
 | 
						dir = aim(self, 1000);
 | 
				
			||||||
	launch_spike(self.origin + '0 0 16', dir);
 | 
						launch_spike(self.origin + '0 0 16', dir);
 | 
				
			||||||
	newmis.touch = superspike_touch;
 | 
						newmis.touch = superspike_touch;
 | 
				
			||||||
	setmodel(newmis, "progs/s_spike.mdl");
 | 
						set_model(newmis, "progs/s_spike.mdl");
 | 
				
			||||||
	setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	self.punchangle_x = -2;
 | 
						self.punchangle_x = -2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(float ox) W_FireSpikes = {
 | 
					void(float ox) wep_fire_nail = {
 | 
				
			||||||
	vector dir;
 | 
						vector dir;
 | 
				
			||||||
	entity old;
 | 
						entity old;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle);
 | 
						make_vectors(self.v_angle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN) {
 | 
						if(self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN) {
 | 
				
			||||||
		W_FireSuperSpikes();
 | 
							wep_fire_super_nail();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.ammo_nails < 1) {
 | 
						if(self.ammo_nails < 1) {
 | 
				
			||||||
		self.weapon = W_BestWeapon();
 | 
							self.weapon = wep_best_weapon();
 | 
				
			||||||
		W_SetCurrentAmmo();
 | 
							wep_set_current_ammo();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -610,7 +608,7 @@ void() spike_touch = {
 | 
				
			||||||
		return; // trigger field, do nothing
 | 
							return; // trigger field, do nothing
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(pointcontents(self.origin) == CONTENT_SKY) {
 | 
						if(point_contents(self.origin) == CONTENT_SKY) {
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -618,19 +616,19 @@ void() spike_touch = {
 | 
				
			||||||
	// hit something that bleeds
 | 
						// hit something that bleeds
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		spawn_touchblood(9);
 | 
							spawn_touchblood(9);
 | 
				
			||||||
		T_Damage(other, self, self.owner, 9);
 | 
							ent_damage(other, self, self.owner, 9);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
							write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
		if(self.classname == "wizspike") {
 | 
							if(self.classname == "wizspike") {
 | 
				
			||||||
			WriteByte(MSG_BROADCAST, TE_WIZSPIKE);
 | 
								write_byte(MSG_BROADCAST, TE_WIZSPIKE);
 | 
				
			||||||
		} else if(self.classname == "knightspike") {
 | 
							} else if(self.classname == "knightspike") {
 | 
				
			||||||
			WriteByte(MSG_BROADCAST, TE_KNIGHTSPIKE);
 | 
								write_byte(MSG_BROADCAST, TE_KNIGHTSPIKE);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			WriteByte(MSG_BROADCAST, TE_SPIKE);
 | 
								write_byte(MSG_BROADCAST, TE_SPIKE);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
							write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
							write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
							write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
| 
						 | 
					@ -647,7 +645,7 @@ void() superspike_touch = {
 | 
				
			||||||
		return; // trigger field, do nothing
 | 
							return; // trigger field, do nothing
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(pointcontents(self.origin) == CONTENT_SKY) {
 | 
						if(point_contents(self.origin) == CONTENT_SKY) {
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -655,13 +653,13 @@ void() superspike_touch = {
 | 
				
			||||||
	// hit something that bleeds
 | 
						// hit something that bleeds
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		spawn_touchblood(18);
 | 
							spawn_touchblood(18);
 | 
				
			||||||
		T_Damage(other, self, self.owner, 18);
 | 
							ent_damage(other, self, self.owner, 18);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
							write_byte(MSG_BROADCAST, SVC_TEMPENTITY);
 | 
				
			||||||
		WriteByte(MSG_BROADCAST, TE_SUPERSPIKE);
 | 
							write_byte(MSG_BROADCAST, TE_SUPERSPIKE);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_x);
 | 
							write_coord(MSG_BROADCAST, self.origin_x);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_y);
 | 
							write_coord(MSG_BROADCAST, self.origin_y);
 | 
				
			||||||
		WriteCoord(MSG_BROADCAST, self.origin_z);
 | 
							write_coord(MSG_BROADCAST, self.origin_z);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
| 
						 | 
					@ -676,7 +674,7 @@ PLAYER WEAPON USE
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() W_SetCurrentAmmo = {
 | 
					void() wep_set_current_ammo = {
 | 
				
			||||||
	player_run(); // get out of any weapon firing states
 | 
						player_run(); // get out of any weapon firing states
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS);
 | 
						self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS);
 | 
				
			||||||
| 
						 | 
					@ -737,7 +735,7 @@ void() W_SetCurrentAmmo = {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
float() W_BestWeapon = {
 | 
					float() wep_best_weapon = {
 | 
				
			||||||
	float it;
 | 
						float it;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	it = self.items;
 | 
						it = self.items;
 | 
				
			||||||
| 
						 | 
					@ -762,21 +760,21 @@ float() W_BestWeapon = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
W_Attack
 | 
					wep_attack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
An attack impulse can be triggered now
 | 
					An attack impulse can be triggered now
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_Attack = {
 | 
					void() wep_attack = {
 | 
				
			||||||
	float r;
 | 
						float r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.currentammo <= 0 && self.weapon != IT_AXE) {
 | 
						if(self.currentammo <= 0 && self.weapon != IT_AXE) {
 | 
				
			||||||
		self.weapon = W_BestWeapon();
 | 
							self.weapon = wep_best_weapon();
 | 
				
			||||||
		W_SetCurrentAmmo();
 | 
							wep_set_current_ammo();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.v_angle); // calculate forward angle for velocity
 | 
						make_vectors(self.v_angle); // calculate forward angle for velocity
 | 
				
			||||||
	self.show_hostile = time + 1; // wake monsters up
 | 
						self.show_hostile = time + 1; // wake monsters up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch(self.weapon) {
 | 
						switch(self.weapon) {
 | 
				
			||||||
| 
						 | 
					@ -796,12 +794,12 @@ void() W_Attack = {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_SHOTGUN:
 | 
							case IT_SHOTGUN:
 | 
				
			||||||
			player_shot1();
 | 
								player_shot1();
 | 
				
			||||||
			W_FireShotgun();
 | 
								wep_fire_shotgun();
 | 
				
			||||||
			self.attack_finished = time + 0.5;
 | 
								self.attack_finished = time + 0.5;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_SUPER_SHOTGUN:
 | 
							case IT_SUPER_SHOTGUN:
 | 
				
			||||||
			player_shot1();
 | 
								player_shot1();
 | 
				
			||||||
			W_FireSuperShotgun();
 | 
								wep_fire_super_shotgun();
 | 
				
			||||||
			self.attack_finished = time + 0.7;
 | 
								self.attack_finished = time + 0.7;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_NAILGUN:
 | 
							case IT_NAILGUN:
 | 
				
			||||||
| 
						 | 
					@ -810,12 +808,12 @@ void() W_Attack = {
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_GRENADE_LAUNCHER:
 | 
							case IT_GRENADE_LAUNCHER:
 | 
				
			||||||
			player_rocket1();
 | 
								player_rocket1();
 | 
				
			||||||
			W_FireGrenade();
 | 
								wep_fire_grenade();
 | 
				
			||||||
			self.attack_finished = time + 0.6;
 | 
								self.attack_finished = time + 0.6;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_ROCKET_LAUNCHER:
 | 
							case IT_ROCKET_LAUNCHER:
 | 
				
			||||||
			player_rocket1();
 | 
								player_rocket1();
 | 
				
			||||||
			W_FireRocket();
 | 
								wep_fire_rocket();
 | 
				
			||||||
			self.attack_finished = time + 0.8;
 | 
								self.attack_finished = time + 0.8;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case IT_LIGHTNING:
 | 
							case IT_LIGHTNING:
 | 
				
			||||||
| 
						 | 
					@ -828,11 +826,11 @@ void() W_Attack = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
W_ChangeWeapon
 | 
					wep_change_weapon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(float wep) W_ChangeWeapon = {
 | 
					void(float wep) wep_change_weapon = {
 | 
				
			||||||
	float it, am, fl;
 | 
						float it, am, fl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	it = self.items;
 | 
						it = self.items;
 | 
				
			||||||
| 
						 | 
					@ -888,29 +886,29 @@ void(float wep) W_ChangeWeapon = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!(self.items & fl)) {
 | 
						if(!(self.items & fl)) {
 | 
				
			||||||
		// don't have the weapon or the ammo
 | 
							// don't have the weapon or the ammo
 | 
				
			||||||
		sprint(self, "no weapon.\n");
 | 
							print_cl(self, "no weapon.\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(am) {
 | 
						if(am) {
 | 
				
			||||||
		// don't have the ammo
 | 
							// don't have the ammo
 | 
				
			||||||
		sprint(self, "not enough ammo.\n");
 | 
							print_cl(self, "not enough ammo.\n");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set weapon, set ammo
 | 
						// set weapon, set ammo
 | 
				
			||||||
	self.weapon = fl;
 | 
						self.weapon = fl;
 | 
				
			||||||
	W_SetCurrentAmmo();
 | 
						wep_set_current_ammo();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
W_CycleWeapon
 | 
					wep_cycle_weapon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Go to the next weapon with ammo
 | 
					Go to the next weapon with ammo
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_CycleWeapon = {
 | 
					void() wep_cycle_weapon = {
 | 
				
			||||||
	float it, am;
 | 
						float it, am;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	it = self.items;
 | 
						it = self.items;
 | 
				
			||||||
| 
						 | 
					@ -967,7 +965,7 @@ void() W_CycleWeapon = {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if((it & self.weapon) && am == 0) {
 | 
							if((it & self.weapon) && am == 0) {
 | 
				
			||||||
			W_SetCurrentAmmo();
 | 
								wep_set_current_ammo();
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -975,12 +973,12 @@ void() W_CycleWeapon = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
W_CycleWeaponReverse
 | 
					wep_cycle_weapon_reverse
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Go to the prev weapon with ammo
 | 
					Go to the prev weapon with ammo
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_CycleWeaponReverse = {
 | 
					void() wep_cycle_weapon_reverse = {
 | 
				
			||||||
	float it, am;
 | 
						float it, am;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	it = self.items;
 | 
						it = self.items;
 | 
				
			||||||
| 
						 | 
					@ -1037,7 +1035,7 @@ void() W_CycleWeaponReverse = {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if((it & self.weapon) && am == 0) {
 | 
							if((it & self.weapon) && am == 0) {
 | 
				
			||||||
			W_SetCurrentAmmo();
 | 
								wep_set_current_ammo();
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1045,27 +1043,27 @@ void() W_CycleWeaponReverse = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
W_WeaponFrame
 | 
					wep_weapon_frame
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Called every frame so impulse events can be handled as well as possible
 | 
					Called every frame so impulse events can be handled as well as possible
 | 
				
			||||||
============
 | 
					============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() W_WeaponFrame = {
 | 
					void() wep_weapon_frame = {
 | 
				
			||||||
	// check for attack
 | 
						// check for attack
 | 
				
			||||||
	if(self.button0) {
 | 
						if(self.button0) {
 | 
				
			||||||
		SuperDamageSound();
 | 
							super_damage_sound();
 | 
				
			||||||
		W_Attack();
 | 
							wep_attack();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
========
 | 
					========
 | 
				
			||||||
SuperDamageSound
 | 
					super_damage_sound
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Plays sound if needed
 | 
					Plays sound if needed
 | 
				
			||||||
========
 | 
					========
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() SuperDamageSound = {
 | 
					void() super_damage_sound = {
 | 
				
			||||||
	if(self.super_damage_finished > time) {
 | 
						if(self.super_damage_finished > time) {
 | 
				
			||||||
		if(self.super_sound < time) {
 | 
							if(self.super_sound < time) {
 | 
				
			||||||
			self.super_sound = time + 1;
 | 
								self.super_sound = time + 1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,24 +31,24 @@ will duck back out and catch it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
LaunchMissile
 | 
					launch_missile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sets the given entities velocity and angles so that it will hit self.enemy
 | 
					Sets the given entities velocity and angles so that it will hit self.enemy
 | 
				
			||||||
if self.enemy maintains it's current velocity
 | 
					if self.enemy maintains it's current velocity
 | 
				
			||||||
0.1 is moderately accurate, 0.0 is totally accurate
 | 
					0.1 is moderately accurate, 0.0 is totally accurate
 | 
				
			||||||
=============
 | 
					=============
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(entity missile, float mspeed, float accuracy) LaunchMissile = {
 | 
					void(entity missile, float mspeed, float accuracy) launch_missile = {
 | 
				
			||||||
	vector vec, move;
 | 
						vector vec, move;
 | 
				
			||||||
	float fly;
 | 
						float fly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile speed
 | 
						// set missile speed
 | 
				
			||||||
	vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin;
 | 
						vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// calc aproximate time for missile to reach vec
 | 
						// calc aproximate time for missile to reach vec
 | 
				
			||||||
	fly = vlen(vec) / mspeed;
 | 
						fly = vec_len(vec) / mspeed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// get the entities xy velocity
 | 
						// get the entities xy velocity
 | 
				
			||||||
	move = self.enemy.velocity;
 | 
						move = self.enemy.velocity;
 | 
				
			||||||
| 
						 | 
					@ -63,19 +63,19 @@ void(entity missile, float mspeed, float accuracy) LaunchMissile = {
 | 
				
			||||||
	missile.velocity = vec * mspeed;
 | 
						missile.velocity = vec * mspeed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.angles = VEC_ORIGIN;
 | 
						missile.angles = VEC_ORIGIN;
 | 
				
			||||||
	missile.angles_y = vectoyaw(missile.velocity);
 | 
						missile.angles_y = vec_yaw(missile.velocity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 5;
 | 
						missile.nextthink = time + 5;
 | 
				
			||||||
	missile.think = SUB_Remove;
 | 
						missile.think = sub_remove;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
WizardCheckAttack
 | 
					wiz_check_attack
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
float() WizardCheckAttack = {
 | 
					float() wiz_check_attack = {
 | 
				
			||||||
	vector spot1, spot2;
 | 
						vector spot1, spot2;
 | 
				
			||||||
	entity targ;
 | 
						entity targ;
 | 
				
			||||||
	float chance;
 | 
						float chance;
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ float() WizardCheckAttack = {
 | 
				
			||||||
	spot1 = self.origin + self.view_ofs;
 | 
						spot1 = self.origin + self.view_ofs;
 | 
				
			||||||
	spot2 = targ.origin + targ.view_ofs;
 | 
						spot2 = targ.origin + targ.view_ofs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	traceline(spot1, spot2, FALSE, self);
 | 
						trace_line(spot1, spot2, FALSE, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(trace_ent != targ) {
 | 
						if(trace_ent != targ) {
 | 
				
			||||||
		// don't have a clear shot, so move to a side
 | 
							// don't have a clear shot, so move to a side
 | 
				
			||||||
| 
						 | 
					@ -144,10 +144,10 @@ float() WizardCheckAttack = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
WizardAttackFinished
 | 
					wiz_attack_finished
 | 
				
			||||||
=================
 | 
					=================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() WizardAttackFinished = {
 | 
					void() wiz_attack_finished = {
 | 
				
			||||||
	if(enemy_range >= RANGE_MID || !enemy_vis) {
 | 
						if(enemy_range >= RANGE_MID || !enemy_vis) {
 | 
				
			||||||
		self.attack_state = AS_STRAIGHT;
 | 
							self.attack_state = AS_STRAIGHT;
 | 
				
			||||||
		self.think = wiz_run1;
 | 
							self.think = wiz_run1;
 | 
				
			||||||
| 
						 | 
					@ -165,13 +165,13 @@ FAST ATTACKS
 | 
				
			||||||
==============================================================================
 | 
					==============================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Wiz_FastFire = {
 | 
					void() wiz_fast_fire = {
 | 
				
			||||||
	vector vec;
 | 
						vector vec;
 | 
				
			||||||
	vector dst;
 | 
						vector dst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(self.owner.health > 0) {
 | 
						if(self.owner.health > 0) {
 | 
				
			||||||
		self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
 | 
							self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
 | 
				
			||||||
		makevectors(self.enemy.angles);
 | 
							make_vectors(self.enemy.angles);
 | 
				
			||||||
		dst = self.enemy.origin - 13 * self.movedir;
 | 
							dst = self.enemy.origin - 13 * self.movedir;
 | 
				
			||||||
		vec = normalize(dst - self.origin);
 | 
							vec = normalize(dst - self.origin);
 | 
				
			||||||
		sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
 | 
				
			||||||
| 
						 | 
					@ -179,43 +179,43 @@ void() Wiz_FastFire = {
 | 
				
			||||||
		newmis.velocity = vec * 600;
 | 
							newmis.velocity = vec * 600;
 | 
				
			||||||
		newmis.owner = self.owner;
 | 
							newmis.owner = self.owner;
 | 
				
			||||||
		newmis.classname = "wizspike";
 | 
							newmis.classname = "wizspike";
 | 
				
			||||||
		setmodel(newmis, "progs/w_spike.mdl");
 | 
							set_model(newmis, "progs/w_spike.mdl");
 | 
				
			||||||
		setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
							set_size(newmis, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	remove(self);
 | 
						remove(self);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Wiz_StartFast = {
 | 
					void() wiz_start_fast = {
 | 
				
			||||||
	entity missile;
 | 
						entity missile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
 | 
				
			||||||
	self.v_angle = self.angles;
 | 
						self.v_angle = self.angles;
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile = spawn();
 | 
						missile = spawn();
 | 
				
			||||||
	missile.owner = self;
 | 
						missile.owner = self;
 | 
				
			||||||
	missile.nextthink = time + 0.6;
 | 
						missile.nextthink = time + 0.6;
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14);
 | 
						set_origin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14);
 | 
				
			||||||
	missile.enemy = self.enemy;
 | 
						missile.enemy = self.enemy;
 | 
				
			||||||
	missile.nextthink = time + 0.8;
 | 
						missile.nextthink = time + 0.8;
 | 
				
			||||||
	missile.think = Wiz_FastFire;
 | 
						missile.think = wiz_fast_fire;
 | 
				
			||||||
	missile.movedir = v_right;
 | 
						missile.movedir = v_right;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile = spawn();
 | 
						missile = spawn();
 | 
				
			||||||
	missile.owner = self;
 | 
						missile.owner = self;
 | 
				
			||||||
	missile.nextthink = time + 1;
 | 
						missile.nextthink = time + 1;
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14);
 | 
						set_origin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14);
 | 
				
			||||||
	missile.enemy = self.enemy;
 | 
						missile.enemy = self.enemy;
 | 
				
			||||||
	missile.nextthink = time + 0.3;
 | 
						missile.nextthink = time + 0.3;
 | 
				
			||||||
	missile.think = Wiz_FastFire;
 | 
						missile.think = wiz_fast_fire;
 | 
				
			||||||
	missile.movedir = VEC_ORIGIN - v_right;
 | 
						missile.movedir = VEC_ORIGIN - v_right;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Wiz_idlesound = {
 | 
					void() wiz_idle_sound = {
 | 
				
			||||||
	float wr;
 | 
						float wr;
 | 
				
			||||||
	wr = random() * 5;
 | 
						wr = random() * 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,7 +241,7 @@ void() wiz_stand7 = [ $hover7, wiz_stand8 ] {ai_stand();};
 | 
				
			||||||
void() wiz_stand8 = [ $hover8, wiz_stand1 ] {ai_stand();};
 | 
					void() wiz_stand8 = [ $hover8, wiz_stand1 ] {ai_stand();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() wiz_walk1 = [ $hover1, wiz_walk2 ] {ai_walk(8);
 | 
					void() wiz_walk1 = [ $hover1, wiz_walk2 ] {ai_walk(8);
 | 
				
			||||||
		 Wiz_idlesound();
 | 
							 wiz_idle_sound();
 | 
				
			||||||
					 };
 | 
										 };
 | 
				
			||||||
void() wiz_walk2 = [ $hover2, wiz_walk3 ] {ai_walk(8);};
 | 
					void() wiz_walk2 = [ $hover2, wiz_walk3 ] {ai_walk(8);};
 | 
				
			||||||
void() wiz_walk3 = [ $hover3, wiz_walk4 ] {ai_walk(8);};
 | 
					void() wiz_walk3 = [ $hover3, wiz_walk4 ] {ai_walk(8);};
 | 
				
			||||||
| 
						 | 
					@ -252,7 +252,7 @@ void() wiz_walk7 = [ $hover7, wiz_walk8 ] {ai_walk(8);};
 | 
				
			||||||
void() wiz_walk8 = [ $hover8, wiz_walk1 ] {ai_walk(8);};
 | 
					void() wiz_walk8 = [ $hover8, wiz_walk1 ] {ai_walk(8);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() wiz_side1 = [ $hover1, wiz_side2 ] {ai_run(8);
 | 
					void() wiz_side1 = [ $hover1, wiz_side2 ] {ai_run(8);
 | 
				
			||||||
		 Wiz_idlesound();
 | 
							 wiz_idle_sound();
 | 
				
			||||||
					 };
 | 
										 };
 | 
				
			||||||
void() wiz_side2 = [ $hover2, wiz_side3 ] {ai_run(8);};
 | 
					void() wiz_side2 = [ $hover2, wiz_side3 ] {ai_run(8);};
 | 
				
			||||||
void() wiz_side3 = [ $hover3, wiz_side4 ] {ai_run(8);};
 | 
					void() wiz_side3 = [ $hover3, wiz_side4 ] {ai_run(8);};
 | 
				
			||||||
| 
						 | 
					@ -263,7 +263,7 @@ void() wiz_side7 = [ $hover7, wiz_side8 ] {ai_run(8);};
 | 
				
			||||||
void() wiz_side8 = [ $hover8, wiz_side1 ] {ai_run(8);};
 | 
					void() wiz_side8 = [ $hover8, wiz_side1 ] {ai_run(8);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() wiz_run1 = [ $fly1, wiz_run2 ] {ai_run(16);
 | 
					void() wiz_run1 = [ $fly1, wiz_run2 ] {ai_run(16);
 | 
				
			||||||
				 Wiz_idlesound();
 | 
									 wiz_idle_sound();
 | 
				
			||||||
				 };
 | 
									 };
 | 
				
			||||||
void() wiz_run2 = [ $fly2, wiz_run3 ] {ai_run(16);};
 | 
					void() wiz_run2 = [ $fly2, wiz_run3 ] {ai_run(16);};
 | 
				
			||||||
void() wiz_run3 = [ $fly3, wiz_run4 ] {ai_run(16);};
 | 
					void() wiz_run3 = [ $fly3, wiz_run4 ] {ai_run(16);};
 | 
				
			||||||
| 
						 | 
					@ -279,7 +279,7 @@ void() wiz_run12 = [ $fly12, wiz_run13 ] {ai_run(16);};
 | 
				
			||||||
void() wiz_run13 = [ $fly13, wiz_run14 ] {ai_run(16);};
 | 
					void() wiz_run13 = [ $fly13, wiz_run14 ] {ai_run(16);};
 | 
				
			||||||
void() wiz_run14 = [ $fly14, wiz_run1 ] {ai_run(16);};
 | 
					void() wiz_run14 = [ $fly14, wiz_run1 ] {ai_run(16);};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() wiz_fast1 = [ $magatt1, wiz_fast2 ] {ai_face(); Wiz_StartFast();};
 | 
					void() wiz_fast1 = [ $magatt1, wiz_fast2 ] {ai_face(); wiz_start_fast();};
 | 
				
			||||||
void() wiz_fast2 = [ $magatt2, wiz_fast3 ] {ai_face();};
 | 
					void() wiz_fast2 = [ $magatt2, wiz_fast3 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast3 = [ $magatt3, wiz_fast4 ] {ai_face();};
 | 
					void() wiz_fast3 = [ $magatt3, wiz_fast4 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast4 = [ $magatt4, wiz_fast5 ] {ai_face();};
 | 
					void() wiz_fast4 = [ $magatt4, wiz_fast5 ] {ai_face();};
 | 
				
			||||||
| 
						 | 
					@ -288,7 +288,7 @@ void() wiz_fast6 = [ $magatt6, wiz_fast7 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast7 = [ $magatt5, wiz_fast8 ] {ai_face();};
 | 
					void() wiz_fast7 = [ $magatt5, wiz_fast8 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast8 = [ $magatt4, wiz_fast9 ] {ai_face();};
 | 
					void() wiz_fast8 = [ $magatt4, wiz_fast9 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast9 = [ $magatt3, wiz_fast10 ] {ai_face();};
 | 
					void() wiz_fast9 = [ $magatt3, wiz_fast10 ] {ai_face();};
 | 
				
			||||||
void() wiz_fast10 = [ $magatt2, wiz_run1 ] {ai_face(); SUB_AttackFinished(2); WizardAttackFinished();};
 | 
					void() wiz_fast10 = [ $magatt2, wiz_run1 ] {ai_face(); sub_attack_finished(2); wiz_attack_finished();};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() wiz_pain1 = [ $pain1, wiz_pain2 ] {};
 | 
					void() wiz_pain1 = [ $pain1, wiz_pain2 ] {};
 | 
				
			||||||
void() wiz_pain2 = [ $pain2, wiz_pain3 ] {};
 | 
					void() wiz_pain2 = [ $pain2, wiz_pain3 ] {};
 | 
				
			||||||
| 
						 | 
					@ -315,17 +315,17 @@ void() wiz_die = {
 | 
				
			||||||
	// check for gib
 | 
						// check for gib
 | 
				
			||||||
	if(self.health < -40) {
 | 
						if(self.health < -40) {
 | 
				
			||||||
		sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
 | 
				
			||||||
		ThrowHead("progs/h_wizard.mdl", self.health);
 | 
							throw_head("progs/h_wizard.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		ThrowGib("progs/gib2.mdl", self.health);
 | 
							throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wiz_death1();
 | 
						wiz_death1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void(entity attacker, float damage) Wiz_Pain = {
 | 
					void(entity attacker, float damage) wiz_pain = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
 | 
				
			||||||
	if(random() * 70 > damage) {
 | 
						if(random() * 70 > damage) {
 | 
				
			||||||
		return; // didn't flinch
 | 
							return; // didn't flinch
 | 
				
			||||||
| 
						 | 
					@ -334,7 +334,7 @@ void(entity attacker, float damage) Wiz_Pain = {
 | 
				
			||||||
	wiz_pain1();
 | 
						wiz_pain1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() Wiz_Missile = {
 | 
					void() wiz_missile = {
 | 
				
			||||||
	wiz_fast1();
 | 
						wiz_fast1();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -360,16 +360,16 @@ void() monster_wizard = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/wizard.mdl");
 | 
						set_model(self, "progs/wizard.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 80;
 | 
						self.health = 80;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = wiz_stand1;
 | 
						self.th_stand = wiz_stand1;
 | 
				
			||||||
	self.th_walk = wiz_walk1;
 | 
						self.th_walk = wiz_walk1;
 | 
				
			||||||
	self.th_run = wiz_run1;
 | 
						self.th_run = wiz_run1;
 | 
				
			||||||
	self.th_missile = Wiz_Missile;
 | 
						self.th_missile = wiz_missile;
 | 
				
			||||||
	self.th_pain = Wiz_Pain;
 | 
						self.th_pain = wiz_pain;
 | 
				
			||||||
	self.th_die = wiz_die;
 | 
						self.th_die = wiz_die;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	flymonster_start();
 | 
						flymonster_start();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,11 +15,11 @@ World Types:
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void() worldspawn = {
 | 
					void() worldspawn = {
 | 
				
			||||||
	lastspawn = world;
 | 
						lastspawn = world;
 | 
				
			||||||
	InitBodyQue();
 | 
						init_body_queue();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(cvar("pr_checkextension")) {
 | 
						if(cvar("pr_checkextension")) {
 | 
				
			||||||
		ext_con_set = checkextension("DP_CON_SET");
 | 
							ext_con_set = check_extension("DP_CON_SET");
 | 
				
			||||||
		ext_strings = checkextension("FTE_STRINGS");
 | 
							ext_strings = check_extension("FTE_STRINGS");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// custom map attributes
 | 
						// custom map attributes
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@ void() worldspawn = {
 | 
				
			||||||
	// the area based ambient sounds MUST be the first precache_sounds
 | 
						// the area based ambient sounds MUST be the first precache_sounds
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// player precaches
 | 
						// player precaches
 | 
				
			||||||
	W_Precache(); // get weapon precaches
 | 
						wep_precache(); // get weapon precaches
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// sounds used from C physics code
 | 
						// sounds used from C physics code
 | 
				
			||||||
	precache_sound("demon/dland2.wav"); // landing thud
 | 
						precache_sound("demon/dland2.wav"); // landing thud
 | 
				
			||||||
| 
						 | 
					@ -142,45 +142,45 @@ void() worldspawn = {
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 0 normal
 | 
						// 0 normal
 | 
				
			||||||
	lightstyle(0, "m");
 | 
						light_style(0, "m");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 1 FLICKER(first variety)
 | 
						// 1 FLICKER(first variety)
 | 
				
			||||||
	lightstyle(1, "mmnmmommommnonmmonqnmmo");
 | 
						light_style(1, "mmnmmommommnonmmonqnmmo");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 2 SLOW STRONG PULSE
 | 
						// 2 SLOW STRONG PULSE
 | 
				
			||||||
	lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
 | 
						light_style(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 3 CANDLE(first variety)
 | 
						// 3 CANDLE(first variety)
 | 
				
			||||||
	lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
 | 
						light_style(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 4 FAST STROBE
 | 
						// 4 FAST STROBE
 | 
				
			||||||
	lightstyle(4, "mamamamamama");
 | 
						light_style(4, "mamamamamama");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 5 GENTLE PULSE 1
 | 
						// 5 GENTLE PULSE 1
 | 
				
			||||||
	lightstyle(5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj");
 | 
						light_style(5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 6 FLICKER(second variety)
 | 
						// 6 FLICKER(second variety)
 | 
				
			||||||
	lightstyle(6, "nmonqnmomnmomomno");
 | 
						light_style(6, "nmonqnmomnmomomno");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 7 CANDLE(second variety)
 | 
						// 7 CANDLE(second variety)
 | 
				
			||||||
	lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
 | 
						light_style(7, "mmmaaaabcdefgmmmmaaaammmaamm");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 8 CANDLE(third variety)
 | 
						// 8 CANDLE(third variety)
 | 
				
			||||||
	lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
 | 
						light_style(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 9 SLOW STROBE(fourth variety)
 | 
						// 9 SLOW STROBE(fourth variety)
 | 
				
			||||||
	lightstyle(9, "aaaaaaaazzzzzzzz");
 | 
						light_style(9, "aaaaaaaazzzzzzzz");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 10 FLUORESCENT FLICKER
 | 
						// 10 FLUORESCENT FLICKER
 | 
				
			||||||
	lightstyle(10, "mmamammmmammamamaaamammma");
 | 
						light_style(10, "mmamammmmammamamaaamammma");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 11 SLOW PULSE NOT FADE TO BLACK
 | 
						// 11 SLOW PULSE NOT FADE TO BLACK
 | 
				
			||||||
	lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
 | 
						light_style(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// styles 32-62 are assigned by the light program for switchable lights
 | 
						// styles 32-62 are assigned by the light program for switchable lights
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 63 testing
 | 
						// 63 testing
 | 
				
			||||||
	lightstyle(63, "a");
 | 
						light_style(63, "a");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() StartFrame = {
 | 
					void() StartFrame = {
 | 
				
			||||||
| 
						 | 
					@ -205,11 +205,11 @@ void() StartFrame = {
 | 
				
			||||||
	if(all_players_are_dead) {
 | 
						if(all_players_are_dead) {
 | 
				
			||||||
		delta = time - all_players_are_dead;
 | 
							delta = time - all_players_are_dead;
 | 
				
			||||||
		if(delta >= 9.95) {
 | 
							if(delta >= 9.95) {
 | 
				
			||||||
			localcmd("restart\n");
 | 
								cmd_server("restart\n");
 | 
				
			||||||
		} else if(rint(delta * 10) == rint(delta) * 10) {
 | 
							} else if(rint(delta * 10) == rint(delta) * 10) {
 | 
				
			||||||
			pl = find(world, classname, "player");
 | 
								pl = find(world, classname, "player");
 | 
				
			||||||
			while(pl != world) {
 | 
								while(pl != world) {
 | 
				
			||||||
				centerprint(pl, "Mission failed.\nRestarting in ",
 | 
									print_center(pl, "Mission failed.\nRestarting in ",
 | 
				
			||||||
				            ftos(10 - rint(delta)), " seconds");
 | 
									            ftos(10 - rint(delta)), " seconds");
 | 
				
			||||||
				pl = find(pl, classname, "player");
 | 
									pl = find(pl, classname, "player");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ entity() spawn_bodyque = {
 | 
				
			||||||
	return e;
 | 
						return e;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() InitBodyQue = {
 | 
					void() init_body_queue = {
 | 
				
			||||||
	entity e;
 | 
						entity e;
 | 
				
			||||||
	float i;
 | 
						float i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,7 +258,7 @@ void() InitBodyQue = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// make a body que entry for the given ent so the ent can be
 | 
					// make a body que entry for the given ent so the ent can be
 | 
				
			||||||
// respawned elsewhere
 | 
					// respawned elsewhere
 | 
				
			||||||
void(entity ent) CopyToBodyQue = {
 | 
					void(entity ent) copy_to_body_queue = {
 | 
				
			||||||
	bodyque_head.angles = ent.angles;
 | 
						bodyque_head.angles = ent.angles;
 | 
				
			||||||
	bodyque_head.model = ent.model;
 | 
						bodyque_head.model = ent.model;
 | 
				
			||||||
	bodyque_head.modelindex = ent.modelindex;
 | 
						bodyque_head.modelindex = ent.modelindex;
 | 
				
			||||||
| 
						 | 
					@ -267,8 +267,8 @@ void(entity ent) CopyToBodyQue = {
 | 
				
			||||||
	bodyque_head.movetype = ent.movetype;
 | 
						bodyque_head.movetype = ent.movetype;
 | 
				
			||||||
	bodyque_head.velocity = ent.velocity;
 | 
						bodyque_head.velocity = ent.velocity;
 | 
				
			||||||
	bodyque_head.flags = 0;
 | 
						bodyque_head.flags = 0;
 | 
				
			||||||
	setorigin(bodyque_head, ent.origin);
 | 
						set_origin(bodyque_head, ent.origin);
 | 
				
			||||||
	setsize(bodyque_head, ent.mins, ent.maxs);
 | 
						set_size(bodyque_head, ent.mins, ent.maxs);
 | 
				
			||||||
	bodyque_head = bodyque_head.owner;
 | 
						bodyque_head = bodyque_head.owner;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -134,12 +134,12 @@ ATTACKS
 | 
				
			||||||
=============================================================================
 | 
					=============================================================================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() ZombieGrenadeTouch = {
 | 
					void() zombie_grenade_touch = {
 | 
				
			||||||
	if(other == self.owner) {
 | 
						if(other == self.owner) {
 | 
				
			||||||
		return; // don't explode on owner
 | 
							return; // don't explode on owner
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(other.takedamage) {
 | 
						if(other.takedamage) {
 | 
				
			||||||
		T_Damage(other, self, self.owner, 10);
 | 
							ent_damage(other, self, self.owner, 10);
 | 
				
			||||||
		sound(self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
 | 
							sound(self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
 | 
				
			||||||
		remove(self);
 | 
							remove(self);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -147,15 +147,15 @@ void() ZombieGrenadeTouch = {
 | 
				
			||||||
	sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
 | 
						sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
 | 
				
			||||||
	self.velocity = VEC_ORIGIN;
 | 
						self.velocity = VEC_ORIGIN;
 | 
				
			||||||
	self.avelocity = VEC_ORIGIN;
 | 
						self.avelocity = VEC_ORIGIN;
 | 
				
			||||||
	self.touch = SUB_Remove;
 | 
						self.touch = sub_remove;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
ZombieFireGrenade
 | 
					zombie_fire_grenade
 | 
				
			||||||
================
 | 
					================
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
void(vector st) ZombieFireGrenade = {
 | 
					void(vector st) zombie_fire_grenade = {
 | 
				
			||||||
	entity missile, mpuff;
 | 
						entity missile, mpuff;
 | 
				
			||||||
	vector org;
 | 
						vector org;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,7 +171,7 @@ void(vector st) ZombieFireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile speed
 | 
						// set missile speed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	makevectors(self.angles);
 | 
						make_vectors(self.angles);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.velocity = normalize(self.enemy.origin - org);
 | 
						missile.velocity = normalize(self.enemy.origin - org);
 | 
				
			||||||
	missile.velocity = missile.velocity * 600;
 | 
						missile.velocity = missile.velocity * 600;
 | 
				
			||||||
| 
						 | 
					@ -179,15 +179,15 @@ void(vector st) ZombieFireGrenade = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.avelocity = '3000 1000 2000';
 | 
						missile.avelocity = '3000 1000 2000';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	missile.touch = ZombieGrenadeTouch;
 | 
						missile.touch = zombie_grenade_touch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set missile duration
 | 
						// set missile duration
 | 
				
			||||||
	missile.nextthink = time + 2.5;
 | 
						missile.nextthink = time + 2.5;
 | 
				
			||||||
	missile.think = SUB_Remove;
 | 
						missile.think = sub_remove;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(missile, "progs/zom_gib.mdl");
 | 
						set_model(missile, "progs/zom_gib.mdl");
 | 
				
			||||||
	setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
						set_size(missile, VEC_ORIGIN, VEC_ORIGIN);
 | 
				
			||||||
	setorigin(missile, org);
 | 
						set_origin(missile, org);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() zombie_atta1 = [ $atta1, zombie_atta2 ] {ai_face();};
 | 
					void() zombie_atta1 = [ $atta1, zombie_atta2 ] {ai_face();};
 | 
				
			||||||
| 
						 | 
					@ -202,7 +202,7 @@ void() zombie_atta9 = [ $atta9, zombie_atta10 ] {ai_face();};
 | 
				
			||||||
void() zombie_atta10 = [ $atta10, zombie_atta11 ] {ai_face();};
 | 
					void() zombie_atta10 = [ $atta10, zombie_atta11 ] {ai_face();};
 | 
				
			||||||
void() zombie_atta11 = [ $atta11, zombie_atta12 ] {ai_face();};
 | 
					void() zombie_atta11 = [ $atta11, zombie_atta12 ] {ai_face();};
 | 
				
			||||||
void() zombie_atta12 = [ $atta12, zombie_atta13 ] {ai_face();};
 | 
					void() zombie_atta12 = [ $atta12, zombie_atta13 ] {ai_face();};
 | 
				
			||||||
void() zombie_atta13 = [ $atta13, zombie_run1 ] {ai_face(); ZombieFireGrenade('-10 -22 30');};
 | 
					void() zombie_atta13 = [ $atta13, zombie_run1 ] {ai_face(); zombie_fire_grenade('-10 -22 30');};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() zombie_attb1 = [ $attb1, zombie_attb2 ] {ai_face();};
 | 
					void() zombie_attb1 = [ $attb1, zombie_attb2 ] {ai_face();};
 | 
				
			||||||
void() zombie_attb2 = [ $attb2, zombie_attb3 ] {ai_face();};
 | 
					void() zombie_attb2 = [ $attb2, zombie_attb3 ] {ai_face();};
 | 
				
			||||||
| 
						 | 
					@ -217,7 +217,7 @@ void() zombie_attb10 = [ $attb10, zombie_attb11 ] {ai_face();};
 | 
				
			||||||
void() zombie_attb11 = [ $attb11, zombie_attb12 ] {ai_face();};
 | 
					void() zombie_attb11 = [ $attb11, zombie_attb12 ] {ai_face();};
 | 
				
			||||||
void() zombie_attb12 = [ $attb12, zombie_attb13 ] {ai_face();};
 | 
					void() zombie_attb12 = [ $attb12, zombie_attb13 ] {ai_face();};
 | 
				
			||||||
void() zombie_attb13 = [ $attb13, zombie_attb14 ] {ai_face();};
 | 
					void() zombie_attb13 = [ $attb13, zombie_attb14 ] {ai_face();};
 | 
				
			||||||
void() zombie_attb14 = [ $attb13, zombie_run1 ] {ai_face(); ZombieFireGrenade('-10 -24 29');};
 | 
					void() zombie_attb14 = [ $attb13, zombie_run1 ] {ai_face(); zombie_fire_grenade('-10 -24 29');};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() zombie_attc1 = [ $attc1, zombie_attc2 ] {ai_face();};
 | 
					void() zombie_attc1 = [ $attc1, zombie_attc2 ] {ai_face();};
 | 
				
			||||||
void() zombie_attc2 = [ $attc2, zombie_attc3 ] {ai_face();};
 | 
					void() zombie_attc2 = [ $attc2, zombie_attc3 ] {ai_face();};
 | 
				
			||||||
| 
						 | 
					@ -230,7 +230,7 @@ void() zombie_attc8 = [ $attc8, zombie_attc9 ] {ai_face();};
 | 
				
			||||||
void() zombie_attc9 = [ $attc9, zombie_attc10 ] {ai_face();};
 | 
					void() zombie_attc9 = [ $attc9, zombie_attc10 ] {ai_face();};
 | 
				
			||||||
void() zombie_attc10 = [ $attc10, zombie_attc11 ] {ai_face();};
 | 
					void() zombie_attc10 = [ $attc10, zombie_attc11 ] {ai_face();};
 | 
				
			||||||
void() zombie_attc11 = [ $attc11, zombie_attc12 ] {ai_face();};
 | 
					void() zombie_attc11 = [ $attc11, zombie_attc12 ] {ai_face();};
 | 
				
			||||||
void() zombie_attc12 = [ $attc12, zombie_run1 ] {ai_face(); ZombieFireGrenade('-12 -19 29');};
 | 
					void() zombie_attc12 = [ $attc12, zombie_run1 ] {ai_face(); zombie_fire_grenade('-12 -19 29');};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() zombie_missile = {
 | 
					void() zombie_missile = {
 | 
				
			||||||
	float r;
 | 
						float r;
 | 
				
			||||||
| 
						 | 
					@ -351,7 +351,7 @@ void() zombie_paine12 = [ $paine12, zombie_paine13 ] {
 | 
				
			||||||
	self.health = 60;
 | 
						self.health = 60;
 | 
				
			||||||
	sound(self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
 | 
						sound(self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	if(!walkmove(0, 0)) {
 | 
						if(!walk_move(0, 0)) {
 | 
				
			||||||
		self.think = zombie_paine11;
 | 
							self.think = zombie_paine11;
 | 
				
			||||||
		self.solid = SOLID_NOT;
 | 
							self.solid = SOLID_NOT;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -378,10 +378,10 @@ void() zombie_paine30 = [ $paine30, zombie_run1 ] {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void() zombie_die = {
 | 
					void() zombie_die = {
 | 
				
			||||||
	sound(self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
 | 
						sound(self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
 | 
				
			||||||
	ThrowHead("progs/h_zombie.mdl", self.health);
 | 
						throw_head("progs/h_zombie.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib1.mdl", self.health);
 | 
						throw_gib("progs/gib1.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib2.mdl", self.health);
 | 
						throw_gib("progs/gib2.mdl", self.health);
 | 
				
			||||||
	ThrowGib("progs/gib3.mdl", self.health);
 | 
						throw_gib("progs/gib3.mdl", self.health);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					@ -481,9 +481,9 @@ void() monster_zombie = {
 | 
				
			||||||
	self.solid = SOLID_SLIDEBOX;
 | 
						self.solid = SOLID_SLIDEBOX;
 | 
				
			||||||
	self.movetype = MOVETYPE_STEP;
 | 
						self.movetype = MOVETYPE_STEP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setmodel(self, "progs/zombie.mdl");
 | 
						set_model(self, "progs/zombie.mdl");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setsize(self, '-16 -16 -24', '16 16 40');
 | 
						set_size(self, '-16 -16 -24', '16 16 40');
 | 
				
			||||||
	self.health = 60;
 | 
						self.health = 60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	self.th_stand = zombie_stand1;
 | 
						self.th_stand = zombie_stand1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								todo
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								todo
									
									
									
									
									
								
							| 
						 | 
					@ -5,7 +5,6 @@ none
 | 
				
			||||||
refactoring:
 | 
					refactoring:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add expansion pack entities
 | 
					add expansion pack entities
 | 
				
			||||||
rename all functions to be lower_underscore
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
core features:
 | 
					core features:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,4 +35,5 @@ enforcers are broken
 | 
				
			||||||
impulse command for spectating
 | 
					impulse command for spectating
 | 
				
			||||||
lives counting
 | 
					lives counting
 | 
				
			||||||
no friendly fire
 | 
					no friendly fire
 | 
				
			||||||
 | 
					rename all functions to be lower_underscore
 | 
				
			||||||
restart map after 10 seconds when everyone is dead
 | 
					restart map after 10 seconds when everyone is dead
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user