예제 #1
0
static void entityWait()
{
	int i;

	checkToMap(self);

	if (self->flags & ON_GROUND)
	{
		if (self->active == TRUE)
		{
			self->touch = &touch;

			self->activate = &activate;
		}

		if (self->mental == 0)
		{
			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);

			fadeBossMusic();

			for (i=0;i<20;i++)
			{
				addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust");
			}

			playSoundToMap("sound/enemy/red_grub/thud", BOSS_CHANNEL, self->x, self->y, 0);

			self->mental = 1;
		}
	}
}
예제 #2
0
static void dieFinish()
{
	if (self->thinkTime > 0)
	{
		self->thinkTime--;

		setCustomAction(self, &invulnerableNoFlash, 240, 0, 0);

		if (self->thinkTime <= 0)
		{
			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);
		}
	}

	if (self->endY == 1)
	{
		setEntityAnimation(self, "STAND");

		self->thinkTime = 60;

		facePlayer();

		self->action = &finalAttack;
	}

	checkToMap(self);
}
예제 #3
0
static void soulTouch(Entity *other)
{
	if (self->health == 1 && other->type == PLAYER)
	{
		if (self->target != NULL)
		{
			self->target->inUse = FALSE;
		}

		keyItemTouch(other);
	}

	else if (self->health == 1 && strcmpignorecase(other->name, "enemy/spirit") == 0)
	{
		self->touch = NULL;

		self->action = &bottleFill;

		self->activate = NULL;

		fireTrigger(other->objectiveName);

		other->target = self;

		other->action = other->die;

		self->mental = 11;

		playSoundToMap("sound/enemy/spirit/spirit_explode", -1, self->x, self->y, 0);

		self->endX = playSoundToMap("sound/enemy/spirit/spirit_scream", -1, self->x, self->y, 0);
	}
}
예제 #4
0
static void activate(int val)
{
	if (self->active == FALSE)
	{
		if (removeInventoryItemByObjectiveName(self->requires) == TRUE)
		{
			self->active = TRUE;

			self->thinkTime = 60;

			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);

			setEntityAnimation(self, "WALK");

			self->action = &sink;

			setInfoBoxMessage(60, 255, 255, 255, _("Used %s"), _(self->requires));
		}

		else
		{
			setInfoBoxMessage(60, 255, 255, 255, _("%s is required"), _(self->requires));
		}
	}
}
예제 #5
0
파일: entity.c 프로젝트: revcozmo/edgar
void entityDieNoDrop()
{
	self->damage = 0;

	self->health = 0;

	if (!(self->flags & INVULNERABLE))
	{
		self->flags &= ~FLY;

		self->weight = fabs(self->originalWeight);

		self->flags |= DO_NOT_PERSIST;

		self->thinkTime = 60;

		setCustomAction(self, &invulnerable, 240, 0, 0);

		self->frameSpeed = 0;

		self->action = &noItemDie;

		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);
	}
}
예제 #6
0
void addRequiredToInventory(Entity *other)
{
	Entity *item;

	if (!(self->flags & INVULNERABLE) && other->type == PLAYER)
	{
		item = getInventoryItemByObjectiveName(self->requires);

		if (item != NULL)
		{
			item->health++;

			self->inUse = FALSE;

			setInfoBoxMessage(60, 255, 255, 255, _("Picked up %s"), _(self->objectiveName));

			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);
		}

		else
		{
			setInfoBoxMessage(60, 255, 255, 255, _("%s is required to carry this item"), _(self->requires));
		}
	}
}
예제 #7
0
파일: entity.c 프로젝트: revcozmo/edgar
void entityDieVanish()
{
	fireTrigger(self->objectiveName);

	fireGlobalTrigger(self->objectiveName);

	self->inUse = FALSE;
}
예제 #8
0
파일: pedestal.c 프로젝트: LibreGames/edgar
static void validate()
{
	int allStatues, orderCorrect;
	EntityList *list = getEntitiesByName(self->name);
	EntityList *l;
	Entity *e;

	allStatues = TRUE;

	orderCorrect = TRUE;

	for (l=list->next;l!=NULL;l=l->next)
	{
		e = l->entity;

		if (e->target == NULL)
		{
			allStatues = FALSE;

			break;
		}

		else if (strcmpignorecase(e->requires, e->target->objectiveName) != 0)
		{
			orderCorrect = FALSE;
		}
	}

	if (allStatues == TRUE)
	{
		if (orderCorrect == TRUE)
		{
			for (l=list->next;l!=NULL;l=l->next)
			{
				e = l->entity;

				e->active = FALSE;

				e->activate = NULL;
			}

			fireTrigger(self->name);

			fireGlobalTrigger(self->name);

			addMedal("occult");
		}

		else
		{
			runScript("wrong_order");
		}
	}

	freeEntityList(list);
}
예제 #9
0
static void die()
{
	int i;
	Entity *e;

	if (strcmpignorecase(self->name, "item/horizontal_glass_wall") == 0)
	{
		for (i=0;i<7;i++)
		{
			e = addTemporaryItem("item/horizontal_glass_wall_piece", self->x, self->y, RIGHT, 0, 0);

			e->x += self->w / 2 - e->w / 2;
			e->y += self->h / 2 - e->h / 2;

			e->dirX = (prand() % 10) * (prand() % 2 == 0 ? -1 : 1);
			e->dirY = ITEM_JUMP_HEIGHT + (prand() % ITEM_JUMP_HEIGHT);

			setEntityAnimationByID(e, i);

			e->thinkTime = 60 + (prand() % 60);
		}

		self->flags |= NO_DRAW;

		self->touch = NULL;

		self->action = &respawnWait;

		self->thinkTime = 300;
	}

	else
	{
		for (i=0;i<7;i++)
		{
			e = addTemporaryItem("item/glass_wall_piece", self->x, self->y, RIGHT, 0, 0);

			e->x += self->w / 2 - e->w / 2;
			e->y += self->h / 2 - e->h / 2;

			e->dirX = (prand() % 10) * (prand() % 2 == 0 ? -1 : 1);
			e->dirY = ITEM_JUMP_HEIGHT + (prand() % ITEM_JUMP_HEIGHT);

			setEntityAnimationByID(e, i);

			e->thinkTime = 60 + (prand() % 60);
		}

		self->inUse = FALSE;

		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);
	}
}
예제 #10
0
static void die()
{
	int i;
	Entity *e;
	char name[MAX_VALUE_LENGTH];

	playSoundToMap("sound/common/crumble", -1, self->x, self->y, 0);

	snprintf(name, sizeof(name), "%s_piece", self->name);

	fireTrigger(self->objectiveName);

	fireGlobalTrigger(self->objectiveName);

	for (i=0;i<9;i++)
	{
		e = addTemporaryItem(name, self->x, self->y, self->face, 0, 0);

		e->x += (self->w - e->w) / 2;
		e->y += (self->w - e->w) / 2;

		e->dirX = (prand() % 5) * (prand() % 2 == 0 ? -1 : 1);
		e->dirY = ITEM_JUMP_HEIGHT + (prand() % ITEM_JUMP_HEIGHT);

		setEntityAnimationByID(e, i);

		e->thinkTime = 60 + (prand() % 180);
	}

	self->damage = 0;

	if (!(self->flags & INVULNERABLE))
	{
		self->touch = &entityTouch;

		self->flags &= ~FLY;

		self->flags |= (DO_NOT_PERSIST|NO_DRAW);

		self->thinkTime = 60;

		setCustomAction(self, &invulnerableNoFlash, 240, 0, 0);

		self->frameSpeed = 0;

		self->action = &standardDie;

		self->damage = 0;
	}
}
예제 #11
0
파일: sorceror_2.c 프로젝트: revcozmo/edgar
static void die()
{
	int i;
	long onGround;

	setEntityAnimation(self, "DIE");

	self->action = &die;

	self->damage = 0;

	self->flags &= ~FLY;

	onGround = self->flags & ON_GROUND;

	checkToMap(self);

	if (landedOnGround(onGround) == TRUE)
	{
		playSoundToMap("sound/enemy/red_grub/thud", BOSS_CHANNEL, self->x, self->y, 0);

		shakeScreen(LIGHT, 15);

		for (i=0;i<20;i++)
		{
			addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust");
		}

		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);

		self->die = &entityDieNoDrop;

		self->action = &dieWait;

		clearContinuePoint();

		increaseKillCount();

		freeBossHealthBar();

		fadeBossMusic();
	}
}
예제 #12
0
파일: entity.c 프로젝트: revcozmo/edgar
void noItemDie()
{
	if (self->flags & ON_GROUND)
	{
		self->dirX = self->standingOn != NULL ? self->standingOn->dirX : 0;
	}

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);

		self->inUse = FALSE;
	}

	checkToMap(self);
}
예제 #13
0
static void creeperTouch(Entity *other)
{
	if (other->type == PLAYER)
	{
		other->health = 0;

		other->flags |= NO_DRAW;

		other->fallout();

		self->mental = 2;

		self->thinkTime = 180;

		self->touch = &entityTouch;

		playSoundToMap("sound/enemy/whirlwind/suck", -1, self->x, self->y, 0);

		game.timesEaten++;

		if (game.timesEaten == 5)
		{
			addMedal("eaten_5");
		}

		self->mental = 1;
	}

	else if (other->head == NULL || (other->head != NULL && other->head != self))
	{
		playSoundToMap("sound/enemy/whirlwind/suck", -1, self->x, self->y, 0);

		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);

		other->inUse = FALSE;

		self->mental = 1;
	}
}
예제 #14
0
파일: entity.c 프로젝트: revcozmo/edgar
void standardDie()
{
	if (self->flags & ON_GROUND)
	{
		self->dirX = self->standingOn != NULL ? self->standingOn->dirX : 0;
	}

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);

		self->inUse = FALSE;

		dropRandomItem(self->x + self->w / 2, self->y);
	}

	checkToMap(self);
}
예제 #15
0
static void entityWait()
{
	checkToMap(self);

	if (self->health < 0)
	{
		if (self->active == TRUE)
		{
			self->health *= -1;

			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);

			playSoundToMap("sound/item/generator", -1, self->x, self->y, 0);

			setEntityAnimationByID(self, self->health);

			self->frameSpeed = 1;
		}
	}
}
예제 #16
0
static void activate(int val)
{
	if (self->active == FALSE && self->health > 0)
	{
		if (removeInventoryItemByObjectiveName(self->requires) == TRUE)
		{
			self->active = TRUE;

			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);

			playSoundToMap("sound/item/generator", -1, self->x, self->y, 0);

			setEntityAnimationByID(self, self->health);
		}

		else
		{
			setInfoBoxMessage(60, 255, 255, 255, _("%s is required"), _(self->requires));
		}
	}
}
예제 #17
0
static void readInputCode()
{
	int val;
	Entity *temp;

	if (self->target->mental == -3)
	{
		setPlayerLocked(FALSE);

		setInfoBoxMessage(60, 255, 255, 255, _("Complete"));

		self->action = &entityWait;

		self->touch = NULL;
		self->activate = NULL;

		fireTrigger(self->objectiveName);

		fireGlobalTrigger(self->objectiveName);

		return;
	}

	if (input.up == 1)
	{
		input.up = 0;

		val = 1;
	}

	else if (input.down == 1)
	{
		input.down = 0;

		val = 2;
	}

	else if (input.left == 1)
	{
		input.left = 0;

		val = 3;
	}

	else if (input.right == 1)
	{
		input.right = 0;

		val = 4;
	}

	else if (input.attack == 1)
	{
		input.attack = 0;

		val = 5;
	}

	else if (input.interact == 1)
	{
		input.interact = 0;

		val = 6;
	}

	else
	{
		val = -1;
	}

	if (val == 6)
	{
		setPlayerLocked(FALSE);

		self->action = &entityWait;

		self->touch = &touch;
		self->activate = &activate;
	}

	else if (val != -1 && self->target->activate != NULL)
	{
		temp = self;

		self = self->target;

		self->activate(val);

		self = temp;
	}
}
예제 #18
0
static void takeDamage(Entity *other, int damage)
{
	Entity *e, *temp;

	if (!(self->flags & INVULNERABLE))
	{
		if (strcmpignorecase(other->name, "weapon/pickaxe") == 0)
		{
			self->health--;

			if (self->health > 0)
			{
				setCustomAction(self, &flashWhite, 6, 0, 0);
			}

			else
			{
				self->health = 0;

				self->touch = NULL;

				e = addPermanentItem("item/purple_gem", self->x + self->w / 2, self->y);

				e->dirX = other->face == LEFT ? -6 : 6;

				e->dirY = ITEM_JUMP_HEIGHT;

				self->active = FALSE;

				setEntityAnimation(self, "WALK");

				fireTrigger(self->objectiveName);

				self->mental = 15;
			}
		}

		else
		{
			playSoundToMap("sound/common/dink", -1, self->x, self->y, 0);

			if (other->reactToBlock != NULL)
			{
				temp = self;

				self = other;

				self->reactToBlock(temp);

				self = temp;
			}

			damage = 0;

			if (other->type != PROJECTILE && prand() % 10 == 0)
			{
				setInfoBoxMessage(60, 255, 255, 255, _("This weapon is not having any effect..."));
			}
		}

		setCustomAction(self, &invulnerableNoFlash, HIT_INVULNERABLE_TIME, 0, 0);
	}
}
예제 #19
0
int addToInventory(Entity *e)
{
	int i, found;
	Entity *temp;

	found = FALSE;

	if (e->flags & STACKABLE)
	{
		for (i=0;i<MAX_INVENTORY_ITEMS;i++)
		{
			if (strcmpignorecase(inventory.item[i].objectiveName, e->objectiveName) == 0 && inventory.item[i].inUse == TRUE)
			{
				if (inventory.item[i].health < MAX_STACKABLES)
				{
					inventory.item[i].health += (e->health == 0 ? 1 : e->health);

					if (inventory.item[i].health > MAX_STACKABLES)
					{
						inventory.item[i].health = MAX_STACKABLES;
					}

					found = TRUE;

					break;
				}

				else
				{
					setInfoBoxMessage(0, 255, 255, 255, _("Cannot carry any more %s"), _(inventory.item[i].objectiveName));

					return FALSE;
				}
			}
		}
	}

	if (found == FALSE)
	{
		for (i=0;i<MAX_INVENTORY_ITEMS;i++)
		{
			if (inventory.item[i].inUse == FALSE)
			{
				if (e->action == &generalItemAction)
				{
					e->action = &doNothing;
				}

				if (strcmpignorecase(e->name, "item/safe_combination") == 0)
				{
					temp = self;

					self = e;

					self->activate(1);

					self = temp;
				}

				e->flags &= ~DO_NOT_PERSIST;

				inventory.item[i] = *e;

				inventory.item[i].face = RIGHT;

				inventory.item[i].thinkTime = 0;

				setEntityAnimationByID(&inventory.item[i], 0);

				if (inventory.item[i].type == WEAPON)
				{
					if (strcmpignorecase(inventory.item[i].name, "weapon/bow") == 0)
					{
						inventory.hasBow = TRUE;
					}

					else if (strcmpignorecase(inventory.item[i].name, "weapon/lightning_sword") == 0)
					{
						inventory.hasLightningSword = TRUE;
					}

					else if (strcmpignorecase(inventory.item[i].name, "weapon/lightning_sword_empty") == 0)
					{
						inventory.hasLightningSword = TRUE;
					}

					if (strcmpignorecase(inventory.item[i].name, "weapon/normal_arrow") != 0 &&
						strcmpignorecase(inventory.item[i].name, "weapon/flaming_arrow") != 0)
					{
						autoSetPlayerWeapon(&inventory.item[i]);
					}
				}

				else if (inventory.item[i].type == SHIELD)
				{
					if (strcmpignorecase(inventory.item[i].name, "weapon/disintegration_shield") == 0)
					{
						switch (inventory.item[i].health)
						{
							case 1:
								loadProperties("weapon/disintegration_shield_1", &inventory.item[i]);
							break;

							case 2:
								loadProperties("weapon/disintegration_shield_2", &inventory.item[i]);
							break;

							case 3:
								loadProperties("weapon/disintegration_shield_3", &inventory.item[i]);
							break;

							case 4:
								loadProperties("weapon/disintegration_shield_4", &inventory.item[i]);
							break;

							default:
								loadProperties("weapon/disintegration_shield", &inventory.item[i]);
							break;
						}
					}

					autoSetPlayerShield(&inventory.item[i]);
				}

				if ((inventory.item[i].flags & STACKABLE) && inventory.item[i].health == 0)
				{
					inventory.item[i].health = 1;
				}

				found = TRUE;

				break;
			}
		}
	}

	if (found == TRUE)
	{
		if ((inventory.item[i].flags & STACKABLE) && e->health > 1)
		{
			setInfoBoxMessage(60, 255, 255, 255, _("Picked up %s x %d"), _(inventory.item[i].objectiveName), e->health);
		}

		else
		{
			setInfoBoxMessage(60, 255, 255, 255, _("Picked up %s"), _(inventory.item[i].objectiveName));
		}

		e->inUse = FALSE;

		fireTrigger(inventory.item[i].objectiveName);

		fireGlobalTrigger(inventory.item[i].objectiveName);
	}

	else
	{
		setInfoBoxMessage(0, 255, 255, 255, _("Cannot pick up %s. Inventory full"), _(e->objectiveName));

		return FALSE;
	}

	return found;
}
예제 #20
0
파일: chaos.c 프로젝트: polluks/edgar
static void dieWait()
{
	int i;
	Entity *e;

	self->thinkTime--;

	if (self->mental == 0)
	{
		self->x = self->startX + sin(DEG_TO_RAD(self->endX)) * 4;

		self->endX += 90;

		if (self->endX >= 360)
		{
			self->endX = 0;
		}
	}

	if (self->thinkTime <= 0)
	{
		if (self->mental == 0)
		{
			self->x = self->startX;

			self->layer = MID_GROUND_LAYER;

			setEntityAnimation(self, "DIE_2");

			shakeScreen(MEDIUM, 60);

			playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0);

			for (i=0;i<300;i++)
			{
				e = addSmoke(self->x + (prand() % self->w), self->y + self->h, "decoration/dust");

				if (e != NULL)
				{
					e->y -= prand() % e->h;
				}
			}

			self->mental = 1;

			self->thinkTime = 120;
		}

		else
		{
			fireTrigger(self->objectiveName);

			fireGlobalTrigger(self->objectiveName);

			clearContinuePoint();

			freeBossHealthBar();
		}
	}

	checkToMap(self);
}