fix various weapon and item functions
This commit is contained in:
		
							parent
							
								
									661307339e
								
							
						
					
					
						commit
						6857946b1a
					
				|  | @ -22,7 +22,7 @@ void() SetChangeParms = { | |||
| 	} | ||||
| 
 | ||||
| 	// 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 | ||||
| 	if(self.health > 100) { | ||||
|  | @ -55,7 +55,7 @@ void() SetNewParms = { | |||
| 	parm5 = 0; | ||||
| 	parm6 = 0; | ||||
| 	parm7 = 0; | ||||
| 	parm8 = 1; | ||||
| 	parm8 = IT_SHOTGUN; | ||||
| 	parm9 = 0; | ||||
| }; | ||||
| 
 | ||||
|  | @ -93,13 +93,11 @@ entity() FindIntermission = { | |||
| 	spot = find(world, classname, "info_intermission"); | ||||
| 	if(spot) { | ||||
| 		// pick a random one | ||||
| 		cyc = random() * 4; | ||||
| 		while(cyc > 1) { | ||||
| 		for(cyc = random() * 4; cyc > 1; cyc--) { | ||||
| 			spot = find(spot, classname, "info_intermission"); | ||||
| 			if(!spot) { | ||||
| 				spot = find(spot, classname, "info_intermission"); | ||||
| 			} | ||||
| 			cyc = cyc - 1; | ||||
| 		} | ||||
| 		return spot; | ||||
| 	} | ||||
|  | @ -283,7 +281,7 @@ void() changelevel_touch = { | |||
| }; | ||||
| 
 | ||||
| /*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 = { | ||||
| 	if(!self.map) { | ||||
|  |  | |||
|  | @ -357,7 +357,7 @@ void() teleport_touch = { | |||
| 	spawn_tfog(org); | ||||
| 	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) { | ||||
| 		other.origin = t.origin; | ||||
| 		other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y); | ||||
|  |  | |||
|  | @ -760,23 +760,6 @@ float() W_BestWeapon = { | |||
| 	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 | ||||
|  | @ -787,14 +770,17 @@ An attack impulse can be triggered now | |||
| void() W_Attack = { | ||||
| 	float r; | ||||
| 
 | ||||
| 	if(!W_CheckNoAmmo()) { | ||||
| 	if(self.currentammo <= 0 && self.weapon != IT_AXE) { | ||||
| 		self.weapon = W_BestWeapon(); | ||||
| 		W_SetCurrentAmmo(); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	makevectors(self.v_angle); // calculate forward angle for velocity | ||||
| 	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); | ||||
| 			r = random(); | ||||
| 			if(r < 0.25) { | ||||
|  | @ -807,30 +793,36 @@ void() W_Attack = { | |||
| 				player_axed1(); | ||||
| 			} | ||||
| 			self.attack_finished = time + 0.5; | ||||
| 	} else if(self.weapon == IT_SHOTGUN) { | ||||
| 			break; | ||||
| 		case IT_SHOTGUN: | ||||
| 			player_shot1(); | ||||
| 			W_FireShotgun(); | ||||
| 			self.attack_finished = time + 0.5; | ||||
| 	} else if(self.weapon == IT_SUPER_SHOTGUN) { | ||||
| 			break; | ||||
| 		case IT_SUPER_SHOTGUN: | ||||
| 			player_shot1(); | ||||
| 			W_FireSuperShotgun(); | ||||
| 			self.attack_finished = time + 0.7; | ||||
| 	} else if(self.weapon == IT_NAILGUN) { | ||||
| 			break; | ||||
| 		case IT_NAILGUN: | ||||
| 		case IT_SUPER_NAILGUN: | ||||
| 			player_nail1(); | ||||
| 	} else if(self.weapon == IT_SUPER_NAILGUN) { | ||||
| 		player_nail1(); | ||||
| 	} else if(self.weapon == IT_GRENADE_LAUNCHER) { | ||||
| 			break; | ||||
| 		case IT_GRENADE_LAUNCHER: | ||||
| 			player_rocket1(); | ||||
| 			W_FireGrenade(); | ||||
| 			self.attack_finished = time + 0.6; | ||||
| 	} else if(self.weapon == IT_ROCKET_LAUNCHER) { | ||||
| 			break; | ||||
| 		case IT_ROCKET_LAUNCHER: | ||||
| 			player_rocket1(); | ||||
| 			W_FireRocket(); | ||||
| 			self.attack_finished = time + 0.8; | ||||
| 	} else if(self.weapon == IT_LIGHTNING) { | ||||
| 			break; | ||||
| 		case IT_LIGHTNING: | ||||
| 			player_light1(); | ||||
| 			self.attack_finished = time + 0.1; | ||||
| 			sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM); | ||||
| 			break; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
|  | @ -971,13 +963,14 @@ void() W_CycleWeapon = { | |||
| 					am = 1; | ||||
| 				} | ||||
| 				break; | ||||
| 			default: | ||||
| 				return; | ||||
| 		} | ||||
| 		if((it & self.weapon) && am == 0) { | ||||
| 			W_SetCurrentAmmo(); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| /* | ||||
|  | @ -1040,13 +1033,14 @@ void() W_CycleWeaponReverse = { | |||
| 					am = 1; | ||||
| 				} | ||||
| 				break; | ||||
| 			default: | ||||
| 				return; | ||||
| 		} | ||||
| 		if((it & self.weapon) && am == 0) { | ||||
| 			W_SetCurrentAmmo(); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| /* | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user