Ejemplo n.º 1
0
static void dieWait()
{
	Entity *e;

	self->thinkTime--;

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

		freeBossHealthBar();

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

		e->x -= e->w;

		e->dirY = ITEM_JUMP_HEIGHT;

		self->action = &entityDieVanish;

		fadeBossMusic();

		player.alpha = 255;
	}
}
Ejemplo n.º 2
0
static void appleWait()
{
	Entity *e;

	self->thinkTime--;

	if (self->thinkTime <= 0)
	{
		self->x += self->dirX;

		if (abs(self->startX - self->x) > 1)
		{
			self->dirX *= -1;
		}

		self->thinkTime = 20;
	}

	if (self->mental > self->head->mental)
	{
		e = addKeyItem("item/apple", self->x, self->y);

		e->dirX = 10 + prand() % 10;

		e->dirX *= prand() % 2 == 0 ? -0.1 : 0.1;

		e->dirY = -10;

		self->inUse = FALSE;
	}
}
Ejemplo n.º 3
0
void KeyEditForm::slotAddClicked()
{
    KeyGrabDialog *d = new KeyGrabDialog( this );
    if( d->exec() == KeyGrabDialog::Accepted )
    {
        QString keystr = d->getKeyStr();
        if( !keystr.isEmpty() )
        {
            addKeyItem( keystr );
        }
    }
    delete d;
}
Ejemplo n.º 4
0
static void dieWait()
{
	Entity *e;

	clearContinuePoint();

	increaseKillCount();

	freeBossHealthBar();

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

	e->dirY = ITEM_JUMP_HEIGHT;

	fadeBossMusic();

	entityDieVanish();
}
Ejemplo n.º 5
0
static void die()
{
	Entity *e;

	if (prand() % 3 == 0)
	{
		e = addKeyItem("item/spike_ball", self->x + self->w / 2, self->y);

		e->x -= e->w / 2;

		e->action = &generalItemAction;

		e->flags |= DO_NOT_PERSIST;
	}

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

	entityDie();
}
Ejemplo n.º 6
0
static void entityWait()
{
	Entity *e;

	if (self->damage == 0)
	{
		self->thinkTime--;

		self->flags &= ~FLY;

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

			freeBossHealthBar();

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

			e->y -= e->h;

			e->dirY = ITEM_JUMP_HEIGHT;

			fadeBossMusic();

			entityDieVanish();
		}
	}

	else if (self->damage == self->mental && self->health == self->maxHealth)
	{
		self->targetY--;

		if (self->targetY <= 0)
		{
			self->targetY = 0;
		}
	}

	checkToMap(self);
}
Ejemplo n.º 7
0
static void activate(int val)
{
	Entity *e;

	if (getInventoryItemByObjectiveName(self->requires) != NULL)
	{
		e = addKeyItem(self->objectiveName, 0, 0);

		replaceInventoryItem(self->requires, e);

		playSoundToMap("sound/item/fill_potion", EDGAR_CHANNEL, self->x, self->y, 0);

		setInfoBoxMessage(60, 255, 255, 255, _("Obtained %s"), _(e->objectiveName));

		e->inUse = FALSE;
	}

	else
	{
		setInfoBoxMessage(60, 255, 255, 255, _("%s is required"), _(self->requires));
	}
}
Ejemplo n.º 8
0
static void dieFinish()
{
	Entity *e;

	self->thinkTime--;

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

		increaseKillCount();

		freeBossHealthBar();

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

		e->dirY = ITEM_JUMP_HEIGHT;

		fadeBossMusic();

		entityDieNoDrop();
	}
}
Ejemplo n.º 9
0
static void dieWait()
{
    Entity *e;

    checkToMap(self);

    self->thinkTime--;

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

        increaseKillCount();

        freeBossHealthBar();

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

        e->dirY = ITEM_JUMP_HEIGHT;

        entityDieNoDrop();

        e = self;

        self = self->target;

        while (self != NULL)
        {
            self->die();

            self = self->target;
        }

        self = e;
    }
}
Ejemplo n.º 10
0
Entity *addEntityFromResource(char *type, char *name, int startX, int startY)
{
	Entity *e = NULL;

	if (strcmpignorecase(type, "ITEM") == 0 || strcmpignorecase(type, "SHIELD") == 0 || strcmpignorecase(type, "WEAPON") == 0)
	{
		e = addPermanentItem(name, startX, startY);
	}

	else if (strcmpignorecase(type, "TEMP_ITEM") == 0 || strcmpignorecase(type, "HEALTH") == 0)
	{
		e = addTemporaryItem(name, startX, startY, LEFT, 0, 0);
	}

	else if (strcmpignorecase(type, "PLAYER") == 0)
	{
		e = loadPlayer(startX, startY, NULL);
	}

	else if (strcmpignorecase(type, "PLAYER_WEAPON") == 0)
	{
		setPlayerWeaponName(name);
	}

	else if (strcmpignorecase(type, "PLAYER_SHIELD") == 0)
	{
		setPlayerShieldName(name);
	}

	else if (strcmpignorecase(type, "KEY_ITEM") == 0)
	{
		e = addKeyItem(name, startX, startY);
	}

	else if (strcmpignorecase(type, "ENEMY") == 0)
	{
		e = addEnemy(name, startX, startY);
	}

	else if (strcmpignorecase(type, "NPC") == 0)
	{
		e = addNPC(name, startX, startY);
	}

	else if (strcmpignorecase(type, "AUTO_LIFT") == 0 || strcmpignorecase(type, "MANUAL_LIFT") == 0)
	{
		e = addLift(name, startX, startY, getEntityTypeByName(type));
	}

	else if (strcmpignorecase(type, "SPAWNER") == 0)
	{
		e = addSpawner(startX, startY, name);
	}

	else if (strcmpignorecase(type, "TARGET") == 0)
	{
		addTarget(startX, startY, name);
	}

	else if (strcmpignorecase(type, "PRESSURE_PLATE") == 0)
	{
		e = addPressurePlate(name, startX, startY);
	}

	else if (strcmpignorecase(type, "TELEPORTER") == 0)
	{
		e = addTeleporter(name, startX, startY);
	}

	else if (strcmpignorecase(type, "AUTO_DOOR") == 0 || strcmpignorecase(type, "MANUAL_DOOR") == 0)
	{
		e = addDoor(name, startX, startY, getEntityTypeByName(type));
	}

	else if (strcmpignorecase(type, "WEAK_WALL") == 0)
	{
		e = addWeakWall(name, startX, startY);
	}

	else if (strcmpignorecase(type, "TRAP_DOOR") == 0)
	{
		e = addTrapDoor(name, startX, startY);
	}

	else if (strcmpignorecase(type, "CONVEYOR_BELT") == 0)
	{
		e = addConveyorBelt(name, startX, startY);
	}

	else if (strcmpignorecase(type, "SWITCH") == 0)
	{
		e = addSwitch(name, startX, startY);
	}

	else if (strcmpignorecase(type, "SCRIPT_LINE_DEF") == 0 || strcmpignorecase(type, "LINE_DEF") == 0)
	{
		e = addLineDef(type, name, startX, startY);
	}

	else if (strcmpignorecase(type, "LEVEL_EXIT") == 0)
	{
		e = addLevelExit(name, startX, startY);
	}

	else if (strcmpignorecase(type, "SAVE_POINT") == 0)
	{
		/* Save points don't spawn for replays */

		if (game.gameType == NORMAL)
		{
			e = addSavePoint(startX, startY);
		}
	}

	else if (strcmpignorecase(type, "TRIGGER") == 0)
	{
		addTriggerFromResource(key, value);
	}

	else if (strcmpignorecase(type, "GLOBAL_TRIGGER") == 0)
	{
		addGlobalTriggerFromResource(key, value);
	}

	else if (strcmpignorecase(type, "MAP_TRIGGER") == 0)
	{
		addMapTriggerFromResource(key, value);
	}

	else if (strcmpignorecase(type, "OBJECTIVE") == 0)
	{
		addObjectiveFromResource(key, value);
	}

	else if (strcmpignorecase(type, "ACTION_POINT") == 0)
	{
		e = addActionPoint(name, startX, startY);
	}

	else if (strcmpignorecase(type, "FALLING_PLATFORM") == 0)
	{
		e = addFallingPlatform(startX, startY, name);
	}

	else if (strcmpignorecase(type, "VANISHING_PLATFORM") == 0)
	{
		e = addVanishingPlatform(startX, startY, name);
	}

	else if (strcmpignorecase(type, "ANTI_GRAVITY") == 0)
	{
		e = addAntiGravityField(startX, startY, name);
	}

	else
	{
		showErrorAndExit("Unknown Entity type %s", type);
	}

	return e;
}