diff --git a/sc2/src/sc2code/libs/graphics/drawable.c b/sc2/src/sc2code/libs/graphics/drawable.c index 8b11f2859..91cef0748 100644 --- a/sc2/src/sc2code/libs/graphics/drawable.c +++ b/sc2/src/sc2code/libs/graphics/drawable.c @@ -149,7 +149,6 @@ DestroyDrawable (DRAWABLE Drawable) DrawablePtr = LockDrawable (Drawable); if (DrawablePtr) { - HFree (DrawablePtr->Frame); UnlockDrawable (Drawable); FreeDrawable (Drawable); diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c index d2aaddae9..d19c73dfe 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c @@ -508,18 +508,22 @@ _ReleaseCelData (MEM_HANDLE handle) cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex)+1; - FramePtr = &DrawablePtr->Frame[cel_ct]; - if (!(TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) & SCREEN_DRAWABLE)) + if (DrawablePtr->Frame) { - while (--FramePtr, cel_ct--) + FramePtr = &DrawablePtr->Frame[cel_ct]; + if (TYPE_GET ((FramePtr-1)->TypeIndexAndFlags) != SCREEN_DRAWABLE) { - TFB_Image *img = FramePtr->image; - if (img) + while (--FramePtr, cel_ct--) { - FramePtr->image = NULL; - TFB_DrawScreen_DeleteImage (img); + TFB_Image *img = FramePtr->image; + if (img) + { + FramePtr->image = NULL; + TFB_DrawScreen_DeleteImage (img); + } } } + HFree (DrawablePtr->Frame); } UnlockDrawable (handle); diff --git a/sc2/src/sc2code/libs/graphics/tfb_prim.c b/sc2/src/sc2code/libs/graphics/tfb_prim.c index ba603f7db..6165b6185 100644 --- a/sc2/src/sc2code/libs/graphics/tfb_prim.c +++ b/sc2/src/sc2code/libs/graphics/tfb_prim.c @@ -36,7 +36,7 @@ TFB_Prim_Point (PPOINT p, TFB_Palette *color) r.corner.y = p->y - _CurFramePtr->HotSpot.y; r.extent.width = r.extent.height = 1; - if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) + if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE) TFB_DrawScreen_Rect (&r, color->r, color->g, color->b, TFB_SCREEN_MAIN); else TFB_DrawImage_Rect (&r, color->r, color->g, color->b, _CurFramePtr->image); @@ -86,7 +86,7 @@ TFB_Prim_FillRect (PRECT r, TFB_Palette *color) rect.extent.height) >> 1; } - if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) + if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE) TFB_DrawScreen_Rect (&rect, color->r, color->g, color->b, TFB_SCREEN_MAIN); else TFB_DrawImage_Rect (&rect, color->r, color->g, color->b, _CurFramePtr->image); @@ -102,7 +102,7 @@ TFB_Prim_Line (PLINE line, TFB_Palette *color) x2=line->second.x - _CurFramePtr->HotSpot.x; y2=line->second.y - _CurFramePtr->HotSpot.y; - if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) + if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE) TFB_DrawScreen_Line (x1, y1, x2, y2, color->r, color->g, color->b, TFB_SCREEN_MAIN); else TFB_DrawImage_Line (x1, y1, x2, y2, color->r, color->g, color->b, _CurFramePtr->image); @@ -155,7 +155,7 @@ TFB_Prim_Stamp (PSTAMP stmp) UnlockMutex (img->mutex); - if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) + if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE) { TFB_DrawScreen_Image (img, x, y, gscale, (paletted ? palette : NULL), TFB_SCREEN_MAIN); @@ -209,7 +209,7 @@ TFB_Prim_StampFill (PSTAMP stmp, TFB_Palette *color) UnlockMutex (img->mutex); - if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) & SCREEN_DRAWABLE) + if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE) { TFB_DrawScreen_FilledImage (img, x, y, gscale, r, g, b, TFB_SCREEN_MAIN);