mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-31 04:50:48 +00:00
- continued work on adding direct native support.
This commit is contained in:
parent
dc16c1d44e
commit
6628b34f4a
3 changed files with 67 additions and 57 deletions
|
@ -904,12 +904,12 @@ void sector_t::ClosestPoint(const DVector2 &in, DVector2 &out) const
|
|||
//
|
||||
//=====================================================================================
|
||||
|
||||
bool sector_t::PlaneMoving(int pos)
|
||||
bool PlaneMoving(sector_t *sector, int pos)
|
||||
{
|
||||
if (pos == floor)
|
||||
return (floordata != NULL || (planes[floor].Flags & PLANEF_BLOCKED));
|
||||
if (pos == sector_t::floor)
|
||||
return (sector->floordata != nullptr || (sector->planes[sector_t::floor].Flags & PLANEF_BLOCKED));
|
||||
else
|
||||
return (ceilingdata != NULL || (planes[ceiling].Flags & PLANEF_BLOCKED));
|
||||
return (sector->ceilingdata != nullptr || (sector->planes[sector_t::ceiling].Flags & PLANEF_BLOCKED));
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -965,14 +965,14 @@ FSectorPortal *sector_t::ValidatePortal(int which)
|
|||
//
|
||||
//=====================================================================================
|
||||
|
||||
void sector_t::GetSpecial(secspecial_t *spec)
|
||||
void GetSpecial(sector_t *sector, secspecial_t *spec)
|
||||
{
|
||||
spec->special = special;
|
||||
spec->damageamount = damageamount;
|
||||
spec->damagetype = damagetype;
|
||||
spec->damageinterval = damageinterval;
|
||||
spec->leakydamage = leakydamage;
|
||||
spec->Flags = Flags & SECF_SPECIALFLAGS;
|
||||
spec->special = sector->special;
|
||||
spec->damageamount = sector->damageamount;
|
||||
spec->damagetype = sector->damagetype;
|
||||
spec->damageinterval = sector->damageinterval;
|
||||
spec->leakydamage = sector->leakydamage;
|
||||
spec->Flags = sector->Flags & SECF_SPECIALFLAGS;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -980,14 +980,14 @@ void sector_t::GetSpecial(secspecial_t *spec)
|
|||
//
|
||||
//=====================================================================================
|
||||
|
||||
void sector_t::SetSpecial(const secspecial_t *spec)
|
||||
void SetSpecial(sector_t *sector, const secspecial_t *spec)
|
||||
{
|
||||
special = spec->special;
|
||||
damageamount = spec->damageamount;
|
||||
damagetype = spec->damagetype;
|
||||
damageinterval = spec->damageinterval;
|
||||
leakydamage = spec->leakydamage;
|
||||
Flags = (Flags & ~SECF_SPECIALFLAGS) | (spec->Flags & SECF_SPECIALFLAGS);
|
||||
sector->special = spec->special;
|
||||
sector->damageamount = spec->damageamount;
|
||||
sector->damagetype = spec->damagetype;
|
||||
sector->damageinterval = spec->damageinterval;
|
||||
sector->leakydamage = spec->leakydamage;
|
||||
sector->Flags = (sector->Flags & ~SECF_SPECIALFLAGS) | (spec->Flags & SECF_SPECIALFLAGS);
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -995,14 +995,14 @@ void sector_t::SetSpecial(const secspecial_t *spec)
|
|||
//
|
||||
//=====================================================================================
|
||||
|
||||
void sector_t::TransferSpecial(sector_t *model)
|
||||
void TransferSpecial(sector_t *sector, sector_t *model)
|
||||
{
|
||||
special = model->special;
|
||||
damageamount = model->damageamount;
|
||||
damagetype = model->damagetype;
|
||||
damageinterval = model->damageinterval;
|
||||
leakydamage = model->leakydamage;
|
||||
Flags = (Flags&~SECF_SPECIALFLAGS) | (model->Flags & SECF_SPECIALFLAGS);
|
||||
sector->special = model->special;
|
||||
sector->damageamount = model->damageamount;
|
||||
sector->damagetype = model->damagetype;
|
||||
sector->damageinterval = model->damageinterval;
|
||||
sector->leakydamage = model->leakydamage;
|
||||
sector->Flags = (sector->Flags&~SECF_SPECIALFLAGS) | (model->Flags & SECF_SPECIALFLAGS);
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -1010,9 +1010,9 @@ void sector_t::TransferSpecial(sector_t *model)
|
|||
//
|
||||
//=====================================================================================
|
||||
|
||||
int sector_t::GetTerrain(int pos) const
|
||||
int GetTerrain(const sector_t *sector, int pos)
|
||||
{
|
||||
return terrainnum[pos] >= 0 ? terrainnum[pos] : TerrainTypes[GetTexture(pos)];
|
||||
return sector->terrainnum[pos] >= 0 ? sector->terrainnum[pos] : TerrainTypes[sector->GetTexture(pos)];
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
|
@ -1300,9 +1300,9 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void sector_t::RemoveForceField()
|
||||
void RemoveForceField(sector_t *sector)
|
||||
{
|
||||
for (auto line : Lines)
|
||||
for (auto line : sector->Lines)
|
||||
{
|
||||
if (line->backsector != NULL && line->special == ForceField)
|
||||
{
|
||||
|
|
20
src/r_defs.h
20
src/r_defs.h
|
@ -1605,4 +1605,24 @@ double FindShortestUpperAround(sector_t *sector); // jff 2/04/98
|
|||
sector_t *FindModelFloorSector(sector_t *sec, double floordestheight); // jff 2/04/98
|
||||
sector_t *FindModelCeilingSector(sector_t *sec, double floordestheight); // jff 2/04/98
|
||||
|
||||
// This setup is to allow the VM call directily into the implementation.
|
||||
// With a member function this may be subject to OS implementation details, e.g. on Windows 32 bit members use a different calling convention than regular functions.
|
||||
void RemoveForceField(sector_t *sec);
|
||||
bool PlaneMoving(sector_t *sector, int pos);
|
||||
void TransferSpecial(sector_t *self, sector_t *model);
|
||||
void GetSpecial(sector_t *self, secspecial_t *spec);
|
||||
void SetSpecial(sector_t *self, const secspecial_t *spec);
|
||||
int GetTerrain(const sector_t *, int pos);
|
||||
void CheckPortalPlane(sector_t *sector, int plane);
|
||||
|
||||
|
||||
inline void sector_t::RemoveForceField() { return ::RemoveForceField(this); }
|
||||
inline bool sector_t::PlaneMoving(int pos) { return ::PlaneMoving(this, pos); }
|
||||
inline void sector_t::TransferSpecial(sector_t *model) { return ::TransferSpecial(this, model); }
|
||||
inline void sector_t::GetSpecial(secspecial_t *spec) { ::GetSpecial(this, spec); }
|
||||
inline void sector_t::SetSpecial(const secspecial_t *spec) { ::SetSpecial(this, spec); }
|
||||
inline int sector_t::GetTerrain(int pos) const { return ::GetTerrain(this, pos); }
|
||||
inline void sector_t::CheckPortalPlane(int plane) { return ::CheckPortalPlane(this, plane); }
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindModelCeilingSector, FindModelCeilingS
|
|||
ACTION_RETURN_POINTER(h);
|
||||
}
|
||||
|
||||
// Note: Do not use struct types like PalEntry as argument types here! We never know what the compilers will do with them.
|
||||
// Note: Do not use struct types like PalEntry as argument types here! We never know what the compilers will do with them, buz we need a guaranteed integer calling convention .
|
||||
static void SetColor(sector_t *self, int color, int desat)
|
||||
{
|
||||
self->Colormap.LightColor.SetRGB(color);
|
||||
|
@ -86,15 +86,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetFade, SetFade)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SetSpecialColor(sector_t *self, int num, int _color)
|
||||
static void SetSpecialColor(sector_t *self, int num, int color)
|
||||
{
|
||||
if (num >= 0 && num < 5)
|
||||
{
|
||||
PalEntry color = _color;
|
||||
color.a = 255;
|
||||
self->SetSpecialColor(num, color);
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetSpecialColor, SetSpecialColor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
|
@ -117,16 +116,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetFogDensity, SetFogDensity)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int PlaneMoving(sector_t *self, int pos)
|
||||
{
|
||||
return self->PlaneMoving(pos);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, PlaneMoving)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, PlaneMoving, PlaneMoving)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
ACTION_RETURN_BOOL(self->PlaneMoving(pos));
|
||||
ACTION_RETURN_BOOL(PlaneMoving(self, pos));
|
||||
}
|
||||
|
||||
static int GetFloorLight(sector_t *self)
|
||||
|
@ -162,43 +156,39 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetHeightSec, GetHeightSec)
|
|||
ACTION_RETURN_POINTER(self->GetHeightSec());
|
||||
}
|
||||
|
||||
static void GetSpecial(sector_t *self, secspecial_t *spec)
|
||||
{
|
||||
self->GetSpecial(spec);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetSpecial, GetSpecial)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_POINTER(spec, secspecial_t);
|
||||
self->GetSpecial(spec);
|
||||
GetSpecial(self, spec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, SetSpecial)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetSpecial, SetSpecial)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_POINTER(spec, secspecial_t);
|
||||
self->SetSpecial(spec);
|
||||
SetSpecial(self, spec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, TransferSpecial)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, TransferSpecial, TransferSpecial)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_POINTER(spec, sector_t);
|
||||
self->TransferSpecial(spec);
|
||||
TransferSpecial(self, spec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, GetTerrain)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetTerrain, GetTerrain)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(pos);
|
||||
ACTION_RETURN_INT(self->GetTerrain(pos));
|
||||
ACTION_RETURN_INT(GetTerrain(self, pos));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, CheckPortalPlane)
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, CheckPortalPlane, CheckPortalPlane)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(plane);
|
||||
|
@ -206,11 +196,11 @@ DEFINE_ACTION_FUNCTION(_Sector, CheckPortalPlane)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, RemoveForceField)
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
self->RemoveForceField();
|
||||
return 0;
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
RemoveForceField(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Sector, AdjustFloorClip)
|
||||
|
|
Loading…
Reference in a new issue