dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

floor drawing leaves garbage

attuska opened this issue · comments

I bet that’s after

--- a/src/Mediator.cpp
+++ b/src/Mediator.cpp
@@ -291,7 +291,6 @@ void Mediator::reshadeWithGridItem( GridItem* item )
         // shade floor in this column, if any
         if ( room->floor[ column ] != nilPointer )
         {
-                room->floor[ column ]->binShadyImage();
                 room->floor[ column ]->setWantShadow( true );
         }
 }
@@ -328,7 +327,6 @@ void Mediator::reshadeWithFreeItem( FreeItem* item )
                         // shade floor in this column, if any
                         if ( room->floor[ column ] != nilPointer )
                         {
-                                room->floor[ column ]->binShadyImage();
                                 room->floor[ column ]->setWantShadow( true );
                         }
                 }

meet freshShadyImage

+void FloorTile::freshShadyImage ()
+{
+        if ( shadyImage != nilPointer )
+        {
+                allegro::destroyBitmap( shadyImage );
+
+                BITMAP* shady = create_bitmap_ex( 32, rawImage->w, rawImage->h );
+                clear_to_color( shady, Color::colorOfTransparency()->toAllegroColor() );
+                blit( rawImage, shady, 0, 0, 0, 0, rawImage->w, rawImage->h );
+                shadyImage = shady;
+        }
+}

I bet that’s after

It's been already applied in 6e5e5e2

I replaced binShadyImage with freshShadyImage which doesn’t just bin it, but makes shadyImage the exact copy of raw non~shaded image of tile

@@ -291,7 +291,7 @@ void Mediator::reshadeWithGridItem( GridItem* item )
         // shade floor in this column, if any
         if ( room->floor[ column ] != nilPointer )
         {
-                room->floor[ column ]->binShadyImage();
+                room->floor[ column ]->freshShadyImage();
                 room->floor[ column ]->setWantShadow( true );
         }
 }
@@ -328,7 +328,7 @@ void Mediator::reshadeWithFreeItem( FreeItem* item )
                         // shade floor in this column, if any
                         if ( room->floor[ column ] != nilPointer )
                         {
-                                room->floor[ column ]->binShadyImage();
+                                room->floor[ column ]->freshShadyImage ();
                                 room->floor[ column ]->setWantShadow( true );
                         }
                 }

It's good, you can close issue.