1 /** @file p_ceiling.h Moving ceilings (lowering, crushing, raising). 2 * 3 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net> 5 * @authors Copyright © 1993-1996 id Software, Inc. 6 * 7 * @par License 8 * GPL: http://www.gnu.org/licenses/gpl.html 9 * 10 * <small>This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by the 12 * Free Software Foundation; either version 2 of the License, or (at your 13 * option) any later version. This program is distributed in the hope that it 14 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 16 * Public License for more details. You should have received a copy of the GNU 17 * General Public License along with this program; if not, write to the Free 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 * 02110-1301 USA</small> 20 */ 21 22 #ifndef LIBCOMMON_THINKER_CEILING_H 23 #define LIBCOMMON_THINKER_CEILING_H 24 25 #include "doomsday.h" 26 #ifdef __cplusplus 27 # include "mapstatereader.h" 28 # include "mapstatewriter.h" 29 #endif 30 31 #define CEILSPEED (1) 32 #define CEILWAIT (150) 33 34 typedef enum { 35 CS_DOWN, 36 CS_UP 37 } ceilingstate_e; 38 39 typedef enum { 40 CT_LOWERTOFLOOR, 41 CT_RAISETOHIGHEST, 42 CT_LOWERANDCRUSH, 43 CT_CRUSHANDRAISE, 44 #if __JDOOM__ || __JDOOM64__ || __JHERETIC__ 45 CT_CRUSHANDRAISEFAST, 46 #endif 47 #if __JDOOM__ || __JDOOM64__ 48 CT_SILENTCRUSHANDRAISE, 49 #endif 50 #if __JDOOM64__ 51 CT_CUSTOM, 52 #endif 53 #if __JHEXEN__ 54 CT_LOWERBYVALUE, 55 CT_RAISEBYVALUE, 56 CT_CRUSHRAISEANDSTAY, 57 CT_MOVETOVALUEMUL8, 58 #endif 59 NUMCEILINGTYPES 60 } ceilingtype_e; 61 62 typedef struct ceiling_s { 63 thinker_t thinker; 64 ceilingtype_e type; 65 Sector* sector; 66 coord_t bottomHeight; 67 coord_t topHeight; 68 float speed; 69 dd_bool crush; 70 ceilingstate_e state; 71 ceilingstate_e oldState; 72 int tag; // id. 73 74 #ifdef __cplusplus 75 void write(MapStateWriter *msw) const; 76 int read(MapStateReader *msr); 77 #endif 78 } ceiling_t; 79 80 #ifdef __cplusplus 81 extern "C" { 82 #endif 83 84 void T_MoveCeiling(void *ceilingThinkerPtr); 85 86 /** 87 * Move a ceiling up/down. 88 */ 89 #if __JHEXEN__ 90 int EV_DoCeiling(Line* line, byte* args, ceilingtype_e type); 91 #else 92 int EV_DoCeiling(Line* li, ceilingtype_e type); 93 #endif 94 95 /** 96 * Reactivates all stopped crushers with the right tag. 97 * 98 * @param tag Tag of ceilings to activate. 99 * 100 * @return @c true, if a ceiling is activated. 101 */ 102 #if __JDOOM__ || __JDOOM64__ || __JHERETIC__ 103 int P_CeilingActivate(short tag); 104 #endif 105 106 /** 107 * Stops all active ceilings with the right tag. 108 * 109 * @param tag Tag of ceilings to stop. 110 * 111 * @return @c true, if a ceiling put in stasis. 112 */ 113 int P_CeilingDeactivate(short tag); 114 115 #ifdef __cplusplus 116 } // extern "C" 117 #endif 118 119 #endif // LIBCOMMON_THINKER_CEILING_H 120