static void dropOnPlayer() { int i; long onGround; self->thinkTime--; if (self->thinkTime <= 0) { self->flags &= ~FLY; onGround = (self->flags & ON_GROUND); checkToMap(self); if (onGround == 0 && (self->flags & ON_GROUND)) { playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); shakeScreen(LIGHT, 15); self->thinkTime = 15; self->action = &dropWait; for (i=0;i<20;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } } } }
static void die() { int i; self->action = ¨ setCustomAction(self, &invulnerableNoFlash, 240, 0, 0); setEntityAnimation(self, "STUNNED"); self->flags &= ~FLY; self->dirX = 0; self->mental = self->x < getMapStartX() + SCREEN_WIDTH / 2 ? 0 : 1; checkToMap(self); if (self->flags & ON_GROUND) { for (i=0;i<20;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); self->thinkTime = 120; self->endY = 0; self->action = &dieFinish; } }
static void shudder() { Entity *smoke; self->endX += 90; if (self->endX >= 360) { self->endX = 0; } self->x = self->startX + sin(DEG_TO_RAD(self->endX)) * 4; checkToMap(self); if (self->mental == 2) { smoke = addSmoke(0, 0, "decoration/dust"); if (smoke != NULL) { smoke->x = self->x + prand() % self->w; smoke->y = self->y + prand() % self->h; smoke->dirY = 0; } } else if (self->mental == 0) { self->x = self->startX; self->action = &entityWait; } }
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; } } }
static void groundCharge() { if (self->thinkTime > 0) { self->thinkTime--; if (self->thinkTime <= 0) { self->dirX = self->face == LEFT ? -self->speed : self->speed; self->dirX *= 3; } addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } else { if (self->dirX == 0) { self->mental--; self->face = self->face == LEFT ? RIGHT : LEFT; if (self->mental <= 0) { self->thinkTime = 60; setEntityAnimation(self, "STAND"); self->action = &groundChargeFinish; } else { self->dirX = self->face == LEFT ? -self->speed : self->speed; self->dirX *= 3; } } addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } checkToMap(self); }
static void addDust() { int i; for (i=0;i<25;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } }
static void riseUp() { Entity *e, *smoke; /*facePlayer();*/ self->thinkTime--; if (self->thinkTime <= 0) { self->damage = 1; self->y -= 2; self->thinkTime = 0; self->flags &= ~NO_DRAW; self->takeDamage = &takeDamage; } alignBodyToHead(); e = self->target; while (e != NULL) { if (e->target == NULL) { smoke = addSmoke(e->x + (prand() % self->w) * (prand() % 2 == 0 ? -1 : 1), e->y + prand() % e->h, "decoration/dust"); if (smoke != NULL) { smoke->dirY = 0; } } e = e->target; } if (self->y <= self->targetY) { self->y = self->targetY; self->targetX = self->x; self->dirX = 0; self->thinkTime = 120; self->action = &headWait; } }
static void sink() { self->y += 0.25; if (self->y >= self->endY) { self->inUse = FALSE; } if (prand() % 2 == 0) { addSmoke(self->x + prand() % self->w, self->endY - prand() % 10, "decoration/dust"); } }
static void breatheIn() { Entity *e; self->thinkTime--; if (self->thinkTime <= 0) { self->thinkTime = 30; self->action = &breatheFire; self->creditsAction = &breatheFire; } e = addSmoke(0, 0, "decoration/dust"); if (e != NULL) { if (self->face == LEFT) { e->x = self->x + self->w - e->w - self->offsetX; } else { e->x = self->x + self->offsetX; } e->y = self->y + self->offsetY; e->targetX = e->x; e->targetY = e->y; e->x += (128 + prand() % 128) * (self->face == LEFT ? -1 : 1); e->y += (prand() % 64) * (prand() % 2 == 0 ? -1 : 1); calculatePath(e->x, e->y, e->targetX, e->targetY, &e->dirX, &e->dirY); e->dirX *= 6; e->dirY *= 6; e->thinkTime = 30; } setCustomAction(&player, &attract, 2, 0, (player.x < (self->x + self->w / 2) ? (player.speed - 0.5) : -(player.speed - 0.5))); checkToMap(self); }
static void addSmokeAlongBody() { int i, bodyLength; shakeScreen(MEDIUM, 15); bodyLength = abs(self->endX - self->x); for (i=0; i<100; i++) { addSmoke((self->face == LEFT ? self->x : self->endX) + (prand() % bodyLength), self->y + prand() % self->h, "decoration/dust"); } playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); }
static void dropOnPlayer() { int i; long onGround; self->thinkTime--; if (self->thinkTime <= 0) { self->flags &= ~FLY; onGround = (self->flags & ON_GROUND); checkToMap(self); if (onGround == 0 && (self->flags & ON_GROUND)) { playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); if ((player.flags & ON_GROUND) && !(player.flags & INVULNERABLE)) { setPlayerStunned(150); } shakeScreen(MEDIUM, 15); self->thinkTime = 15; self->action = &dropWait; for (i=0;i<20;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } self->endX--; if (self->endX == 0) { self->mental = 1; self->endX = 4; } self->targetY = self->y; } } }
static void flameWaveDrop() { int i; long onGround; if (self->thinkTime > 0) { self->flags |= INVULNERABLE; self->thinkTime--; self->x = player.x + player.w / 2 - self->w / 2; if (self->thinkTime <= 0) { playSoundToMap("sound/common/spell", -1, self->x, self->y, 0); addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2); self->flags &= ~(FLY|NO_DRAW); self->dirY = 0; } } 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"); } self->mental = 5; self->thinkTime = 30; self->action = &flameWaveAttack; } }
static void die() { int i; long onGround; setEntityAnimation(self, "DIE"); self->action = ¨ 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(); } }
static void attack() { int i; self->dirY = 12; checkToMap(self); if (self->flags & ON_GROUND) { playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); for (i=0;i<20;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } self->thinkTime = 60; self->action = &attackFinish; } }
static void stompAttackInit() { int i; Entity *e; setEntityAnimation(self, "STOMP_READY"); self->weight = 0.5; self->dirY = -8; self->action = &stompAttackRise; for (i=0;i<30;i++) { e = addSmoke(0, 0, "decoration/dust"); if (e != NULL) { e->x = self->x + prand() % self->w; e->y = self->y + self->h; e->dirX = (10 + prand() % 30); e->dirX /= 10; e->y -= prand() % e->h; if (e->x < self->x + self->w / 2) { e->dirX *= -1; } } } checkToMap(self); }
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); }
static void stunned() { int i; long onGround = self->flags & ON_GROUND; Entity *e; checkToMap(self); if (self->flags & ON_GROUND) { if (onGround == 0) { for (i=0;i<2;i++) { e = getFreeEntity(); if (e == NULL) { showErrorAndExit("No free slots to add the Cave Boss's Star"); } loadProperties("boss/armour_boss_star", e); e->x = self->x; e->y = self->y; e->action = &starWait; e->draw = &drawLoopingAnimationToMap; e->thinkTime = self->thinkTime; e->head = self; setEntityAnimation(e, "STAND"); e->currentFrame = (i == 0 ? 0 : 6); if (self->face == LEFT) { e->x = self->x + self->w - e->w - e->offsetX; } else { e->x = self->x + e->offsetX; } e->y = self->y + e->offsetY; } for (i=0;i<20;i++) { addSmoke(self->x + prand() % self->w, self->y + self->h - prand() % 10, "decoration/dust"); } playSoundToMap("sound/common/crash", BOSS_CHANNEL, self->x, self->y, 0); } self->action = &stunFinish; } }
static void changeSides() { int side; Entity *e, *smoke; Target *t; self->x += self->dirX; self->y += self->dirY; if (atTarget()) { self->flags |= NO_DRAW; self->takeDamage = NULL; self->targetX = self->x; self->dirX = 0; self->thinkTime = 120; side = prand() % 2; if (side == 0) { t = getTargetByName("SNAKE_BOSS_TARGET_LEFT"); self->face = RIGHT; } else { t = getTargetByName("SNAKE_BOSS_TARGET_RIGHT"); self->face = LEFT; } if (t == NULL) { showErrorAndExit("Snake boss cannot find target"); } self->damage = 0; setSnakePosition(t->x, t->y); self->targetX = self->x; self->targetY = self->y - 64; self->thinkTime = 120; self->action = &riseUpWait; } else { e = self->target; while (e != NULL) { if (e->target == NULL) { smoke = addSmoke(e->x + (prand() % self->w) * (prand() % 2 == 0 ? -1 : 1), e->y + prand() % e->h, "decoration/dust"); if (smoke != NULL) { smoke->dirY = 0; } } e = e->target; } } alignBodyToHead(); }