fix various weapon and item functions
This commit is contained in:
		
							parent
							
								
									661307339e
								
							
						
					
					
						commit
						6857946b1a
					
				|  | @ -22,7 +22,7 @@ void() SetChangeParms = { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// remove items | 	// remove items | ||||||
| 	self.items = self.items - (self.items & (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD)); | 	self.items &= ~(IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD); | ||||||
| 
 | 
 | ||||||
| 	// cap super health | 	// cap super health | ||||||
| 	if(self.health > 100) { | 	if(self.health > 100) { | ||||||
|  | @ -55,7 +55,7 @@ void() SetNewParms = { | ||||||
| 	parm5 = 0; | 	parm5 = 0; | ||||||
| 	parm6 = 0; | 	parm6 = 0; | ||||||
| 	parm7 = 0; | 	parm7 = 0; | ||||||
| 	parm8 = 1; | 	parm8 = IT_SHOTGUN; | ||||||
| 	parm9 = 0; | 	parm9 = 0; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | @ -93,13 +93,11 @@ entity() FindIntermission = { | ||||||
| 	spot = find(world, classname, "info_intermission"); | 	spot = find(world, classname, "info_intermission"); | ||||||
| 	if(spot) { | 	if(spot) { | ||||||
| 		// pick a random one | 		// pick a random one | ||||||
| 		cyc = random() * 4; | 		for(cyc = random() * 4; cyc > 1; cyc--) { | ||||||
| 		while(cyc > 1) { |  | ||||||
| 			spot = find(spot, classname, "info_intermission"); | 			spot = find(spot, classname, "info_intermission"); | ||||||
| 			if(!spot) { | 			if(!spot) { | ||||||
| 				spot = find(spot, classname, "info_intermission"); | 				spot = find(spot, classname, "info_intermission"); | ||||||
| 			} | 			} | ||||||
| 			cyc = cyc - 1; |  | ||||||
| 		} | 		} | ||||||
| 		return spot; | 		return spot; | ||||||
| 	} | 	} | ||||||
|  | @ -283,7 +281,7 @@ void() changelevel_touch = { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /*QUAKED trigger_changelevel(0.5 0.5 0.5) ? NO_INTERMISSION | /*QUAKED trigger_changelevel(0.5 0.5 0.5) ? NO_INTERMISSION | ||||||
| When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats. | When the player touches this, they get sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats. | ||||||
| */ | */ | ||||||
| void() trigger_changelevel = { | void() trigger_changelevel = { | ||||||
| 	if(!self.map) { | 	if(!self.map) { | ||||||
|  |  | ||||||
|  | @ -357,7 +357,7 @@ void() teleport_touch = { | ||||||
| 	spawn_tfog(org); | 	spawn_tfog(org); | ||||||
| 	spawn_tdeath(t.origin, other); | 	spawn_tdeath(t.origin, other); | ||||||
| 
 | 
 | ||||||
| 	// move the player and lock him down for a little while | 	// move the player and lock them down for a little while | ||||||
| 	if(!other.health) { | 	if(!other.health) { | ||||||
| 		other.origin = t.origin; | 		other.origin = t.origin; | ||||||
| 		other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y); | 		other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y); | ||||||
|  |  | ||||||
|  | @ -760,23 +760,6 @@ float() W_BestWeapon = { | ||||||
| 	return IT_AXE; | 	return IT_AXE; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| float() W_CheckNoAmmo = { |  | ||||||
| 	if(self.currentammo > 0) { |  | ||||||
| 		return TRUE; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if(self.weapon == IT_AXE) { |  | ||||||
| 		return TRUE; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	self.weapon = W_BestWeapon(); |  | ||||||
| 
 |  | ||||||
| 	W_SetCurrentAmmo(); |  | ||||||
| 
 |  | ||||||
| 	// drop the weapon down |  | ||||||
| 	return FALSE; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /* | /* | ||||||
| ============ | ============ | ||||||
| W_Attack | W_Attack | ||||||
|  | @ -787,14 +770,17 @@ An attack impulse can be triggered now | ||||||
| void() W_Attack = { | void() W_Attack = { | ||||||
| 	float r; | 	float r; | ||||||
| 
 | 
 | ||||||
| 	if(!W_CheckNoAmmo()) { | 	if(self.currentammo <= 0 && self.weapon != IT_AXE) { | ||||||
|  | 		self.weapon = W_BestWeapon(); | ||||||
|  | 		W_SetCurrentAmmo(); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	makevectors(self.v_angle); // calculate forward angle for velocity | 	makevectors(self.v_angle); // calculate forward angle for velocity | ||||||
| 	self.show_hostile = time + 1; // wake monsters up | 	self.show_hostile = time + 1; // wake monsters up | ||||||
| 
 | 
 | ||||||
| 	if(self.weapon == IT_AXE) { | 	switch(self.weapon) { | ||||||
|  | 		case IT_AXE: | ||||||
| 			sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM); | 			sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM); | ||||||
| 			r = random(); | 			r = random(); | ||||||
| 			if(r < 0.25) { | 			if(r < 0.25) { | ||||||
|  | @ -807,30 +793,36 @@ void() W_Attack = { | ||||||
| 				player_axed1(); | 				player_axed1(); | ||||||
| 			} | 			} | ||||||
| 			self.attack_finished = time + 0.5; | 			self.attack_finished = time + 0.5; | ||||||
| 	} else if(self.weapon == IT_SHOTGUN) { | 			break; | ||||||
|  | 		case IT_SHOTGUN: | ||||||
| 			player_shot1(); | 			player_shot1(); | ||||||
| 			W_FireShotgun(); | 			W_FireShotgun(); | ||||||
| 			self.attack_finished = time + 0.5; | 			self.attack_finished = time + 0.5; | ||||||
| 	} else if(self.weapon == IT_SUPER_SHOTGUN) { | 			break; | ||||||
|  | 		case IT_SUPER_SHOTGUN: | ||||||
| 			player_shot1(); | 			player_shot1(); | ||||||
| 			W_FireSuperShotgun(); | 			W_FireSuperShotgun(); | ||||||
| 			self.attack_finished = time + 0.7; | 			self.attack_finished = time + 0.7; | ||||||
| 	} else if(self.weapon == IT_NAILGUN) { | 			break; | ||||||
|  | 		case IT_NAILGUN: | ||||||
|  | 		case IT_SUPER_NAILGUN: | ||||||
| 			player_nail1(); | 			player_nail1(); | ||||||
| 	} else if(self.weapon == IT_SUPER_NAILGUN) { | 			break; | ||||||
| 		player_nail1(); | 		case IT_GRENADE_LAUNCHER: | ||||||
| 	} else if(self.weapon == IT_GRENADE_LAUNCHER) { |  | ||||||
| 			player_rocket1(); | 			player_rocket1(); | ||||||
| 			W_FireGrenade(); | 			W_FireGrenade(); | ||||||
| 			self.attack_finished = time + 0.6; | 			self.attack_finished = time + 0.6; | ||||||
| 	} else if(self.weapon == IT_ROCKET_LAUNCHER) { | 			break; | ||||||
|  | 		case IT_ROCKET_LAUNCHER: | ||||||
| 			player_rocket1(); | 			player_rocket1(); | ||||||
| 			W_FireRocket(); | 			W_FireRocket(); | ||||||
| 			self.attack_finished = time + 0.8; | 			self.attack_finished = time + 0.8; | ||||||
| 	} else if(self.weapon == IT_LIGHTNING) { | 			break; | ||||||
|  | 		case IT_LIGHTNING: | ||||||
| 			player_light1(); | 			player_light1(); | ||||||
| 			self.attack_finished = time + 0.1; | 			self.attack_finished = time + 0.1; | ||||||
| 			sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM); | 			sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM); | ||||||
|  | 			break; | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | @ -971,13 +963,14 @@ void() W_CycleWeapon = { | ||||||
| 					am = 1; | 					am = 1; | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
|  | 			default: | ||||||
|  | 				return; | ||||||
| 		} | 		} | ||||||
| 		if((it & self.weapon) && am == 0) { | 		if((it & self.weapon) && am == 0) { | ||||||
| 			W_SetCurrentAmmo(); | 			W_SetCurrentAmmo(); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* | /* | ||||||
|  | @ -1040,13 +1033,14 @@ void() W_CycleWeaponReverse = { | ||||||
| 					am = 1; | 					am = 1; | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
|  | 			default: | ||||||
|  | 				return; | ||||||
| 		} | 		} | ||||||
| 		if((it & self.weapon) && am == 0) { | 		if((it & self.weapon) && am == 0) { | ||||||
| 			W_SetCurrentAmmo(); | 			W_SetCurrentAmmo(); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* | /* | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								todo
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								todo
									
									
									
									
									
								
							|  | @ -5,7 +5,6 @@ rename all functions to be lower_underscore | ||||||
| 
 | 
 | ||||||
| core features: | core features: | ||||||
| 
 | 
 | ||||||
| custom pronouns |  | ||||||
| distributed ammo | distributed ammo | ||||||
| lives counting | lives counting | ||||||
| 
 | 
 | ||||||
|  | @ -27,4 +26,5 @@ third person player weapon models | ||||||
| done: | done: | ||||||
| 
 | 
 | ||||||
| corpse pickups have keys | corpse pickups have keys | ||||||
|  | custom pronouns | ||||||
| no friendly fire | no friendly fire | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user