1 //************************************************************************** 2 //** 3 //** ## ## ## ## ## #### #### ### ### 4 //** ## ## ## ## ## ## ## ## ## ## #### #### 5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## 6 //** ## ## ######## ## ## ## ## ## ## ## ### ## 7 //** ### ## ## ### ## ## ## ## ## ## 8 //** # ## ## # #### #### ## ## 9 //** 10 //** $Id: p_levelinfo.h 3953 2009-01-05 18:10:49Z dj_jl $ 11 //** 12 //** Copyright (C) 1999-2006 Jānis Legzdiņš 13 //** 14 //** This program is free software; you can redistribute it and/or 15 //** modify it under the terms of the GNU General Public License 16 //** as published by the Free Software Foundation; either version 2 17 //** of the License, or (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 //************************************************************************** 25 26 class VLevelInfo : public VThinker 27 { 28 DECLARE_CLASS(VLevelInfo, VThinker, 0) 29 30 enum { TID_HASH_SIZE = 64 }; 31 32 VGameInfo* Game; 33 VWorldInfo* World; 34 35 VStr LevelName; 36 vint32 LevelNum; 37 vuint8 Cluster; 38 39 VName NextMap; 40 VName SecretMap; 41 42 vint32 ParTime; 43 vint32 SuckTime; 44 45 vint32 Sky1Texture; 46 vint32 Sky2Texture; 47 float Sky1ScrollDelta; 48 float Sky2ScrollDelta; 49 VName SkyBox; 50 51 VName FadeTable; 52 vuint32 Fade; 53 vuint32 OutsideFog; 54 55 VName SongLump; 56 vuint8 CDTrack; 57 58 enum 59 { 60 LIF_DoubleSky = 0x00000001, 61 LIF_Lightning = 0x00000002, 62 LIF_Map07Special = 0x00000004, 63 LIF_BaronSpecial = 0x00000008, 64 LIF_CyberDemonSpecial = 0x00000010, 65 LIF_SpiderMastermindSpecial = 0x00000020, 66 LIF_MinotaurSpecial = 0x00000040, 67 LIF_DSparilSpecial = 0x00000080, 68 LIF_IronLichSpecial = 0x00000100, 69 LIF_SpecialActionOpenDoor = 0x00000200, 70 LIF_SpecialActionLowerFloor = 0x00000400, 71 LIF_SpecialActionKillMonsters = 0x00000800, 72 LIF_NoIntermission = 0x00001000, 73 LIF_AllowMonsterTelefrags = 0x00002000, 74 LIF_NoAllies = 0x00004000, 75 LIF_DeathSlideShow = 0x00008000, 76 LIF_ForceNoSkyStretch = 0x00010000, 77 LIF_LookupName = 0x00020000, 78 LIF_FallingDamage = 0x00040000, 79 LIF_OldFallingDamage = 0x00080000, 80 LIF_StrifeFallingDamage = 0x00100000, 81 LIF_MonsterFallingDamage = 0x00200000, 82 LIF_NoFreelook = 0x00400000, 83 LIF_NoJump = 0x00800000, 84 LIF_NoAutoSndSeq = 0x01000000, 85 LIF_ActivateOwnSpecial = 0x02000000, 86 LIF_MissilesActivateImpact = 0x04000000, 87 LIF_FilterStarts = 0x08000000, 88 LIF_InfiniteFlightPowerup = 0x10000000, 89 LIF_ClipMidTex = 0x20000000, 90 LIF_WrapMidTex = 0x40000000, 91 LIF_KeepFullInventory = 0x80000000, 92 }; 93 vuint32 LevelInfoFlags; 94 enum 95 { 96 LIF2_CompatShortTex = 0x00000001, 97 LIF2_CompatStairs = 0x00000002, 98 LIF2_CompatLimitPain = 0x00000004, 99 LIF2_CompatNoPassOver = 0x00000008, 100 LIF2_CompatNoTossDrops = 0x00000010, 101 LIF2_CompatUseBlocking = 0x00000020, 102 LIF2_CompatNoDoorLight = 0x00000040, 103 LIF2_CompatRavenScroll = 0x00000080, 104 LIF2_CompatSoundTarget = 0x00000100, 105 LIF2_CompatDehHealth = 0x00000200, 106 LIF2_CompatTrace = 0x00000400, 107 LIF2_CompatDropOff = 0x00000800, 108 LIF2_CompatBoomScroll = 0x00001000, 109 LIF2_CompatInvisibility = 0x00002000, 110 LIF2_LaxMonsterActivation = 0x00004000, 111 LIF2_HaveMonsterActivation = 0x00008000, 112 LIF2_ClusterHub = 0x00010000, 113 LIF2_BegunPlay = 0x00020000, 114 }; 115 vuint32 LevelInfoFlags2; 116 117 int TotalKills; 118 int TotalItems; 119 int TotalSecret; // for intermission 120 int CurrentKills; 121 int CurrentItems; 122 int CurrentSecret; 123 124 float CompletitionTime; // For intermission 125 126 // Maintain single and multi player starting spots. 127 TArray<mthing_t> DeathmatchStarts; // Player spawn spots for deathmatch. 128 TArray<mthing_t> PlayerStarts; // Player spawn spots. 129 130 VEntity* TIDHash[TID_HASH_SIZE]; 131 132 float Gravity; // Level Gravity 133 float AirControl; 134 int Infighting; 135 TArray<VMapSpecialAction> SpecialActions; 136 137 VLevelInfo(); 138 139 void SetMapInfo(const mapInfo_t&); 140 141 void SectorStartSound(const sector_t*, int, int, float, float); 142 void SectorStopSound(const sector_t*, int); 143 void SectorStartSequence(const sector_t*, VName, int); 144 void SectorStopSequence(const sector_t*); 145 void PolyobjStartSequence(const polyobj_t*, VName, int); 146 void PolyobjStopSequence(const polyobj_t*); 147 148 void ExitLevel(int Position); 149 void SecretExitLevel(int Position); 150 void Completed(int Map, int Position, int SaveAngle); 151 152 bool ChangeSwitchTexture(int, bool, VName, bool&); 153 bool StartButton(int, vuint8, int, VName, bool); 154 155 VEntity* FindMobjFromTID(int, VEntity*); 156 157 void ChangeMusic(VName); 158 GetLevelName()159 VStr GetLevelName() const 160 { 161 return LevelInfoFlags & LIF_LookupName ? GLanguage[*LevelName] : LevelName; 162 } 163 164 // Static lights 165 DECLARE_FUNCTION(AddStaticLight) DECLARE_FUNCTION(AddStaticLightRGB)166 DECLARE_FUNCTION(AddStaticLightRGB) 167 168 // Sound sequences 169 DECLARE_FUNCTION(SectorStartSequence) 170 DECLARE_FUNCTION(SectorStopSequence) 171 DECLARE_FUNCTION(PolyobjStartSequence) 172 DECLARE_FUNCTION(PolyobjStopSequence) 173 174 // Exiting the level 175 DECLARE_FUNCTION(ExitLevel) 176 DECLARE_FUNCTION(SecretExitLevel) 177 DECLARE_FUNCTION(Completed) 178 179 // Special thinker utilites 180 DECLARE_FUNCTION(ChangeSwitchTexture) 181 DECLARE_FUNCTION(FindMobjFromTID) 182 DECLARE_FUNCTION(AutoSave) 183 184 DECLARE_FUNCTION(ChangeMusic) 185 186 void eventSpawnSpecials() 187 { 188 P_PASS_SELF; 189 EV_RET_VOID(NAME_SpawnSpecials); 190 } eventUpdateSpecials()191 void eventUpdateSpecials() 192 { 193 P_PASS_SELF; 194 EV_RET_VOID(NAME_UpdateSpecials); 195 } eventAfterUnarchiveThinkers()196 void eventAfterUnarchiveThinkers() 197 { 198 P_PASS_SELF; 199 EV_RET_VOID(NAME_AfterUnarchiveThinkers); 200 } eventPolyThrustMobj(VEntity * A,TVec thrustDir,polyobj_t * po)201 void eventPolyThrustMobj(VEntity* A, TVec thrustDir, polyobj_t* po) 202 { 203 P_PASS_SELF; 204 P_PASS_REF(A); 205 P_PASS_VEC(thrustDir); 206 P_PASS_PTR(po); 207 EV_RET_VOID(NAME_PolyThrustMobj); 208 } eventTagBusy(int tag)209 bool eventTagBusy(int tag) 210 { 211 P_PASS_SELF; 212 P_PASS_INT(tag); 213 EV_RET_BOOL(NAME_TagBusy); 214 } eventPolyBusy(int polyobj)215 bool eventPolyBusy(int polyobj) 216 { 217 P_PASS_SELF; 218 P_PASS_INT(polyobj); 219 EV_RET_BOOL(NAME_PolyBusy); 220 } eventThingCount(int type,VName TypeName,int tid,int SectorTag)221 int eventThingCount(int type, VName TypeName, int tid, int SectorTag) 222 { 223 P_PASS_SELF; 224 P_PASS_INT(type); 225 P_PASS_NAME(TypeName); 226 P_PASS_INT(tid); 227 P_PASS_INT(SectorTag); 228 EV_RET_INT(NAME_ThingCount); 229 } eventExecuteActionSpecial(int Special,int Arg1,int Arg2,int Arg3,int Arg4,int Arg5,line_t * Line,int Side,VEntity * A)230 int eventExecuteActionSpecial(int Special, int Arg1, int Arg2, int Arg3, 231 int Arg4, int Arg5, line_t* Line, int Side, VEntity* A) 232 { 233 P_PASS_SELF; 234 P_PASS_INT(Special); 235 P_PASS_INT(Arg1); 236 P_PASS_INT(Arg2); 237 P_PASS_INT(Arg3); 238 P_PASS_INT(Arg4); 239 P_PASS_INT(Arg5); 240 P_PASS_PTR(Line); 241 P_PASS_INT(Side); 242 P_PASS_REF(A); 243 EV_RET_INT(NAME_ExecuteActionSpecial); 244 } eventEV_ThingProjectile(int tid,int type,int angle,int speed,int vspeed,int gravity,int newtid,VName TypeName,VEntity * Activator)245 int eventEV_ThingProjectile(int tid, int type, int angle, int speed, 246 int vspeed, int gravity, int newtid, VName TypeName, VEntity* Activator) 247 { 248 P_PASS_SELF; 249 P_PASS_INT(tid); 250 P_PASS_INT(type); 251 P_PASS_INT(angle); 252 P_PASS_INT(speed); 253 P_PASS_INT(vspeed); 254 P_PASS_INT(gravity); 255 P_PASS_INT(newtid); 256 P_PASS_NAME(TypeName); 257 P_PASS_REF(Activator); 258 EV_RET_INT(NAME_EV_ThingProjectile); 259 } eventStartPlaneWatcher(VEntity * it,line_t * line,int lineSide,bool ceiling,int tag,int height,int special,int arg1,int arg2,int arg3,int arg4,int arg5)260 void eventStartPlaneWatcher(VEntity* it, line_t* line, int lineSide, 261 bool ceiling, int tag, int height, int special, int arg1, int arg2, 262 int arg3, int arg4, int arg5) 263 { 264 P_PASS_SELF; 265 P_PASS_REF(it); 266 P_PASS_PTR(line); 267 P_PASS_INT(lineSide); 268 P_PASS_BOOL(ceiling); 269 P_PASS_INT(tag); 270 P_PASS_INT(height); 271 P_PASS_INT(special); 272 P_PASS_INT(arg1); 273 P_PASS_INT(arg2); 274 P_PASS_INT(arg3); 275 P_PASS_INT(arg4); 276 P_PASS_INT(arg5); 277 EV_RET_VOID(NAME_StartPlaneWatcher); 278 } eventSpawnMapThing(mthing_t * mthing)279 void eventSpawnMapThing(mthing_t* mthing) 280 { 281 P_PASS_SELF; 282 P_PASS_PTR(mthing); 283 EV_RET_VOID(NAME_SpawnMapThing); 284 } eventUpdateParticle(particle_t * p,float DeltaTime)285 void eventUpdateParticle(particle_t* p, float DeltaTime) 286 { 287 P_PASS_SELF; 288 P_PASS_PTR(p); 289 P_PASS_FLOAT(DeltaTime); 290 EV_RET_VOID(NAME_UpdateParticle); 291 } eventAcsSpawnThing(VName Name,TVec Org,int Tid,float Angle)292 int eventAcsSpawnThing(VName Name, TVec Org, int Tid, float Angle) 293 { 294 P_PASS_SELF; 295 P_PASS_NAME(Name); 296 P_PASS_VEC(Org); 297 P_PASS_INT(Tid); 298 P_PASS_FLOAT(Angle); 299 EV_RET_INT(NAME_AcsSpawnThing); 300 } eventAcsSpawnSpot(VName Name,int SpotTid,int Tid,float Angle)301 int eventAcsSpawnSpot(VName Name, int SpotTid, int Tid, float Angle) 302 { 303 P_PASS_SELF; 304 P_PASS_NAME(Name); 305 P_PASS_INT(SpotTid); 306 P_PASS_INT(Tid); 307 P_PASS_FLOAT(Angle); 308 EV_RET_INT(NAME_AcsSpawnSpot); 309 } eventAcsSpawnSpotFacing(VName Name,int SpotTid,int Tid)310 int eventAcsSpawnSpotFacing(VName Name, int SpotTid, int Tid) 311 { 312 P_PASS_SELF; 313 P_PASS_NAME(Name); 314 P_PASS_INT(SpotTid); 315 P_PASS_INT(Tid); 316 EV_RET_INT(NAME_AcsSpawnSpotFacing); 317 } eventSectorDamage(int Tag,int Amount,VName DamageType,VName ProtectionType,int Flags)318 void eventSectorDamage(int Tag, int Amount, VName DamageType, 319 VName ProtectionType, int Flags) 320 { 321 P_PASS_SELF; 322 P_PASS_INT(Tag); 323 P_PASS_INT(Amount); 324 P_PASS_NAME(DamageType); 325 P_PASS_NAME(ProtectionType); 326 P_PASS_INT(Flags); 327 EV_RET_VOID(NAME_SectorDamage); 328 } eventDoThingDamage(int Tid,int Amount,VName DmgType,VEntity * Activator)329 int eventDoThingDamage(int Tid, int Amount, VName DmgType, VEntity* Activator) 330 { 331 P_PASS_SELF; 332 P_PASS_INT(Tid); 333 P_PASS_INT(Amount); 334 P_PASS_NAME(DmgType); 335 P_PASS_REF(Activator); 336 EV_RET_INT(NAME_DoThingDamage); 337 } eventSetMarineWeapon(int Tid,int Weapon,VEntity * Activator)338 void eventSetMarineWeapon(int Tid, int Weapon, VEntity* Activator) 339 { 340 P_PASS_SELF; 341 P_PASS_INT(Tid); 342 P_PASS_INT(Weapon); 343 P_PASS_REF(Activator); 344 EV_RET_VOID(NAME_SetMarineWeapon); 345 } eventSetMarineSprite(int Tid,VName SrcClass,VEntity * Activator)346 void eventSetMarineSprite(int Tid, VName SrcClass, VEntity* Activator) 347 { 348 P_PASS_SELF; 349 P_PASS_INT(Tid); 350 P_PASS_NAME(SrcClass); 351 P_PASS_REF(Activator); 352 EV_RET_VOID(NAME_SetMarineSprite); 353 } eventAcsFadeRange(float BlendR1,float BlendG1,float BlendB1,float BlendA1,float BlendR2,float BlendG2,float BlendB2,float BlendA2,float Duration,VEntity * Activator)354 void eventAcsFadeRange(float BlendR1, float BlendG1, float BlendB1, 355 float BlendA1, float BlendR2, float BlendG2, float BlendB2, 356 float BlendA2, float Duration, VEntity* Activator) 357 { 358 P_PASS_SELF; 359 P_PASS_FLOAT(BlendR1); 360 P_PASS_FLOAT(BlendG1); 361 P_PASS_FLOAT(BlendB1); 362 P_PASS_FLOAT(BlendA1); 363 P_PASS_FLOAT(BlendR2); 364 P_PASS_FLOAT(BlendG2); 365 P_PASS_FLOAT(BlendB2); 366 P_PASS_FLOAT(BlendA2); 367 P_PASS_FLOAT(Duration); 368 P_PASS_REF(Activator); 369 EV_RET_VOID(NAME_AcsFadeRange); 370 } eventAcsCancelFade(VEntity * Activator)371 void eventAcsCancelFade(VEntity* Activator) 372 { 373 P_PASS_SELF; 374 P_PASS_REF(Activator); 375 EV_RET_VOID(NAME_AcsCancelFade); 376 } 377 }; 378