1 /* 2 ** r_sprites.h 3 ** 4 **--------------------------------------------------------------------------- 5 ** Copyright 2011 Braden Obrzut 6 ** All rights reserved. 7 ** 8 ** Redistribution and use in source and binary forms, with or without 9 ** modification, are permitted provided that the following conditions 10 ** are met: 11 ** 12 ** 1. Redistributions of source code must retain the above copyright 13 ** notice, this list of conditions and the following disclaimer. 14 ** 2. Redistributions in binary form must reproduce the above copyright 15 ** notice, this list of conditions and the following disclaimer in the 16 ** documentation and/or other materials provided with the distribution. 17 ** 3. The name of the author may not be used to endorse or promote products 18 ** derived from this software without specific prior written permission. 19 ** 20 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 **--------------------------------------------------------------------------- 31 ** 32 ** 33 */ 34 35 #ifndef __R_SPRITES_H__ 36 #define __R_SPRITES_H__ 37 38 #include "actor.h" 39 #include "zstring.h" 40 41 enum SpecialSprites 42 { 43 SPR_NONE, 44 45 NUM_SPECIAL_SPRITES 46 }; 47 48 bool R_CheckSpriteValid(unsigned int spr); 49 class FTexture *R_GetAMSprite(AActor *actor, angle_t rotangle, bool &flip); 50 unsigned int R_GetSprite(const char* spr); 51 void R_GetSpriteHitlist(BYTE* hitlist); 52 void R_InitSprites(); 53 void R_LoadSprite(const FString &name); 54 55 void ScaleSprite(AActor *actor, int xcenter, const Frame *frame, unsigned height); 56 void R_DrawPlayerSprite(AActor *actor, const Frame *frame, fixed offsetX, fixed offsetY); 57 58 // For FArchive 59 unsigned int R_GetNumLoadedSprites(); 60 uint32_t R_GetNameForSprite(unsigned int index); 61 62 // Thinker for S3DNA style zoom in sprites. (Game over, you win, cast call) 63 class SpriteZoomer : public Thinker 64 { 65 DECLARE_CLASS(SpriteZoomer, Thinker) 66 67 private: 68 const Frame *frame; 69 FTextureID texID; 70 int frametics; 71 unsigned short count; 72 unsigned short zoomtime; 73 74 public: 75 SpriteZoomer(FTextureID texID, unsigned short zoomtime); 76 SpriteZoomer(const Frame *frame, unsigned short zoomtime); 77 78 void Draw(); 79 void Tick(); 80 }; 81 82 void R_DrawZoomer(FTextureID texID); 83 84 #endif 85