//----------------------------------------------------------------------------- // // Copyright 2016-2018 Christoph Oelckers // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see http://www.gnu.org/licenses/ // //----------------------------------------------------------------------------- // // VM thunks for simple functions. // //----------------------------------------------------------------------------- #include "vm.h" #include "r_defs.h" #include "g_levellocals.h" #include "s_sound.h" #include "p_local.h" DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindShortestTextureAround, FindShortestTextureAround) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_FLOAT(FindShortestTextureAround(self)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindShortestUpperAround, FindShortestUpperAround) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_FLOAT(FindShortestUpperAround(self)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindModelFloorSector, FindModelFloorSector) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_FLOAT(fdh); auto h = FindModelFloorSector(self, fdh); ACTION_RETURN_POINTER(h); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindModelCeilingSector, FindModelCeilingSector) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_FLOAT(fdh); auto h = FindModelCeilingSector(self, fdh); ACTION_RETURN_POINTER(h); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetColor, SetColor) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_COLOR(color); PARAM_INT(desat); SetColor(self, color, desat); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetFade, SetFade) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_COLOR(fade); SetFade(self, fade); return 0; } static void SetSpecialColor(sector_t *self, int num, int color) { if (num >= 0 && num < 5) { self->SetSpecialColor(num, color); } } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetSpecialColor, SetSpecialColor) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(num); PARAM_COLOR(color); SetSpecialColor(self, num, color); return 0; } static void SetFogDensity(sector_t *self, int dens) { self->Colormap.FogDensity = dens; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetFogDensity, SetFogDensity) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(dens); self->Colormap.FogDensity = dens; return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PlaneMoving, PlaneMoving) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(PlaneMoving(self, pos)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetFloorLight, GetFloorLight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_INT(self->GetFloorLight()); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetCeilingLight, GetCeilingLight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_INT(self->GetCeilingLight()); } static sector_t *GetHeightSec(sector_t *self) { return self->GetHeightSec(); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetHeightSec, GetHeightSec) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_POINTER(self->GetHeightSec()); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetSpecial, GetSpecial) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_POINTER(spec, secspecial_t); GetSpecial(self, spec); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetSpecial, SetSpecial) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_POINTER(spec, secspecial_t); SetSpecial(self, spec); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, TransferSpecial, TransferSpecial) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_POINTER(spec, sector_t); TransferSpecial(self, spec); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetTerrain, GetTerrain) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(GetTerrain(self, pos)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, CheckPortalPlane, CheckPortalPlane) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(plane); self->CheckPortalPlane(plane); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); RemoveForceField(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, AdjustFloorClip, AdjustFloorClip) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); AdjustFloorClip(self); return 0; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PointInSector, P_PointInSectorXY) { PARAM_PROLOGUE; PARAM_FLOAT(x); PARAM_FLOAT(y); ACTION_RETURN_POINTER(P_PointInSector(x, y)); } static void SetXOffset(sector_t *self, int pos, double o) { self->SetXOffset(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetXOffset(pos, o); return 0; } static void AddXOffset(sector_t *self, int pos, double o) { self->AddXOffset(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, AddXOffset, AddXOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->AddXOffset(pos, o); return 0; } static double GetXOffset(sector_t *self, int pos) { return self->GetXOffset(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetXOffset, GetXOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetXOffset(pos)); } static void SetYOffset(sector_t *self, int pos, double o) { self->SetYOffset(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetYOffset, SetYOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetXOffset(pos, o); return 0; } static void AddYOffset(sector_t *self, int pos, double o) { self->AddYOffset(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, AddYOffset, AddYOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->AddYOffset(pos, o); return 0; } static double GetYOffset(sector_t *self, int pos) { return self->GetYOffset(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetYOffset, GetYOffset) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_BOOL(addbase); ACTION_RETURN_FLOAT(self->GetYOffset(pos, addbase)); } static void SetXScale(sector_t *self, int pos, double o) { self->SetXScale(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXScale, SetXScale) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetXScale(pos, o); return 0; } static double GetXScale(sector_t *self, int pos) { return self->GetXScale(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetXScale, GetXScale) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetXScale(pos)); } static void SetYScale(sector_t *self, int pos, double o) { self->SetYScale(pos, o); } DEFINE_ACTION_FUNCTION(_Sector, SetYScale) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetYScale(pos, o); return 0; } static double GetYScale(sector_t *self, int pos) { return self->GetYScale(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetYScale, GetYScale) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetYScale(pos)); } static void SetAngle(sector_t *self, int pos, double o) { self->SetAngle(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetAngle, SetAngle) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_ANGLE(o); self->SetAngle(pos, o); return 0; } static double GetAngle(sector_t *self, int pos, bool addbase) { return self->GetAngle(pos, addbase).Degrees; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetAngle, GetAngle) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_BOOL(addbase); ACTION_RETURN_FLOAT(self->GetAngle(pos, addbase).Degrees); } static void SetBase(sector_t *self, int pos, double o, double a) { self->SetBase(pos, o, a); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetBase, SetBase) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); PARAM_ANGLE(a); self->SetBase(pos, o, a); return 0; } static void SetAlpha(sector_t *self, int pos, double o) { self->SetAlpha(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetAlpha, SetAlpha) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetAlpha(pos, o); return 0; } static double GetAlpha(sector_t *self, int pos) { return self->GetAlpha(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetAlpha, GetAlpha) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetAlpha(pos)); } static int GetFlags(sector_t *self, int pos) { return self->GetFlags(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetFlags, GetFlags) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetFlags(pos)); } static int GetVisFlags(sector_t *self, int pos) { return self->GetVisFlags(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetVisFlags, GetVisFlags) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetVisFlags(pos)); } static void ChangeFlags(sector_t *self, int pos, int a, int o) { self->ChangeFlags(pos, a, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, ChangeFlags, ChangeFlags) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_INT(a); PARAM_INT(o); self->ChangeFlags(pos, a, o); return 0; } static void SetPlaneLight(sector_t *self, int pos, int o) { self->SetPlaneLight(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetPlaneLight, SetPlaneLight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_INT(o); self->SetPlaneLight(pos, o); return 0; } static int GetPlaneLight(sector_t *self, int pos) { return self->GetPlaneLight(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetPlaneLight, GetPlaneLight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetPlaneLight(pos)); } static void SetTexture(sector_t *self, int pos, int o, bool adj) { self->SetTexture(pos, FSetTextureID(o), adj); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetTexture, SetTexture) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_INT(o); PARAM_BOOL(adj); self->SetTexture(pos, FSetTextureID(o), adj); return 0; } static int GetTexture(sector_t *self, int pos) { return self->GetTexture(pos).GetIndex(); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetTexture, GetTexture) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetTexture(pos).GetIndex()); } static void SetPlaneTexZ(sector_t *self, int pos, double o, bool) { self->SetPlaneTexZ(pos, o, true); // not setting 'dirty' here is a guaranteed cause for problems. } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetPlaneTexZ, SetPlaneTexZ) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); PARAM_BOOL(dirty); self->SetPlaneTexZ(pos, o, true); // not setting 'dirty' here is a guaranteed cause for problems. return 0; } static double GetPlaneTexZ(sector_t *self, int pos) { return self->GetPlaneTexZ(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetPlaneTexZ, GetPlaneTexZ) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetPlaneTexZ(pos)); } static void SetLightLevel(sector_t *self, int o) { self->SetLightLevel(o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetLightLevel, SetLightLevel) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(o); self->SetLightLevel(o); return 0; } static void ChangeLightLevel(sector_t *self, int o) { self->ChangeLightLevel(o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, ChangeLightLevel, ChangeLightLevel) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(o); self->ChangeLightLevel(o); return 0; } static int GetLightLevel(sector_t *self) { return self->GetLightLevel(); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetLightLevel, GetLightLevel) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_INT(self->GetLightLevel()); } static int PortalBlocksView(sector_t *self, int pos) { return self->PortalBlocksView(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PortalBlocksView, PortalBlocksView) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(self->PortalBlocksView(pos)); } static int PortalBlocksSight(sector_t *self, int pos) { return self->PortalBlocksSight(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PortalBlocksSight, PortalBlocksSight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(self->PortalBlocksSight(pos)); } static int PortalBlocksMovement(sector_t *self, int pos) { return self->PortalBlocksMovement(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PortalBlocksMovement, PortalBlocksMovement) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(self->PortalBlocksMovement(pos)); } static int PortalBlocksSound(sector_t *self, int pos) { return self->PortalBlocksSound(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PortalBlocksSound, PortalBlocksSound) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(self->PortalBlocksSound(pos)); } static int PortalIsLinked(sector_t *self, int pos) { return self->PortalIsLinked(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PortalIsLinked, PortalIsLinked) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_BOOL(self->PortalIsLinked(pos)); } static void ClearPortal(sector_t *self, int pos) { self->ClearPortal(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, ClearPortal, ClearPortal) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); self->ClearPortal(pos); return 0; } static double GetPortalPlaneZ(sector_t *self, int pos) { return self->GetPortalPlaneZ(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetPortalPlaneZ, GetPortalPlaneZ) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetPortalPlaneZ(pos)); } static int GetPortalType(sector_t *self, int pos) { return self->GetPortalType(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetPortalType, GetPortalType) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetPortalType(pos)); } static int GetOppositePortalGroup(sector_t *self, int pos) { return self->GetOppositePortalGroup(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetOppositePortalGroup, GetOppositePortalGroup) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetOppositePortalGroup(pos)); } static double CenterFloor(sector_t *self) { return self->CenterFloor(); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, CenterFloor, CenterFloor) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_FLOAT(self->CenterFloor()); } static double CenterCeiling(sector_t *self) { return self->CenterCeiling(); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, CenterCeiling, CenterCeiling) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_FLOAT(self->CenterCeiling()); } static int Index(sector_t *self) { unsigned ndx = self->Index(); if (ndx >= level.sectors.Size()) return -1; // This must not throw because it is the only means to check that the given pointer is valid. return ndx; } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, Index, Index) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); ACTION_RETURN_INT(Index(self)); } static void SetEnvironmentID(sector_t *self, int envnum) { level.Zones[self->ZoneNumber].Environment = S_FindEnvironment(envnum); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetEnvironmentID, SetEnvironmentID) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(envnum); SetEnvironmentID(self, envnum); return 0; } static void SetEnvironment(sector_t *self, const FString &env) { level.Zones[self->ZoneNumber].Environment = S_FindEnvironment(env); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetEnvironment, SetEnvironment) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_STRING(env); SetEnvironment(self, env); return 0; } static double GetGlowHeight(sector_t *self, int pos) { return self->GetGlowHeight(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetGlowHeight, GetGlowHeight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_FLOAT(self->GetGlowHeight(pos)); } static double GetGlowColor(sector_t *self, int pos) { return self->GetGlowColor(pos); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetGlowColor, GetGlowColor) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); ACTION_RETURN_INT(self->GetGlowColor(pos)); } static void SetGlowHeight(sector_t *self, int pos, double o) { self->SetGlowHeight(pos, float(o)); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetGlowHeight, SetGlowHeight) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_FLOAT(o); self->SetGlowHeight(pos, float(o)); return 0; } static void SetGlowColor(sector_t *self, int pos, int o) { self->SetGlowColor(pos, o); } DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetGlowColor, SetGlowColor) { PARAM_SELF_STRUCT_PROLOGUE(sector_t); PARAM_INT(pos); PARAM_COLOR(o); self->SetGlowColor(pos, o); return 0; } //=========================================================================== // // line_t exports // //=========================================================================== DEFINE_ACTION_FUNCTION(_Line, isLinePortal) { PARAM_SELF_STRUCT_PROLOGUE(line_t); ACTION_RETURN_BOOL(self->isLinePortal()); } DEFINE_ACTION_FUNCTION(_Line, isVisualPortal) { PARAM_SELF_STRUCT_PROLOGUE(line_t); ACTION_RETURN_BOOL(self->isVisualPortal()); } DEFINE_ACTION_FUNCTION(_Line, getPortalDestination) { PARAM_SELF_STRUCT_PROLOGUE(line_t); ACTION_RETURN_POINTER(self->getPortalDestination()); } DEFINE_ACTION_FUNCTION(_Line, getPortalAlignment) { PARAM_SELF_STRUCT_PROLOGUE(line_t); ACTION_RETURN_INT(self->getPortalAlignment()); } DEFINE_ACTION_FUNCTION(_Line, Index) { PARAM_SELF_STRUCT_PROLOGUE(line_t); unsigned ndx = self->Index(); if (ndx >= level.lines.Size()) { ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Accessed invalid line"); } ACTION_RETURN_INT(ndx); } //=========================================================================== // // // //=========================================================================== DEFINE_ACTION_FUNCTION(_Side, GetTexture) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); ACTION_RETURN_INT(self->GetTexture(which).GetIndex()); } DEFINE_ACTION_FUNCTION(_Side, SetTexture) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_INT(tex); self->SetTexture(which, FSetTextureID(tex)); return 0; } DEFINE_ACTION_FUNCTION(_Side, SetTextureXOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->SetTextureXOffset(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, AddTextureXOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->AddTextureXOffset(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, GetTextureXOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); ACTION_RETURN_FLOAT(self->GetTextureXOffset(which)); } DEFINE_ACTION_FUNCTION(_Side, SetTextureYOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->SetTextureYOffset(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, AddTextureYOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->AddTextureYOffset(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, GetTextureYOffset) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); ACTION_RETURN_FLOAT(self->GetTextureYOffset(which)); } DEFINE_ACTION_FUNCTION(_Side, SetTextureXScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->SetTextureXScale(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureXScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->MultiplyTextureXScale(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, GetTextureXScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); ACTION_RETURN_FLOAT(self->GetTextureXScale(which)); } DEFINE_ACTION_FUNCTION(_Side, SetTextureYScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->SetTextureYScale(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureYScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); PARAM_FLOAT(ofs); self->MultiplyTextureYScale(which, ofs); return 0; } DEFINE_ACTION_FUNCTION(_Side, GetTextureYScale) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(which); ACTION_RETURN_FLOAT(self->GetTextureYScale(which)); } DEFINE_ACTION_FUNCTION(_Side, V1) { PARAM_SELF_STRUCT_PROLOGUE(side_t); ACTION_RETURN_POINTER(self->V1()); } DEFINE_ACTION_FUNCTION(_Side, V2) { PARAM_SELF_STRUCT_PROLOGUE(side_t); ACTION_RETURN_POINTER(self->V2()); } DEFINE_ACTION_FUNCTION(_Side, Index) { PARAM_SELF_STRUCT_PROLOGUE(side_t); ACTION_RETURN_INT(self->Index()); } //===================================================================================== // // //===================================================================================== DEFINE_ACTION_FUNCTION(_Side, SetSpecialColor) { PARAM_SELF_STRUCT_PROLOGUE(side_t); PARAM_INT(tier); PARAM_INT(position); PARAM_COLOR(color); if (tier >= 0 && tier < 3 && position >= 0 && position < 2) { color.a = 255; self->SetSpecialColor(tier, position, color); } return 0; } DEFINE_ACTION_FUNCTION(_Vertex, Index) { PARAM_SELF_STRUCT_PROLOGUE(vertex_t); ACTION_RETURN_INT(self->Index()); } DEFINE_ACTION_FUNCTION(_TexMan, ReplaceTextures) { PARAM_PROLOGUE; PARAM_STRING(from); PARAM_STRING(to); PARAM_INT(flags); P_ReplaceTextures(from, to, flags); return 0; } DEFINE_ACTION_FUNCTION(_Secplane, isSlope) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); ACTION_RETURN_BOOL(!self->normal.XY().isZero()); } DEFINE_ACTION_FUNCTION(_Secplane, PointOnSide) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_FLOAT(z); ACTION_RETURN_INT(self->PointOnSide(DVector3(x, y, z))); } DEFINE_ACTION_FUNCTION(_Secplane, ZatPoint) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(x); PARAM_FLOAT(y); ACTION_RETURN_FLOAT(self->ZatPoint(x, y)); } DEFINE_ACTION_FUNCTION(_Secplane, ZatPointDist) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_FLOAT(d); ACTION_RETURN_FLOAT((d + self->normal.X*x + self->normal.Y*y) * self->negiC); } DEFINE_ACTION_FUNCTION(_Secplane, isEqual) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_POINTER(other, secplane_t); ACTION_RETURN_BOOL(*self == *other); } DEFINE_ACTION_FUNCTION(_Secplane, ChangeHeight) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(hdiff); self->ChangeHeight(hdiff); return 0; } DEFINE_ACTION_FUNCTION(_Secplane, GetChangedHeight) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(hdiff); ACTION_RETURN_FLOAT(self->GetChangedHeight(hdiff)); } DEFINE_ACTION_FUNCTION(_Secplane, HeightDiff) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(oldd); PARAM_FLOAT(newd); if (newd != 1e37) { ACTION_RETURN_FLOAT(self->HeightDiff(oldd)); } else { PARAM_FLOAT(newd); ACTION_RETURN_FLOAT(self->HeightDiff(oldd, newd)); } } DEFINE_ACTION_FUNCTION(_Secplane, PointToDist) { PARAM_SELF_STRUCT_PROLOGUE(secplane_t); PARAM_FLOAT(x); PARAM_FLOAT(y); PARAM_FLOAT(z); ACTION_RETURN_FLOAT(self->PointToDist(DVector2(x, y), z)); }