@@ -355,16 +355,28 @@ std::vector<Vector>* MOSprite::GetAllPixelPositions(const Vector& origin, float
355
355
std::vector<Vector>* posList = new std::vector<Vector>();
356
356
CLAMP (m_FrameCount - 1 , 0 , whichFrame);
357
357
BITMAP* sprite = m_aSprite[whichFrame];
358
- for (int y = 0 ; y < GetSpriteHeight (); y++) {
359
- for (int x = 0 ; x < GetSpriteWidth (); x++) {
360
- int pixelIndex = GetPixelIndex (x, y, whichFrame);
358
+ BITMAP* temp = create_bitmap_ex (8 , m_SpriteDiameter * m_Scale, m_SpriteDiameter * m_Scale);
359
+ rectfill (temp, 0 , 0 , temp->w - 1 , temp->h - 1 , 0 );
360
+ Vector offset = Vector (temp->w / 2 + m_SpriteOffset.m_X , temp->h / 2 + m_SpriteOffset.m_Y );
361
+
362
+ if (!hflipped) {
363
+ rotate_scaled_sprite (temp, sprite, offset.m_X , offset.m_Y , ftofix (GetAllegroAngle (-m_Rotation.GetDegAngle ())), ftofix (m_Scale));
364
+ } else {
365
+ rotate_scaled_sprite_v_flip (temp, sprite, offset.m_X , offset.m_Y , ftofix (GetAllegroAngle (-m_Rotation.GetDegAngle ())) + itofix (128 ), ftofix (m_Scale));
366
+ }
367
+
368
+ for (int y = 0 ; y < temp->h ; y++) {
369
+ for (int x = 0 ; x < temp->w ; x++) {
370
+ int pixelIndex = getpixel (temp, x, y);
361
371
if (includeTransparency || pixelIndex > 0 ) {
362
- Vector pixelPos = (Vector (x, y) + m_SpriteOffset). FlipX (hflipped). RadRotate (angle ) + origin;
372
+ Vector pixelPos = (Vector (x - temp-> w / 2 , y - temp-> h / 2 ) ) + origin;
363
373
posList->push_back (pixelPos.GetRounded ());
364
374
}
365
375
}
366
376
}
367
377
378
+ destroy_bitmap (temp);
379
+ temp = NULL ;
368
380
return posList;
369
381
}
370
382
0 commit comments