diff --git a/src/actor.h b/src/actor.h index 13511b617..42689310b 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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. diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 197a0616d..00b1d7be8 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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: { diff --git a/src/p_acs.h b/src/p_acs.h index 52665a39b..8265e5b37 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -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); diff --git a/src/p_local.h b/src/p_local.h index d50d2be52..89346328e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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__ diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 53491f235..829674ba6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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 () diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index e85fd744f..5e0a8f6ac 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -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 diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 786166a7b..74ef5c1cc 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -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 { diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 1ff8a5e92..5ba744a8e 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -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