@@ -443,16 +443,28 @@ std::vector<Vector>* MOSprite::GetAllPixelPositions(const Vector& origin, float
443
443
std::vector<Vector>* posList = new std::vector<Vector>();
444
444
CLAMP (m_FrameCount - 1 , 0 , whichFrame);
445
445
BITMAP* sprite = m_aSprite[whichFrame];
446
- for (int y = 0 ; y < GetSpriteHeight (); y++) {
447
- for (int x = 0 ; x < GetSpriteWidth (); x++) {
448
- int pixelIndex = GetPixelIndex (x, y, whichFrame);
446
+ BITMAP* temp = create_bitmap_ex (8 , m_SpriteDiameter * m_Scale, m_SpriteDiameter * m_Scale);
447
+ rectfill (temp, 0 , 0 , temp->w - 1 , temp->h - 1 , 0 );
448
+ Vector offset = Vector (temp->w / 2 + m_SpriteOffset.m_X , temp->h / 2 + m_SpriteOffset.m_Y );
449
+
450
+ if (!hflipped) {
451
+ rotate_scaled_sprite (temp, sprite, offset.m_X , offset.m_Y , ftofix (GetAllegroAngle (-m_Rotation.GetDegAngle ())), ftofix (m_Scale));
452
+ } else {
453
+ rotate_scaled_sprite_v_flip (temp, sprite, offset.m_X , offset.m_Y , ftofix (GetAllegroAngle (-m_Rotation.GetDegAngle ())) + itofix (128 ), ftofix (m_Scale));
454
+ }
455
+
456
+ for (int y = 0 ; y < temp->h ; y++) {
457
+ for (int x = 0 ; x < temp->w ; x++) {
458
+ int pixelIndex = getpixel (temp, x, y);
449
459
if (includeTransparency || pixelIndex > 0 ) {
450
- Vector pixelPos = (Vector (x, y) + m_SpriteOffset). FlipX (hflipped). RadRotate (angle ) + origin;
460
+ Vector pixelPos = (Vector (x - temp-> w / 2 , y - temp-> h / 2 ) ) + origin;
451
461
posList->push_back (pixelPos.GetRounded ());
452
462
}
453
463
}
454
464
}
455
465
466
+ destroy_bitmap (temp);
467
+ temp = NULL ;
456
468
return posList;
457
469
}
458
470
0 commit comments