// Emacs style mode select	 -*- C++ -*- 
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This source is available for distribution and/or modification
// only under the terms of the DOOM Source Code License as
// published by id Software. All rights reserved.
//
// The source is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
// for more details.
//
// $Log:$
//
// DESCRIPTION:
//		Handling interactions (i.e., collisions).
//
//-----------------------------------------------------------------------------




// Data.
#include "doomdef.h"
#include "dstrings.h"

#include "doomstat.h"

#include "m_random.h"
#include "i_system.h"

#include "am_map.h"

#include "c_console.h"
#include "c_dispatch.h"

#include "p_local.h"

#include "s_sound.h"

#include "p_inter.h"
#include "p_lnspec.h"



#define BONUSADD		6




// a weapon is found with two clip loads,
// a big item has five clip loads
int 	maxammo[NUMAMMO] = {200, 50, 300, 50};
int 	clipammo[NUMAMMO] = {10, 4, 20, 1};


static void PickupMessage (AActor *toucher, const char *message)
{
	// Some maps have multiple items stacked on top of each other.
	// It looks odd to display pickup messages for all of them.
	static int lastmessagetic;
	static const char *lastmessage = NULL;

	if (toucher == players[consoleplayer].camera
		&& (lastmessagetic != gametic || lastmessage != message))
	{
		lastmessagetic = gametic;
		lastmessage = message;
		Printf (PRINT_LOW, "%s\n", message);
	}
}

//
// GET STUFF
//

//
// P_GiveAmmo (changed for csDoom)
// Num is the number of clip loads,
//

BOOL P_GiveAmmo (player_t *player, ammotype_t ammo, int num)
{
	int oldammo;
				
	if (ammo < 0 || ammo > NUMAMMO)
		I_Error ("P_GiveAmmo: bad type %i", ammo);
					
	oldammo = player->ammo[ammo];
	player->ammo[ammo] += num;	

	if (player->ammo[ammo] > player->maxammo[ammo])
		player->ammo[ammo] = player->maxammo[ammo];
		
	return true;
}


//
// P_GiveWeapon (changed for csDoom)
//
BOOL P_GiveWeapon (player_t *player, weapontype_t weapon, BOOL dropped)
{
	BOOL gaveweapon;

	// [RH] Don't get the weapon if no graphics for it
	state_t *state = states + weaponinfo[weapon].readystate;
	if ((state->frame & FF_FRAMEMASK) >= sprites[state->sprite].numframes)
		return false;

	if (player->weaponowned[weapon])
		gaveweapon = false;
	else
	{
		player->weaponowned[weapon] = true;
		gaveweapon = true;
	}
	
	return gaveweapon;
}

 

//
// P_GiveBody
// Returns false if the body isn't needed at all
//
BOOL P_GiveBody (player_t *player, int num)
{
	if (player->health >= MAXHEALTH)
		return false;
				
	player->health += num;
	if (player->health > MAXHEALTH)
		player->health = MAXHEALTH;
	player->mo->health = player->health;
		
	return true;
}



//
// P_GiveArmor
// Returns false if the armor is worse
// than the current armor.
//
BOOL P_GiveArmor (player_t *player, int armortype)
{
	int hits;
		
	hits = armortype*100;
	if (player->armorpoints >= hits)
		return false;	// don't pick up
				
	player->armortype = armortype;
	player->armorpoints = hits;
		
	return true;
}



//
// P_GiveCard
//
void P_GiveCard (player_t *player, card_t card)
{
	if (player->cards[card])
		return;
	
	player->bonuscount = BONUSADD;
	player->cards[card] = 1;
}


//
// P_GivePower
//
BOOL P_GivePower (player_t *player, int /*powertype_t*/ power)
{
	if (power == pw_invulnerability)
	{
		player->powers[power] = INVULNTICS;
		return true;
	}
	
	if (power == pw_invisibility)
	{
		player->powers[power] = INVISTICS;
		player->mo->flags |= MF_SHADOW;
		return true;
	}
	
	if (power == pw_infrared)
	{
		player->powers[power] = INFRATICS;
		return true;
	}
	
	if (power == pw_ironfeet)
	{
		player->powers[power] = IRONTICS;
		return true;
	}
	
	if (power == pw_strength)
	{
		P_GiveBody (player, 100);
		player->powers[power] = 1;
		return true;
	}
		
	if (player->powers[power])
		return false;	// already got it
				
	player->powers[power] = 1;
	return true;
}



//
// P_TouchSpecialThing
//
void P_TouchSpecialThing (spritenum_t sprite, AActor *toucher)
{
	player_t*	player;
	int 		i;
	int 		sound;
					
	sound = 0; 
	player = toucher->player;

	// DL - bugfix, player can sometimes be 0
	if(!player)
		return;

	// Identify by sprite.
	switch (sprite)
	{
		// armor
	  case SPR_ARM1:
		if (!P_GiveArmor (player, deh.GreenAC))
			return;
		PickupMessage (toucher, GOTARMOR);
		break;
				
	  case SPR_ARM2:
		if (!P_GiveArmor (player, deh.BlueAC))
			return;
		PickupMessage (toucher, GOTMEGA);
		break;
		
		// bonus items
	  case SPR_BON1:
		player->health++;				// can go over 100%
		if (player->health > deh.MaxSoulsphere)
			player->health = deh.MaxSoulsphere;
		player->mo->health = player->health;
		PickupMessage (toucher, GOTHTHBONUS);
		break;
		
	  case SPR_BON2:
		player->armorpoints++;			// can go over 100%
		if (player->armorpoints > deh.MaxArmor)
			player->armorpoints = deh.MaxArmor;
		if (!player->armortype)
			player->armortype = deh.GreenAC;
		PickupMessage (toucher, GOTARMBONUS);
		break;
		
	  case SPR_SOUL:
		player->health += deh.SoulsphereHealth;
		if (player->health > deh.MaxSoulsphere)
			player->health = deh.MaxSoulsphere;
		player->mo->health = player->health;
		PickupMessage (toucher, GOTSUPER);
		sound = 1;
		break;
		
	  case SPR_MEGA:
		player->health = deh.MegasphereHealth;
		player->mo->health = player->health;
		P_GiveArmor (player,deh.BlueAC);
		PickupMessage (toucher, GOTMSPHERE);
		sound = 1;
		break;
		
		// cards
		// leave cards for everyone
	  case SPR_BKEY:
		if (!player->cards[it_bluecard])
			PickupMessage (toucher, GOTBLUECARD);
		P_GiveCard (player, it_bluecard);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
	  case SPR_YKEY:
		if (!player->cards[it_yellowcard])
			PickupMessage (toucher, GOTYELWCARD);
		P_GiveCard (player, it_yellowcard);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
	  case SPR_RKEY:
		if (!player->cards[it_redcard])
			PickupMessage (toucher, GOTREDCARD);
		P_GiveCard (player, it_redcard);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
	  case SPR_BSKU:
		if (!player->cards[it_blueskull])
			PickupMessage (toucher, GOTBLUESKUL);
		P_GiveCard (player, it_blueskull);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
	  case SPR_YSKU:
		if (!player->cards[it_yellowskull])
			PickupMessage (toucher, GOTYELWSKUL);
		P_GiveCard (player, it_yellowskull);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
	  case SPR_RSKU:
		if (!player->cards[it_redskull])
			PickupMessage (toucher, GOTREDSKULL);
		P_GiveCard (player, it_redskull);
		sound = 3;
		if (!multiplayer)
			break;
		return;
		
		// medikits, heals
	  case SPR_STIM:
		if (!P_GiveBody (player, 10))
			return;
		PickupMessage (toucher, GOTSTIM);
		break;
		
	  case SPR_MEDI:
		if (!P_GiveBody (player, 25))
			return;

		if (player->health < 25)
			PickupMessage (toucher, GOTMEDINEED);
		else
			PickupMessage (toucher, GOTMEDIKIT);
		break;

		
		// power ups
	  case SPR_PINV:
		if (!P_GivePower (player, pw_invulnerability))
			return;
		PickupMessage (toucher, GOTINVUL);
		sound = 1;
		break;
		
	  case SPR_PSTR:
		if (!P_GivePower (player, pw_strength))
			return;
		PickupMessage (toucher, GOTBERSERK);
		sound = 1;
		break;
		
	  case SPR_PINS:
		if (!P_GivePower (player, pw_invisibility))
			return;
		PickupMessage (toucher, GOTINVIS);
		sound = 1;
		break;
		
	  case SPR_SUIT:
		if (!P_GivePower (player, pw_ironfeet))
			return;
		PickupMessage (toucher, GOTSUIT);
		sound = 1;
		break;
		
	  case SPR_PMAP:
		if (!P_GivePower (player, pw_allmap))
			return;
		PickupMessage (toucher, GOTMAP);
		sound = 1;
		break;
		
	  case SPR_PVIS:
		if (!P_GivePower (player, pw_infrared))
			return;
		PickupMessage (toucher, GOTVISOR);
		sound = 1;
		break;
		
		// ammo
	  case SPR_CLIP:
		PickupMessage (toucher, GOTCLIP);
		break;
		
	  case SPR_AMMO:
		PickupMessage (toucher, GOTCLIPBOX);
		break;
		
	  case SPR_ROCK:
		PickupMessage (toucher, GOTROCKET);
		break;
		
	  case SPR_BROK:
		PickupMessage (toucher, GOTROCKBOX);
		break;
		
	  case SPR_CELL:
		PickupMessage (toucher, GOTCELL);
		break;
		
	  case SPR_CELP:
		PickupMessage (toucher, GOTCELLBOX);
		break;
		
	  case SPR_SHEL:
		PickupMessage (toucher, GOTSHELLS);
		break;
		
	  case SPR_SBOX:
		PickupMessage (toucher, GOTSHELLBOX);
		break;
		
	  case SPR_BPAK:
		if (!player->backpack)
		{
			for (i=0 ; i<NUMAMMO ; i++)
				player->maxammo[i] *= 2;
			player->backpack = true;
		}
		PickupMessage (toucher, GOTBACKPACK);
		break;
		
		// weapons
	  case SPR_BFUG:
		if (!P_GiveWeapon (player, wp_bfg, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTBFG9000);
		sound = 2;		
		break;
		
	  case SPR_MGUN:
		if (!P_GiveWeapon (player, wp_chaingun, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTCHAINGUN);
		sound = 2;		
		break;
		
	  case SPR_CSAW:
		if (!P_GiveWeapon (player, wp_chainsaw, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTCHAINSAW);
		sound = 2;		
		break;
		
	  case SPR_LAUN:
		if (!P_GiveWeapon (player, wp_missile, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTLAUNCHER);
		sound = 2;		
		break;
		
	  case SPR_PLAS:
		if (!P_GiveWeapon (player, wp_plasma, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTPLASMA);
		sound = 2;		
		break;
		
	  case SPR_SHOT:
		if (!P_GiveWeapon (player, wp_shotgun, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTSHOTGUN);
		sound = 2;		
		break;
				
	  case SPR_SGN2:
		if (!P_GiveWeapon (player, wp_supershotgun, 0/*special->flags & MF_DROPPED*/))
			return;
		PickupMessage (toucher, GOTSHOTGUN2);
		sound = 2;		
		break;
				
	  default:
		I_Error ("P_SpecialThing: Unknown gettable thing. S=%d\n", sprite);
	}

/*
	// [RH] Execute an attached special (if any)
	if (special->special)
	{
		LineSpecials[special->special] (NULL, toucher, special->args[0],
			special->args[1], special->args[2], special->args[3], special->args[4]);
		special->special = 0;
	}

	if (special->flags & MF_COUNTITEM)
	{
		player->itemcount++;
		level.found_items++;
	}
	player->bonuscount = BONUSADD;

	{
		AActor *ent;

		if (player->mo == players[consoleplayer].camera)
			ent = NULL;
		else
			ent = player->mo;

		switch (sound) {
			case 0:
			case 3:
				S_Sound (ent, CHAN_ITEM, "misc/i_pkup", 1, ATTN_NORM);
				break;
			case 1:
				S_Sound (ent, CHAN_ITEM, "misc/p_pkup", 1,
					!ent ? ATTN_SURROUND : ATTN_NORM);
				break;
			case 2:
				S_Sound (ent, CHAN_ITEM, "misc/w_pkup", 1, ATTN_NORM);
				break;
		}
	}
*/
}


// [RH]
// SexMessage: Replace parts of strings with gender-specific pronouns
//
// The following expansions are performed:
//		%g -> he/she/it
//		%h -> him/her/it
//		%p -> his/her/its
//
void SexMessage (const char *from, char *to, int gender)
{
	static const char *genderstuff[3][3] = {
		{ "he",  "him", "his" },
		{ "she", "her", "her" },
		{ "it",  "it",  "its" }
	};
	static const int gendershift[3][3] = {
		{ 2, 3, 3 },
		{ 3, 3, 3 },
		{ 2, 2, 3 }
	};
	int gendermsg;

	do {
		if (*from != '%') {
			*to++ = *from;
		} else {
			switch (from[1]) {
				case 'g':	gendermsg = 0;	break;
				case 'h':	gendermsg = 1;	break;
				case 'p':	gendermsg = 2;	break;
				default:	gendermsg = -1;	break;
			}
			if (gendermsg < 0) {
				*to++ = '%';
			} else {
				strcpy (to, genderstuff[gender][gendermsg]);
				to += gendershift[gender][gendermsg];
				from++;
			}
		}
	} while (*from++);
}

// [RH]
// ClientObituary: Show a message when a player dies
//
void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker)
{
	int	 mod;
	char *message;
	char gendermessage[1024];
	BOOL friendly;
	int  gender;

	if (!self->player)
		return;

	gender = self->player->userinfo.gender;

	// Treat voodoo dolls as unknown deaths
	if (inflictor && inflictor->player == self->player)
		MeansOfDeath = MOD_UNKNOWN;

	if (multiplayer && !deathmatch.value)
		MeansOfDeath |= MOD_FRIENDLY_FIRE;

	player_t *cl; // changed - added
	cl = (player_t *)&players[consoleplayer];

	friendly = MeansOfDeath & MOD_FRIENDLY_FIRE;
	mod = MeansOfDeath & ~MOD_FRIENDLY_FIRE;
	message = NULL;

	switch (mod) {
		case MOD_SUICIDE:
			message = OB_SUICIDE;
			break;
		case MOD_FALLING:
			message = OB_FALLING;
			break;
		case MOD_CRUSH:
			message = OB_CRUSH;
			break;
		case MOD_EXIT:
			message = OB_EXIT;
			break;
		case MOD_WATER:
			message = OB_WATER;
			break;
		case MOD_SLIME:
			message = OB_SLIME;
			break;
		case MOD_LAVA:
			message = OB_LAVA;
			break;
		case MOD_BARREL:
			message = OB_BARREL;
			break;
		case MOD_SPLASH:
			message = OB_SPLASH;
			break;
	}

	if (attacker && !message) {
		if (attacker == self) {
			switch (mod) {
				case MOD_R_SPLASH:
					message = OB_R_SPLASH;
					break;
				case MOD_ROCKET:
					message = OB_ROCKET;
					break;
				default:
					message = OB_KILLEDSELF;
					break;
			}
		} else if (!attacker->player) {
			switch (attacker->type) {
				case MT_STEALTHBABY:
					message = OB_STEALTHBABY;
					break;
				case MT_STEALTHVILE:
					message = OB_STEALTHVILE;
					break;
				case MT_STEALTHBRUISER:
					message = OB_STEALTHBARON;
					break;
				case MT_STEALTHHEAD:
					message = OB_STEALTHCACO;
					break;
				case MT_STEALTHCHAINGUY:
					message = OB_STEALTHCHAINGUY;
					break;
				case MT_STEALTHSERGEANT:
					message = OB_STEALTHDEMON;
					break;
				case MT_STEALTHKNIGHT:
					message = OB_STEALTHKNIGHT;
					break;
				case MT_STEALTHIMP:
					message = OB_STEALTHIMP;
					break;
				case MT_STEALTHFATSO:
					message = OB_STEALTHFATSO;
					break;
				case MT_STEALTHUNDEAD:
					message = OB_STEALTHUNDEAD;
					break;
				case MT_STEALTHSHOTGUY:
					message = OB_STEALTHSHOTGUY;
					break;
				case MT_STEALTHZOMBIE:
					message = OB_STEALTHZOMBIE;
					break;
				default:
					if (mod == MOD_HIT) {
						switch (attacker->type) {
							case MT_UNDEAD:
								message = OB_UNDEADHIT;
								break;
							case MT_TROOP:
								message = OB_IMPHIT;
								break;
							case MT_HEAD:
								message = OB_CACOHIT;
								break;
							case MT_SERGEANT:
								message = OB_DEMONHIT;
								break;
							case MT_SHADOWS:
								message = OB_SPECTREHIT;
								break;
							case MT_BRUISER:
								message = OB_BARONHIT;
								break;
							case MT_KNIGHT:
								message = OB_KNIGHTHIT;
								break;
							default:
								break;
						}
					} else {
						switch (attacker->type) {
							case MT_POSSESSED:
								message = OB_ZOMBIE;
								break;
							case MT_SHOTGUY:
								message = OB_SHOTGUY;
								break;
							case MT_VILE:
								message = OB_VILE;
								break;
							case MT_UNDEAD:
								message = OB_UNDEAD;
								break;
							case MT_FATSO:
								message = OB_FATSO;
								break;
							case MT_CHAINGUY:
								message = OB_CHAINGUY;
								break;
							case MT_SKULL:
								message = OB_SKULL;
								break;
							case MT_TROOP:
								message = OB_IMP;
								break;
							case MT_HEAD:
								message = OB_CACO;
								break;
							case MT_BRUISER:
								message = OB_BARON;
								break;
							case MT_KNIGHT:
								message = OB_KNIGHT;
								break;
							case MT_SPIDER:
								message = OB_SPIDER;
								break;
							case MT_BABY:
								message = OB_BABY;
								break;
							case MT_CYBORG:
								message = OB_CYBORG;
								break;
							case MT_WOLFSS:
								message = OB_WOLFSS;
								break;
							default:
								break;
						}
					}
					break;
			}
		}
	}

	if (message) {
		SexMessage (message, gendermessage, gender);
		Printf (PRINT_MEDIUM, "%s %s.\n", self->player->userinfo.netname, gendermessage);

		if(!attacker)C_MidPrint (gendermessage);
		else if(cl == attacker->player)C_MidPrint (gendermessage); // changed - added

		return;
	}

	if (attacker && attacker->player) {
		if (friendly) {
			int rnum = P_Random (pr_obituary);

			attacker->player->fragcount -= 2;
			attacker->player->frags[attacker->player - players]++;
			self = attacker;
			gender = self->player->userinfo.gender;

			if (rnum < 64)
				message = OB_FRIENDLY1;
			else if (rnum < 128)
				message = OB_FRIENDLY2;
			else if (rnum < 192)
				message = OB_FRIENDLY3;
			else
				message = OB_FRIENDLY4;
		} else {
			switch (mod) {
				case MOD_FIST:
					message = OB_MPFIST;
					break;
				case MOD_CHAINSAW:
					message = OB_MPCHAINSAW;
					break;
				case MOD_PISTOL:
					message = OB_MPPISTOL;
					break;
				case MOD_SHOTGUN:
					message = OB_MPSHOTGUN;
					break;
				case MOD_SSHOTGUN:
					message = OB_MPSSHOTGUN;
					break;
				case MOD_CHAINGUN:
					message = OB_MPCHAINGUN;
					break;
				case MOD_ROCKET:
					message = OB_MPROCKET;
					break;
				case MOD_R_SPLASH:
					message = OB_MPR_SPLASH;
					break;
				case MOD_PLASMARIFLE:
					message = OB_MPPLASMARIFLE;
					break;
				case MOD_BFG_BOOM:
					message = OB_MPBFG_BOOM;
					break;
				case MOD_BFG_SPLASH:
					message = OB_MPBFG_SPLASH;
					break;
				case MOD_TELEFRAG:
					message = OB_MPTELEFRAG;
					break;
				case MOD_RAILGUN:
					message = OB_RAILGUN;
					break;
			}
		}
	}

	if (message) {
		char work[256];

		SexMessage (message, gendermessage, gender);
		sprintf (work, "%%s %s\n", gendermessage);
		Printf (PRINT_MEDIUM, work, self->player->userinfo.netname,
				attacker->player->userinfo.netname);

		char full[456]; // changed - added

		if(cl == attacker->player)
			{
			sprintf(full, "You killed %s!", self->player->userinfo.netname);
			C_MidPrint (full); // changed - added
			}
		if(cl == self->player)
			{
			sprintf(full, "%s killed You!", attacker->player->userinfo.netname);
			C_MidPrint (full); // changed - added
			}

		return;
	}

	SexMessage (OB_DEFAULT, gendermessage, gender);
	Printf (PRINT_MEDIUM, "%s %s.\n", self->player->userinfo.netname, gendermessage);

	if(attacker)if(cl == self->player)C_MidPrint("You died");
}


//
// KillMobj
//
EXTERN_CVAR (fraglimit)

void A_PlayerScream(AActor*);

EXTERN_CVAR (am_overlay)

void P_KillMobj (AActor *source, AActor *target, AActor *inflictor)
{
//	AActor *mo;
		
	target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY);

	if (target->type != MT_SKULL)
		target->flags &= ~MF_NOGRAVITY;

	target->flags |= MF_CORPSE|MF_DROPOFF;
	target->flags2 &= ~MF2_PASSMOBJ;
	target->height >>= 2;

	// [RH] If the thing has a special, execute and remove it
	//		Note that the thing that killed it is considered
	//		the activator of the script.
	if ((target->flags & MF_COUNTKILL) && target->special)
	{
		LineSpecials[target->special] (NULL, source, target->args[0],
									   target->args[1], target->args[2],
									   target->args[3], target->args[4]);
		target->special = 0;
	}
	// [RH] Also set the thing's tid to 0. [why?]
	target->tid = 0;
	
	if (target->player)
	{
		// [NightFang] - Added this, thought it would be cooler
		// [Fly] - No, it's not cooler
		// target->player->cheats = CF_CHASECAM;
		
		// [RH] Force a delay between death and respawn
		target->player->respawn_time = level.time + TICRATE;
						
		target->flags &= ~MF_SOLID;
		target->player->playerstate = PST_DEAD;
		P_DropWeapon (target->player);

		if (target == players[consoleplayer].camera && automapactive)
		{
			// don't die in auto map, switch view prior to dying - changed - die in automap if overlay
			if(!am_overlay.value)AM_Stop ();
		}
	}

	if (target->health < -target->info->spawnhealth 
		&& target->info->xdeathstate)
	{
		P_SetMobjState (target, target->info->xdeathstate);
	}
	else
		P_SetMobjState (target, target->info->deathstate);
	target->tics -= P_Random (pr_killmobj) & 3;

	if (target->tics < 1)
		target->tics = 1;
				
	// [RH] Death messages
	if (target->player && level.time)
		ClientObituary (target, inflictor, source);

/*
	// Drop stuff.
	// This determines the kind of object spawned
	// during the death frame of a thing.
	mobjtype_t item = (mobjtype_t)0;

	switch (target->type)
	{
	case MT_WOLFSS:
	case MT_POSSESSED:
		item = MT_CLIP;
		break;
		
	case MT_SHOTGUY:
		item = MT_SHOTGUN;
		break;
		
	case MT_CHAINGUY:
		item = MT_CHAINGUN;
		break;		

	default:
		return;
	}

	if (!item)
		return; //Happens if bot or player killed when using fists.
	mo = new AActor (target->x, target->y, ONFLOORZ, item);
	mo->flags |= MF_DROPPED;	// special versions of items
*/
}




//
// P_DamageMobj
// Damages both enemies and players
// "inflictor" is the thing that caused the damage
//	creature or missile, can be NULL (slime, etc)
// "source" is the thing to target after taking damage
//	creature or NULL
// Source and inflictor are the same for melee attacks.
// Source can be NULL for slime, barrel explosions
// and other environmental stuff.
//
int MeansOfDeath;

void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int mod, int flags)
{
}

BOOL CheckCheatmode (void);

BEGIN_COMMAND (kill)
{
	if (argc > 1 && !stricmp (argv[1], "monsters"))
	{
		// Kill all the monsters
		if (CheckCheatmode ())
			return;

		Net_WriteByte (DEM_GENERICCHEAT);
		Net_WriteByte (CHT_MASSACRE);
	}
	else
	{
		// Kill the player
		Net_WriteByte (DEM_SUICIDE);
	}
	C_HideConsole ();
}
END_COMMAND (kill)
