Currently placeholder is a 1x1 transparent sprite.
Placeholder is returned by the operator[] for safety purposes.
DoesSpriteExist() is still a valid way to test if a sprite is actually registered.
Removed the obscure mechanic of remapping failed sprites to sprite 0.
From upstream 74ff2bdf0ccba4d62821099bce11817f161f47ae
* separate variant of add_dynamic_sprite() that searches for the free slot itself,
not requiring user to do this;
* the previously existing variant is used for: replacing modified dynamic sprite
and restoring sprites from save.
* add_dynamic_sprite() accepts unique_ptr<Bitmap>, explicitly saying that the
ownership will be taken by the spriteset.
* sprite info and SPF_* flags are set inside spriteset, instead of hacking them in
add_dynamic_sprite().
* simplified LoadSaveSlotScreenshot()
From upstream 0913f49e4212fea3a48539251ffc1ab92518a231
and aca47b9f466fe41d73d99a15b9f0ae41e65c6926
+ minor changes
Remapped sprites are the sprites that were supposed to be present in the game
assets (according to the sprite index), but failed to load for whatever reasons.
The idea is that whenever a remapped sprite is requested, sprite cache should
return a placeholder sprite (sprite 0) instead.
This commit corrects the logic of this, where it would use remapped sprite index
one step earlier. This should fix incorrect duplicating addition of same "bad" sprite
index to the MRU list, and also saves little redundant actions where the LoadSprite
would reload the sprite 0 unnecessarily per each such request.
From upstream eca2e2d3b47a7fcf235690ee0ebda9058a662c91
The spriteset's [] operator loads a sprite, but some operations may
omit that and check the preloaded information instead.
This also makes it more certain where the actual sprite's bitmap is necessary.
From upstream df30fc1edd30d4f334addaf7883286e745dea2c3
The assertion is reduntant since there's already an identical check with error
logging and it should not trigger for remapped sprites.
Fixes TRAC #14730
This could make a new sprite look differently, depending on placeholder's (sprite 0) settings, until the game is saved once.
From upstream f2a922a9cefd40337502bde734503605a76550db
Sprite Cache and Managed Objects produce a lot of entries in the log currently.
They use a macro to set if they should be on or not, but this macro may be set =0, with the intent of disabling.
Let's instead use #if when testing these macros.
Additionally
- only define DEBUG_MANAGED_OBJECTS if AGS_DEBUG_MANAGED_OBJECTS is true
- adds a new command line flag AGS_DEBUG_SPRITECACHE, which will only define DEBUG_SPRITECACHE if true
- guard indefinition through core/platform.h
From upstream e8bd58da2e09d844068dc087f1da153a693b7aa8
The implementation of std::list::erase invalidates iterators to the
erased item. However our implementation in Common::List does not.
And the SpriteCache code relied on this behaviour. So instead we
have to invalidate the iterators manually.