1 /* 2 * file sprite.h - handling all sprites 3 * 4 * $Id: sprite.h,v 1.6 2006/02/09 21:21:25 fzago Exp $ 5 * 6 * Program XBLAST 7 * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published 11 * by the Free Software Foundation; either version 2; or (at your option) 12 * any later version 13 * 14 * This program is distributed in the hope that it will be entertaining, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 17 * Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License along 20 * with this program; if not, write to the Free Software Foundation, Inc. 21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #ifndef XBLAST_SPRITE_H 25 #define XBLAST_SPRITE_H 26 27 /* 28 * some flags 29 */ 30 #define SPM_UNMAPPED 0 31 #define SPM_MAPPED (1<<1) 32 #define SPM_MASKED (1<<2) 33 34 #define MAX_COLOR_SPRITES 6 35 36 typedef enum 37 { 38 ISA_Color1, 39 ISA_Color2, 40 ISA_Color3, 41 ISA_Color4, 42 ISA_Color5, 43 ISA_Color6, 44 ISA_LedOff, 45 ISA_LedOn, 46 ISA_Abort, 47 ISA_Default, 48 ISA_TeamNone, 49 ISA_TeamRed, 50 ISA_TeamGreen, 51 ISA_TeamBlue, 52 MAX_ICON_SPRITES 53 } IconSpriteAnimation; 54 55 typedef union _sprite Sprite; 56 57 /* type of sprite */ 58 typedef enum 59 { 60 STNone = 0, 61 STPlayer, 62 STBomb, 63 STText, 64 STIcon 65 } SpriteType; 66 67 typedef void (*DrawFunc) (const Sprite *); 68 typedef const BMRectangle *(*RectFunc) (const Sprite *); 69 typedef struct _any_sprite AnySprite; 70 /* common basis */ 71 struct _any_sprite 72 { 73 SpriteType type; 74 XBBool dirty; 75 AnySprite *prev; 76 AnySprite *next; 77 DrawFunc draw; 78 RectFunc rect; 79 int ysort; 80 int x; 81 int y; 82 int mode; 83 unsigned anime; 84 }; 85 /* players */ 86 typedef struct 87 { 88 AnySprite any; 89 int player; 90 } PlayerSprite; 91 92 /* bombs */ 93 typedef struct 94 { 95 AnySprite any; 96 int bomb; 97 } BombSprite; 98 99 /* text (for menus) */ 100 typedef struct 101 { 102 AnySprite any; 103 int w; 104 int h; 105 const char *text; 106 } TextSprite; 107 108 /* icons for menus */ 109 typedef struct 110 { 111 AnySprite any; 112 } IconSprite; 113 114 union _sprite 115 { 116 int type; 117 AnySprite any; 118 PlayerSprite player; 119 BombSprite bomb; 120 TextSprite text; 121 IconSprite icon; 122 }; 123 124 /* 125 * prototypes 126 */ 127 extern Sprite *CreatePlayerSprite (int p, int x, int y, unsigned a, int m); 128 extern Sprite *CreateBombSprite (int b, int x, int y, unsigned a, int m); 129 extern Sprite *CreateTextSprite (const char *t, int x, int y, int w, int h, unsigned a, int m); 130 extern Sprite *CreateIconSprite (int x, int y, unsigned a, int m); 131 extern void DeleteSprite (Sprite * spr); 132 extern void MoveSprite (Sprite * sprite, int x, int y); 133 extern void SetSpriteMode (Sprite * sprite, int mode); 134 extern void SetSpriteAnime (Sprite * sprite, unsigned anime); 135 extern void SetSpriteText (Sprite * sprite, const char *text); 136 extern void SetSpriteColor (Sprite * sprite, XBColor color); 137 extern void ShuffleAllSprites (void); 138 extern void MarkAllSprites (void); 139 extern void DrawAllSprites (void); 140 extern void DeleteAllBombSprites (void); 141 extern const BMRectangle *SpriteRectangle (const Sprite *); 142 extern int SpriteAnime (const Sprite *); 143 extern int SpriteBomb (const Sprite *); 144 extern int SpritePlayer (const Sprite *); 145 extern const char *SpriteText (const Sprite *); 146 extern XBBool SpriteIsMasked (const Sprite *); 147 extern void MarkMazeSprite (const Sprite * spr); 148 149 #endif 150 /* 151 * end fo file sprite.h 152 */ 153