diff --git a/src/actionspecials.h b/src/actionspecials.h index 9b9c38cb9..3edb1671d 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -258,5 +258,6 @@ DEFINE_SPECIAL(Ceiling_LowerByTexture, 269, 2, 4, 4) DEFINE_SPECIAL(Stairs_BuildDownDoom, 270, 5, 5, 5) DEFINE_SPECIAL(Stairs_BuildUpDoomSync, 271, 4, 4, 4) DEFINE_SPECIAL(Stairs_BuildDownDoomSync, 272, 4, 4, 4) +DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5) #undef DEFINE_SPECIAL diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 072b89f02..e934c5b9d 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -278,6 +278,19 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct return EMoveResult::ok; } +DEFINE_ACTION_FUNCTION(_Sector, MoveFloor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(speed); + PARAM_FLOAT(dest); + PARAM_INT(crush); + PARAM_INT(dir); + PARAM_BOOL(hex); + PARAM_BOOL_DEF(inst); + ACTION_RETURN_INT((int)self->MoveFloor(speed, dest, crush, dir, hex, inst)); +} + + EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush) { bool flag; @@ -391,3 +404,14 @@ EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int dire } return EMoveResult::ok; } + +DEFINE_ACTION_FUNCTION(_Sector, MoveCeiling) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(speed); + PARAM_FLOAT(dest); + PARAM_INT(crush); + PARAM_INT(dir); + PARAM_BOOL(hex); + ACTION_RETURN_INT((int)self->MoveCeiling(speed, dest, crush, dir, hex)); +} diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 34163987c..dbe3792da 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -625,7 +625,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, floor->m_PauseTime = 0; floor->m_StepTime = floor->m_PerStepTime = persteptime; - floor->m_Crush = (!(usespecials & DFloor::stairUseSpecials) && speed == 4) ? 10 : -1; //jff 2/27/98 fix uninitialized crush field + floor->m_Crush = (usespecials & DFloor::stairCrush) ? 10 : -1; //jff 2/27/98 fix uninitialized crush field floor->m_Hexencrush = false; floor->m_Speed = speed; diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index 14b7d0f79..8a0cc9ca0 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -86,6 +86,13 @@ bool sector_t::IsLinked(sector_t *other, bool ceiling) const return false; } +DEFINE_ACTION_FUNCTION(_Sector, isLinked) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_POINTER(other, sector_t); + PARAM_BOOL(ceiling); + ACTION_RETURN_BOOL(self->IsLinked(other, ceiling)); +} //============================================================================ // diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index e9b9d53a4..c1e342de8 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -591,6 +591,13 @@ FUNC(LS_Stairs_BuildUpDoom) arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0); } +FUNC(LS_Stairs_BuildUpDoomCrush) +// Stairs_BuildUpDoom (tag, speed, height, delay, reset) +{ + return EV_BuildStairs(arg0, DFloor::buildUp, ln, + arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairCrush); +} + FUNC(LS_Stairs_BuildDownDoom) // Stair_BuildDownDoom (tag, speed, height, delay, reset) { diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index c7a502354..d4abcc534 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -57,6 +57,14 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const return NULL; } +DEFINE_ACTION_FUNCTION(_Sector, NextSpecialSector) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(type); + PARAM_POINTER(nogood, sector_t); + ACTION_RETURN_POINTER(self->NextSpecialSector(type, nogood)); +} + // // P_FindLowestFloorSurrounding() // FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS @@ -96,8 +104,16 @@ double sector_t::FindLowestFloorSurrounding (vertex_t **v) const return floor; } - - +DEFINE_ACTION_FUNCTION(_Sector, FindLowestFloorSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestFloorSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // // P_FindHighestFloorSurrounding() // FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS @@ -137,6 +153,16 @@ double sector_t::FindHighestFloorSurrounding (vertex_t **v) const return floor; } +DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestFloorSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // @@ -190,6 +216,16 @@ double sector_t::FindNextHighestFloor (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestFloor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextHighestFloor(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // // P_FindNextLowestFloor() @@ -242,6 +278,17 @@ double sector_t::FindNextLowestFloor (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestFloor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextLowestFloor(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + + // // P_FindNextLowestCeiling() // @@ -293,6 +340,17 @@ double sector_t::FindNextLowestCeiling (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestCeiling) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextLowestCeiling(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + + // // P_FindNextHighestCeiling() // @@ -344,6 +402,17 @@ double sector_t::FindNextHighestCeiling (vertex_t **v) const return height; } + +DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestCeiling) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindNextHighestCeiling(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // // FIND LOWEST CEILING IN THE SURROUNDING SECTORS // @@ -382,6 +451,16 @@ double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestCeilingSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // // FIND HIGHEST CEILING IN THE SURROUNDING SECTORS @@ -421,6 +500,17 @@ double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindHighestCeilingSurrounding) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestCeilingSurrounding(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + + // // P_FindShortestTextureAround() // @@ -461,6 +551,13 @@ double sector_t::FindShortestTextureAround () const return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight(); } +DEFINE_ACTION_FUNCTION(_Sector, FindShortestTextureAround) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + double h = self->FindShortestTextureAround(); + ACTION_RETURN_FLOAT(h); +} + // // P_FindShortestUpperAround() @@ -487,6 +584,12 @@ double sector_t::FindShortestUpperAround () const return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight(); } +DEFINE_ACTION_FUNCTION(_Sector, FindShortestUpperAround) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + double h = self->FindShortestUpperAround(); + ACTION_RETURN_FLOAT(h); +} // // P_FindModelFloorSector() @@ -519,6 +622,14 @@ sector_t *sector_t::FindModelFloorSector (double floordestheight) const return NULL; } +DEFINE_ACTION_FUNCTION(_Sector, FindModelFloorSector) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(fdh); + auto h = self->FindModelFloorSector(fdh); + ACTION_RETURN_POINTER(h); +} + // // P_FindModelCeilingSector() @@ -552,6 +663,14 @@ sector_t *sector_t::FindModelCeilingSector (double floordestheight) const return NULL; } +DEFINE_ACTION_FUNCTION(_Sector, FindModelCeilingSector) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(fdh); + auto h = self->FindModelCeilingSector(fdh); + ACTION_RETURN_POINTER(h); +} + // // Find minimum light from an adjacent sector // @@ -570,6 +689,14 @@ int sector_t::FindMinSurroundingLight (int min) const return min; } +DEFINE_ACTION_FUNCTION(_Sector, FindMinSurroundingLight) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(min); + auto h = self->FindMinSurroundingLight(min); + ACTION_RETURN_INT(h); +} + // // Find the highest point on the floor of the sector // @@ -609,6 +736,16 @@ double sector_t::FindHighestFloorPoint (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindHighestFloorPoint(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + // // Find the lowest point on the ceiling of the sector // @@ -648,6 +785,20 @@ double sector_t::FindLowestCeilingPoint (vertex_t **v) const return height; } +DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingPoint) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + vertex_t *v; + double h = self->FindLowestCeilingPoint(&v); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC); + return numret; +} + +//===================================================================================== +// +// +//===================================================================================== void sector_t::SetColor(int r, int g, int b, int desat) { @@ -666,6 +817,11 @@ DEFINE_ACTION_FUNCTION(_Sector, SetColor) return 0; } +//===================================================================================== +// +// +//===================================================================================== + void sector_t::SetFade(int r, int g, int b) { PalEntry fade = PalEntry (r,g,b); @@ -746,6 +902,11 @@ void sector_t::ClosestPoint(const DVector2 &in, DVector2 &out) const } +//===================================================================================== +// +// +//===================================================================================== + bool sector_t::PlaneMoving(int pos) { if (pos == floor) @@ -754,6 +915,17 @@ bool sector_t::PlaneMoving(int pos) return (ceilingdata != NULL || (planes[ceiling].Flags & PLANEF_BLOCKED)); } +DEFINE_ACTION_FUNCTION(_Sector, PlaneMoving) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PlaneMoving(pos)); +} + +//===================================================================================== +// +// +//===================================================================================== int sector_t::GetFloorLight () const { @@ -767,6 +939,17 @@ int sector_t::GetFloorLight () const } } +DEFINE_ACTION_FUNCTION(_Sector, GetFloorLight) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_INT(self->GetFloorLight()); +} + +//===================================================================================== +// +// +//===================================================================================== + int sector_t::GetCeilingLight () const { if (GetFlags(ceiling) & PLANEF_ABSLIGHTING) @@ -779,6 +962,16 @@ int sector_t::GetCeilingLight () const } } +DEFINE_ACTION_FUNCTION(_Sector, GetCeilingLight) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_INT(self->GetCeilingLight()); +} + +//===================================================================================== +// +// +//===================================================================================== FSectorPortal *sector_t::ValidatePortal(int which) { @@ -789,8 +982,12 @@ FSectorPortal *sector_t::ValidatePortal(int which) return port; } +//===================================================================================== +// +// +//===================================================================================== -sector_t *sector_t::GetHeightSec() const +sector_t *sector_t::GetHeightSec() const { if (heightsec == NULL) { @@ -814,6 +1011,16 @@ sector_t *sector_t::GetHeightSec() const return heightsec; } +DEFINE_ACTION_FUNCTION(_Sector, GetHeightSec) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_POINTER(self->GetHeightSec()); +} + +//===================================================================================== +// +// +//===================================================================================== void sector_t::GetSpecial(secspecial_t *spec) { @@ -825,6 +1032,19 @@ void sector_t::GetSpecial(secspecial_t *spec) spec->Flags = Flags & SECF_SPECIALFLAGS; } +DEFINE_ACTION_FUNCTION(_Sector, GetSpecial) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_POINTER(spec, secspecial_t); + self->GetSpecial(spec); + return 0; +} + +//===================================================================================== +// +// +//===================================================================================== + void sector_t::SetSpecial(const secspecial_t *spec) { special = spec->special; @@ -835,6 +1055,20 @@ void sector_t::SetSpecial(const secspecial_t *spec) Flags = (Flags & ~SECF_SPECIALFLAGS) | (spec->Flags & SECF_SPECIALFLAGS); } +DEFINE_ACTION_FUNCTION(_Sector, SetSpecial) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_POINTER(spec, secspecial_t); + self->SetSpecial(spec); + return 0; +} + + +//===================================================================================== +// +// +//===================================================================================== + void sector_t::TransferSpecial(sector_t *model) { special = model->special; @@ -845,11 +1079,36 @@ void sector_t::TransferSpecial(sector_t *model) Flags = (Flags&~SECF_SPECIALFLAGS) | (model->Flags & SECF_SPECIALFLAGS); } +DEFINE_ACTION_FUNCTION(_Sector, TransferSpecial) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_POINTER(spec, sector_t); + self->TransferSpecial(spec); + return 0; +} + +//===================================================================================== +// +// +//===================================================================================== + int sector_t::GetTerrain(int pos) const { return terrainnum[pos] >= 0 ? terrainnum[pos] : TerrainTypes[GetTexture(pos)]; } +DEFINE_ACTION_FUNCTION(_Sector, GetTerrain) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetTerrain(pos)); +} + +//===================================================================================== +// +// +//===================================================================================== + void sector_t::CheckPortalPlane(int plane) { if (GetPortalType(plane) == PORTS_LINKEDPORTAL) @@ -861,6 +1120,14 @@ void sector_t::CheckPortalPlane(int plane) } } +DEFINE_ACTION_FUNCTION(_Sector, CheckPortalPlane) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(plane); + self->CheckPortalPlane(plane); + return 0; +} + //=========================================================================== // // Finds the highest ceiling at the given position, all portals considered @@ -884,6 +1151,18 @@ double sector_t::HighestCeilingAt(const DVector2 &p, sector_t **resultsec) return check->ceilingplane.ZatPoint(pos); } +DEFINE_ACTION_FUNCTION(_Sector, HighestCeilingAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + sector_t *s; + double h = self->HighestCeilingAt(DVector2(x, y), &s); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(s, ATAG_GENERIC); + return numret; +} + //=========================================================================== // // Finds the lowest floor at the given position, all portals considered @@ -907,6 +1186,22 @@ double sector_t::LowestFloorAt(const DVector2 &p, sector_t **resultsec) return check->floorplane.ZatPoint(pos); } +DEFINE_ACTION_FUNCTION(_Sector, LowestFloorAt) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + sector_t *s; + double h = self->LowestFloorAt(DVector2(x, y), &s); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetPointer(s, ATAG_GENERIC); + return numret; +} + +//===================================================================================== +// +// +//===================================================================================== double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags, sector_t **resultsec, F3DFloor **resultffloor) { @@ -980,6 +1275,11 @@ DEFINE_ACTION_FUNCTION(_Sector, NextHighestCeilingAt) return numret; } +//===================================================================================== +// +// +//===================================================================================== + double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, double steph, sector_t **resultsec, F3DFloor **resultffloor) { sector_t *sec = this; @@ -1080,6 +1380,17 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) } } + DEFINE_ACTION_FUNCTION(_Sector, GetFriction) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(plane); + double mf; + double h = self->GetFriction(plane, &mf); + if (numret > 0) ret[0].SetFloat(h); + if (numret > 1) ret[1].SetFloat(mf); + return numret; + } + //=========================================================================== // // @@ -1107,6 +1418,32 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) return 0; } + //=========================================================================== + // + // phares 3/12/98: End of friction effects + // + //=========================================================================== + + void sector_t::AdjustFloorClip() const + { + msecnode_t *node; + + for (node = touching_thinglist; node; node = node->m_snext) + { + if (node->m_thing->flags2 & MF2_FLOORCLIP) + { + node->m_thing->AdjustFloorClip(); + } + } + } + + DEFINE_ACTION_FUNCTION(_Sector, AdjustFloorClip) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + self->AdjustFloorClip(); + return 0; + } + DEFINE_ACTION_FUNCTION(_Sector, PointInSector) { @@ -1116,6 +1453,325 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt) ACTION_RETURN_POINTER(P_PointInSector(x, y)); } + DEFINE_ACTION_FUNCTION(_Sector, SetXOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->SetXOffset(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, AddXOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->AddXOffset(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetXOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetXOffset(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetYOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->SetXOffset(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, AddYOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->AddXOffset(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetYOffset) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_BOOL_DEF(addbase); + ACTION_RETURN_FLOAT(self->GetYOffset(pos, addbase)); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetXScale) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->SetXScale(pos, o); + return 0; + } + + + DEFINE_ACTION_FUNCTION(_Sector, GetXScale) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetXScale(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetYScale) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->SetXScale(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetYScale) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetYScale(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetAngle) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_ANGLE(o); + self->SetAngle(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetAngle) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_BOOL_DEF(addbase); + ACTION_RETURN_FLOAT(self->GetAngle(pos, addbase).Degrees); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetBase) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + PARAM_ANGLE(a); + self->SetBase(pos, o, a); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, SetAlpha) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + self->SetAlpha(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetAlpha) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetAlpha(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, GetFlags) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetFlags(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, GetVisFlags) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetVisFlags(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, ChangeFlags) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_INT(a); + PARAM_INT(o); + self->ChangeFlags(pos, a, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, SetPlaneLight) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_INT(o); + self->SetPlaneLight(pos, o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetPlaneLight) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetPlaneLight(pos)); + } + + class FSetTextureID : public FTextureID + { + public: + FSetTextureID(int v) : FTextureID(v) {} + }; + + DEFINE_ACTION_FUNCTION(_Sector, SetTexture) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_INT(o); + PARAM_BOOL_DEF(adj); + self->SetTexture(pos, FSetTextureID(o), adj); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetTexture) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetTexture(pos).GetIndex()); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetPlaneTexZ) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + PARAM_FLOAT(o); + PARAM_BOOL_DEF(dirty); + self->SetPlaneTexZ(pos, o, dirty); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetPlaneTexZ) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetPlaneTexZ(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, SetLightLevel) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(o); + self->SetLightLevel(o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, ChangeLightLevel) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(o); + self->ChangeLightLevel(o); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetLightLevel) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_INT(self->GetLightLevel()); + } + + DEFINE_ACTION_FUNCTION(_Sector, ClearSpecial) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + self->ClearSpecial(); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksView) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PortalBlocksView(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksSight) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PortalBlocksSight(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksMovement) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PortalBlocksMovement(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksSound) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PortalBlocksSound(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, PortalIsLinked) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_BOOL(self->PortalIsLinked(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, ClearPortal) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + self->ClearPortal(pos); + return 0; + } + + DEFINE_ACTION_FUNCTION(_Sector, GetPortalPlaneZ) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_FLOAT(self->GetPortalPlaneZ(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, GetPortalDisplacement) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_VEC2(self->GetPortalDisplacement(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, GetPortalType) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetPortalType(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, GetOppositePortalGroup) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_INT(pos); + ACTION_RETURN_INT(self->GetOppositePortalGroup(pos)); + } + + DEFINE_ACTION_FUNCTION(_Sector, CenterFloor) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_FLOAT(self->CenterFloor()); + } + + DEFINE_ACTION_FUNCTION(_Sector, CenterCeiling) + { + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + ACTION_RETURN_FLOAT(self->CenterCeiling()); + } + //=========================================================================== // // @@ -1448,3 +2104,5 @@ DEFINE_FIELD_X(Line, line_t, portalindex) DEFINE_FIELD_X(Secplane, secplane_t, normal) DEFINE_FIELD_X(Secplane, secplane_t, D) DEFINE_FIELD_X(Secplane, secplane_t, negiC) + +DEFINE_FIELD_X(Vertex, vertex_t, p) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index b3cf9c597..45f4d043c 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -1589,23 +1589,3 @@ double FrictionToMoveFactor(double friction) return movefactor; } - - -// -// phares 3/12/98: End of friction effects -// -//////////////////////////////////////////////////////////////////////////// - -void sector_t::AdjustFloorClip () const -{ - msecnode_t *node; - - for (node = touching_thinglist; node; node = node->m_snext) - { - if (node->m_thing->flags2 & MF2_FLOORCLIP) - { - node->m_thing->AdjustFloorClip(); - } - } -} - diff --git a/src/p_spec.h b/src/p_spec.h index ea98c82c1..a2fd0727a 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -503,7 +503,8 @@ public: enum EStairType { stairUseSpecials = 1, - stairSync = 2 + stairSync = 2, + stairCrush = 4, }; DFloor (sector_t *sec); diff --git a/src/r_defs.h b/src/r_defs.h index 912ce8d7b..8a10a9faf 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -91,11 +91,8 @@ typedef double vtype; struct vertex_t { -private: DVector2 p; -public: - void set(fixed_t x, fixed_t y) { p.X = x / 65536.; @@ -135,7 +132,7 @@ public: DVector2 fPos() { - return { p.X, p.Y }; + return p; } angle_t viewangle; // precalculated angle for clipping diff --git a/wadsrc/static/xlat/base.txt b/wadsrc/static/xlat/base.txt index 8a99ba318..0fc02739e 100644 --- a/wadsrc/static/xlat/base.txt +++ b/wadsrc/static/xlat/base.txt @@ -99,7 +99,7 @@ include "xlat/defines.i" 97 = WALK|REP|MONST, Teleport (0, tag) 98 = WALK|REP, Floor_LowerToHighest (tag, F_FAST, 136) 99 = USE|REP, Door_LockedRaise (tag, D_FAST, 0, BCard | CardIsSkull) -100 = WALK, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +100 = WALK, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 101 = USE, Floor_RaiseToLowestCeiling (tag, F_SLOW) 102 = USE, Floor_LowerToHighest (tag, F_SLOW, 128) 103 = USE, Door_Open (tag, D_SLOW) @@ -126,7 +126,7 @@ include "xlat/defines.i" 124 = WALK, Exit_Secret (0) 125 = MONWALK, Teleport (0, tag) 126 = MONWALK|REP, Teleport (0, tag) -127 = USE, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +127 = USE, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 128 = WALK|REP, Floor_RaiseToNearest (tag, F_SLOW) 129 = WALK|REP, Floor_RaiseToNearest (tag, F_FAST) 130 = WALK, Floor_RaiseToNearest (tag, F_FAST) @@ -259,9 +259,9 @@ include "xlat/defines.i" 254 = 0, Scroll_Texture_Model (lineid, 0) 255 = 0, Scroll_Texture_Offsets () 256 = WALK|REP, Stairs_BuildUpDoom (tag, ST_SLOW, 8, 0, 0) -257 = WALK|REP, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +257 = WALK|REP, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 258 = USE|REP, Stairs_BuildUpDoom (tag, ST_SLOW, 8, 0, 0) -259 = USE|REP, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +259 = USE|REP, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 260 = 0, TranslucentLine (lineid, 168) // Changed to better reflect the BOOM default 261 = 0, Transfer_CeilingLight (tag) 262 = WALK|MONST, Teleport_Line (tag, tag, 1) diff --git a/wadsrc/static/xlat/strife.txt b/wadsrc/static/xlat/strife.txt index 50fcb2ff8..e4ae8244f 100644 --- a/wadsrc/static/xlat/strife.txt +++ b/wadsrc/static/xlat/strife.txt @@ -120,7 +120,7 @@ RetailOnly = 121 104 = WALK, Light_MinNeighbor (tag) 108 = WALK, Door_Raise (tag, D_FAST, VDOORWAIT) 109 = WALK, Door_Open (tag, D_FAST) -100 = WALK, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +100 = WALK, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 197 = WALK|REP, ACS_ExecuteAlways (0, 0, 197, tag) 110 = WALK, Door_Close (tag, D_FAST) 119 = WALK, Floor_RaiseToNearest (tag, F_SLOW) @@ -255,7 +255,7 @@ RetailOnly = 121 112 = USE, Door_Open (tag, D_FAST) 113 = USE, Door_Close (tag, D_FAST) 122 = USE, Plat_DownWaitUpStayLip (tag, P_TURBO, PLATWAIT, 0) -127 = USE, Stairs_BuildUpDoom (tag, ST_TURBO, 16, 0, 0) +127 = USE, Stairs_BuildUpDoomCrush (tag, ST_TURBO, 16, 0, 0) 131 = USE, Floor_RaiseToNearest (tag, F_FAST) 133 = USE, Door_LockedRaise (tag, D_FAST, 0, 4) 135 = USE, Door_LockedRaise (tag, D_FAST, 0, 11) diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index be161483e..673257a3c 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -185,6 +185,11 @@ struct F3DFloor native { } +struct Vertex native +{ + native readonly Vector2 p; +} + struct Line native { enum ELineFlags @@ -250,7 +255,18 @@ struct SecPlane native native void ChangeHeight(double hdiff); native double GetChangedHeight(double hdiff); native double HeightDiff(double oldd, double newd = 0.0); - native double PointToDist(const DVector2 &xy, double z); + native double PointToDist(Vector2 xy, double z); +} + +// This encapsulates all info Doom's original 'special' field contained - for saving and transferring. +struct SecSpecial +{ + Name damagetype; + int damageamount; + short special; + short damageinterval; + short leakydamage; + int Flags; } struct Sector native @@ -345,6 +361,14 @@ struct Sector native SECF_NOMODIFY = SECF_SECRET|SECF_WASSECRET, // not modifiable by Sector_ChangeFlags SECF_SPECIALFLAGS = SECF_DAMAGEFLAGS|SECF_FRICTION|SECF_PUSH, // these flags originate from 'special and must be transferrable by floor thinkers } + + enum EMoveResult + { + MOVE_OK, + MOVE_CRUSHED, + MOVE_PASTDEST + }; + native uint Flags; native SectorAction SecActTarget; @@ -362,6 +386,101 @@ struct Sector native native static Sector PointInSector(Vector2 pt); native void SetColor(color c, int desat = 0); native void SetFade(color c); + + native bool PlaneMoving(int pos); + native int GetFloorLight(); + native int GetCeilingLight(); + native Sector GetHeightSec(); + native void TransferSpecial(Sector model); + native void GetSpecial(out SecSpecial spec); + native void SetSpecial( SecSpecial spec); + native int GetTerrain(int pos); + native void CheckPortalPlane(int plane); + native double, Sector HighestCeilingAt(Vector2 a); + native double, Sector LowestFloorAt(Vector2 a); + native double, double GetFriction(int plane); + + native void SetXOffset(int pos, double o); + native void AddXOffset(int pos, double o); + native double GetXOffset(int pos); + native void SetYOffset(int pos, double o); + native void AddYOffset(int pos, double o); + native double GetYOffset(int pos, bool addbase = true); + native void SetXScale(int pos, double o); + native double GetXScale(int pos); + native void SetYScale(int pos, double o); + native double GetYScale(int pos); + native void SetAngle(int pos, double o); + native double GetAngle(int pos, bool addbase = true); + native void SetBase(int pos, double y, double o); + native void SetAlpha(int pos, double o); + native double GetAlpha(int pos); + native int GetFlags(int pos); + native int GetVisFlags(int pos); + native void ChangeFlags(int pos, int And, int Or); + native int GetPlaneLight(int pos); + native void SetPlaneLight(int pos, int level); + native TextureID GetTexture(int pos); + native void SetTexture(int pos, TextureID tex, bool floorclip = true); + native double GetPlaneTexZ(int pos); + native void SetPlaneTexZ(int pos, double val, bool dirtify = false); // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code. + native void ChangeLightLevel(int newval); + native void SetLightLevel(int newval); + native int GetLightLevel(); + native void AdjustFloorClip(); + native bool IsLinked(Sector other, bool ceiling); + + native bool PortalBlocksView(int plane); + native bool PortalBlocksSight(int plane); + native bool PortalBlocksMovement(int plane); + native bool PortalBlocksSound(int plane); + native bool PortalIsLinked(int plane); + native void ClearPortal(int plane); + native double GetPortalPlaneZ(int plane); + native Vector2 GetPortalDisplacement(int plane); + native int GetPortalType(int plane); + native int GetOppositePortalGroup(int plane); + native double CenterFloor(); + native double CenterCeiling(); + + native int MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant = false); + native int MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush); + + native Sector NextSpecialSector(int type, Sector prev); + native double, Vertex FindLowestFloorSurrounding(); + native double, Vertex FindHighestFloorSurrounding(); + native double, Vertex FindNextHighestFloor(); + native double, Vertex FindNextLowestFloor(); + native double, Vertex FindLowestCeilingSurrounding(); + native double, Vertex FindHighestCeilingSurrounding(); + native double, Vertex FindNextLowestCeiling(); + native double, Vertex FindNextHighestCeiling(); + + native double FindShortestTextureAround(); + native double FindShortestUpperAround(); + native Sector FindModelFloorSector(double floordestheight); + native Sector FindModelCeilingSector(double floordestheight); + native int FindMinSurroundingLight(int max); + native double, Vertex FindLowestCeilingPoint(); + native double, Vertex FindHighestFloorPoint(); + + + bool isSecret() + { + return !!(Flags & SECF_SECRET); + } + + bool wasSecret() + { + return !!(Flags & SECF_WASSECRET); + } + + void ClearSecret() + { + Flags &= ~SECF_SECRET; + } + + } struct Wads