diff --git a/source/core/g_mapinfo.cpp b/source/core/g_mapinfo.cpp index 1aebe8927..d9882c6a3 100644 --- a/source/core/g_mapinfo.cpp +++ b/source/core/g_mapinfo.cpp @@ -360,7 +360,7 @@ void FMapInfoParser::ParseBreakWall() sc.MustGetString(); size_t p = strcspn(sc.String, "."); - if (p != 0) + if (sc.String[p] != 0) { FName clsname(sc.String, p, false); FName funcname = sc.String + p + 1; @@ -384,6 +384,70 @@ void FMapInfoParser::ParseBreakWall() } +//========================================================================== +// +// +// +//========================================================================== + +void FMapInfoParser::ParseBreakCeiling() +{ + + sc.MustGetStringName("{"); + while (!sc.CheckString("}")) + { + int basetile = -1; + int breaktile = -1; + int flags = 0; + FSoundID sound = NO_SOUND; + VMFunction* handler = nullptr; + + sc.MustGetString(); + FString basename = sc.String; // save for printing error messages. + basetile = TileFiles.tileForName(sc.String); + if (basetile < 0) + { + sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String, basetile); + SkipToNext(); + } + ParseAssign(); + sc.MustGetString(); + breaktile = TileFiles.tileForName(sc.String); + if (*sc.String && breaktile < 0) sc.ScriptMessage("Unknown texture '%s' in breakceiling definition", sc.String, breaktile); + if (sc.CheckString(",")) + { + sc.MustGetString(); + sound = S_FindSound(sc.String); + if (*sc.String && !sound.isvalid()) Printf(TEXTCOLOR_RED "Unknown sound '%s' in definition for breakable ceiling '5s'\n", basename.GetChars()); + + auto saved = sc.SavePos(); + if (sc.CheckString(",")) + { + sc.MustGetString(); + + size_t p = strcspn(sc.String, "."); + if (sc.String[p] != 0) + { + FName clsname(sc.String, p, false); + FName funcname = sc.String + p + 1; + handler = PClass::FindFunction(clsname, funcname); + if (handler == nullptr) + sc.ScriptMessage("Call to undefined function %s", sc.String); + // todo: validate the function's signature. Must be (sectortype) + } + else sc.RestorePos(saved); + while (sc.CheckString(",")) + { + sc.MustGetString(); + if (sc.Compare("lightsout")) flags |= 1; // all internal definitions have these two flags. + else if (sc.Compare("ceilingglass")) flags |= 2; + else sc.ScriptMessage("'%s': Unknown breakable flag", sc.String); + } + } + } + breakCeilingMap.Insert(basetile, { breaktile, sound, handler, flags }); + } +} //========================================================================== // @@ -1436,6 +1500,10 @@ void FMapInfoParser::ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord { ParseBreakWall(); } + else if (sc.Compare("breakceiling")) + { + ParseBreakCeiling(); + } else if (sc.Compare("clearall")) { // clears all map and progression related data, so that a mod can start with a clean slate. diff --git a/source/core/g_mapinfo.h b/source/core/g_mapinfo.h index 3a950fd4e..3c41379f5 100644 --- a/source/core/g_mapinfo.h +++ b/source/core/g_mapinfo.h @@ -64,6 +64,7 @@ struct BreakWallRec }; using BreakWallMap = TMap; inline BreakWallMap breakWallMap; +inline BreakWallMap breakCeilingMap; struct FMapInfoParser { @@ -91,6 +92,7 @@ struct FMapInfoParser void ParseGameInfo(); void ParseSpawnClasses(); void ParseBreakWall(); + void ParseBreakCeiling(); void ParseMapInfo (int lump, MapRecord &gamedefaults, MapRecord &defaultinfo); void ParseOpenBrace(); diff --git a/source/core/maptypes.h b/source/core/maptypes.h index a5e18c2b2..08a6144db 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -306,6 +306,11 @@ struct walltype struct sectortype { + enum EWhich + { + ceiling = 0, + floor = 1, + }; // Fields were reordered by size, some also enlarged. DCoreActor* firstEntry, * lastEntry; @@ -439,6 +444,12 @@ struct sectortype // same for SW bool hasU() const { return u_defined; } + + // Refactoring helper to remove all places that will need the tile num from future searches + int legacyTileNum(int which) const + { + return which? ceilingpicnum : floorpicnum; + } }; //============================================================================= diff --git a/source/games/blood/src/animatesprite.cpp b/source/games/blood/src/animatesprite.cpp index 4e1dfcc72..9bba3bc33 100644 --- a/source/games/blood/src/animatesprite.cpp +++ b/source/games/blood/src/animatesprite.cpp @@ -363,7 +363,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF if (!pNSprite) break; pNSprite->pos.Z = getflorzofslopeptr(pTSprite->sectp, pNSprite->pos); - if ((pNSprite->sectp->floorpicnum >= 4080) && (pNSprite->sectp->floorpicnum <= 4095) && !VanillaMode()) // if floor has ror, find actual floor + if (pNSprite->sectp->portalflags == PORTAL_SECTOR_FLOOR && !VanillaMode()) // if floor has ror, find actual floor { DVector3 cPos = pNSprite->pos; double cZrel = cPos.Z; @@ -374,7 +374,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF break; const double newFloorZ = getflorzofslopeptr(cSect, cPos.X, cPos.Z); cZrel += newFloorZ - cPos.Z; // get height difference for next sector's ceiling/floor, and add to relative height for shadow - if ((cSect->floorpicnum < 4080) || (cSect->floorpicnum > 4095)) // if current sector is not open air, use as floor for shadow casting, otherwise continue to next sector + if (cSect->portalflags != PORTAL_SECTOR_FLOOR) // if current sector is not open air, use as floor for shadow casting, otherwise continue to next sector break; cPos.Z = newFloorZ; } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 37765d22e..843427238 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -2850,13 +2850,13 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe aLower->spr.type = kMarkerLowWater; break; default: - if (pSector->ceilingpicnum < 4080 || pSector->ceilingpicnum > 4095) aLower->xspr.sysData1 = kMarkerLowLink; + if (pSector->portalflags != PORTAL_SECTOR_CEILING) aLower->xspr.sysData1 = kMarkerLowLink; else aLower->xspr.sysData1 = kMarkerLowStack; break; } } else if (aLower->xspr.sysData1 > 0) aLower->spr.type = aLower->xspr.sysData1; - else if (pSector->ceilingpicnum < 4080 || pSector->ceilingpicnum > 4095) aLower->spr.type = kMarkerLowLink; + else if (pSector->portalflags != PORTAL_SECTOR_CEILING) aLower->spr.type = kMarkerLowLink; else aLower->spr.type = kMarkerLowStack; } @@ -2872,13 +2872,13 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe aUpper->spr.type = kMarkerUpWater; break; default: - if (pSector->floorpicnum < 4080 || pSector->floorpicnum > 4095) aUpper->xspr.sysData1 = kMarkerUpLink; + if (pSector->portalflags != PORTAL_SECTOR_FLOOR) aUpper->xspr.sysData1 = kMarkerUpLink; else aUpper->xspr.sysData1 = kMarkerUpStack; break; } } else if (aUpper->xspr.sysData1 > 0) aUpper->spr.type = aUpper->xspr.sysData1; - else if (pSector->floorpicnum < 4080 || pSector->floorpicnum > 4095) aUpper->spr.type = kMarkerUpLink; + else if (pSector->portalflags != PORTAL_SECTOR_FLOOR) aUpper->spr.type = kMarkerUpLink; else aUpper->spr.type = kMarkerUpStack; } @@ -3983,17 +3983,17 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH case 24: switch (arg3) { - default: return (condCmp(surfType[pObj->floorpicnum], arg1, arg2, cmpOp) || condCmp(surfType[pObj->ceilingpicnum], arg1, arg2, cmpOp)); - case 1: return condCmp(surfType[pObj->floorpicnum], arg1, arg2, cmpOp); - case 2: return condCmp(surfType[pObj->ceilingpicnum], arg1, arg2, cmpOp); + default: return (condCmp(surfType[pObj->legacyTileNum(sectortype::floor)], arg1, arg2, cmpOp) || condCmp(surfType[pObj->legacyTileNum(sectortype::ceiling)], arg1, arg2, cmpOp)); + case 1: return condCmp(surfType[pObj->legacyTileNum(sectortype::floor)], arg1, arg2, cmpOp); + case 2: return condCmp(surfType[pObj->legacyTileNum(sectortype::ceiling)], arg1, arg2, cmpOp); } break; case 25: switch (arg3) { - default: return (condCmp(pObj->floorpicnum, arg1, arg2, cmpOp) || condCmp(pObj->ceilingpicnum, arg1, arg2, cmpOp)); - case 1: return condCmp(pObj->floorpicnum, arg1, arg2, cmpOp); - case 2: return condCmp(pObj->ceilingpicnum, arg1, arg2, cmpOp); + default: return (condCmp(pObj->legacyTileNum(sectortype::floor), arg1, arg2, cmpOp) || condCmp(pObj->legacyTileNum(sectortype::ceiling), arg1, arg2, cmpOp)); + case 1: return condCmp(pObj->legacyTileNum(sectortype::floor), arg1, arg2, cmpOp); + case 2: return condCmp(pObj->legacyTileNum(sectortype::ceiling), arg1, arg2, cmpOp); } break; case 26: @@ -4265,7 +4265,7 @@ bool condCheckWall(DBloodActor* aCond, int cmpOp, bool PUSH) if (PUSH) condPush(aCond, pWall->sectorp()); return true; case 10: // this wall is a mirror? // must be as constants here - return (pWall->type != kWallStack && condCmp(pWall->picnum, 4080, (4080 + 16) - 1, 0)); + return (pWall->portalflags == PORTAL_WALL_MIRROR); case 15: if (!pWall->twoSided()) return false; else if (PUSH) condPush(aCond, pWall->nextSector()); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index aa77be9c6..e2f849e3d 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -231,13 +231,13 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h auto wal = dasectp->walls.Data(); double d = (wal->pos - actor->spr.pos.XY()).Sum(); if (d < radius) - fi.checkhitceiling(dasectp); + checkhitceiling(dasectp); else { auto thirdpoint = wal->point2Wall()->point2Wall(); d = (thirdpoint->pos - actor->spr.pos.XY()).Sum(); if (d < radius) - fi.checkhitceiling(dasectp); + checkhitceiling(dasectp); } } @@ -1066,7 +1066,7 @@ static void flamethrowerflame(DDukeActor *actor) { SetActor(actor, dapos); if (actor->vel.Z < 0) - fi.checkhitceiling(actor->sector()); + checkhitceiling(actor->sector()); } if (actor->spr.scale.X >= 0.15625) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 221a0407f..0e09f4c70 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -184,13 +184,13 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h auto wal = dasectp->walls.Data(); double d = (wal->pos - actor->spr.pos.XY()).Sum(); if (d < radius) - fi.checkhitceiling(dasectp); + checkhitceiling(dasectp); else { auto thirdpoint = wal->point2Wall()->point2Wall(); d = (thirdpoint->pos - actor->spr.pos.XY()).Sum(); if (d < radius) - fi.checkhitceiling(dasectp); + checkhitceiling(dasectp); } } diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index cf906ce30..e43a6702c 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -43,8 +43,6 @@ bool checkhitswitch_d(int snum, walltype* w, DDukeActor *act); bool checkhitswitch_r(int snum, walltype* w, DDukeActor* act); void activatebysector_d(sectortype* sect, DDukeActor* j); void activatebysector_r(sectortype* sect, DDukeActor* j); -bool checkhitceiling_d(sectortype* sn); -bool checkhitceiling_r(sectortype* sn); void checkhitsprite_d(DDukeActor* i, DDukeActor* sn); void checkhitsprite_r(DDukeActor* i, DDukeActor* sn); void checkhitdefault_d(DDukeActor* i, DDukeActor* sn); @@ -105,7 +103,6 @@ void SetDispatcher() operateforcefields_d, checkhitswitch_d, activatebysector_d, - checkhitceiling_d, checkhitsprite_d, checkhitdefault_d, checksectors_d, @@ -142,7 +139,6 @@ void SetDispatcher() operateforcefields_r, checkhitswitch_r, activatebysector_r, - checkhitceiling_r, checkhitsprite_r, checkhitdefault_r, checksectors_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index f8761178b..23c916ab0 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -79,7 +79,6 @@ struct Dispatcher void (*operateforcefields)(DDukeActor* act, int low); bool (*checkhitswitch)(int snum, walltype* w, DDukeActor* act); void (*activatebysector)(sectortype* sect, DDukeActor* j); - bool (*checkhitceiling)(sectortype* sn); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn); void (*checkhitdefault)(DDukeActor* i, DDukeActor* sn); void (*checksectors)(int low); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index e8802754c..7fe225944 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -116,6 +116,7 @@ int setpal(player_struct* p); int madenoise(int playerNum); int haskey(sectortype* sect, int snum); +bool checkhitceiling(sectortype* sectp); void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos); int callsound(sectortype* sectnum,DDukeActor* snum, bool endstate = false); double hitasprite(DDukeActor* snum,DDukeActor **hitSprite); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 92ad50608..24f61bbc0 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1075,7 +1075,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case SECTOR_CEILINGPICNUM: if (bSet) sectp->ceilingpicnum = lValue; - else SetGameVarID(lVar2, sectp->ceilingpicnum, sActor, sPlayer); + else SetGameVarID(lVar2, sectp->legacyTileNum(sectortype::ceiling), sActor, sPlayer); break; case SECTOR_CEILINGSLOPE: if (bSet) sectp->setceilingslope(lValue); @@ -1099,7 +1099,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, break; case SECTOR_FLOORPICNUM: if (bSet) sectp->floorpicnum = lValue; - else SetGameVarID(lVar2, sectp->floorpicnum, sActor, sPlayer); + else SetGameVarID(lVar2, sectp->legacyTileNum(sectortype::ceiling), sActor, sPlayer); break; case SECTOR_FLOORSLOPE: if (bSet) sectp->setfloorslope(lValue); @@ -3454,7 +3454,7 @@ int ParseState::parse(void) case concmd_gettexturefloor: { insptr++; - SetGameVarID(g_iTextureID, g_ac->sector()->floorpicnum, g_ac, g_p); + SetGameVarID(g_iTextureID, g_ac->sector()->legacyTileNum(sectortype::ceiling), g_ac, g_p); break; } @@ -3591,7 +3591,7 @@ int ParseState::parse(void) case concmd_gettextureceiling: { insptr++; - SetGameVarID(g_iTextureID, g_ac->sector()->ceilingpicnum, g_ac, g_p); + SetGameVarID(g_iTextureID, g_ac->sector()->legacyTileNum(sectortype::ceiling), g_ac, g_p); break; } case concmd_ifvarvarand: diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index ccab8a715..94a48cd52 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -418,7 +418,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int return; } else - fi.checkhitceiling(hit.hitSector); + checkhitceiling(hit.hitSector); } spawn(spark, DTILE_SMALLSMOKE); } @@ -947,7 +947,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang) if (hit.hitWall == nullptr && hit.actor() == nullptr && hit.hitSector != nullptr) { if (zvel < 0 && (hit.hitSector->ceilingstat & CSTAT_SECTOR_SKY) == 0) - fi.checkhitceiling(hit.hitSector); + checkhitceiling(hit.hitSector); } else if (hit.actor() != nullptr) fi.checkhitsprite(hit.actor(), spark); else if (hit.hitWall != nullptr) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 164eb62da..245fc85c8 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -308,7 +308,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int return; } else - fi.checkhitceiling(hit.hitSector); + checkhitceiling(hit.hitSector); } if (hit.hitSector->lotag != 1) spawn(spark, RTILE_SMALLSMOKE); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 5d723912a..202fe8e93 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1319,6 +1319,67 @@ void checkhitwall(DDukeActor* spr, walltype* wal, const DVector3& pos) // //--------------------------------------------------------------------------- +bool checkhitceiling(sectortype* sectp) +{ + auto data = breakCeilingMap.CheckKey(sectp->ceilingpicnum); + if (data && !(data->flags & 1)) + { + if (!data->handler) + { + sectp->ceilingpicnum = data->brokentex; + S_PlayActorSound(data->breaksound, ps[screenpeek].GetActor()); // this is nonsense but what the original code did. + } + else + { + VMValue args[7] = { sectp, data->brokentex, data->breaksound.index() }; + VMCall(data->handler, args, 3, nullptr, 0); + } + if (data->flags & 1) + { + if (!sectp->hitag) + { + DukeSectIterator it(sectp); + while (auto act = it.Next()) + { + if (iseffector(act) && act->spr.lotag == SE_12_LIGHT_SWITCH) + { + DukeStatIterator it1(STAT_EFFECTOR); + while (auto act2 = it1.Next()) + { + if (act2->spr.hitag == act->spr.hitag) + act2->temp_data[3] = 1; + } + break; + } + } + } + + int j = krand() & 1; + DukeStatIterator it(STAT_EFFECTOR); + while (auto act = it.Next()) + { + if (act->spr.hitag == (sectp->hitag) && act->spr.lotag == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) + { + act->temp_data[2] = j; + act->temp_data[4] = 1; + } + } + } + if (data->flags & 2) + { + ceilingglass(ps[myconnectindex].GetActor(), sectp, 10); + } + return true; + } + return false; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void allignwarpelevators(void) { DukeStatIterator it(STAT_EFFECTOR); diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 137243e0f..f4b4ac701 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -599,82 +599,6 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll) // //--------------------------------------------------------------------------- -bool checkhitceiling_d(sectortype* sectp) -{ - int j; - - switch (sectp->ceilingpicnum) - { - case DTILE_WALLLIGHT1: - case DTILE_WALLLIGHT2: - case DTILE_WALLLIGHT3: - case DTILE_WALLLIGHT4: - case DTILE_TECHLIGHT2: - case DTILE_TECHLIGHT4: - - ceilingglass(ps[myconnectindex].GetActor(), sectp, 10); - S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor()); - - if (sectp->ceilingpicnum == DTILE_WALLLIGHT1) - sectp->ceilingpicnum = DTILE_WALLLIGHTBUST1; - - if (sectp->ceilingpicnum == DTILE_WALLLIGHT2) - sectp->ceilingpicnum = DTILE_WALLLIGHTBUST2; - - if (sectp->ceilingpicnum == DTILE_WALLLIGHT3) - sectp->ceilingpicnum = DTILE_WALLLIGHTBUST3; - - if (sectp->ceilingpicnum == DTILE_WALLLIGHT4) - sectp->ceilingpicnum = DTILE_WALLLIGHTBUST4; - - if (sectp->ceilingpicnum == DTILE_TECHLIGHT2) - sectp->ceilingpicnum = DTILE_TECHLIGHTBUST2; - - if (sectp->ceilingpicnum == DTILE_TECHLIGHT4) - sectp->ceilingpicnum = DTILE_TECHLIGHTBUST4; - - - if (!sectp->hitag) - { - DukeSectIterator it(sectp); - while (auto act = it.Next()) - { - if (iseffector(act) && act->spr.lotag == SE_12_LIGHT_SWITCH) - { - DukeStatIterator it1(STAT_EFFECTOR); - while (auto act2 = it1.Next()) - { - if (act2->spr.hitag == act->spr.hitag) - act2->temp_data[3] = 1; - } - break; - } - } - } - - j = krand() & 1; - DukeStatIterator it(STAT_EFFECTOR); - while (auto act = it.Next()) - { - if (act->spr.hitag == (sectp->hitag) && act->spr.lotag == 3) - { - act->temp_data[2] = j; - act->temp_data[4] = 1; - } - } - - return 1; - } - - return 0; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void checkhitdefault_d(DDukeActor* targ, DDukeActor* proj) { if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && targ->spr.hitag == 0 && targ->spr.lotag == 0 && targ->spr.statnum == STAT_DEFAULT) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index fc81023c2..126e337de 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -721,107 +721,6 @@ void checkplayerhurt_r(player_struct* p, const Collision &coll) // //--------------------------------------------------------------------------- -bool checkhitceiling_r(sectortype* sectp) -{ - int j; - - switch (sectp->ceilingpicnum) - { - case RTILE_WALLLIGHT1: - case RTILE_WALLLIGHT3: - case RTILE_WALLLIGHT4: - case RTILE_TECHLIGHT2: - case RTILE_TECHLIGHT4: - case RTILE_RRTILE1939: - case RTILE_RRTILE1986: - case RTILE_RRTILE1988: - case RTILE_RRTILE2123: - case RTILE_RRTILE2125: - case RTILE_RRTILE2878: - case RTILE_RRTILE2898: - - - ceilingglass(ps[myconnectindex].GetActor(), sectp, 10); - S_PlayActorSound(GLASS_BREAKING, ps[screenpeek].GetActor()); - - if (sectp->ceilingpicnum == RTILE_WALLLIGHT1) - sectp->ceilingpicnum = RTILE_WALLLIGHTBUST1; - - if (sectp->ceilingpicnum == RTILE_WALLLIGHT3) - sectp->ceilingpicnum = RTILE_WALLLIGHTBUST3; - - if (sectp->ceilingpicnum == RTILE_WALLLIGHT4) - sectp->ceilingpicnum = RTILE_WALLLIGHTBUST4; - - if (sectp->ceilingpicnum == RTILE_TECHLIGHT2) - sectp->ceilingpicnum = RTILE_TECHLIGHTBUST2; - - if (sectp->ceilingpicnum == RTILE_TECHLIGHT4) - sectp->ceilingpicnum = RTILE_TECHLIGHTBUST4; - - if (sectp->ceilingpicnum == RTILE_RRTILE1986) - sectp->ceilingpicnum = RTILE_RRTILE1987; - - if (sectp->ceilingpicnum == RTILE_RRTILE1939) - sectp->ceilingpicnum = RTILE_RRTILE2004; - - if (sectp->ceilingpicnum == RTILE_RRTILE1988) - sectp->ceilingpicnum = RTILE_RRTILE2005; - - if (sectp->ceilingpicnum == RTILE_RRTILE2898) - sectp->ceilingpicnum = RTILE_RRTILE2899; - - if (sectp->ceilingpicnum == RTILE_RRTILE2878) - sectp->ceilingpicnum = RTILE_RRTILE2879; - - if (sectp->ceilingpicnum == RTILE_RRTILE2123) - sectp->ceilingpicnum = RTILE_RRTILE2124; - - if (sectp->ceilingpicnum == RTILE_RRTILE2125) - sectp->ceilingpicnum = RTILE_RRTILE2126; - - - if (!sectp->hitag) - { - DukeSectIterator it(sectp); - while (auto act1 = it.Next()) - { - if (iseffector(act1) && (act1->spr.lotag == SE_12_LIGHT_SWITCH || (isRRRA() && (act1->spr.lotag == 47 || act1->spr.lotag == 48)))) - { - DukeStatIterator itr(STAT_EFFECTOR); - while (auto act2 = itr.Next()) - { - if (act2->spr.hitag == act1->spr.hitag) - act2->temp_data[3] = 1; - } - break; - } - } - } - - j = krand() & 1; - DukeStatIterator it(STAT_EFFECTOR); - while (auto act1 = it.Next()) - { - if (act1->spr.hitag == (sectp->hitag) && act1->spr.lotag == 3) - { - act1->temp_data[2] = j; - act1->temp_data[4] = 1; - } - } - - return 1; - } - - return 0; -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void checkhitdefault_r(DDukeActor* targ, DDukeActor* proj) { if ((targ->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL) && targ->spr.hitag == 0 && targ->spr.lotag == 0 && targ->spr.statnum == 0) diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index a66231f50..ab1674d0e 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -1343,7 +1343,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, checkhitwall, duke_checkhitwall) void duke_checkhitceiling(sectortype* sect, DDukeActor* actor) { - fi.checkhitceiling(sect); // actor is currently unused, this may change. + checkhitceiling(sect); // actor is currently unused, this may change. } DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, checkhitceiling, duke_checkhitceiling) @@ -1351,7 +1351,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, checkhitceiling, duke_checkhitceiling) PARAM_PROLOGUE; PARAM_POINTER(wal, sectortype); PARAM_POINTER(act, DDukeActor); - fi.checkhitceiling(wal); + checkhitceiling(wal); return 0; } diff --git a/wadsrc/static/filter/dukelike/rmapinfo.breakables b/wadsrc/static/filter/dukelike/rmapinfo.breakables index 32346e85f..a0caf056a 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.breakables +++ b/wadsrc/static/filter/dukelike/rmapinfo.breakables @@ -58,3 +58,13 @@ breakwalls TECHLIGHT4 = TECHLIGHTBUST4, "", "DukeBreakWalls.LightBreak" ATM = ATMBROKE, "GLASS_HEAVYBREAK", "DukeBreakWalls.ATMBreak" } + +breakceiling +{ + WALLLIGHT1 = WALLLIGHTBUST1, "GLASS_BREAKING", lightsout, ceilingglass + WALLLIGHT2 = WALLLIGHTBUST2, "GLASS_BREAKING", lightsout, ceilingglass + WALLLIGHT3 = WALLLIGHTBUST3, "GLASS_BREAKING", lightsout, ceilingglass + WALLLIGHT4 = WALLLIGHTBUST4, "GLASS_BREAKING", lightsout, ceilingglass + TECHLIGHT2 = TECHLIGHTBUST2, "GLASS_BREAKING", lightsout, ceilingglass + TECHLIGHT4 = TECHLIGHTBUST4, "GLASS_BREAKING", lightsout, ceilingglass +} diff --git a/wadsrc/static/filter/redneck/rmapinfo.breakables b/wadsrc/static/filter/redneck/rmapinfo.breakables index 9c15ba0e6..33b2eda99 100644 --- a/wadsrc/static/filter/redneck/rmapinfo.breakables +++ b/wadsrc/static/filter/redneck/rmapinfo.breakables @@ -34,6 +34,23 @@ breakwalls PICKUPFRONT = "", "TRUKDIE", "RedneckBreakwalls.PickupHit" PICKUPBACK1 = "", "TRUKDIE", "RedneckBreakwalls.PickupHit" PICKUPBACK2 = "", "TRUKDIE", "RedneckBreakwalls.PickupHit" - - } + +breakceiling +{ + WALLLIGHT1 = WALLLIGHTBUST1, "GLASS_BREAKING", lightsout, ceilingglass + WALLLIGHT3 = WALLLIGHTBUST3, "GLASS_BREAKING", lightsout, ceilingglass + WALLLIGHT4 = WALLLIGHTBUST4, "GLASS_BREAKING", lightsout, ceilingglass + TECHLIGHT2 = TECHLIGHTBUST2, "GLASS_BREAKING", lightsout, ceilingglass + TECHLIGHT4 = TECHLIGHTBUST4, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE1986 = RRTILE1987, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE1939 = RRTILE2004, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE1988 = RRTILE2005, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE2898 = RRTILE2899, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE2878 = RRTILE2879, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE2123 = RRTILE2124, "GLASS_BREAKING", lightsout, ceilingglass + RRTILE2125 = RRTILE2126, "GLASS_BREAKING", lightsout, ceilingglass +} + + +