From e0bfe5fd424f721de8d5b478f1eeba77d1124eb1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Mar 2008 17:20:54 +0000 Subject: [PATCH] - Added Line_SetTextureOffset special. - Added 'allowprotection' keyword to terrain definitions to allow damaging flats that don't damage players with a radiation suit. - Fixed: SNDINFO rolloff setting for Strife was missing. SVN r839 (trunk) --- docs/rh-log.txt | 4 ++++ src/actionspecials.h | 1 + src/p_lnspec.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++- src/p_spec.cpp | 18 +++++++++++++-- src/p_terrain.cpp | 7 ++++-- src/p_terrain.h | 1 + src/s_sound.cpp | 5 +++- wadsrc/sndinfo.txt | 2 ++ 8 files changed, 87 insertions(+), 6 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 531ab42629..43fc00627e 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ March 22, 2008 (Changes by Graf Zahl) +- Added Line_SetTextureOffset special. +- Added 'allowprotection' keyword to terrain definitions to allow damaging + flats that don't damage players with a radiation suit. +- Fixed: SNDINFO rolloff setting for Strife was missing. - Added more options to Light_ForceLightning: Setting the first arg to 0 will behave as before, setting it to 1 will create exactly one lighting and setting it to 2 will terminate lightning for the current level diff --git a/src/actionspecials.h b/src/actionspecials.h index 9feaa4026a..4e7b4a4366 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -50,6 +50,7 @@ DEFINE_SPECIAL(GlassBreak, 49, 0, 1) DEFINE_SPECIAL(ExtraFloor_LightOnly, 50, -1, -1) DEFINE_SPECIAL(Sector_SetLink, 51, 4, 4) DEFINE_SPECIAL(Scroll_Wall, 52, 5, 5) +DEFINE_SPECIAL(Line_SetTextureOffset, 53, 5, 5) DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3) DEFINE_SPECIAL(Plat_Stop, 61, 1, 1) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 9ebf4c332c..8007851e45 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2289,6 +2289,59 @@ FUNC(LS_Line_AlignFloor) return ret; } +FUNC(LS_Line_SetTextureOffset) +// Line_SetTextureOffset (id, x, y, side, flags) +{ + const fixed_t NO_CHANGE = 32767< 1) + return false; + + for(int line = -1; (line = P_FindLineFromID (arg0, line)) >= 0; ) + { + if (lines[line].sidenum[arg3] != NO_SIDE) + { + side_t *side = &sides[lines[line].sidenum[arg3]]; + + if ((arg4&8)==0) + { + // set + if (arg1 != NO_CHANGE) + { + if (arg4&1) side->SetTextureXOffset(side_t::top, arg1); + if (arg4&2) side->SetTextureXOffset(side_t::mid, arg1); + if (arg4&4) side->SetTextureXOffset(side_t::bottom, arg1); + } + if (arg2 != NO_CHANGE) + { + if (arg4&1) side->SetTextureYOffset(side_t::top, arg2); + if (arg4&2) side->SetTextureYOffset(side_t::mid, arg2); + if (arg4&4) side->SetTextureYOffset(side_t::bottom, arg2); + } + } + else + { + // add + if (arg1 != NO_CHANGE) + { + if (arg4&1) side->AddTextureXOffset(side_t::top, arg1); + if (arg4&2) side->AddTextureXOffset(side_t::mid, arg1); + if (arg4&4) side->AddTextureXOffset(side_t::bottom, arg1); + } + if (arg2 != NO_CHANGE) + { + if (arg4&1) side->AddTextureYOffset(side_t::top, arg2); + if (arg4&2) side->AddTextureYOffset(side_t::mid, arg2); + if (arg4&4) side->AddTextureYOffset(side_t::bottom, arg2); + } + } + } + } + return true; +} + + + FUNC(LS_ChangeCamera) // ChangeCamera (tid, who, revert?) { @@ -2876,7 +2929,7 @@ lnSpecFunc LineSpecials[256] = LS_NOP, // 50: ExtraFloor_LightOnly LS_Sector_SetLink, LS_Scroll_Wall, - LS_NOP, // 53 + LS_Line_SetTextureOffset, LS_NOP, // 54 LS_NOP, // 55 LS_NOP, // 56 diff --git a/src/p_spec.cpp b/src/p_spec.cpp index c5beb64584..794bdb7a54 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -568,8 +568,22 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType) if (Terrains[floorType].DamageAmount && !(level.time & Terrains[floorType].DamageTimeMask)) { - P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, - Terrains[floorType].DamageMOD); + AInventory *ironfeet = NULL; + + if (Terrains[floorType].AllowProtection) + { + for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) + { + if (ironfeet->IsKindOf (RUNTIME_CLASS(APowerIronFeet))) + break; + } + } + + if (ironfeet == NULL) + { + P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, + Terrains[floorType].DamageMOD); + } if (Terrains[floorType].Splash != -1) { S_SoundID (player->mo, CHAN_AUTO, diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index be362f0f35..c8ff8dacb7 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -80,7 +80,8 @@ enum ETerrainKeywords TR_LEFTSTEPSOUNDS, TR_RIGHTSTEPSOUNDS, TR_LIQUID, - TR_FRICTION + TR_FRICTION, + TR_ALLOWPROTECTION }; enum EGenericType @@ -180,6 +181,7 @@ static const char *TerrainKeywords[] = "rightstepsounds", "liquid", "friction", + "allowprotection", NULL }; @@ -216,7 +218,8 @@ static FGenericParse TerrainParser[] = { GEN_Sound, {theoffsetof(FTerrainDef, LeftStepSound)} }, { GEN_Sound, {theoffsetof(FTerrainDef, RightStepSound)} }, { GEN_Bool, {theoffsetof(FTerrainDef, IsLiquid)} }, - { GEN_Custom, {(size_t)ParseFriction} } + { GEN_Custom, {(size_t)ParseFriction} }, + { GEN_Bool, {theoffsetof(FTerrainDef, AllowProtection)} }, }; /* diff --git a/src/p_terrain.h b/src/p_terrain.h index 44ab4e6db2..3e4e433b33 100644 --- a/src/p_terrain.h +++ b/src/p_terrain.h @@ -74,6 +74,7 @@ struct FTerrainDef int LeftStepSound; int RightStepSound; bool IsLiquid; + bool AllowProtection; fixed_t Friction; fixed_t MoveFactor; }; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 0c34ac4bdc..cf1a554f2c 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1350,7 +1350,6 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) length = Wads.LumpLength (lumpnum); if (length == 0) { - offset = 0; return false; } musiccache.Resize(length); @@ -1360,6 +1359,10 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) { offset = Wads.GetLumpOffset (lumpnum); length = Wads.LumpLength (lumpnum); + if (length == 0) + { + return false; + } } } else diff --git a/wadsrc/sndinfo.txt b/wadsrc/sndinfo.txt index 4c5935c582..d95bc834a3 100644 --- a/wadsrc/sndinfo.txt +++ b/wadsrc/sndinfo.txt @@ -879,6 +879,8 @@ $endif // ifhexen $ifstrife +$rolloff * 200 1200 + $playersound player male *death dspldeth $playersound player male *xdeath dspdiehi $playersound player male *gibbed dsslop