| 1 | /*****************************************************************************/ |
| 2 | /* Crossfire Animator v2.0a */ |
| 3 | /* Contacts: [email protected], [email protected] */ |
| 4 | /*****************************************************************************/ |
| 5 | /* That code is placed under the GNU General Public Licence (GPL) */ |
| 6 | /* */ |
| 7 | /* (C) 2001 David Delbecq for the original code version. */ |
| 8 | /*****************************************************************************/ |
| 9 | /* CrossFire, A Multiplayer game for X-windows */ |
| 10 | /* */ |
| 11 | /* Copyright (C) 2000 Mark Wedel */ |
| 12 | /* Copyright (C) 1992 Frank Tore Johansen */ |
| 13 | /* */ |
| 14 | /* This program is free software; you can redistribute it and/or modify */ |
| 15 | /* it under the terms of the GNU General Public License as published by */ |
| 16 | /* the Free Software Foundation; either version 2 of the License, or */ |
| 17 | /* (at your option) any later version. */ |
| 18 | /* */ |
| 19 | /* This program is distributed in the hope that it will be useful, */ |
| 20 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 21 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 22 | /* GNU General Public License for more details. */ |
| 23 | /* */ |
| 24 | /* You should have received a copy of the GNU General Public License */ |
| 25 | /* along with this program; if not, write to the Free Software */ |
| 26 | /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 27 | /* */ |
| 28 | /*****************************************************************************/ |
| 29 | #ifndef PLUGIN_ANIM_H |
| 30 | #define PLUGIN_ANIM_H |
| 31 | |
| 32 | #define PLUGIN_NAME "Animator" |
| 33 | #define PLUGIN_VERSION "CFAnim Plugin 2.0" |
| 34 | |
| 35 | #include <plugin.h> |
| 36 | #include <plugin_common.h> |
| 37 | |
| 38 | /** Time units the animation can use. @todo add owner's speed unit */ |
| 39 | enum time_enum { |
| 40 | time_second, /**< One second. */ |
| 41 | time_tick /**< One server tick. */ |
| 42 | }; |
| 43 | |
| 44 | /** Result of one animation move. */ |
| 45 | typedef enum anim_move_result { |
| 46 | mr_finished, /**< Move completed. */ |
| 47 | mr_again /**< Move should continue next time. */ |
| 48 | } anim_move_result; |
| 49 | |
| 50 | struct CFanimation_struct; |
| 51 | struct CFmovement_struct; |
| 52 | |
| 53 | typedef anim_move_result (*CFAnimRunFunc)(struct CFanimation_struct *animation, long int id, void *parameters); |
| 54 | |
| 55 | typedef long int (*CFAnimInitFunc)(const char *name, char *parameters, struct CFmovement_struct *); |
| 56 | |
| 57 | /** One move in an animation. */ |
| 58 | typedef struct CFmovement_struct { |
| 59 | struct CFanimation_struct *parent; /**< Animation this move is linked to. */ |
| 60 | CFAnimRunFunc func; /**< Function to run for this move. */ |
| 61 | void *parameters; /**< Parameters to the function. */ |
| 62 | long int id; /**< Identifier, used for various things. */ |
| 63 | int tick; /**< Move duration, units depending on parent's time_representation. */ |
| 64 | struct CFmovement_struct *next; /**< Next move in the animation. */ |
| 65 | } CFmovement; |
| 66 | |
| 67 | /** One full animation. */ |
| 68 | typedef struct CFanimation_struct { |
| 69 | char *name; |
| 70 | object *victim; |
| 71 | object *event; |
| 72 | int paralyze; |
| 73 | int invisible; |
| 74 | int wizard; |
| 75 | int unique; |
| 76 | int verbose; |
| 77 | int ghosted; |
| 78 | int errors_allowed; |
| 79 | int delete_end; |
| 80 | object *corpse; |
| 81 | long int tick_left; |
| 82 | enum time_enum time_representation; |
| 83 | struct CFmovement_struct *nextmovement; |
| 84 | struct CFanimation_struct *nextanimation; |
| 85 | } CFanimation; |
| 86 | |
| 87 | /** Available animation move. */ |
| 88 | typedef struct { |
| 89 | const char *name; /**< Name as it appears in the animation file. */ |
| 90 | CFAnimInitFunc funcinit; /**< Function to process the parameters of the move. */ |
| 91 | CFAnimRunFunc funcrun; /**< Function to run the move. */ |
| 92 | } CFanimationHook; |
| 93 | |
| 94 | extern CFanimationHook animationbox[]; |
| 95 | |
| 96 | extern int animationcount; |
| 97 | |
| 98 | #include <cfanim_proto.h> |
| 99 | |
| 100 | #endif /* PLUGIN_ANIM_H */ |