/////////////////////////////////////////////////////////////////////////////////////////////////
//
//	routines for handling monster paths that are hardcoded into levels
//
/////////////////////////////////////////////////////////////////////////////////////////////////

#include "world.h"
#include "skat.h"
#include "nodelist.h"
#include "ai_move.h"
#include "misc.h"

////////////////////////////////////////////////////////////////////////////////
// exports
////////////////////////////////////////////////////////////////////////////////

DllExport	void	monster_path_corner (userEntity_t *self);

////////////////////////////////////////////////////////////////////////////////
// defines
////////////////////////////////////////////////////////////////////////////////

void	monster_path_corner (userEntity_t *self)
{
	mpathHook_t	*hook;
	int			i;

	self->userHook = com->malloc_hook (sizeof (mpathHook_t), MEM_HUNK);
	hook = (mpathHook_t *) self->userHook;

	for (i=0; self->epair [i].key != NULL; i++)
	{
		// targets
		if (!stricmp (self->epair [i].key, "target1") || !stricmp (self->epair [i].key, "target"))
		{
			self->target = self->epair [i].value;
			hook->target [0] = self->epair [i].value;
		}
		else if (!stricmp (self->epair [i].key, "target2"))
			hook->target [1] = self->epair [i].value;
		else if (!stricmp (self->epair [i].key, "target3"))
			hook->target [2] = self->epair [i].value;
		else if (!stricmp (self->epair [i].key, "target4"))
			hook->target [3] = self->epair [i].value;
		
		// actions
		else if (!stricmp (self->epair [i].key, "action1"))
			hook->action [0] = self->epair [i].value;
		else if (!stricmp (self->epair [i].key, "action2"))
			hook->action [1] = self->epair [i].value; 
		else if (!stricmp (self->epair [i].key, "action3"))
			hook->action [2] = self->epair [i].value;	
		else if (!stricmp (self->epair [i].key, "action4"))
			hook->action [3] = self->epair [i].value;

		else if (!stricmp (self->epair [i].key, "targetname"))
			self->targetname = self->epair [i].value;	
	}		

	self->className = "monster_path_corner";

	// show us the path corner for now
//	gstate->SetModel (self, "models/curnode.mdl");
	self->movetype = MOVETYPE_NONE;
	self->solid = SOLID_NOT;
	gstate->SetSize (self, 0, 0, 0, 0, 0, 0);
	gstate->SetOrigin2 (self, self->s.origin);
}