/** ** Draw missile. */ void Missile::DrawMissile(const CViewport &vp) const { Assert(this->Type); CUnit *sunit = this->SourceUnit; // FIXME: I should copy SourcePlayer for second level missiles. if (sunit && sunit->Player) { #ifdef DYNAMIC_LOAD if (!this->Type->Sprite) { LoadMissileSprite(this->Type); } #endif } const PixelPos screenPixelPos = vp.MapToScreenPixelPos(this->position); switch (this->Type->Class) { case MissileClassHit: CLabel(GetGameFont()).DrawClip(screenPixelPos.x, screenPixelPos.y, this->Damage); break; default: if (Type->G) { this->Type->DrawMissileType(this->SpriteFrame, screenPixelPos); } break; } }
/** ** Draw missile. ** ** @param frame Animation frame ** @param pos Screen pixel position */ void MissileType::DrawMissileType(int frame, const PixelPos &pos) const { #ifdef DYNAMIC_LOAD if (!this->G->IsLoaded()) { LoadMissileSprite(this); } #endif if (this->Flip) { if (frame < 0) { if (this->Transparency > 0) { this->G->DrawFrameClipTransX(-frame - 1, pos.x, pos.y, int(256 - 2.56 * Transparency)); } else { this->G->DrawFrameClipX(-frame - 1, pos.x, pos.y); } } else { if (this->Transparency > 0) { this->G->DrawFrameClipTrans(frame, pos.x, pos.y, int(256 - 2.56 * Transparency)); } else { this->G->DrawFrameClip(frame, pos.x, pos.y); } } } else { const int row = this->NumDirections / 2 + 1; if (frame < 0) { frame = ((-frame - 1) / row) * this->NumDirections + this->NumDirections - (-frame - 1) % row; } else { frame = (frame / row) * this->NumDirections + frame % row; } if (this->Transparency > 0) { this->G->DrawFrameClipTrans(frame, pos.x, pos.y, int(256 - 2.56 * Transparency)); } else { this->G->DrawFrameClip(frame, pos.x, pos.y); } } }