Skip to content

Commit

Permalink
Engine: merged sprite.cpp contents into draw.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Aug 14, 2024
1 parent 2afc37f commit d75dac0
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 75 deletions.
2 changes: 0 additions & 2 deletions Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ target_sources(engine
ac/draw_software.h
ac/drawingsurface.cpp
ac/drawingsurface.h
ac/dynamicsprite.cpp
ac/dynamicsprite.h
ac/dynobj/all_dynamicclasses.h
ac/dynobj/all_scriptclasses.h
ac/dynobj/cc_agsdynamicobject.cpp
Expand Down
11 changes: 10 additions & 1 deletion Engine/ac/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "ac/roomstatus.h"
#include "ac/runtime_defines.h"
#include "ac/screenoverlay.h"
#include "ac/sprite.h"
#include "ac/string.h"
#include "ac/system.h"
#include "ac/viewframe.h"
Expand Down Expand Up @@ -990,6 +989,16 @@ void texturecache_precache(uint32_t sprite_id)
texturecache.GetOrLoad(sprite_id, nullptr, false);
}

Bitmap *initialize_sprite(sprkey_t index, Bitmap *image, uint32_t &sprite_flags)
{
return PrepareSpriteForUse(image, (sprite_flags & SPF_KEEPDEPTH) == 0);
}

void post_init_sprite(sprkey_t index)
{
pl_run_plugin_hooks(AGSE_SPRITELOAD, index);
}

void mark_screen_dirty()
{
drawstate.ScreenIsDirty = true;
Expand Down
9 changes: 9 additions & 0 deletions Engine/ac/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "core/types.h"
#include "ac/common_defines.h"
#include "ac/runtime_defines.h"
#include "ac/spritecache.h"
#include "gfx/bitmap.h"
#include "gfx/gfx_def.h"
#include "game/roomstruct.h"
Expand Down Expand Up @@ -99,6 +100,14 @@ void clear_shared_texture(uint32_t sprite_id);
// Prepares a texture for the given sprite and stores in the cache
void texturecache_precache(uint32_t sprite_id);

// Initializes a loaded sprite for use in the game, adjusts the sprite flags.
// Returns a resulting bitmap, which may be a new or old bitmap; or null on failure.
// Original bitmap **gets deleted** if a new bitmap had to be created,
// or if failed to properly initialize one.
Common::Bitmap *initialize_sprite(Common::sprkey_t index, Common::Bitmap *image, uint32_t &sprite_flags);
// Run after a sprite was loaded and adjusted for the game
void post_init_sprite(Common::sprkey_t index);

// whether there are currently remnants of a DisplaySpeech
void mark_screen_dirty();
bool is_screen_dirty();
Expand Down
1 change: 0 additions & 1 deletion Engine/ac/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "ac/sys_events.h"
#include "ac/room.h"
#include "ac/roomstatus.h"
#include "ac/sprite.h"
#include "ac/spritecache.h"
#include "ac/string.h"
#include "ac/translation.h"
Expand Down
36 changes: 0 additions & 36 deletions Engine/ac/sprite.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions Engine/ac/sprite.h

This file was deleted.

2 changes: 0 additions & 2 deletions Solutions/Engine.App/Engine.App.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
<ClCompile Include="..\..\Engine\ac\screenoverlay.cpp" />
<ClCompile Include="..\..\Engine\ac\slider.cpp" />
<ClCompile Include="..\..\Engine\ac\speech.cpp" />
<ClCompile Include="..\..\Engine\ac\sprite.cpp" />
<ClCompile Include="..\..\Engine\ac\string.cpp" />
<ClCompile Include="..\..\Engine\ac\system.cpp" />
<ClCompile Include="..\..\Engine\ac\textbox.cpp" />
Expand Down Expand Up @@ -805,7 +804,6 @@
<ClInclude Include="..\..\Engine\ac\screenoverlay.h" />
<ClInclude Include="..\..\Engine\ac\slider.h" />
<ClInclude Include="..\..\Engine\ac\speech.h" />
<ClInclude Include="..\..\Engine\ac\sprite.h" />
<ClInclude Include="..\..\Engine\ac\string.h" />
<ClInclude Include="..\..\Engine\ac\system.h" />
<ClInclude Include="..\..\Engine\ac\textbox.h" />
Expand Down
6 changes: 0 additions & 6 deletions Solutions/Engine.App/Engine.App.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@
<ClCompile Include="..\..\Engine\ac\speech.cpp">
<Filter>Source Files\ac</Filter>
</ClCompile>
<ClCompile Include="..\..\Engine\ac\sprite.cpp">
<Filter>Source Files\ac</Filter>
</ClCompile>
<ClCompile Include="..\..\Engine\ac\string.cpp">
<Filter>Source Files\ac</Filter>
</ClCompile>
Expand Down Expand Up @@ -983,9 +980,6 @@
<ClInclude Include="..\..\Engine\ac\speech.h">
<Filter>Header Files\ac</Filter>
</ClInclude>
<ClInclude Include="..\..\Engine\ac\sprite.h">
<Filter>Header Files\ac</Filter>
</ClInclude>
<ClInclude Include="..\..\Engine\ac\string.h">
<Filter>Header Files\ac</Filter>
</ClInclude>
Expand Down

0 comments on commit d75dac0

Please sign in to comment.