tr2/output: add support for animated sprites

This uses the same logic as TR1 to allow sprites to be animated.

Resolves #2401.
This commit is contained in:
lahm86 2025-01-27 21:07:39 +00:00
parent d15fb44214
commit 074cfb138b
3 changed files with 17 additions and 0 deletions

View file

@ -7,6 +7,7 @@
- added the ability to hold left/right to move through menus more quickly (#2298)
- added the ability to disable exit fade effects alone (#2348)
- added a fade-out effect when completing Lara's Home
- added support for animated sprites (#2401)
- changed default input bindings to let the photo mode binding be compatible with TR1X:
| Key | Old binding | New binding |
| ----------------------------- | ----------- | ------------ |

View file

@ -107,6 +107,7 @@ game with new enhancements and features.
- added ability to toggle between the software/hardware renderer at runtime
- added optional fade effects to the hardware renderer
- added text information when changing rendering options at runtime
- added support for animated sprites
- changed the hardware renderer to always use 16-bit textures
- changed the software renderer to use the picture's palette for the background pictures
- changed fullscreen behavior to use windowed desktop mode

View file

@ -757,6 +757,21 @@ void Output_DoAnimateTextures(const int32_t ticks)
g_ObjectTextures[range->textures[i]] = temp;
range = range->next_range;
}
for (int32_t i = 0; i < MAX_STATIC_OBJECTS; i++) {
const STATIC_OBJECT_2D *const object = Object_GetStaticObject2D(i);
if (!object->loaded || object->frame_count == 1) {
continue;
}
const int16_t frame_count = object->frame_count;
const SPRITE_TEXTURE temp = g_SpriteTextures[object->texture_idx];
for (int32_t j = 0; j < frame_count - 1; j++) {
g_SpriteTextures[object->texture_idx + j] =
g_SpriteTextures[object->texture_idx + j + 1];
}
g_SpriteTextures[object->texture_idx + frame_count - 1] = temp;
}
m_TickComp -= TICKS_PER_FRAME * 5;
}
}