Skip to content

Commit

Permalink
Expose changing sidedef wallpart flags to zscript
Browse files Browse the repository at this point in the history
  • Loading branch information
azamorapl authored and coelckers committed Oct 25, 2020
1 parent eab3289 commit 7676ed6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gamedata/r_defs.h
Expand Up @@ -1320,6 +1320,17 @@ struct side_t
textures[which].yScale *= delta;
}

int GetTextureFlags(int which)
{
return textures[which].flags;
}

void ChangeTextureFlags(int which, int And, int Or)
{
textures[which].flags &= ~And;
textures[which].flags |= Or;
}

void SetSpecialColor(int which, int slot, int r, int g, int b, bool useown = true)
{
textures[which].SpecialColors[slot] = PalEntry(255, r, g, b);
Expand Down
27 changes: 27 additions & 0 deletions src/scripting/vmthunks.cpp
Expand Up @@ -1399,6 +1399,33 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset)
ACTION_RETURN_POINTER(self->V2());
}

static int GetTextureFlags(side_t* self, int tier)
{
return self->GetTextureFlags(tier);
}

DEFINE_ACTION_FUNCTION_NATIVE(_Side, GetTextureFlags, GetTextureFlags)
{
PARAM_SELF_STRUCT_PROLOGUE(side_t);
PARAM_INT(tier);
ACTION_RETURN_INT(self->GetTextureFlags(tier));
}

static void ChangeTextureFlags(side_t* self, int tier, int And, int Or)
{
self->ChangeTextureFlags(tier, And, Or);
}

DEFINE_ACTION_FUNCTION_NATIVE(_Side, ChangeTextureFlags, ChangeTextureFlags)
{
PARAM_SELF_STRUCT_PROLOGUE(side_t);
PARAM_INT(tier);
PARAM_INT(a);
PARAM_INT(o);
ChangeTextureFlags(self, tier, a, o);
return 0;
}

static void SetSideSpecialColor(side_t *self, int tier, int position, int color, int useown)
{
if (tier >= 0 && tier < 3 && position >= 0 && position < 2)
Expand Down
10 changes: 10 additions & 0 deletions wadsrc/static/zscript/mapdata.zs
Expand Up @@ -62,6 +62,14 @@ struct Side native play
WALLF_LIGHT_FOG = 128, // This wall's Light is used even in fog.
};

enum EPartFlags
{
NoGradient = 1,
FlipGradient = 2,
ClampGradient = 4,
UseOwnSpecialColors = 8,
UseOwnAdditiveColor = 16,
};

native readonly Sector sector; // Sector the SideDef is facing.
//DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
Expand All @@ -83,6 +91,8 @@ struct Side native play
native void SetTextureYScale(int which, double scale);
native double GetTextureYScale(int which);
native void MultiplyTextureYScale(int which, double delta);
native int GetTextureFlags(int tier);
native void ChangeTextureFlags(int tier, int And, int Or);
native void SetSpecialColor(int tier, int position, Color scolor, bool useowncolor = true);
native Color GetAdditiveColor(int tier);
native void SetAdditiveColor(int tier, Color color);
Expand Down

0 comments on commit 7676ed6

Please sign in to comment.