void P_CopyLine(Line *dest, Line *src) { xline_t *xsrc = P_ToXLine(src); xline_t *xdest = P_ToXLine(dest); if(src == dest) return; // no point copying self // Copy the built-in properties for(int i = 0; i < 2; ++i) // For each side { int sidx = (i==0? DMU_FRONT : DMU_BACK); Side *sidefrom = (Side *)P_GetPtrp(src, sidx); Side *sideto = (Side *)P_GetPtrp(dest, sidx); if(!sidefrom || !sideto) continue; float temp[4]; coord_t itemp[2]; P_SetPtrp (sideto, DMU_TOP_MATERIAL, P_GetPtrp(sidefrom, DMU_TOP_MATERIAL)); P_GetDoublepv(sidefrom, DMU_TOP_MATERIAL_OFFSET_XY, itemp); P_SetDoublepv(sideto, DMU_TOP_MATERIAL_OFFSET_XY, itemp); P_GetFloatpv (sidefrom, DMU_TOP_COLOR, temp); P_SetFloatpv (sideto, DMU_TOP_COLOR, temp); P_SetPtrp (sideto, DMU_MIDDLE_MATERIAL, P_GetPtrp(sidefrom, DMU_MIDDLE_MATERIAL)); P_GetDoublepv(sidefrom, DMU_MIDDLE_MATERIAL_OFFSET_XY, itemp); P_SetDoublepv(sideto, DMU_MIDDLE_MATERIAL_OFFSET_XY, itemp); P_SetFloatpv (sideto, DMU_MIDDLE_COLOR, temp); P_SetIntp (sideto, DMU_MIDDLE_BLENDMODE, P_GetIntp(sidefrom, DMU_MIDDLE_BLENDMODE)); P_SetPtrp (sideto, DMU_BOTTOM_MATERIAL, P_GetPtrp(sidefrom, DMU_BOTTOM_MATERIAL)); P_GetDoublepv(sidefrom, DMU_BOTTOM_MATERIAL_OFFSET_XY, itemp); P_SetDoublepv(sideto, DMU_BOTTOM_MATERIAL_OFFSET_XY, itemp); P_GetFloatpv (sidefrom, DMU_BOTTOM_COLOR, temp); P_SetFloatpv (sideto, DMU_BOTTOM_COLOR, temp); } // Copy the extended properties too #if __JDOOM__ || __JHERETIC__ || __JDOOM64__ xdest->special = xsrc->special; xdest->tag = xsrc->tag; if(xsrc->xg && xdest->xg) std::memcpy(xdest->xg, xsrc->xg, sizeof(*xdest->xg)); else xdest->xg = 0; #else xdest->special = xsrc->special; xdest->arg1 = xsrc->arg1; xdest->arg2 = xsrc->arg2; xdest->arg3 = xsrc->arg3; xdest->arg4 = xsrc->arg4; xdest->arg5 = xsrc->arg5; #endif }
void P_BuildLineTagLists(void) { int i; P_DestroyLineTagLists(); for(i = 0; i < numlines; ++i) { Line* line = P_ToPtr(DMU_LINE, i); xline_t* xline = P_ToXLine(line); #if !__JHEXEN__ if(xline->tag) { iterlist_t* list = P_GetLineIterListForTag(xline->tag, true); IterList_PushBack(list, line); } #else switch(xline->special) { default: break; case 121: ///< Line_SetIdentification. if(xline->arg1) { iterlist_t* list = P_GetLineIterListForTag((int) xline->arg1, true); IterList_PushBack(list, line); } xline->special = 0; break; } #endif } }
void EV_TurnTagLightsOff(linedef_t *line) { int j; float min; float lightlevel; sector_t *sec = NULL, *tsec; linedef_t *other; iterlist_t *list; list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; P_IterListResetIterator(list, true); while((sec = P_IterListIterator(list)) != NULL) { min = P_GetFloatp(sec, DMU_LIGHT_LEVEL); for(j = 0; j < P_GetIntp(sec, DMU_LINEDEF_COUNT); ++j) { other = P_GetPtrp(sec, DMU_LINEDEF_OF_SECTOR | j); tsec = P_GetNextSector(other, sec); if(!tsec) continue; lightlevel = P_GetFloatp(tsec, DMU_LIGHT_LEVEL); if(lightlevel < min) min = lightlevel; } P_SetFloatp(sec, DMU_LIGHT_LEVEL, min); } }
void EV_LightTurnOn(Line *line, float max) { iterlist_t *list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; float lightLevel = 0; if(NON_ZERO(max)) lightLevel = max; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); Sector *sec; while((sec = (Sector *)IterList_MoveIterator(list))) { // If Max = 0 means to search for the highest light level in the // surrounding sector. if(IS_ZERO(max)) { lightLevel = P_GetFloatp(sec, DMU_LIGHT_LEVEL); float otherLevel = DDMINFLOAT; P_FindSectorSurroundingHighestLight(sec, &otherLevel); if(otherLevel > lightLevel) lightLevel = otherLevel; } P_SetFloatp(sec, DMU_LIGHT_LEVEL, lightLevel); } }
/// @return 0= continue iteration; otherwise stop. static int spreadSoundToNeighbors(void *ptr, void *context) { spreadsoundtoneighborsparams_t *parm = (spreadsoundtoneighborsparams_t *) context; Line *li = (Line *) ptr; xline_t *xline = P_ToXLine(li); Sector *frontSec, *backSec, *other; assert(xline); if(!(xline->flags & ML_TWOSIDED)) return false; frontSec = P_GetPtrp(li, DMU_FRONT_SECTOR); if(!frontSec) return false; backSec = P_GetPtrp(li, DMU_BACK_SECTOR); if(!backSec) return false; P_SetTraceOpening(li); if(!(P_TraceOpening()->range > 0)) return false; other = (frontSec == parm->baseSec? backSec : frontSec); if(xline->flags & ML_SOUNDBLOCK) { if(!parm->soundBlocks) P_RecursiveSound(parm->soundTarget, other, 1); } else { P_RecursiveSound(parm->soundTarget, other, parm->soundBlocks); } return false; // Continue iteration. }
Sector *P_GetNextSector(Line *line, Sector *sec) { if(!sec || !line) return 0; if(!(P_ToXLine(line)->flags & ML_TWOSIDED)) return 0; Sector *frontSec = (Sector *)P_GetPtrp(line, DMU_FRONT_SECTOR); if(frontSec == sec) return (Sector *)P_GetPtrp(line, DMU_BACK_SECTOR); return frontSec; }
/** * Start strobing lights (usually from a trigger) */ void EV_StartLightStrobing(Line *line) { iterlist_t *list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); Sector *sec; while((sec = (Sector *)IterList_MoveIterator(list))) { if(P_ToXSector(sec)->specialData) continue; P_SpawnStrobeFlash(sec, SLOWDARK, 0); } }
/** * Start strobing lights (usually from a trigger). */ void EV_StartLightStrobing(linedef_t *line) { sector_t *sec = NULL; iterlist_t *list; list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; P_IterListResetIterator(list, true); while((sec = P_IterListIterator(list)) != NULL) { if(P_ToXSector(sec)->specialData) continue; P_SpawnStrobeFlash(sec, SLOWDARK, 0); } }
/** * Called when a thing shoots a special line. */ static void P_ShootSpecialLine(mobj_t *thing, Line *line) { xline_t *xline = P_ToXLine(line); // Impacts that other things can activate. if(!thing->player) { switch(xline->special) { default: return; case 46: ///< OPEN DOOR IMPACT break; } } switch(xline->special) { case 24: ///< RAISE FLOOR EV_DoFloor(line, FT_RAISEFLOOR); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; break; case 46: ///< OPEN DOOR EV_DoDoor(line, DT_OPEN); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 47: ///< RAISE FLOOR NEAR AND CHANGE EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; break; case 191: ///< LOWER FLOOR WAIT RAISE (jd64) EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; } }
void EV_TurnTagLightsOff(Line *line) { iterlist_t *list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; IterList_SetIteratorDirection(list, ITERLIST_FORWARD); IterList_RewindIterator(list); Sector *sec; while((sec = (Sector *)IterList_MoveIterator(list))) { float lightLevel = P_GetFloatp(sec, DMU_LIGHT_LEVEL); float otherLevel = DDMAXFLOAT; P_FindSectorSurroundingLowestLight(sec, &otherLevel); if(otherLevel < lightLevel) lightLevel = otherLevel; P_SetFloatp(sec, DMU_LIGHT_LEVEL, lightLevel); } }
int EV_DoPlat(Line *line, plattype_e type, int amount) #endif { #if __JHEXEN__ return doPlat(line, (int) args[0], args, type, amount); #else int rtn = 0; xline_t *xline = P_ToXLine(line); // Activate all <type> plats that are in stasis. switch(type) { case PT_PERPETUALRAISE: rtn = P_PlatActivate(xline->tag); break; default: break; } return doPlat(line, xline->tag, type, amount) || rtn; #endif }
void EV_LightTurnOn(linedef_t *line, float max) { int j; float lightlevel; sector_t *sec = NULL, *tsec; linedef_t *tline; iterlist_t *list; list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return; P_IterListResetIterator(list, true); while((sec = P_IterListIterator(list)) != NULL) { // max = 0 means to search // for highest light level // surrounding sector if(!max) { for(j = 0; j < P_GetIntp(sec, DMU_LINEDEF_COUNT); ++j) { tline = P_GetPtrp(sec, DMU_LINEDEF_OF_SECTOR | j); tsec = P_GetNextSector(tline, sec); if(!tsec) continue; lightlevel = P_GetFloatp(tsec, DMU_LIGHT_LEVEL); if(lightlevel > max) max = lightlevel; } } P_SetFloatp(sec, DMU_LIGHT_LEVEL, max); } }
/** * Reads all versions of archived lines. * Including the old Ver1. */ void SV_ReadLine(Line *li, MapStateReader *msr) { xline_t *xli = P_ToXLine(li); Reader1 *reader = msr->reader(); int mapVersion = msr->mapVersion(); bool xgDataFollows = false; #if __JHEXEN__ if(mapVersion >= 4) #else if(mapVersion >= 2) #endif { xgDataFollows = Reader_ReadByte(reader) == 1; } #ifdef __JHEXEN__ DENG2_UNUSED(xgDataFollows); #endif // A version byte? int ver = 1; #if __JHEXEN__ if(mapVersion >= 3) #else if(mapVersion >= 5) #endif { ver = (int) Reader_ReadByte(reader); } if(ver >= 4) { P_SetIntp(li, DMU_FLAGS, Reader_ReadInt16(reader)); } int flags = Reader_ReadInt16(reader); if(xli->flags & ML_TWOSIDED) { flags |= ML_TWOSIDED; } if(ver < 4) { // Translate old line flags. int ddLineFlags = 0; if(flags & 0x0001) // old ML_BLOCKING flag { ddLineFlags |= DDLF_BLOCKING; flags &= ~0x0001; } if(flags & 0x0008) // old ML_DONTPEGTOP flag { ddLineFlags |= DDLF_DONTPEGTOP; flags &= ~0x0008; } if(flags & 0x0010) // old ML_DONTPEGBOTTOM flag { ddLineFlags |= DDLF_DONTPEGBOTTOM; flags &= ~0x0010; } P_SetIntp(li, DMU_FLAGS, ddLineFlags); } if(ver < 3) { if(flags & ML_MAPPED) { int lineIDX = P_ToIndex(li); // Set line as having been seen by all players.. de::zap(xli->mapped); for(int i = 0; i < MAXPLAYERS; ++i) { P_SetLineAutomapVisibility(i, lineIDX, true); } } } xli->flags = flags; if(ver >= 3) { for(int i = 0; i < MAXPLAYERS; ++i) { xli->mapped[i] = Reader_ReadByte(reader); } } #if __JHEXEN__ xli->special = Reader_ReadByte(reader); xli->arg1 = Reader_ReadByte(reader); xli->arg2 = Reader_ReadByte(reader); xli->arg3 = Reader_ReadByte(reader); xli->arg4 = Reader_ReadByte(reader); xli->arg5 = Reader_ReadByte(reader); #else xli->special = Reader_ReadInt16(reader); /*xli->tag =*/ Reader_ReadInt16(reader); #endif // For each side for(int i = 0; i < 2; ++i) { Side *si = (Side *)P_GetPtrp(li, (i? DMU_BACK:DMU_FRONT)); if(!si) continue; // Versions latter than 2 store per surface texture offsets. if(ver >= 2) { float offset[2]; offset[VX] = (float) Reader_ReadInt16(reader); offset[VY] = (float) Reader_ReadInt16(reader); P_SetFloatpv(si, DMU_TOP_MATERIAL_OFFSET_XY, offset); offset[VX] = (float) Reader_ReadInt16(reader); offset[VY] = (float) Reader_ReadInt16(reader); P_SetFloatpv(si, DMU_MIDDLE_MATERIAL_OFFSET_XY, offset); offset[VX] = (float) Reader_ReadInt16(reader); offset[VY] = (float) Reader_ReadInt16(reader); P_SetFloatpv(si, DMU_BOTTOM_MATERIAL_OFFSET_XY, offset); } else { float offset[2]; offset[VX] = (float) Reader_ReadInt16(reader); offset[VY] = (float) Reader_ReadInt16(reader); P_SetFloatpv(si, DMU_TOP_MATERIAL_OFFSET_XY, offset); P_SetFloatpv(si, DMU_MIDDLE_MATERIAL_OFFSET_XY, offset); P_SetFloatpv(si, DMU_BOTTOM_MATERIAL_OFFSET_XY, offset); } if(ver >= 3) { P_SetIntp(si, DMU_TOP_FLAGS, Reader_ReadInt16(reader)); P_SetIntp(si, DMU_MIDDLE_FLAGS, Reader_ReadInt16(reader)); P_SetIntp(si, DMU_BOTTOM_FLAGS, Reader_ReadInt16(reader)); } world_Material *topMaterial = 0, *bottomMaterial = 0, *middleMaterial = 0; #if !__JHEXEN__ if(mapVersion >= 4) #endif { topMaterial = msr->material(Reader_ReadInt16(reader), 1); bottomMaterial = msr->material(Reader_ReadInt16(reader), 1); middleMaterial = msr->material(Reader_ReadInt16(reader), 1); } P_SetPtrp(si, DMU_TOP_MATERIAL, topMaterial); P_SetPtrp(si, DMU_BOTTOM_MATERIAL, bottomMaterial); P_SetPtrp(si, DMU_MIDDLE_MATERIAL, middleMaterial); // Ver2 includes surface colours if(ver >= 2) { float rgba[4]; int flags; for(int k = 0; k < 3; ++k) rgba[k] = (float) Reader_ReadByte(reader) / 255.f; rgba[3] = 1; P_SetFloatpv(si, DMU_TOP_COLOR, rgba); for(int k = 0; k < 3; ++k) rgba[k] = (float) Reader_ReadByte(reader) / 255.f; rgba[3] = 1; P_SetFloatpv(si, DMU_BOTTOM_COLOR, rgba); for(int k = 0; k < 4; ++k) rgba[k] = (float) Reader_ReadByte(reader) / 255.f; P_SetFloatpv(si, DMU_MIDDLE_COLOR, rgba); P_SetIntp(si, DMU_MIDDLE_BLENDMODE, Reader_ReadInt32(reader)); flags = Reader_ReadInt16(reader); if(mapVersion < 12) { if(P_GetIntp(si, DMU_FLAGS) & SDF_SUPPRESS_BACK_SECTOR) flags |= SDF_SUPPRESS_BACK_SECTOR; } P_SetIntp(si, DMU_FLAGS, flags); } } #if !__JHEXEN__ if(xgDataFollows) { SV_ReadXGLine(li, msr); } #endif }
void SV_WriteLine(Line *li, MapStateWriter *msw) { xline_t *xli = P_ToXLine(li); Writer1 *writer = msw->writer(); #if !__JHEXEN__ Writer_WriteByte(writer, xli->xg? 1 : 0); /// @c 1= XG data will follow. #else Writer_WriteByte(writer, 0); #endif // Version. // 2: Per surface texture offsets. // 2: Surface colors. // 3: "Mapped by player" values. // 3: Surface flags. // 4: Engine-side line flags. Writer_WriteByte(writer, 4); // Write a version byte Writer_WriteInt16(writer, P_GetIntp(li, DMU_FLAGS)); Writer_WriteInt16(writer, xli->flags); for(int i = 0; i < MAXPLAYERS; ++i) Writer_WriteByte(writer, xli->mapped[i]); #if __JHEXEN__ Writer_WriteByte(writer, xli->special); Writer_WriteByte(writer, xli->arg1); Writer_WriteByte(writer, xli->arg2); Writer_WriteByte(writer, xli->arg3); Writer_WriteByte(writer, xli->arg4); Writer_WriteByte(writer, xli->arg5); #else Writer_WriteInt16(writer, xli->special); Writer_WriteInt16(writer, xli->tag); #endif // For each side float rgba[4]; for(int i = 0; i < 2; ++i) { Side *si = (Side *)P_GetPtrp(li, (i? DMU_BACK:DMU_FRONT)); if(!si) continue; Writer_WriteInt16(writer, P_GetIntp(si, DMU_TOP_MATERIAL_OFFSET_X)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_TOP_MATERIAL_OFFSET_Y)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_MIDDLE_MATERIAL_OFFSET_X)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_MIDDLE_MATERIAL_OFFSET_Y)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_BOTTOM_MATERIAL_OFFSET_X)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_BOTTOM_MATERIAL_OFFSET_Y)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_TOP_FLAGS)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_MIDDLE_FLAGS)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_BOTTOM_FLAGS)); Writer_WriteInt16(writer, msw->serialIdFor((world_Material *)P_GetPtrp(si, DMU_TOP_MATERIAL))); Writer_WriteInt16(writer, msw->serialIdFor((world_Material *)P_GetPtrp(si, DMU_BOTTOM_MATERIAL))); Writer_WriteInt16(writer, msw->serialIdFor((world_Material *)P_GetPtrp(si, DMU_MIDDLE_MATERIAL))); P_GetFloatpv(si, DMU_TOP_COLOR, rgba); for(int k = 0; k < 3; ++k) Writer_WriteByte(writer, (byte)(255 * rgba[k])); P_GetFloatpv(si, DMU_BOTTOM_COLOR, rgba); for(int k = 0; k < 3; ++k) Writer_WriteByte(writer, (byte)(255 * rgba[k])); P_GetFloatpv(si, DMU_MIDDLE_COLOR, rgba); for(int k = 0; k < 4; ++k) Writer_WriteByte(writer, (byte)(255 * rgba[k])); Writer_WriteInt32(writer, P_GetIntp(si, DMU_MIDDLE_BLENDMODE)); Writer_WriteInt16(writer, P_GetIntp(si, DMU_FLAGS)); } #if !__JHEXEN__ // Extended General? if(xli->xg) { SV_WriteXGLine(li, msw); } #endif }
/** * Called every time a thing origin is about to cross a line with a non 0 special. */ static void P_CrossSpecialLine(Line *line, int side, mobj_t *thing) { // Extended functionality overrides old. if(XL_CrossLine(line, side, thing)) return; xline_t *xline = P_ToXLine(line); // Triggers that other things can activate if(!thing->player) { dd_bool ok = false; // Things that should NOT trigger specials... switch(thing->type) { case MT_ROCKET: case MT_PLASMA: case MT_BFG: case MT_TROOPSHOT: case MT_HEADSHOT: case MT_BRUISERSHOT: case MT_BRUISERSHOTRED: // jd64 case MT_NTROSHOT: // jd64 return; default: break; } switch(xline->special) { case 39: ///< TELEPORT TRIGGER case 97: ///< TELEPORT RETRIGGER case 993: // jd64 case 125: ///< TELEPORT MONSTERONLY TRIGGER case 126: ///< TELEPORT MONSTERONLY RETRIGGER case 4: ///< RAISE DOOR case 10: ///< PLAT DOWN-WAIT-UP-STAY TRIGGER case 88: ///< PLAT DOWN-WAIT-UP-STAY RETRIGGER case 415: // jd64 ok = true; break; } // Anything can trigger this line! if(xline->flags & ML_ALLTRIGGER) ok = true; if(!ok) return; } // Note: could use some const's here. switch(xline->special) { // TRIGGERS. // All from here to RETRIGGERS. case 2: // Open Door EV_DoDoor(line, DT_OPEN); xline->special = 0; break; case 3: // Close Door EV_DoDoor(line, DT_CLOSE); xline->special = 0; break; case 4: // Raise Door EV_DoDoor(line, DT_NORMAL); xline->special = 0; break; case 5: // Raise Floor EV_DoFloor(line, FT_RAISEFLOOR); xline->special = 0; break; case 6: // Fast Ceiling Crush & Raise EV_DoCeiling(line, CT_CRUSHANDRAISEFAST); xline->special = 0; break; case 8: // Build Stairs EV_BuildStairs(line, build8); xline->special = 0; break; case 10: // PlatDownWaitUp EV_DoPlat(line, PT_DOWNWAITUPSTAY, 0); xline->special = 0; break; case 12: // Light Turn On - brightest near EV_LightTurnOn(line, 0); xline->special = 0; break; case 13: // Light Turn On - max EV_LightTurnOn(line, 1); xline->special = 0; break; case 16: // Close Door 30 EV_DoDoor(line, DT_CLOSE30THENOPEN); xline->special = 0; break; case 17: // Start Light Strobing EV_StartLightStrobing(line); xline->special = 0; break; case 19: // Lower Floor EV_DoFloor(line, FT_LOWER); xline->special = 0; break; case 22: // Raise floor to nearest height and change texture EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0); xline->special = 0; break; case 25: // Ceiling Crush and Raise EV_DoCeiling(line, CT_CRUSHANDRAISE); xline->special = 0; break; case 30: // Raise floor to shortest texture height // on either side of lines. EV_DoFloor(line, FT_RAISETOTEXTURE); xline->special = 0; break; case 35: // Lights Very Dark EV_LightTurnOn(line, 35.0f/255.0f); xline->special = 0; break; case 36: // Lower Floor (TURBO) EV_DoFloor(line, FT_LOWERTURBO); xline->special = 0; break; case 37: // LowerAndChange EV_DoFloor(line, FT_LOWERANDCHANGE); xline->special = 0; break; case 38: // Lower Floor To Lowest EV_DoFloor(line, FT_LOWERTOLOWEST); xline->special = 0; break; case 420: // jd64 EV_DoFloorAndCeiling(line, FT_TOHIGHESTPLUS8, CT_RAISETOHIGHEST); xline->special = 0; break; case 430: // jd64 EV_DoFloor(line, FT_TOHIGHESTPLUSBITMIP); break; case 431: // jd64 EV_DoFloor(line, FT_TOHIGHESTPLUSBITMIP); xline->special = 0; break; case 426: // jd64 EV_DoCeiling(line, CT_CUSTOM); break; case 427: // jd64 EV_DoCeiling(line, CT_CUSTOM); xline->special = 0; break; case 991: // jd64 // TELEPORT! EV_FadeSpawn(line, thing); xline->special = 0; break; case 993: // jd64 if(!thing->player) EV_FadeSpawn(line, thing); xline->special = 0; break; case 992: // jd64 // Lower Ceiling to Floor if(EV_DoCeiling(line, CT_LOWERTOFLOOR)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 994: // jd64 /// @todo Might as well do this with XG. /// Also, export this text string to DED. P_SetMessage(thing->player, "You've found a secret area!"); thing->player->secretCount++; thing->player->update |= PSF_COUNTERS; xline->special = 0; break; case 995: // jd64 /// @todo Might as well do this with XG. P_SetMessage(thing->player, "You've found a shrine!"); xline->special = 0; break; case 998: // jd64 // BE GONE! EV_FadeAway(line, thing); xline->special = 0; break; case 39: // TELEPORT! EV_Teleport(line, side, thing, true); xline->special = 0; break; case 40: // RaiseCeilingLowerFloor EV_DoCeiling(line, CT_RAISETOHIGHEST); EV_DoFloor(line, FT_LOWERTOLOWEST); xline->special = 0; break; case 44: // Ceiling Crush EV_DoCeiling(line, CT_LOWERANDCRUSH); xline->special = 0; break; case 52: // EXIT! G_SetGameActionMapCompleted(COMMON_GAMESESSION->mapUriForNamedExit("next")); break; case 53: // Perpetual Platform Raise EV_DoPlat(line, PT_PERPETUALRAISE, 0); xline->special = 0; break; case 54: // Platform Stop P_PlatDeactivate(xline->tag); xline->special = 0; break; case 56: // Raise Floor Crush EV_DoFloor(line, FT_RAISEFLOORCRUSH); xline->special = 0; break; case 57: // Ceiling Crush Stop P_CeilingDeactivate(xline->tag); xline->special = 0; break; case 58: // Raise Floor 24 EV_DoFloor(line, FT_RAISE24); xline->special = 0; break; case 59: // Raise Floor 24 And Change EV_DoFloor(line, FT_RAISE24ANDCHANGE); xline->special = 0; break; case 104: // Turn lights off in sector(tag) EV_TurnTagLightsOff(line); xline->special = 0; break; case 108: // Blazing Door Raise (faster than TURBO!) EV_DoDoor(line, DT_BLAZERAISE); xline->special = 0; break; case 109: // Blazing Door Open (faster than TURBO!) EV_DoDoor(line, DT_BLAZEOPEN); xline->special = 0; break; case 100: // Build Stairs Turbo 16 EV_BuildStairs(line, turbo16); xline->special = 0; break; case 110: // Blazing Door Close (faster than TURBO!) EV_DoDoor(line, DT_BLAZECLOSE); xline->special = 0; break; case 119: // Raise floor to nearest surr. floor EV_DoFloor(line, FT_RAISEFLOORTONEAREST); xline->special = 0; break; case 121: // Blazing PlatDownWaitUpStay EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0); xline->special = 0; break; case 124: // Secret EXIT G_SetGameActionMapCompleted(COMMON_GAMESESSION->mapUriForNamedExit("secret"), 0, true); break; case 125: // TELEPORT MonsterONLY if(!thing->player) { EV_Teleport(line, side, thing, true); xline->special = 0; } break; case 130: // Raise Floor Turbo EV_DoFloor(line, FT_RAISEFLOORTURBO); xline->special = 0; break; case 141: // Silent Ceiling Crush & Raise EV_DoCeiling(line, CT_SILENTCRUSHANDRAISE); xline->special = 0; break; // RETRIGGERS. All from here till end. case 72: // Ceiling Crush EV_DoCeiling(line, CT_LOWERANDCRUSH); break; case 73: // Ceiling Crush and Raise EV_DoCeiling(line, CT_CRUSHANDRAISE); break; case 74: // Ceiling Crush Stop P_CeilingDeactivate(xline->tag); break; case 75: // Close Door EV_DoDoor(line, DT_CLOSE); break; case 76: // Close Door 30 EV_DoDoor(line, DT_CLOSE30THENOPEN); break; case 77: // Fast Ceiling Crush & Raise EV_DoCeiling(line, CT_CRUSHANDRAISEFAST); break; case 79: // Lights Very Dark EV_LightTurnOn(line, 35.0f/255.0f); break; case 80: // Light Turn On - brightest near EV_LightTurnOn(line, 0); break; case 81: // Light Turn On - max EV_LightTurnOn(line, 1); break; case 82: // Lower Floor To Lowest EV_DoFloor(line, FT_LOWERTOLOWEST); break; case 83: // Lower Floor EV_DoFloor(line, FT_LOWER); break; case 84: // LowerAndChange EV_DoFloor(line, FT_LOWERANDCHANGE); break; case 86: // Open Door EV_DoDoor(line, DT_OPEN); break; case 87: // Perpetual Platform Raise EV_DoPlat(line, PT_PERPETUALRAISE, 0); break; case 88: // PlatDownWaitUp EV_DoPlat(line, PT_DOWNWAITUPSTAY, 0); break; case 415: // jd64 if(thing->player) EV_DoPlat(line, PT_UPWAITDOWNSTAY, 0); break; case 89: // Platform Stop P_PlatDeactivate(xline->tag); break; case 90: // Raise Door EV_DoDoor(line, DT_NORMAL); break; case 91: // Raise Floor EV_DoFloor(line, FT_RAISEFLOOR); break; case 92: // Raise Floor 24 EV_DoFloor(line, FT_RAISE24); break; case 93: // Raise Floor 24 And Change EV_DoFloor(line, FT_RAISE24ANDCHANGE); break; case 94: // Raise Floor Crush EV_DoFloor(line, FT_RAISEFLOORCRUSH); break; case 95: // Raise floor to nearest height // and change texture. EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0); break; case 96: // Raise floor to shortest texture height // on either side of lines. EV_DoFloor(line, FT_RAISETOTEXTURE); break; case 97: // TELEPORT! EV_Teleport(line, side, thing, true); break; case 423: // jd64 // TELEPORT! (no fog) // FIXME: DJS - might as well do this in XG. EV_Teleport(line, side, thing, false); break; case 98: // Lower Floor (TURBO) EV_DoFloor(line, FT_LOWERTURBO); break; case 105: // Blazing Door Raise (faster than TURBO!) EV_DoDoor(line, DT_BLAZERAISE); break; case 106: // Blazing Door Open (faster than TURBO!) EV_DoDoor(line, DT_BLAZEOPEN); break; case 107: // Blazing Door Close (faster than TURBO!) EV_DoDoor(line, DT_BLAZECLOSE); break; case 120: // Blazing PlatDownWaitUpStay. EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0); break; case 126: // TELEPORT MonsterONLY. if(!thing->player) EV_Teleport(line, side, thing, true); break; case 128: // Raise To Nearest Floor EV_DoFloor(line, FT_RAISEFLOORTONEAREST); break; case 129: // Raise Floor Turbo EV_DoFloor(line, FT_RAISEFLOORTURBO); break; case 155: // jd64 // Raise Floor 512 // FIXME: DJS - again, might as well do this in XG. if(EV_DoFloor(line, FT_RAISE32)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); P_ToXLine(line)->special = 0; } break; } }
static void P_v13_UnArchiveWorld(void) { int i, j; fixed_t offx, offy; Sector* sec; xsector_t* xsec; Line* line; xline_t* xline; // Do sectors. for(i = 0; i < numsectors; ++i) { Uri *floorTextureUrn, *ceilingTextureUrn; sec = P_ToPtr(DMU_SECTOR, i); xsec = P_ToXSector(sec); P_SetDoublep(sec, DMU_FLOOR_HEIGHT, (coord_t)Reader_ReadInt16(svReader)); P_SetDoublep(sec, DMU_CEILING_HEIGHT, (coord_t)Reader_ReadInt16(svReader)); floorTextureUrn = readTextureUrn(svReader, "Flats"); P_SetPtrp(sec, DMU_FLOOR_MATERIAL, DD_MaterialForTextureUri(floorTextureUrn)); Uri_Delete(floorTextureUrn); ceilingTextureUrn = readTextureUrn(svReader, "Flats"); P_SetPtrp(sec, DMU_CEILING_MATERIAL, DD_MaterialForTextureUri(ceilingTextureUrn)); Uri_Delete(ceilingTextureUrn); P_SetFloatp(sec, DMU_LIGHT_LEVEL, (float) (Reader_ReadInt16(svReader)) / 255.0f); xsec->special = Reader_ReadInt16(svReader); // needed? /*xsec->tag = **/Reader_ReadInt16(svReader); // needed? xsec->specialData = 0; xsec->soundTarget = 0; } // Do lines. for(i = 0; i < numlines; ++i) { line = P_ToPtr(DMU_LINE, i); xline = P_ToXLine(line); xline->flags = Reader_ReadInt16(svReader); xline->special = Reader_ReadInt16(svReader); /*xline->tag =*/Reader_ReadInt16(svReader); for(j = 0; j < 2; ++j) { Uri *topTextureUrn, *bottomTextureUrn, *middleTextureUrn; Side* sdef = P_GetPtrp(line, j == 0? DMU_FRONT : DMU_BACK); if(!sdef) continue; offx = Reader_ReadInt16(svReader) << FRACBITS; offy = Reader_ReadInt16(svReader) << FRACBITS; P_SetFixedp(sdef, DMU_TOP_MATERIAL_OFFSET_X, offx); P_SetFixedp(sdef, DMU_TOP_MATERIAL_OFFSET_Y, offy); P_SetFixedp(sdef, DMU_MIDDLE_MATERIAL_OFFSET_X, offx); P_SetFixedp(sdef, DMU_MIDDLE_MATERIAL_OFFSET_Y, offy); P_SetFixedp(sdef, DMU_BOTTOM_MATERIAL_OFFSET_X, offx); P_SetFixedp(sdef, DMU_BOTTOM_MATERIAL_OFFSET_Y, offy); topTextureUrn = readTextureUrn(svReader, "Textures"); P_SetPtrp(sdef, DMU_TOP_MATERIAL, DD_MaterialForTextureUri(topTextureUrn)); Uri_Delete(topTextureUrn); bottomTextureUrn = readTextureUrn(svReader, "Textures"); P_SetPtrp(sdef, DMU_BOTTOM_MATERIAL, DD_MaterialForTextureUri(bottomTextureUrn)); Uri_Delete(bottomTextureUrn); middleTextureUrn = readTextureUrn(svReader, "Textures"); P_SetPtrp(sdef, DMU_MIDDLE_MATERIAL, DD_MaterialForTextureUri(middleTextureUrn)); Uri_Delete(middleTextureUrn); } } }
dd_bool P_UseSpecialLine2(mobj_t *mo, Line *line, int side) { xline_t *xline = P_ToXLine(line); // Err... // Use the back sides of VERY SPECIAL lines... if(side) { switch(xline->special) { case 124: // Sliding door open&close (unused). break; default: return false; } } // Switches that other things can activate. if(!mo->player) { // Never open secret doors. if(xline->flags & ML_SECRET) return false; switch(xline->special) { case 1: // MANUAL DOOR RAISE case 32: // MANUAL BLUE case 33: // MANUAL RED case 34: // MANUAL YELLOW break; default: return false; break; } } // Do something. switch(xline->special) { // MANUALS case 1: // Vertical Door case 26: // Blue Door/Locked case 27: // Yellow Door /Locked case 28: // Red Door /Locked case 31: // Manual door open case 32: // Blue locked door open case 33: // Red locked door open case 34: // Yellow locked door open case 117: // Blazing door raise case 118: // Blazing door open case 525: // jd64 case 526: // jd64 case 527: // jd64 EV_VerticalDoor(line, mo); break; //UNUSED - Door Slide Open&Close // case 124: // EV_SlidingDoor (line, mo); // break; // SWITCHES case 7: // Build Stairs, if(EV_BuildStairs(line, build8)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 9: // Change Donut, if(EV_DoDonut(line)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 11: // Exit level, if(cyclingMaps && mapCycleNoExit) break; // Prevent zombies from exiting levels, if(mo->player && mo->player->health <= 0 && !cfg.zombiesCanExit) { S_StartSound(SFX_NOWAY, mo); return false; } P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_SWTCHX, false, 0); xline->special = 0; G_SetGameActionMapCompleted(COMMON_GAMESESSION->mapUriForNamedExit("next")); break; case 14: // Raise Floor 32 and change texture. if(EV_DoPlat(line, PT_RAISEANDCHANGE, 32)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 15: // Raise Floor 24 and change texture. if(EV_DoPlat(line, PT_RAISEANDCHANGE, 24)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 18: // Raise Floor to next highest floor. if(EV_DoFloor(line, FT_RAISEFLOORTONEAREST)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 20: // Raise Plat next highest floor and change texture. if(EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 21: // PlatDownWaitUpStay. if(EV_DoPlat(line, PT_DOWNWAITUPSTAY, 0)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 23: // Lower Floor to Lowest. if(EV_DoFloor(line, FT_LOWERTOLOWEST)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 29: // Raise Door. if(EV_DoDoor(line, DT_NORMAL)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 41: // Lower Ceiling to Floor. if(EV_DoCeiling(line, CT_LOWERTOFLOOR)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 71: // Turbo Lower Floor. if(EV_DoFloor(line, FT_LOWERTURBO)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 49: // Ceiling Crush And Raise. if(EV_DoCeiling(line, CT_CRUSHANDRAISE)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 50: // Close Door. if(EV_DoDoor(line, DT_CLOSE)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 51: // Secret EXIT. if(cyclingMaps && mapCycleNoExit) break; // Prevent zombies from exiting levels. if(mo->player && mo->player->health <= 0 && !cfg.zombiesCanExit) { S_StartSound(SFX_NOWAY, mo); return false; } P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; G_SetGameActionMapCompleted(COMMON_GAMESESSION->mapUriForNamedExit("secret"), 0, true); break; case 55: // Raise Floor Crush. if(EV_DoFloor(line, FT_RAISEFLOORCRUSH)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 101: // Raise Floor. if(EV_DoFloor(line, FT_RAISEFLOOR)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 102: // Lower Floor to Surrounding floor height. if(EV_DoFloor(line, FT_LOWER)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 103: // Open Door. if(EV_DoDoor(line, DT_OPEN)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 111: // Blazing Door Raise (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZERAISE)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 112: // Blazing Door Open (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZEOPEN)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 113: // Blazing Door Close (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZECLOSE)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 122: // Blazing PlatDownWaitUpStay. if(EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 127: // Build Stairs Turbo 16. if(EV_BuildStairs(line, turbo16)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 131: // Raise Floor Turbo. if(EV_DoFloor(line, FT_RAISEFLOORTURBO)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 133: // BlzOpenDoor BLUE. case 135: // BlzOpenDoor RED. case 137: // BlzOpenDoor YELLOW. if(EV_DoLockedDoor(line, DT_BLAZEOPEN, mo)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 140: // Raise Floor 512. if(EV_DoFloor(line, FT_RAISE512)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; // BUTTONS case 42: // Close Door. if(EV_DoDoor(line, DT_CLOSE)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 43: // Lower Ceiling to Floor. if(EV_DoCeiling(line, CT_LOWERTOFLOOR)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 45: // Lower Floor to Surrounding floor height. if(EV_DoFloor(line, FT_LOWER)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 60: // Lower Floor to Lowest. if(EV_DoFloor(line, FT_LOWERTOLOWEST)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 61: // Open Door. if(EV_DoDoor(line, DT_OPEN)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 62: // PlatDownWaitUpStay. if(EV_DoPlat(line, PT_DOWNWAITUPSTAY, 1)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 63: // Raise Door. if(EV_DoDoor(line, DT_NORMAL)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 64: // Raise Floor to ceiling. if(EV_DoFloor(line, FT_RAISEFLOOR)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 66: // Raise Floor 24 and change texture. if(EV_DoPlat(line, PT_RAISEANDCHANGE, 24)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 67: // Raise Floor 32 and change texture. if(EV_DoPlat(line, PT_RAISEANDCHANGE, 32)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 65: // Raise Floor Crush. if(EV_DoFloor(line, FT_RAISEFLOORCRUSH)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 68: // Raise Plat to next highest floor and change texture. if(EV_DoPlat(line, PT_RAISETONEARESTANDCHANGE, 0)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 69: // Raise Floor to next highest floor. if(EV_DoFloor(line, FT_RAISEFLOORTONEAREST)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 70: // Turbo Lower Floor. if(EV_DoFloor(line, FT_LOWERTURBO)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 114: // Blazing Door Raise (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZERAISE)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 115: // Blazing Door Open (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZEOPEN)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 116: // Blazing Door Close (faster than TURBO!). if(EV_DoDoor(line, DT_BLAZECLOSE)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 123: // Blazing PlatDownWaitUpStay. if(EV_DoPlat(line, PT_DOWNWAITUPSTAYBLAZE, 0)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 132: // Raise Floor Turbo. if(EV_DoFloor(line, FT_RAISEFLOORTURBO)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 99: // BlzOpenDoor BLUE. case 134: // BlzOpenDoor RED. case 136: // BlzOpenDoor YELLOW. if(EV_DoLockedDoor(line, DT_BLAZERAISE, mo)) // jd64 was "DT_BLAZEOPEN" P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 138: // Light Turn On. EV_LightTurnOn(line, 1); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 139: // Light Turn Off. EV_LightTurnOn(line, 35.0f/255.0f); P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 343: // jd64 - BlzOpenDoor LaserPowerup 1. case 344: // jd64 - BlzOpenDoor LaserPowerup 2. case 345: // jd64 - BlzOpenDoor LaserPowerup 3. if(EV_DoLockedDoor(line, DT_BLAZEOPEN, mo)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 414: // jd64 if(EV_DoPlat(line, PT_UPWAITDOWNSTAY, 1)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 416: // jd64 if(EV_DoFloorAndCeiling(line, FT_TOHIGHESTPLUS8, CT_RAISETOHIGHEST)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 424: // jd64 if(EV_DoCeiling(line, CT_CUSTOM)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 425: // jd64 if(EV_DoCeiling(line, CT_CUSTOM)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; case 428: // jd64 if(EV_DoFloor(line, FT_TOHIGHESTPLUSBITMIP)) P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, BUTTONTIME); break; case 429: // jd64 if(EV_DoFloor(line, FT_TOHIGHESTPLUSBITMIP)) { P_ToggleSwitch((Side *)P_GetPtrp(line, DMU_FRONT), SFX_NONE, false, 0); xline->special = 0; } break; } return true; }
int EV_Teleport(linedef_t *line, int side, mobj_t *thing) { float oldpos[3]; float aboveFloor; mobj_t *m; thinker_t *thinker; sector_t *sec = NULL, *sector; iterlist_t *list; if(thing->flags2 & MF2_NOTELEPORT) return 0; // Don't teleport if hit back of line, // so you can get out of teleporter. if(side == 1) return 0; list = P_GetSectorIterListForTag(P_ToXLine(line)->tag, false); if(!list) return 0; P_IterListResetIterator(list, true); while((sec = P_IterListIterator(list)) != NULL) { thinker = thinkerCap.next; for(thinker = thinkerCap.next; thinker != &thinkerCap; thinker = thinker->next) { // not a mobj if(thinker->function != P_MobjThinker) continue; m = (mobj_t *) thinker; // not a teleportman if(m->type != MT_TELEPORTMAN) continue; sector = P_GetPtrp(m->subsector, DMU_SECTOR); // wrong sector if(sector != sec) continue; memcpy(oldpos, thing->pos, sizeof(thing->pos)); aboveFloor = thing->pos[VZ] - thing->floorZ; if(!P_TeleportMove(thing, m->pos[VX], m->pos[VY], false)) return 0; // In Final Doom things teleported to their destination // but the height wasn't set to the floor. if(gamemission != GM_TNT && gamemission != GM_PLUT) thing->pos[VZ] = thing->floorZ; #if 0 // Spawn teleport fog at source and destination. fog = P_SpawnMobj3fv(MT_TFOG, oldpos); S_StartSound(SFX_TELEPT, fog); an = m->angle >> ANGLETOFINESHIFT; fog = P_SpawnMobj3f(MT_TFOG, m->pos[VX] + 20 * FIX2FLT(finecosine[an]), m->pos[VY] + 20 * FIX2FLT(finesine[an]), thing->pos[VZ]); // Emit sound, where? S_StartSound(SFX_TELEPT, fog); #endif thing->angle = m->angle; if(thing->flags2 & MF2_FLOORCLIP) { thing->floorClip = 0; if(thing->pos[VZ] == P_GetFloatp(thing->subsector, DMU_FLOOR_HEIGHT)) { const terraintype_t* tt = P_MobjGetFloorTerrainType(thing); if(tt->flags & TTF_FLOORCLIP) { thing->floorClip = 10; } } } thing->mom[MX] = thing->mom[MY] = thing->mom[MZ] = 0; // don't move for a bit if(thing->player) { thing->reactionTime = 18; if(thing->player->powers[PT_FLIGHT] && aboveFloor) { thing->pos[VZ] = thing->floorZ + aboveFloor; if(thing->pos[VZ] + thing->height > thing->ceilingZ) { thing->pos[VZ] = thing->ceilingZ - thing->height; } thing->dPlayer->viewZ = thing->pos[VZ] + thing->dPlayer->viewHeight; } else { //thing->dPlayer->clLookDir = 0; /* $unifiedangles */ thing->dPlayer->lookDir = 0; } //thing->dPlayer->clAngle = thing->angle; /* $unifiedangles */ thing->dPlayer->flags |= DDPF_FIXANGLES | DDPF_FIXPOS | DDPF_FIXMOM; } return 1; } } return 0; }
int EV_Teleport(Line* line, int side, mobj_t* mo, dd_bool spawnFog) { mobj_t* dest; // Clients cannot teleport on their own. if(IS_CLIENT) return 0; if(mo->flags2 & MF2_NOTELEPORT) return 0; // Don't teleport if hit back of line, so you can get out of teleporter. if(side == 1) return 0; if((dest = getTeleportDestination(P_ToXLine(line)->tag)) != NULL) { // A suitable destination has been found. coord_t oldPos[3], aboveFloor; angle_t oldAngle; mobj_t* fog; uint an; memcpy(oldPos, mo->origin, sizeof(mo->origin)); oldAngle = mo->angle; aboveFloor = mo->origin[VZ] - mo->floorZ; if(!P_TeleportMove(mo, dest->origin[VX], dest->origin[VY], false)) return 0; mo->origin[VZ] = mo->floorZ; if(spawnFog) { // Spawn teleport fog at source and destination. if((fog = P_SpawnMobj(MT_TFOG, oldPos, oldAngle + ANG180, 0))) S_StartSound(SFX_TELEPT, fog); an = dest->angle >> ANGLETOFINESHIFT; if((fog = P_SpawnMobjXYZ(MT_TFOG, dest->origin[VX] + 20 * FIX2FLT(finecosine[an]), dest->origin[VY] + 20 * FIX2FLT(finesine[an]), mo->origin[VZ], dest->angle + ANG180, 0))) { // Emit sound, where? S_StartSound(SFX_TELEPT, fog); } } mo->angle = dest->angle; if(mo->flags2 & MF2_FLOORCLIP) { mo->floorClip = 0; if(FEQUAL(mo->origin[VZ], P_GetDoublep(Mobj_Sector(mo), DMU_FLOOR_HEIGHT))) { terraintype_t const *tt = P_MobjFloorTerrain(mo); if(tt->flags & TTF_FLOORCLIP) { mo->floorClip = 10; } } } mo->mom[MX] = mo->mom[MY] = mo->mom[MZ] = 0; // $voodoodolls Must be the real player. if(mo->player && mo->player->plr->mo == mo) { mo->reactionTime = 18; // Don't move for a bit. if(mo->player->powers[PT_FLIGHT] && aboveFloor > 0) { mo->origin[VZ] = mo->floorZ + aboveFloor; if(mo->origin[VZ] + mo->height > mo->ceilingZ) { mo->origin[VZ] = mo->ceilingZ - mo->height; } } else { //mo->dPlayer->clLookDir = 0; /* $unifiedangles */ mo->dPlayer->lookDir = 0; } mo->player->viewHeight = (coord_t) cfg.common.plrViewHeight; mo->player->viewHeightDelta = 0; mo->player->viewZ = mo->origin[VZ] + mo->player->viewHeight; mo->player->viewOffset[VX] = mo->player->viewOffset[VY] = mo->player->viewOffset[VZ] = 0; mo->player->bob = 0; //mo->dPlayer->clAngle = mo->angle; /* $unifiedangles */ mo->dPlayer->flags |= DDPF_FIXANGLES | DDPF_FIXORIGIN | DDPF_FIXMOM; } return 1; }