aliens

Author Topic: Animation frames/sprites [8] and there relation with voxel data ?  (Read 1111 times)

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
It seems each Tile Part for O_FLOOR, O_WESTWALL, O_NORTHWALL, O_OBJECT has 8 animation frames available and possibly associated sprites.

There seems to be only one loft array in MapData and one voxel data array in Tile.

So am I correct in assuming that all 8 animation frames/sprites share the same voxel data ? Or is it possible for each animation from to have it's own voxel data/lofts somehow ???

I saw that an apple tree can be shot and I believe the voxel data/loft changed for the apple tree. So I assume that somehow the apple tree is replaced by a different MapData which contains different voxel data is this correct ?

Could you also point me towards the code which is responsible for this switcheroo ? I would like to see it.

I am a bit curious to spots in code which somehow changes the voxel/collision logic/data so if you know any other interesting points in code I am all ears.

So far a promising unit to study maybe be TileEngine... it seems to be a utility class and might it changes voxel data/logic here and there... but I suspect there are probably other files/classes that might do much more...

Offline kevL

  • Colonel
  • ****
  • Posts: 471
  • pitchforks and torches
    • View Profile
Re: Animation frames/sprites [8] and there relation with voxel data ?
« Reply #1 on: April 11, 2022, 10:35:43 pm »
there is only one loftset per MCD record.

for a part to change its loftset, the part in the tileslot must be changed.

1. it's a door
2. it got destroyed
3. ???

The 8 sprites for each part cycle constantly on the battlefield. But this doesn't change the loftset of the tilepart.

note: Sliding/UFO doors are tricky ... (they don't cycle until activated, then do only 4 animations before changing to their alternate part, iirc)

Offline kevL

  • Colonel
  • ****
  • Posts: 471
  • pitchforks and torches
    • View Profile
Re: Animation frames/sprites [8] and there relation with voxel data ?
« Reply #2 on: April 11, 2022, 10:46:19 pm »
here for example is the code that changes to a different MCD record if a part gets destroyed by an explosion

bool TileEngine::detonate(Tile* tile)
https://github.com/OpenXcom/OpenXcom/blob/94640aab1279ae268e0420a7b5c99cc44eb09473/src/Battlescape/TileEngine.cpp#L1560

bool Tile::destroy(TilePart part, SpecialTileType type)
https://github.com/OpenXcom/OpenXcom/blob/94640aab1279ae268e0420a7b5c99cc44eb09473/src/Savegame/Tile.cpp#L466
« Last Edit: April 11, 2022, 10:50:12 pm by kevL »