Hey guys,
So I've been working on my game for quite a while and there are many instances where we need to wait x amount of frames before we execute (waiting for an animation, etc). In handmade hero, the closest thing to this that I got to was the cutscene code. In that code, casey kept a float of the amount of time elapsed and manually updated this variable for the cutscene state. In my game, I have a timer object that I allocate and each timer is linked together in a linked list so that I can call a single function to update all my timers and not have to worry about forgetting to update a timer in my code. Then anything that needs to time anything just has a pointer to a timer and uses it as needed.
I was wondering how other people handled this in their own applications since casey's method is definitly cleaner in my opinion but you can sometimes forget to increment the float thats accumulating the time. In my case, thats all handled for me but it comes at the cost of having to allocate timers that can fragment memory and have to be deleted. Im debating about switching over to something like what casey did but I wanted to hear how others have gone about this issue before I decide to do anything.