I'm working on what I think would be a very useful tool for all Gamestudio users... an easy way to create and play back in-engine cutscenes (rendered by A7 instead of loading a video).

On the whiteboard my algorithm and data structures appear to work nicely... but then I tried to implement these and used structs for my data structures and things got weird.

I am not so familiar with the use of structs and the related commands such as malloc and memcopy and others.

I'll detail my playback method and data structs below. It would be really great if somebody could describe to me how to use the structs to accomplish what I've planned. (I've already got code that sort of works but need better knowledge in order to find the bugs)

----------------------------
struct Keyframe
contains
  • activation time of keyframe
  • array of Cues


struct Cue
contains
  • WED entity name
  • start and end positions
  • start and end rotations
  • start and end scale
  • animation name
  • duration of this Cue


Playback Algorithm:
Code:
load keyframes information from text file
put keyframes into an array of keyframes
repeat every frame
{
  if the total time passed has exceeded the start time of the next keyframe
  {
    add all the cues stored in the keyframe to a linked list containing all active cues
  }
  for each cue in the active cues linked list:
  {
    if the total time has passed the end time of the cue
       remove it from the linked list
    otherwise interpolate the position, rotation, scale, and animation of the entity named in the cue based on the current time, and the start and end times of the cue
   }
}
once the end of the keyframe has been reached the scene is ended



At this moment it can load the scene from the text file, but it crashes if I try to make it play any more than one keyframe/cue...