1 /*************************************************************************** 2 pipe.h - description 3 ------------------- 4 begin : Thu Aug 17 2000 5 copyright : (C) 2000 by Waldemar Baraldi 6 email : baraldi@lacasilla.com.ar 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef PIPE_H 19 #define PIPE_H 20 21 #include "animatedcanvas.h" 22 #include "pointer.h" 23 #include "videomanager.h" 24 #include "sprite.h" 25 26 #define NORMAL_BONUS_VALUE 5 27 #define SUPER_BONUS_VALUE 10 28 #define ULTRA_BONUS_VALUE 25 29 #define HYPER_BONUS_VALUE 50 30 31 enum CardinalPoint {Void, South, West, North, East}; 32 enum Bonus {NormalBonus, SuperBonus, UltraBonus, 33 HyperBonus, LifeBonus, TimeBonus}; 34 35 static const int PipeWidth=60; 36 static const int PipeHeight=60; 37 38 class Player;//Can understan this fucking need 39 40 class Pipe: public AnimatedCanvas{ 41 42 public: 43 44 /** Constructor default. */ 45 Pipe(); 46 47 /** Destructor. */ 48 virtual ~Pipe(); 49 width()50 int width(){return PipeWidth;} height()51 int height(){return PipeHeight;} full()52 virtual int full(){return DefaultCapacity;} 53 54 /** Retorna true si existe una conexi�n en ese punto cardinal. */ 55 virtual bool hasConnection(CardinalPoint con)=0; 56 57 /** Retorna true si el pipe puede ser reemplazado por otro.*/ 58 virtual bool isRemovable(); 59 60 /** Setea la capacidad de ser removido de un pipe*/ 61 virtual void setFixed(bool flag=true); 62 63 /** Setea el tipo de bonus*/ 64 virtual void setBonus(Bonus bonus=NormalBonus); 65 66 /** Retorna el tipo de bonus*/ 67 virtual Bonus getBonus(); 68 69 /** Setea el owner del pipe*/ 70 virtual void setOwner(Player * owner); 71 72 /** Retorna el owner del pipe*/ 73 virtual Player * getOwner(); 74 75 /** Restringe la conexi�n como salida. 76 No hace nada si la conexi�n no existe.*/ 77 virtual void restrictAsOutput(CardinalPoint con)=0; 78 79 /** Retorna true si la conexi�n esta restruingida como salida.*/ 80 virtual bool isRestrictedAsOutput(CardinalPoint con)=0; 81 82 /** Retorna la salida de ese punto cardinal. El resultado es Void 83 si no existe el input.*/ 84 virtual CardinalPoint getOutput(CardinalPoint input)=0; 85 86 virtual bool hasLiquid(); 87 88 89 virtual void setLast(bool flag); 90 91 virtual bool isLast(); 92 93 /** Incrementa el nivel de llenado en 1 para la conexi�n con ese input. 94 El resultado es 0 si no existe input.*/ 95 virtual void incFullLevel(CardinalPoint input, unsigned int amount)=0; 96 97 /** Retorna el nivel de llenado para ese input. Si el input no existe 98 retorna -1.*/ 99 virtual int getFullLevel(CardinalPoint input)=0; 100 101 /** Retorna una referencia al puntero asociado.*/ 102 virtual Pointer * getPointer()=0; 103 104 /** Para uso futuro. Cambiarla a abstracta e 105 implementarla en cada pipe*/ 106 void tick(); 107 108 protected: 109 110 static const int Gran=50; 111 static const int DefaultCapacity=1000; 112 113 virtual void paintRestriction(VideoManager * vm, CardinalPoint con); 114 virtual void paintBonus(VideoManager * vm, Bonus bonus); 115 virtual void paintExclamation(VideoManager * vm); 116 117 int full_level; 118 CardinalPoint used_input; 119 Pointer * p; 120 CardinalPoint ro; 121 bool fixed; 122 Bonus bonus; 123 Player * owner; 124 Sprite * excl; 125 int exclFrame; 126 bool last; 127 128 int bonusFrame; 129 Sprite * bonusSprite; 130 }; 131 #endif 132 133 134