Skip to content

Commit 3761580

Browse files
committed
Rebasing is a fucking mess :D
1 parent e4bacc0 commit 3761580

File tree

1 file changed

+0
-81
lines changed

1 file changed

+0
-81
lines changed

Source/Entities/MOSprite.cpp

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -439,87 +439,6 @@ void MOSprite::SetAllSpritePixelIndexes(int whichFrame, int colorIndex, int igno
439439
}
440440
}
441441

442-
int MOSprite::GetSpritePixelIndex(int x, int y, int whichFrame) const {
443-
unsigned int clampedFrame = std::max(std::min(whichFrame, static_cast<int>(m_FrameCount) - 1), 0);
444-
BITMAP* targetSprite = m_aSprite[clampedFrame];
445-
if (is_inside_bitmap(targetSprite, x, y, 0)) {
446-
return _getpixel(targetSprite, x, y);
447-
}
448-
return -1;
449-
}
450-
451-
std::vector<Vector>* MOSprite::GetAllSpritePixelPositions(const Vector& origin, float angle, bool hflipped, int whichFrame, int ignoreIndex, bool invert, bool includeChildren) {
452-
std::vector<Vector>* posList = new std::vector<Vector>();
453-
unsigned int clampedFrame = std::max(std::min(whichFrame, static_cast<int>(m_FrameCount) - 1), 0);
454-
int spriteSize = m_SpriteDiameter;
455-
if (includeChildren && dynamic_cast<MOSRotating*>(this)) {
456-
spriteSize = dynamic_cast<MOSRotating*>(this)->GetDiameter();
457-
}
458-
BITMAP* sprite = m_aSprite[clampedFrame];
459-
BITMAP* temp = create_bitmap_ex(8, spriteSize, spriteSize);
460-
rectfill(temp, 0, 0, temp->w - 1, temp->h - 1, 0);
461-
Vector tempCentre = Vector(temp->w / 2, temp->h / 2);
462-
Vector spriteCentre = Vector(sprite->w / 2, sprite->h / 2);
463-
464-
if (includeChildren) {
465-
Draw(temp, m_Pos - tempCentre);
466-
} else {
467-
Vector offset = (tempCentre + (m_SpriteOffset + spriteCentre).GetXFlipped(m_HFlipped).RadRotate(m_Rotation.GetRadAngle()) - spriteCentre);
468-
if (!hflipped) {
469-
rotate_scaled_sprite(temp, sprite, offset.m_X, offset.m_Y, ftofix(GetAllegroAngle(-m_Rotation.GetDegAngle())), ftofix(m_Scale));
470-
} else {
471-
rotate_scaled_sprite_v_flip(temp, sprite, offset.m_X, offset.m_Y, ftofix(GetAllegroAngle(-m_Rotation.GetDegAngle())) + itofix(128), ftofix(m_Scale));
472-
}
473-
}
474-
475-
for (int y = 0; y < temp->h; y++) {
476-
for (int x = 0; x < temp->w; x++) {
477-
int pixelIndex = _getpixel(temp, x, y);
478-
if (pixelIndex >= 0 && (pixelIndex != ignoreIndex) != invert) {
479-
Vector pixelPos = (Vector(x, y) - tempCentre) + origin;
480-
posList->push_back(pixelPos);
481-
}
482-
}
483-
}
484-
485-
destroy_bitmap(temp);
486-
return posList;
487-
}
488-
489-
bool MOSprite::SetSpritePixelIndex(int x, int y, int whichFrame, int colorIndex, int ignoreIndex, bool invert) {
490-
if (!m_SpriteModified) {
491-
std::vector<BITMAP*> spriteList;
492-
493-
for (BITMAP* sprite : m_aSprite) {
494-
BITMAP* spriteCopy = create_bitmap_ex(8, sprite->w, sprite->h);
495-
rectfill(spriteCopy, 0, 0, spriteCopy->w - 1, spriteCopy->h - 1, 0);
496-
draw_sprite(spriteCopy, sprite, 0, 0);
497-
spriteList.push_back(spriteCopy);
498-
}
499-
500-
m_aSprite = spriteList;
501-
m_SpriteModified = true;
502-
}
503-
504-
unsigned int clampedFrame = std::max(std::min(whichFrame, static_cast<int>(m_FrameCount) - 1), 0);
505-
BITMAP* targetSprite = m_aSprite[clampedFrame];
506-
if (is_inside_bitmap(targetSprite, x, y, 0) && (ignoreIndex < 0 || (_getpixel(targetSprite, x, y) != ignoreIndex) != invert)) {
507-
_putpixel(targetSprite, x, y, colorIndex);
508-
return true;
509-
}
510-
return false;
511-
}
512-
513-
void MOSprite::SetAllSpritePixelIndexes(int whichFrame, int colorIndex, int ignoreIndex, bool invert) {
514-
unsigned int clampedFrame = std::max(std::min(whichFrame, static_cast<int>(m_FrameCount) - 1), 0);
515-
BITMAP* targetSprite = m_aSprite[clampedFrame];
516-
for (int y = 0; y < targetSprite->h; y++) {
517-
for (int x = 0; x < targetSprite->w; x++) {
518-
SetSpritePixelIndex(x, y, clampedFrame, colorIndex, ignoreIndex, invert);
519-
}
520-
}
521-
}
522-
523442
void MOSprite::Update() {
524443
MovableObject::Update();
525444

0 commit comments

Comments
 (0)