|
Post by dfut on Jan 24, 2018 14:26:11 GMT -5
So, i was browsing the monster code and found this:
mframe_t berserk_frames_pain2[] = { {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL}, {ai_move, 0, NULL} }; How does it work? Why is the same line repeated over and over again for a pain animation?
|
|
|
Post by knightmare on Jan 24, 2018 17:21:14 GMT -5
That's just part of the animation system. The animation frames themselves are in the monster models, and are listed in the header (.h) file for each monster.
The mframe_t frame pointer lists declare which functions are to be called for each animation frame and the distance moved, while the mmove_t sequence declares the start and end frames for an animation, along with the pointer list and end function. The monster's currentmove pointer is set to an mmove_t sequence, and the generic monster code (in g_monster.c) handles it from there.
In short, you won't be able to understand the monster animation/movement/AI from looking at a single file. It's distributed across multiple files to simplify adding more monsters.
|
|