static void init() { EntityList *list; EntityList *l; Entity *e = NULL; if (strlen(self->objectiveName) != 0) { list = getEntitiesByObjectiveName(self->objectiveName); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; if (e != self && strcmpignorecase(self->objectiveName, e->objectiveName) == 0) { break; } } if (e == NULL) { showErrorAndExit("Pedestal could not get statue %s", self->objectiveName); } self->target = e; self->target->x = self->x + self->w / 2; self->target->x -= self->target->w / 2; self->target->y = self->y - self->target->h; self->target->flags |= FLY; self->target->touch = NULL; self->target->action = &statueWait; freeEntityList(list); } self->action = &entityWait; self->activate = self->active == TRUE ? &addStatue : NULL; }
static void init() { EntityList *list; EntityList *l; Entity *e; if (strlen(self->objectiveName) == 0) { showErrorAndExit("Scale at %d %d has no name", (int)self->x, (int)self->y); } list = getEntitiesByObjectiveName(self->objectiveName); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; if (e != self) { self->target = e; break; } } freeEntityList(list); if (self->target == NULL) { showErrorAndExit("Scale could not find partner %s", self->objectiveName); } self->targetY = self->startY + (self->endY - self->startY) / 2; addChain(); self->mental = getMapCeiling(self->x, self->y); self->action = &entityWait; }
static void destroyFloor() { EntityList *list; EntityList *l; Entity *e; self->thinkTime--; if (self->thinkTime <= 0) { if (self->mental == 0) { self->y = getMapFloor(self->x + self->w / 2, self->y) - self->h; playSoundToMap("sound/common/spell", -1, self->x, self->y, 0); self->flags &= ~NO_DRAW; addParticleExplosion(self->x + self->w / 2, self->y + self->h / 2); self->thinkTime = 60; self->mental = 1; } else if (self->mental == 1) { setEntityAnimation(self, "ATTACK_1"); self->mental = 2; self->thinkTime = 600; list = getEntitiesByObjectiveName("SORCEROR_FLOOR"); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->active = TRUE; } freeEntityList(list); } else if (self->mental == 2) { setEntityAnimation(self, "STAND"); list = getEntitiesByObjectiveName("SORCEROR_FLOOR"); for (l=list->next;l!=NULL;l=l->next) { e = l->entity; e->active = FALSE; } freeEntityList(list); self->thinkTime = 30; self->action = &teleportAway; } } if (player.y >= getMapMaxY()) { self->thinkTime = 5; self->mental = 2; } checkToMap(self); }