This commit is contained in:
Rachael Alexanderson 2017-02-09 11:21:01 -05:00
commit 6ed46921c8
8 changed files with 94 additions and 58 deletions

View file

@ -417,7 +417,8 @@ enum ActorRenderFlag
RF_FLATSPRITE = 0x2000, // Flat sprite
RF_VOXELSPRITE = 0x3000, // Voxel object
RF_INVISIBLE = 0x8000, // Don't bother drawing this actor
RF_MAYBEINVISIBLE = 0x10000,
RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting)
RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting)
RF_ROLLSPRITE = 0x40000, //[marrub]roll the sprite billboard
RF_DONTFLIP = 0x80000, // Don't flip it when viewed from behind.
RF_ROLLCENTER = 0x00100000, // Rotate from the center of sprite instead of offsets
@ -425,9 +426,7 @@ enum ActorRenderFlag
RF_ABSMASKANGLE = 0x00400000, // [MC] The mask rotation does not offset by the actor's angle.
RF_ABSMASKPITCH = 0x00800000, // [MC] The mask rotation does not offset by the actor's pitch.
RF_INTERPOLATEANGLES = 0x01000000, // [MC] Allow interpolation of the actor's angle, pitch and roll.
RF_FORCEYBILLBOARD = 0x10000, // [BB] OpenGL only: draw with y axis billboard, i.e. anchored to the floor (overrides gl_billboard_mode setting)
RF_FORCEXYBILLBOARD = 0x20000, // [BB] OpenGL only: draw with xy axis billboard, i.e. unanchored (overrides gl_billboard_mode setting)
RF_MAYBEINVISIBLE = 0x02000000,
};
// This translucency value produces the closest match to Heretic's TINTTAB.

View file

@ -114,13 +114,6 @@ FRandom pr_acs ("ACS");
#define HUDMSG_VISIBILITY_MASK (0x00070000)
// See HUDMSG visibility enumerations in sbar.h
// Flags for ReplaceTextures
#define NOT_BOTTOM 1
#define NOT_MIDDLE 2
#define NOT_TOP 4
#define NOT_FLOOR 8
#define NOT_CEILING 16
// LineAttack flags
#define FHF_NORANDOMPUFFZ 1
#define FHF_NOIMPACTDECAL 2
@ -3322,47 +3315,6 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
}
}
void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
{
const char *fromname = FBehavior::StaticLookupString (fromnamei);
const char *toname = FBehavior::StaticLookupString (tonamei);
FTextureID picnum1, picnum2;
if (fromname == NULL)
return;
if ((flags ^ (NOT_BOTTOM | NOT_MIDDLE | NOT_TOP)) != 0)
{
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
for (auto &side : level.sides)
{
for(int j=0;j<3;j++)
{
static BYTE bits[]={NOT_TOP, NOT_MIDDLE, NOT_BOTTOM};
if (!(flags & bits[j]) && side.GetTexture(j) == picnum1)
{
side.SetTexture(j, picnum2);
}
}
}
}
if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
for (auto &sec : level.sectors)
{
if (!(flags & NOT_FLOOR) && sec.GetTexture(sector_t::floor) == picnum1)
sec.SetTexture(sector_t::floor, picnum2);
if (!(flags & NOT_CEILING) && sec.GetTexture(sector_t::ceiling) == picnum1)
sec.SetTexture(sector_t::ceiling, picnum2);
}
}
}
int DLevelScript::DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, bool force)
{
PClassActor *info = PClass::FindActor(FBehavior::StaticLookupString (type));
@ -8352,9 +8304,14 @@ scriptwait:
break;
case PCD_REPLACETEXTURES:
ReplaceTextures (STACK(3), STACK(2), STACK(1));
{
const char *fromname = FBehavior::StaticLookupString(STACK(3));
const char *toname = FBehavior::StaticLookupString(STACK(2));
P_ReplaceTextures(fromname, toname, STACK(1));
sp -= 3;
break;
}
case PCD_SETLINEBLOCKING:
{

View file

@ -913,7 +913,6 @@ protected:
static void ChangeFlat (int tag, int name, bool floorOrCeiling);
static int CountPlayers ();
static void SetLineTexture (int lineid, int side, int position, int name);
static void ReplaceTextures (int fromname, int toname, int flags);
static int DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, bool force);
static int DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force);
static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor);

View file

@ -441,4 +441,15 @@ enum EDmgFlags
//
bool P_AlignFlat (int linenum, int side, int fc);
enum ETexReplaceFlags
{
NOT_BOTTOM = 1,
NOT_MIDDLE = 2,
NOT_TOP = 4,
NOT_FLOOR = 8,
NOT_CEILING = 16
};
void P_ReplaceTextures(const char *fromname, const char *toname, int flags);
#endif // __P_LOCAL__

View file

@ -144,8 +144,6 @@ IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(Poisoner)
IMPLEMENT_POINTER(DamageFunc)
IMPLEMENT_POINTER(alternative)
IMPLEMENT_POINTER(TeleFogSourceType)
IMPLEMENT_POINTER(TeleFogDestType)
IMPLEMENT_POINTERS_END
AActor::~AActor ()

View file

@ -2120,6 +2120,63 @@ bool P_AlignFlat (int linenum, int side, int fc)
return true;
}
//==========================================================================
//
// P_ReplaceTextures
//
//==========================================================================
void P_ReplaceTextures(const char *fromname, const char *toname, int flags)
{
FTextureID picnum1, picnum2;
if (fromname == nullptr)
return;
if ((flags ^ (NOT_BOTTOM | NOT_MIDDLE | NOT_TOP)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
for (auto &side : level.sides)
{
for (int j = 0; j<3; j++)
{
static uint8_t bits[] = { NOT_TOP, NOT_MIDDLE, NOT_BOTTOM };
if (!(flags & bits[j]) && side.GetTexture(j) == picnum1)
{
side.SetTexture(j, picnum2);
}
}
}
}
if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{
picnum1 = TexMan.GetTexture(fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture(toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
for (auto &sec : level.sectors)
{
if (!(flags & NOT_FLOOR) && sec.GetTexture(sector_t::floor) == picnum1)
sec.SetTexture(sector_t::floor, picnum2);
if (!(flags & NOT_CEILING) && sec.GetTexture(sector_t::ceiling) == picnum1)
sec.SetTexture(sector_t::ceiling, picnum2);
}
}
}
DEFINE_ACTION_FUNCTION(_TexMan, ReplaceTextures)
{
PARAM_PROLOGUE;
PARAM_STRING(from);
PARAM_STRING(to);
PARAM_INT(flags);
P_ReplaceTextures(from, to, flags);
return 0;
}
//==========================================================================
//
// P_BuildPolyBSP

View file

@ -680,7 +680,10 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
void ProcessMouseWheelEvent(NSEvent* theEvent)
{
const CGFloat delta = [theEvent deltaY];
const SWORD modifiers = ModifierFlagsToGUIKeyModifiers(theEvent);
const CGFloat delta = (modifiers & GKM_SHIFT)
? [theEvent deltaX]
: [theEvent deltaY];
const bool isZeroDelta = fabs(delta) < 1.0E-5;
if (isZeroDelta && GUICapture)
@ -694,7 +697,7 @@ void ProcessMouseWheelEvent(NSEvent* theEvent)
{
event.type = EV_GUI_Event;
event.subtype = delta > 0.0f ? EV_GUI_WheelUp : EV_GUI_WheelDown;
event.data3 = ModifierFlagsToGUIKeyModifiers(theEvent);
event.data3 = modifiers;
}
else
{

View file

@ -28,8 +28,20 @@ struct TexMan
ShortNameOnly = 16,
DontCreate = 32
};
enum ETexReplaceFlags
{
NOT_BOTTOM = 1,
NOT_MIDDLE = 2,
NOT_TOP = 4,
NOT_FLOOR = 8,
NOT_CEILING = 16,
NOT_WALL = 7,
NOT_FLAT = 24
};
native static TextureID CheckForTexture(String name, int usetype, int flags = TryAny);
native static void ReplaceTextures(String from, String to, int flags);
}
enum DrawTextureTags