/** * Draw episode 1 guardian. * * @param ticks Time * @param change Time since last iteration */ void MedGuardian::draw(unsigned int ticks, int change) { Anim *stageAnim; unsigned char frame; if (next) next->draw(ticks, change); fixed xChange = getDrawX(change); fixed yChange = getDrawY(change); frame = ticks / (set->animSpeed << 5); if (stage == 0) stageAnim = anim; else stageAnim = level->getAnim(set->anims[E_LFINISHANIM | (animType & 1)] & 0x7F); stageAnim->setFrame(frame + gridX + gridY, true); if (ticks < flashTime) stageAnim->flashPalette(0); drawnX = x + anim->getXOffset(); drawnY = y + anim->getYOffset() + stageAnim->getOffset(); stageAnim->draw(xChange, yChange); if (ticks < flashTime) stageAnim->restorePalette(); return; }
/** * Draw current frame. * * @param x X-coordinate at which to draw * @param y Y-coordinate at which to draw */ void Anim::draw (fixed x, fixed y, int accessories) { Anim* anim; sprites[frame]->draw( FTOI(x) + (xOffsets[frame] << 2), FTOI(y) + yOffsets[frame] - yOffset); if (accessories && accessory) { anim = level->getAnim(accessory); anim->setFrame(frame, true); anim->draw( x + ITOF(accessoryX << 2), y + ITOF(accessoryY - yOffset) - anim->getOffset(), accessories - 1); } return; }