int Egg_object::is_active ( Game_object *obj, int tx, int ty, int tz, int from_tx, int from_ty ) { if ((flags & (1 << (int) hatched)) && !(flags & (1 << (int) auto_reset))) return (0); Game_window *gwin = Game_window::get_game_window(); if (flags & (1 << (int) nocturnal)) { int hour = gwin->get_hour(); if (!(hour >= 9 || hour <= 5)) return (0); } if (cheat.in_map_editor()) return 0; Egg_criteria cri = (Egg_criteria) get_criteria();  int deltaz = tz - get_lift(); int absdeltaz = deltaz < 0 ? -deltaz : deltaz; switch (cri) { case cached_in: { if (obj != gwin->get_main_actor() || !area.has_point(tx, ty)) return 0; if (!(flags & (1 << (int) hatched))) return 1;   return !area.has_point(from_tx, from_ty); } case party_near: case avatar_near: if (type == teleport) return absdeltaz == 0 && area.has_point(tx, ty); if (!((absdeltaz <= 1 ||  (Game::get_game_type() == SERPENT_ISLE && type != missile) || (type == missile && tz/5 == get_lift()/5)) && area.has_point(tx, ty) && !area.has_point(from_tx, from_ty))) return 0; return (obj == gwin->get_main_actor() || (type == party_near && obj->get_party_id() >= 0)); case avatar_far: { if (obj != gwin->get_main_actor() || !area.has_point(tx, ty)) return (0); Rectangle inside(area.x + 1, area.y + 1, area.w - 2, area.h - 2); return inside.has_point(from_tx, from_ty) && !inside.has_point(tx, ty); } case avatar_footpad: return obj == gwin->get_main_actor() && deltaz == 0 && area.has_point(tx, ty); case party_footpad: return area.has_point(tx, ty) && deltaz == 0 && (obj->get_party_id() >= 0 || obj == gwin->get_main_actor()); case something_on: return obj != gwin->get_main_actor() &&  deltaz >= -1 && deltaz <= 3 && area.has_point(tx, ty) && obj->get_npc_num() <= 0; case external_criteria: default: return 0; } }
int is_active() const { return !(flags & (1 << (int) hatched)); }
int Egg_object::is_active	(	Game_object *obj,		// Object placed (or Actor).	int tx, int ty, int tz,		// Tile stepped onto.	int from_tx, int from_ty	// Tile stepped from.	)	{	if ((flags & (1 << (int) hatched)) &&			!(flags & (1 << (int) auto_reset)))		return (0);		// For now... Already hatched.	Game_window *gwin = Game_window::get_game_window();	if (flags & (1 << (int) nocturnal))		{			// Nocturnal.		int hour = gwin->get_hour();		if (!(hour >= 9 || hour <= 5))			return (0);	// It's not night.		}	if (cheat.in_map_editor())		return 0;		// Disable in map-editor.	Egg_criteria cri = (Egg_criteria) get_criteria();	int deltaz = tz - get_lift();	int absdeltaz = deltaz < 0 ? -deltaz : deltaz;	switch (cri)		{	case cached_in:			// Anywhere in square.		{		if (obj != gwin->get_main_actor() || !area.has_point(tx, ty))			return 0;	// Not in square.		if (!(flags & (1 << (int) hatched)))			return 1;	// First time.					// Must have autoreset.					// Just activate when reentering.		return !area.has_point(from_tx, from_ty);		}	case party_near:	case avatar_near:		// New tile is in, old is out.		if (type == teleport)	// Teleports:  Any tile, exact lift.			return absdeltaz == 0 && area.has_point(tx, ty);		if (!((absdeltaz <= 1 || 					// Using trial&error here:			 (Game::get_game_type() == SERPENT_ISLE &&						type != missile) ||				(type == missile && tz/5 == get_lift()/5)) &&			area.has_point(tx, ty) &&					!area.has_point(from_tx, from_ty)))			return 0;		return (obj == gwin->get_main_actor() ||		    (type == party_near && obj->get_party_id() >= 0));	case avatar_far:		// New tile is outside, old is inside.		{		if (obj != gwin->get_main_actor() || !area.has_point(tx, ty))			return (0);		Rectangle inside(area.x + 1, area.y + 1, 						area.w - 2, area.h - 2);		return inside.has_point(from_tx, from_ty) &&			!inside.has_point(tx, ty);		}	case avatar_footpad:		return obj == gwin->get_main_actor() && deltaz == 0 &&						area.has_point(tx, ty);	case party_footpad:		return area.has_point(tx, ty) && deltaz == 0 &&			(obj->get_party_id() >= 0 || 						obj == gwin->get_main_actor());	case something_on:		return obj != gwin->get_main_actor() && 					// Guessing.  At SI end, deltaz == -1.			deltaz >= -1 && deltaz <= 3 &&			area.has_point(tx, ty) && obj->get_npc_num() <= 0;	case external_criteria:	default:		return 0;		}	}