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,50 +770,59 @@ 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) {
 | 
				
			||||||
		sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
 | 
							case IT_AXE:
 | 
				
			||||||
		r = random();
 | 
								sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
 | 
				
			||||||
		if(r < 0.25) {
 | 
								r = random();
 | 
				
			||||||
			player_axe1();
 | 
								if(r < 0.25) {
 | 
				
			||||||
		} else if(r < 0.5) {
 | 
									player_axe1();
 | 
				
			||||||
			player_axeb1();
 | 
								} else if(r < 0.5) {
 | 
				
			||||||
		} else if(r < 0.75) {
 | 
									player_axeb1();
 | 
				
			||||||
			player_axec1();
 | 
								} else if(r < 0.75) {
 | 
				
			||||||
		} else {
 | 
									player_axec1();
 | 
				
			||||||
			player_axed1();
 | 
								} else {
 | 
				
			||||||
		}
 | 
									player_axed1();
 | 
				
			||||||
		self.attack_finished = time + 0.5;
 | 
								}
 | 
				
			||||||
	} else if(self.weapon == IT_SHOTGUN) {
 | 
								self.attack_finished = time + 0.5;
 | 
				
			||||||
		player_shot1();
 | 
								break;
 | 
				
			||||||
		W_FireShotgun();
 | 
							case IT_SHOTGUN:
 | 
				
			||||||
		self.attack_finished = time + 0.5;
 | 
								player_shot1();
 | 
				
			||||||
	} else if(self.weapon == IT_SUPER_SHOTGUN) {
 | 
								W_FireShotgun();
 | 
				
			||||||
		player_shot1();
 | 
								self.attack_finished = time + 0.5;
 | 
				
			||||||
		W_FireSuperShotgun();
 | 
								break;
 | 
				
			||||||
		self.attack_finished = time + 0.7;
 | 
							case IT_SUPER_SHOTGUN:
 | 
				
			||||||
	} else if(self.weapon == IT_NAILGUN) {
 | 
								player_shot1();
 | 
				
			||||||
		player_nail1();
 | 
								W_FireSuperShotgun();
 | 
				
			||||||
	} else if(self.weapon == IT_SUPER_NAILGUN) {
 | 
								self.attack_finished = time + 0.7;
 | 
				
			||||||
		player_nail1();
 | 
								break;
 | 
				
			||||||
	} else if(self.weapon == IT_GRENADE_LAUNCHER) {
 | 
							case IT_NAILGUN:
 | 
				
			||||||
		player_rocket1();
 | 
							case IT_SUPER_NAILGUN:
 | 
				
			||||||
		W_FireGrenade();
 | 
								player_nail1();
 | 
				
			||||||
		self.attack_finished = time + 0.6;
 | 
								break;
 | 
				
			||||||
	} else if(self.weapon == IT_ROCKET_LAUNCHER) {
 | 
							case IT_GRENADE_LAUNCHER:
 | 
				
			||||||
		player_rocket1();
 | 
								player_rocket1();
 | 
				
			||||||
		W_FireRocket();
 | 
								W_FireGrenade();
 | 
				
			||||||
		self.attack_finished = time + 0.8;
 | 
								self.attack_finished = time + 0.6;
 | 
				
			||||||
	} else if(self.weapon == IT_LIGHTNING) {
 | 
								break;
 | 
				
			||||||
		player_light1();
 | 
							case IT_ROCKET_LAUNCHER:
 | 
				
			||||||
		self.attack_finished = time + 0.1;
 | 
								player_rocket1();
 | 
				
			||||||
		sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
 | 
								W_FireRocket();
 | 
				
			||||||
 | 
								self.attack_finished = time + 0.8;
 | 
				
			||||||
 | 
								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;
 | 
										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