Merge commit '38df0665e3a2018cf1d0028a36357df6c7e908e9' into scripting

Conflicts:
	src/d_dehacked.cpp
	src/decallib.cpp
	src/g_hexen/a_clericstaff.cpp
	src/p_interaction.cpp
	src/p_local.h
	src/thingdef/thingdef_codeptr.cpp
	wadsrc/static/actors/constants.txt
	wadsrc/static/actors/shared/inventory.txt
This commit is contained in:
Christoph Oelckers 2016-01-17 19:50:34 +01:00
commit fbaab5044d
50 changed files with 2432 additions and 2093 deletions

View file

@ -237,6 +237,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
scalex = <float>; // Vertical scaling on thing. Default = 0 (ignored).
scaley = <float>; // Horizontal scaling on thing. Default = 0 (ignored).
scale = <float>; // Vertical and horizontal scaling on thing. Default = 0 (ignored).
floatbobphase = <int>; // Sets the thing's floatbobphase. Valid phase values are 0-63. Default = -1 (use actor class default).
* Note about arg0str

View file

@ -375,6 +375,7 @@ enum ActorFlag7
MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal
MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's.
MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced.
MF7_ICESHATTER = 0x00200000, // [MC] Shatters ice corpses regardless of damagetype.
};
// --- mobj.renderflags ---

View file

@ -2328,7 +2328,9 @@ void AM_drawWalls (bool allmap)
AM_drawMline (&l, AMColors.LockedColor); // locked special
}
}
else if (am_showtriggerlines && AMColors.isValid(AMColors.SpecialWallColor) && lines[i].special != 0
else if (am_showtriggerlines && AMColors.isValid(AMColors.SpecialWallColor)
&& LineSpecialsInfo[lines[i].special] != NULL
&& LineSpecialsInfo[lines[i].special]->max_args >= 0
&& lines[i].special != Door_Open
&& lines[i].special != Door_Close
&& lines[i].special != Door_CloseWaitOpen

View file

@ -368,8 +368,7 @@ bool FConfigFile::DeleteCurrentSection()
LastSectionPtr = &sec->Next;
}
CurrentSection->~FConfigSection();
delete[] (char *)CurrentSection;
delete CurrentSection;
CurrentSection = sec->Next;
return CurrentSection != NULL;

View file

@ -842,7 +842,7 @@ static int PatchThing (int thingy)
bool hadStyle = false;
FStateDefinitions statedef;
bool patchedStates = false;
int oldflags;
ActorFlags oldflags;
PClassActor *type;
SWORD *ednum, dummyed;
@ -1197,28 +1197,28 @@ static int PatchThing (int thingy)
}
if (vchanged[1])
{
info->flags2 = ActorFlags2::FromInt (value[1]);
if (info->flags2 & 0x00000004) // old BOUNCE1
if (value[1] & 0x00000004) // old BOUNCE1
{
info->flags2 &= ActorFlags2::FromInt (~4);
value[1] &= ~0x00000004;
info->BounceFlags = BOUNCE_DoomCompat;
}
// Damage types that once were flags but now are not
if (info->flags2 & 0x20000000)
if (value[1] & 0x20000000)
{
info->DamageType = NAME_Ice;
info->flags2 &= ActorFlags2::FromInt (~0x20000000);
value[1] &= ~0x20000000;
}
if (info->flags2 & 0x10000)
if (value[1] & 0x10000000)
{
info->DamageType = NAME_Fire;
info->flags2 &= ActorFlags2::FromInt (~0x10000);
value[1] &= ~0x10000000;
}
if (info->flags2 & 1)
if (value[1] & 0x00000001)
{
info->gravity = FRACUNIT/4;
info->flags2 &= ActorFlags2::FromInt (~1);
value[1] &= ~0x00000001;
}
info->flags2 = ActorFlags2::FromInt (value[1]);
}
if (vchanged[2])
{

View file

@ -432,7 +432,7 @@ WORD FDecalLib::GetDecalID (FScanner &sc)
unsigned long num = strtoul (sc.String, NULL, 10);
if (num < 1 || num > 65535)
{
sc.MustGetStringName ("Decal ID must be between 1 and 65535");
sc.ScriptError ("Decal ID must be between 1 and 65535");
}
return (WORD)num;
}
@ -603,16 +603,18 @@ void FDecalLib::ParseGenerator (FScanner &sc)
{
PClassActor *type;
FDecalBase *decal;
AActor *actor;
bool optional = false;
// Get name of generator (actor)
sc.MustGetString ();
type = PClass::FindActor(sc.String);
optional = sc.Compare("optional");
if (optional) sc.MustGetString();
type = PClass::FindActor (sc.String);
if (type == NULL)
{
sc.ScriptError ("%s is not an actor.", sc.String);
if (!optional) sc.ScriptError ("%s is not an actor.", sc.String);
}
actor = (AActor *)type->Defaults;
// Get name of generated decal
sc.MustGetString ();
@ -625,14 +627,17 @@ void FDecalLib::ParseGenerator (FScanner &sc)
decal = ScanTreeForName (sc.String, Root);
if (decal == NULL)
{
sc.ScriptError ("%s has not been defined.", sc.String);
if (!optional) sc.ScriptError ("%s has not been defined.", sc.String);
}
}
if (type != NULL)
{
AActor *actor = (AActor *)type->Defaults;
actor->DecalGenerator = decal;
if (decal != NULL)
{
decal->Users.Push (type);
decal->Users.Push(type);
}
}
}

View file

@ -365,6 +365,7 @@ struct FMapThing
short pitch;
short roll;
DWORD RenderStyle;
int FloatbobPhase;
};

View file

@ -1236,7 +1236,7 @@ void FParser::SF_ObjFlag(void)
t_return.type = svt_int;
if (mo && flagnum<26)
{
t_return.value.i = !!(mo->flags & (1 << flagnum));
t_return.value.i = !!(mo->flags & ActorFlags::FromInt(1 << flagnum));
}
else t_return.value.i = 0;
}

View file

@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
&& (!(linetarget->flags2&(MF2_DORMANT+MF2_INVULNERABLE))))
&& (!(linetarget->flags2&(MF2_DORMANT|MF2_INVULNERABLE))))
{
newLife = player->health+(damage>>3);
newLife = newLife > max ? max : newLife;

View file

@ -698,6 +698,13 @@ void G_DoCompleted (void)
gameaction = ga_nothing;
if ( gamestate == GS_DEMOSCREEN
|| gamestate == GS_FULLCONSOLE
|| gamestate == GS_STARTUP)
{
return;
}
if (gamestate == GS_TITLELEVEL)
{
level.MapName = nextlevel;

View file

@ -561,8 +561,10 @@ enum ESkillProperty
SKILLP_FriendlyHealth,
SKILLP_NoPain,
SKILLP_ArmorFactor,
SKILLP_HealthFactor,
SKILLP_EasyKey,
SKILLP_SlowMonsters,
SKILLP_Infight,
};
int G_SkillProperty(ESkillProperty prop);
const char * G_SkillName();
@ -600,7 +602,9 @@ struct FSkillInfo
fixed_t MonsterHealth;
fixed_t FriendlyHealth;
bool NoPain;
int Infighting;
fixed_t ArmorFactor;
fixed_t HealthFactor;
FSkillInfo() {}
FSkillInfo(const FSkillInfo &other)

View file

@ -270,10 +270,12 @@ bool P_GiveBody (AActor *actor, int num, int max)
return true;
}
}
else
else if (num > 0)
{
if (player->health < max)
{
num = FixedMul(num, G_SkillProperty(SKILLP_HealthFactor));
if (num < 1) num = 1;
player->health += num;
if (player->health > max)
{
@ -726,6 +728,7 @@ AInventory *AInventory::CreateCopy (AActor *other)
{
AInventory *copy;
Amount = MIN(Amount, MaxAmount);
if (GoAway ())
{
copy = static_cast<AInventory *>(Spawn (GetClass(), 0, 0, 0, NO_REPLACE));

View file

@ -15,10 +15,23 @@
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
#include "v_text.h"
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
static FRandom pr_randomspawn("RandomSpawn");
static bool IsMonster(DDropItem *di)
{
const PClass *pclass = PClass::FindClass(di->Name);
if (NULL == pclass)
{
return false;
}
return 0 != (GetDefaultByType(pclass)->flags3 & MF3_ISMONSTER);
}
class ARandomSpawner : public AActor
{
DECLARE_CLASS (ARandomSpawner, AActor)
@ -41,7 +54,7 @@ class ARandomSpawner : public AActor
{
if (di->Name != NAME_None)
{
if (!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER))
if (!nomonsters || !IsMonster(di))
{
if (di->Amount < 0) di->Amount = 1; // default value is -1, we need a positive value.
n += di->Amount; // this is how we can weight the list.
@ -62,7 +75,7 @@ class ARandomSpawner : public AActor
while (n > -1 && di != NULL)
{
if (di->Name != NAME_None &&
(!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER)))
(!nomonsters || !IsMonster(di)))
{
n -= di->Amount;
if ((di->Next != NULL) && (n > -1))
@ -106,6 +119,7 @@ class ARandomSpawner : public AActor
}
else
{
Printf(TEXTCOLOR_RED "Unknown item class %s to drop from a random spawner\n", di->Name.GetChars());
Species = NAME_None;
}
}

View file

@ -186,10 +186,12 @@ void ASkyPicker::PostBeginPlay ()
if (0 == (args[1] & 2))
{
Sector->CeilingSkyBox = box;
if (box == NULL) Sector->MoreFlags |= SECF_NOCEILINGSKYBOX; // sector should ignore the level's default skybox
}
if (0 == (args[1] & 1))
{
Sector->FloorSkyBox = box;
if (box == NULL) Sector->MoreFlags |= SECF_NOFLOORSKYBOX; // sector should ignore the level's default skybox
}
}
Destroy ();

View file

@ -1338,17 +1338,17 @@ void DBaseStatusBar::Draw (EHudState state)
{
if (Scaled)
{
y -= Scale (10, SCREENHEIGHT, 200);
y -= Scale (11, SCREENHEIGHT, 200);
}
else
{
if (SCREENWIDTH < 640)
{
y -= 11;
y -= 12;
}
else
{ // Get past the tops of the gargoyles' wings
y -= 26;
y -= 28;
}
}
}

View file

@ -83,6 +83,8 @@ void FMapInfoParser::ParseSkill ()
skill.FriendlyHealth = FRACUNIT;
skill.NoPain = false;
skill.ArmorFactor = FRACUNIT;
skill.Infighting = 0;
skill.HealthFactor = FRACUNIT;
sc.MustGetString();
skill.Name = sc.String;
@ -266,6 +268,20 @@ void FMapInfoParser::ParseSkill ()
sc.MustGetFloat();
skill.ArmorFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare("HealthFactor"))
{
ParseAssign();
sc.MustGetFloat();
skill.HealthFactor = FLOAT2FIXED(sc.Float);
}
else if (sc.Compare("NoInfighting"))
{
skill.Infighting = LEVEL2_NOINFIGHTING;
}
else if (sc.Compare("TotalInfighting"))
{
skill.Infighting = LEVEL2_TOTALINFIGHTING;
}
else if (sc.Compare("DefaultSkill"))
{
if (DefaultSkill >= 0)
@ -384,6 +400,17 @@ int G_SkillProperty(ESkillProperty prop)
case SKILLP_ArmorFactor:
return AllSkills[gameskill].ArmorFactor;
case SKILLP_HealthFactor:
return AllSkills[gameskill].HealthFactor;
case SKILLP_Infight:
// This property also needs to consider the level flags for the same info.
if (level.flags2 & LEVEL2_TOTALINFIGHTING) return 1;
if (level.flags2 & LEVEL2_NOINFIGHTING) return -1;
if (AllSkills[gameskill].Infighting == LEVEL2_TOTALINFIGHTING) return 1;
if (AllSkills[gameskill].Infighting == LEVEL2_NOINFIGHTING) return -1;
return infighting;
}
}
return 0;
@ -463,7 +490,9 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
MonsterHealth = other.MonsterHealth;
FriendlyHealth = other.FriendlyHealth;
NoPain = other.NoPain;
Infighting = other.Infighting;
ArmorFactor = other.ArmorFactor;
HealthFactor = other.HealthFactor;
return *this;
}

View file

@ -385,6 +385,11 @@ FListMenuItemStaticPatch::FListMenuItemStaticPatch(int x, int y, FTextureID patc
void FListMenuItemStaticPatch::Drawer(bool selected)
{
if (!mTexture.Exists())
{
return;
}
int x = mXpos;
FTexture *tex = TexMan(mTexture);
if (mYpos >= 0)
@ -486,7 +491,7 @@ bool FListMenuItemSelectable::MouseEvent(int type, int x, int y)
{
if (type == DMenu::MOUSE_Release)
{
if (DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true))
if (NULL != DMenu::CurrentMenu && DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true))
{
return true;
}

View file

@ -95,6 +95,18 @@ static void DeinitMenus()
ClearSaveGames();
}
static FTextureID GetMenuTexture(const char* const name)
{
const FTextureID texture = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch);
if (!texture.Exists())
{
Printf("Missing menu texture: \"%s\"\n", name);
}
return texture;
}
//=============================================================================
//
//
@ -235,7 +247,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
else if (sc.Compare("Selector"))
{
sc.MustGetString();
desc->mSelector = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
desc->mSelector = GetMenuTexture(sc.String);
sc.MustGetStringName(",");
sc.MustGetNumber();
desc->mSelectOfsX = sc.Number;
@ -278,7 +290,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
int y = sc.Number;
sc.MustGetStringName(",");
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(sc.String);
FListMenuItem *it = new FListMenuItemStaticPatch(x, y, tex, centered);
desc->mItems.Push(it);
@ -299,7 +311,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
else if (sc.Compare("PatchItem"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(sc.String);
sc.MustGetStringName(",");
sc.MustGetString();
int hotkey = sc.String[0];
@ -1045,7 +1057,7 @@ static void BuildEpisodeMenu()
FListMenuItem *it;
if (AllEpisodes[i].mPicName.IsNotEmpty())
{
FTextureID tex = TexMan.CheckForTexture(AllEpisodes[i].mPicName, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
it = new FListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
tex, NAME_Skillmenu, i);
}
@ -1442,7 +1454,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
if (skill.PicName.Len() != 0 && pItemText == NULL)
{
FTextureID tex = TexMan.CheckForTexture(skill.PicName, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(skill.PicName);
li = new FListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, i);
}
else

View file

@ -1045,6 +1045,19 @@ public:
return text;
}
int Draw(FOptionMenuDescriptor*desc, int y, int indent, bool selected)
{
if (mEntering)
{
// reposition the text so that the cursor is visible when in entering mode.
FString text = Represent();
int tlen = SmallFont->StringWidth(text) * CleanXfac_1;
int newindent = screen->GetWidth() - tlen - CURSORSPACE;
if (newindent < indent) indent = newindent;
}
return FOptionMenuFieldBase::Draw(desc, y, indent, selected);
}
bool MenuEvent ( int mkey, bool fromcontroller )
{
if ( mkey == MKEY_Enter )

View file

@ -408,6 +408,7 @@ xx(Roll)
xx(Scale)
xx(ScaleX)
xx(ScaleY)
xx(Floatbobphase)
xx(Blocking)
xx(Blockmonsters)

View file

@ -133,6 +133,16 @@ enum
ARMORINFO_ACTUALSAVEAMOUNT,
};
// PickActor
// [JP] I've renamed these flags to something else to avoid confusion with the other PAF_ flags
enum
{
// PAF_FORCETID,
// PAF_RETURNTID
PICKAF_FORCETID = 1,
PICKAF_RETURNTID = 2,
};
struct CallReturn
{
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway)
@ -3364,6 +3374,14 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
if (info != NULL)
{
info = info->GetReplacement ();
if ((GetDefaultByType (info)->flags3 & MF3_ISMONSTER) &&
((dmflags & DF_NO_MONSTERS) || (level.flags2 & LEVEL2_NOMONSTERS)))
{
return 0;
}
actor = Spawn (info, x, y, z, ALLOW_REPLACE);
if (actor != NULL)
{
@ -5753,9 +5771,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return 0;
}
DWORD actorMask = MF_SHOOTABLE;
ActorFlags actorMask = MF_SHOOTABLE;
if (argCount >= 6) {
actorMask = args[5];
actorMask = ActorFlags::FromInt(args[5]);
}
DWORD wallMask = ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN;
@ -5763,11 +5781,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
wallMask = args[6];
}
bool forceTID = 0;
int flags = 0;
if (argCount >= 8)
{
if (args[7] != 0)
forceTID = 1;
flags = args[7];
}
AActor* pickedActor = P_LinePickActor(actor, args[1] << 16, args[3], args[2] << 16, actorMask, wallMask);
@ -5775,15 +5792,19 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return 0;
}
if (!(forceTID) && (args[4] == 0) && (pickedActor->tid == 0))
if (!(flags & PICKAF_FORCETID) && (args[4] == 0) && (pickedActor->tid == 0))
return 0;
if ((pickedActor->tid == 0) || (forceTID))
if ((pickedActor->tid == 0) || (flags & PICKAF_FORCETID))
{
pickedActor->RemoveFromHash();
pickedActor->tid = args[4];
pickedActor->AddToHash();
}
if (flags & PICKAF_RETURNTID)
{
return pickedActor->tid;
}
return 1;
}
break;
@ -5856,6 +5877,8 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false;
fixed_t heightoffset = argCount > 8 ? args[8] : 0;
fixed_t radiusoffset = argCount > 9 ? args[9] : 0;
fixed_t pitch = argCount > 10 ? args[10] : 0;
FState *state = argCount > 6 ? activator->GetClass()->FindStateByString(statename, exact) : 0;
@ -5873,7 +5896,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (!reference)
return false;
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset))
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch))
{
if (state && argCount > 6)
{

View file

@ -707,6 +707,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
mapthings[count].RenderStyle = STYLE_Count;
mapthings[count].alpha = -1;
mapthings[count].health = -1;
mapthings[count].FloatbobPhase = -1;
if (xsprites != NULL && sprites[i].lotag == 710)
{ // Blood ambient sound

View file

@ -965,7 +965,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
if (target->health <= 0)
{
if (inflictor && mod == NAME_Ice)
if (inflictor && mod == NAME_Ice && !(inflictor->flags7 & MF7_ICESHATTER))
{
return -1;
}
@ -1634,9 +1634,7 @@ bool AActor::OkayToSwitchTarget (AActor *other)
int infight;
if (flags5 & MF5_NOINFIGHTING) infight=-1;
else if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1;
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1;
else infight = infighting;
else infight = G_SkillProperty(SKILLP_Infight);
if (infight < 0 && other->player == NULL && !IsHostile (other))
{

View file

@ -56,6 +56,7 @@
#include "p_3dmidtex.h"
#include "d_net.h"
#include "d_event.h"
#include "gstrings.h"
#include "r_data/colormaps.h"
#define FUNC(a) static int a (line_t *ln, AActor *it, bool backSide, \
@ -1599,6 +1600,11 @@ FUNC(LS_Thing_Move) // [BC]
return P_Thing_Move (arg0, it, arg1, arg2 ? false : true);
}
enum
{
TRANSLATION_ICE = 0x100007
};
FUNC(LS_Thing_SetTranslation)
// Thing_SetTranslation (tid, range)
{
@ -1615,6 +1621,10 @@ FUNC(LS_Thing_SetTranslation)
{
range = TRANSLATION(TRANSLATION_LevelScripted, (arg1-1));
}
else if (arg1 == TRANSLATION_ICE)
{
range = TRANSLATION(TRANSLATION_Standard, 7);
}
else
{
range = 0;
@ -2985,13 +2995,14 @@ FUNC(LS_SendToCommunicator)
{
S_StopSound (CHAN_VOICE);
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
if (arg2 == 0)
// Get the message from the LANGUAGE lump.
FString msg;
msg.Format("TXT_COMM%d", arg2);
const char *str = GStrings[msg];
if (str != NULL)
{
Printf (PRINT_CHAT, "Incoming Message\n");
}
else if (arg2 == 1)
{
Printf (PRINT_CHAT, "Incoming Message from BlackBird\n");
Printf (PRINT_CHAT, "%s\n", str);
}
}
return true;

View file

@ -180,7 +180,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser);
bool P_Thing_CanRaise(AActor *thing);
PClassActor *P_GetSpawnableType(int spawnnum);
void InitSpawnablesFromMapinfo();
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset);
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset, fixed_t radiusoffset, angle_t pitch);
enum WARPF
{
@ -202,6 +202,8 @@ enum WARPF
WARPF_MOVEPTR = 0x1000,
WARPF_USEPTR = 0x2000,
WARPF_USETID = 0x2000,
WARPF_COPYVELOCITY = 0x4000,
WARPF_COPYPITCH = 0x8000,
};
@ -504,7 +506,7 @@ enum // P_LineAttack flags
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LinePickActor (AActor *t1, angle_t angle, fixed_t distance, int pitch, DWORD actorMask, DWORD wallMask);
AActor *P_LinePickActor (AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version

View file

@ -938,10 +938,7 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter)
// to harm / be harmed by anything.
if (!victim->player && !shooter->player)
{
int infight;
if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight = 1;
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight = -1;
else infight = infighting;
int infight = G_SkillProperty(SKILLP_Infight);
if (infight < 0)
{
@ -3912,7 +3909,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
//==========================================================================
AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
DWORD actorMask, DWORD wallMask)
ActorFlags actorMask, DWORD wallMask)
{
fixed_t vx, vy, vz, shootz;

View file

@ -5026,6 +5026,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->SpawnPoint[2] = mthing->z;
mobj->SpawnAngle = mthing->angle;
mobj->SpawnFlags = mthing->flags;
if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase;
if (mthing->gravity < 0) mobj->gravity = -mthing->gravity;
else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity);
else mobj->flags &= ~MF_NOGRAVITY;
@ -6564,25 +6565,25 @@ void PrintMiscActorInfo(AActor *query)
Printf("%s @ %p has the following flags:\n flags: %x", query->GetTag(), query, query->flags.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags));
if (query->flags & ActorFlags::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags));
Printf("\n flags2: %x", query->flags2.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags2 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags2));
if (query->flags2 & ActorFlags2::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags2));
Printf("\n flags3: %x", query->flags3.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags3 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags3));
if (query->flags3 & ActorFlags3::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags3));
Printf("\n flags4: %x", query->flags4.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags4 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags4));
if (query->flags4 & ActorFlags4::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags4));
Printf("\n flags5: %x", query->flags5.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags5 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags5));
if (query->flags5 & ActorFlags5::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags5));
Printf("\n flags6: %x", query->flags6.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags6 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags6));
if (query->flags6 & ActorFlags6::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags6));
Printf("\n flags7: %x", query->flags7.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags7 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags7));
if (query->flags7 & ActorFlags7::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags7));
Printf("\nBounce flags: %x\nBounce factors: f:%f, w:%f",
query->BounceFlags.GetValue(), FIXED2FLOAT(query->bouncefactor),
FIXED2FLOAT(query->wallbouncefactor));

View file

@ -29,6 +29,7 @@
#include "po_man.h"
#include "farchive.h"
#include "r_utility.h"
#include "a_sharedglobal.h"
#include "r_data/colormaps.h"
@ -800,6 +801,23 @@ int sector_t::GetCeilingLight () const
}
}
ASkyViewpoint *sector_t::GetSkyBox(int which)
{
if (which == floor)
{
if (FloorSkyBox != NULL) return FloorSkyBox;
if (MoreFlags & SECF_NOFLOORSKYBOX) return NULL;
}
else
{
if (CeilingSkyBox != NULL) return CeilingSkyBox;
if (MoreFlags & SECF_NOCEILINGSKYBOX) return NULL;
}
return level.DefaultSkybox;
}
sector_t *sector_t::GetHeightSec() const
{
if (heightsec == NULL)

View file

@ -1755,6 +1755,7 @@ void P_LoadThings (MapData * map)
mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1;
mti[i].health = 1;
mti[i].FloatbobPhase = -1;
flags &= ~MTF_SKILLMASK;
mti[i].flags = (short)((flags & 0xf) | 0x7e0);
if (gameinfo.gametype == GAME_Strife)
@ -1839,6 +1840,7 @@ void P_LoadThings2 (MapData * map)
mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1;
mti[i].health = 1;
mti[i].FloatbobPhase = -1;
}
delete[] mtp;
}
@ -2350,7 +2352,16 @@ static void P_LoopSidedefs (bool firstloop)
// instead of as part of another loop
if (line->frontsector == line->backsector)
{
right = DWORD(line->sidedef[!sidetemp[i].b.lineside] - sides);
const side_t* const rightside = line->sidedef[!sidetemp[i].b.lineside];
if (NULL == rightside)
{
// There is no right side!
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[unsigned(line-lines)]);
continue;
}
right = DWORD(rightside - sides);
}
else
{

View file

@ -680,7 +680,7 @@ void InitSpawnablesFromMapinfo()
}
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset)
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset, fixed_t radiusoffset, angle_t pitch)
{
if (flags & WARPF_MOVEPTR)
{
@ -692,7 +692,6 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
fixed_t oldx = caller->x;
fixed_t oldy = caller->y;
fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset);
@ -700,11 +699,14 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
}
const fixed_t rad = FixedMul(radiusoffset, reference->radius);
const angle_t fineangle = angle >> ANGLETOFINESHIFT;
if (!(flags & WARPF_ABSOLUTEPOSITION))
{
if (!(flags & WARPF_ABSOLUTEOFFSET))
{
angle_t fineangle = angle >> ANGLETOFINESHIFT;
fixed_t xofs1 = xofs;
// (borrowed from A_SpawnItemEx, assumed workable)
@ -722,15 +724,16 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
// assigning position again with.
// extra unlink, link and environment calculation
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->floorz + zofs);
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z);
caller->z = caller->floorz + zofs;
}
else
{
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z + zofs);
}
}
@ -738,11 +741,12 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
if (flags & WARPF_TOFLOOR)
{
caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
caller->z = caller->floorz + zofs;
}
else
{
caller->SetOrigin(xofs, yofs, zofs);
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
}
}
@ -756,6 +760,18 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
caller->angle = angle;
if (flags & WARPF_COPYPITCH)
caller->SetPitch(reference->pitch, false);
if (pitch)
caller->SetPitch(caller->pitch + pitch, false);
if (flags & WARPF_COPYVELOCITY)
{
caller->velx = reference->velx;
caller->vely = reference->vely;
caller->velz = reference->velz;
}
if (flags & WARPF_STOP)
{
caller->velx = 0;

View file

@ -42,7 +42,8 @@ struct FTraceInfo
{
fixed_t StartX, StartY, StartZ;
fixed_t Vx, Vy, Vz;
DWORD ActorMask, WallMask;
ActorFlags ActorMask;
DWORD WallMask;
AActor *IgnoreThis;
FTraceResults *Results;
sector_t *CurSector;
@ -70,7 +71,7 @@ static bool EditTraceResult (DWORD flags, FTraceResults &res);
bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist,
DWORD actorMask, DWORD wallMask, AActor *ignore,
ActorFlags actorMask, DWORD wallMask, AActor *ignore,
FTraceResults &res,
DWORD flags, ETraceStatus (*callback)(FTraceResults &res, void *), void *callbackdata)
{

View file

@ -35,6 +35,7 @@
#define __P_TRACE_H__
#include <stddef.h>
#include "actor.h"
#include "textures/textures.h"
struct sector_t;
@ -96,7 +97,7 @@ enum ETraceStatus
bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist,
DWORD ActorMask, DWORD WallMask, AActor *ignore,
ActorFlags ActorMask, DWORD WallMask, AActor *ignore,
FTraceResults &res,
DWORD traceFlags=0,
ETraceStatus (*callback)(FTraceResults &res, void *)=NULL, void *callbackdata=NULL);

View file

@ -474,6 +474,7 @@ public:
th->RenderStyle = STYLE_Count;
th->alpha = -1;
th->health = 1;
th->FloatbobPhase = -1;
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
@ -631,6 +632,11 @@ public:
Flag(th->flags, MTF_SECRET, key);
break;
case NAME_Floatbobphase:
CHECK_N(Zd | Zdt)
th->FloatbobPhase = CheckInt(key);
break;
case NAME_Renderstyle:
{
FName style = CheckString(key);

View file

@ -342,17 +342,19 @@ VideoModes[] =
{ 1680, 1050 }, // 16:10
{ 1920, 1080 },
{ 1920, 1200 },
{ 2048, 1152 }, // 16:9, iMac Retina 4K 21.5", HiDPI off
{ 2048, 1536 },
{ 2304, 1440 },
{ 2304, 1440 }, // 16:10, MacBook Retina 12"
{ 2560, 1440 },
{ 2560, 1600 },
{ 2560, 2048 },
{ 2880, 1800 },
{ 2880, 1800 }, // 16:10, MacBook Pro Retina 15"
{ 3200, 1800 },
{ 3840, 2160 },
{ 3840, 2400 },
{ 4096, 2160 },
{ 5120, 2880 }
{ 4096, 2304 }, // 16:9, iMac Retina 4K 21.5"
{ 5120, 2880 } // 16:9, iMac Retina 5K 27"
};

View file

@ -1087,7 +1087,8 @@ void R_Subsector (subsector_t *sub)
basecolormap = frontsector->ColorMap;
}
skybox = frontsector->CeilingSkyBox != NULL ? frontsector->CeilingSkyBox : level.DefaultSkybox;
skybox = frontsector->GetSkyBox(sector_t::ceiling);
ceilingplane = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) > 0 ||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum ||
(skybox != NULL && skybox->bAlways) ||
@ -1127,7 +1128,7 @@ void R_Subsector (subsector_t *sub)
// killough 3/7/98: Add (x,y) offsets to flats, add deep water check
// killough 3/16/98: add floorlightlevel
// killough 10/98: add support for skies transferred from sidedefs
skybox = frontsector->FloorSkyBox != NULL ? frontsector->FloorSkyBox : level.DefaultSkybox;
skybox = frontsector->GetSkyBox(sector_t::floor);
floorplane = frontsector->floorplane.PointOnSide(viewx, viewy, viewz) > 0 || // killough 3/7/98
frontsector->GetTexture(sector_t::floor) == skyflatnum ||
(skybox != NULL && skybox->bAlways) ||

View file

@ -340,6 +340,8 @@ enum
SECF_UNDERWATERMASK = 32+64,
SECF_DRAWN = 128, // sector has been drawn at least once
SECF_HIDDEN = 256, // Do not draw on textured automap
SECF_NOFLOORSKYBOX = 512, // force use of regular sky
SECF_NOCEILINGSKYBOX = 1024, // force use of regular sky
};
enum
@ -451,6 +453,8 @@ struct sector_t
DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position);
ASkyViewpoint *GetSkyBox(int which);
enum
{
floor,

View file

@ -254,7 +254,7 @@ void R_InitTextureMapping ()
void R_SetVisibility (float vis)
{
// Allow negative visibilities, just for novelty's sake
//vis = clamp (vis, -204.7f, 204.7f);
vis = clamp (vis, -204.7f, 204.7f); // (205 and larger do not work in 5:4 aspect ratio)
CurrentVisibility = vis;

View file

@ -2375,6 +2375,16 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
}
}
FName *aliasp = MusicAliases.CheckKey(musicname);
if (aliasp != NULL)
{
if (*aliasp == NAME_None)
{
return true; // flagged to be ignored
}
musicname = aliasp->GetChars();
}
if (!mus_playing.name.IsEmpty() &&
mus_playing.handle != NULL &&
stricmp (mus_playing.name, musicname) == 0 &&
@ -2413,16 +2423,8 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
int length = 0;
int device = MDEV_DEFAULT;
MusInfo *handle = NULL;
FName musicasname = musicname;
FName *aliasp = MusicAliases.CheckKey(musicasname);
if (aliasp != NULL)
{
musicname = (musicasname = *aliasp).GetChars();
if (musicasname == NAME_None) return true;
}
int *devp = MidiDevices.CheckKey(musicasname);
int *devp = MidiDevices.CheckKey(musicname);
if (devp != NULL) device = *devp;
// Strip off any leading file:// component.

View file

@ -713,11 +713,11 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
if ( hRT )
{
// Must wait process to terminate to guarantee that it has exited...
WaitForSingleObject(hProcess, INFINITE);
// Must wait for process to terminate to guarantee that it has exited...
DWORD res = WaitForSingleObject(hProcess, 1000);
CloseHandle(hRT);
bSuccess = TRUE;
bSuccess = (res == WAIT_OBJECT_0);
dwErr = WAIT_TIMEOUT;
}
if ( !bSuccess )

View file

@ -1349,7 +1349,7 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
alSourcei(source, AL_LOOPING, (chanflags&SNDF_LOOP) ? AL_TRUE : AL_FALSE);
alSourcef(source, AL_MAX_GAIN, SfxVolume);
alSourcef(source, AL_GAIN, SfxVolume);
alSourcef(source, AL_GAIN, SfxVolume*vol);
if(EnvSlot)
{

View file

@ -94,6 +94,10 @@ public:
static Self FromInt (TT value) { return Self (static_cast<T> (value)); }
private:
template<typename X> Self operator| (X value) const { return Self::FromInt (Value | value); }
template<typename X> Self operator& (X value) const { return Self::FromInt (Value & value); }
template<typename X> Self operator^ (X value) const { return Self::FromInt (Value ^ value); }
TT Value;
};

View file

@ -789,15 +789,17 @@ static int DoJumpIfCloser(AActor *target, VM_ARGS)
PARAM_ACTION_PROLOGUE;
PARAM_FIXED (dist);
PARAM_STATE (jump);
PARAM_BOOL_OPT(noz) { noz = false; }
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
// No target - no jump
if (target != NULL && P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
( (self->z > target->z && self->z - (target->z + target->height) < dist) ||
(self->z <=target->z && target->z - (self->z + self->height) < dist)
)
)
if (!target)
return numret;
if (P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
(noz ||
((self->z > target->z && self->z - (target->z + target->height) < dist) ||
(self->z <= target->z && target->z - (self->z + self->height) < dist))))
{
ACTION_JUMP(jump);
}
@ -1156,7 +1158,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
targ = owner;
missile->target = owner;
// automatic handling of seeker missiles
if (self->flags & missile->flags2 & MF2_SEEKERMISSILE)
if (self->flags2 & missile->flags2 & MF2_SEEKERMISSILE)
{
missile->tracer = self->tracer;
}
@ -1577,6 +1579,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
PARAM_FIXED_OPT (lifesteal) { lifesteal = 0; }
PARAM_INT_OPT (lifestealmax) { lifestealmax = 0; }
PARAM_CLASS_OPT (armorbonustype, ABasicArmorBonus) { armorbonustype = NULL; }
PARAM_SOUND_OPT (MeleeSound) { MeleeSound = ""; }
PARAM_SOUND_OPT (MissSound) { MissSound = ""; }
if (!self->player)
return 0;
@ -1611,7 +1615,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
P_LineAttack (self, angle, range, pitch, damage, NAME_Melee, pufftype, puffFlags, &linetarget, &actualdamage);
if (linetarget)
if (!linetarget)
{
if (MissSound) S_Sound(self, CHAN_WEAPON, MissSound, 1, ATTN_NORM);
}
else
{
if (lifesteal && !(linetarget->flags5 & MF5_DONTDRAIN))
{
@ -1643,7 +1651,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
}
if (weapon != NULL)
{
S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM);
if (MeleeSound) S_Sound(self, CHAN_WEAPON, MeleeSound, 1, ATTN_NORM);
else S_Sound (self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM);
}
if (!(flags & CPF_NOTURN))
@ -3718,7 +3727,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
lof_data.Flags = flags;
lof_data.BadActor = false;
Trace(x1, y1, z1, sec, vx, vy, vz, range, 0xFFFFFFFF, ML_BLOCKEVERYTHING, self, trace, 0,
Trace(x1, y1, z1, sec, vx, vy, vz, range, ActorFlags::FromInt(0xFFFFFFFF), ML_BLOCKEVERYTHING, self, trace, 0,
CheckLOFTraceFunc, &lof_data);
if (trace.HitType == TRACE_HitActor ||
@ -5040,6 +5049,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_STATE_OPT(success_state) { success_state = NULL; }
PARAM_FIXED_OPT(heightoffset) { heightoffset = 0; }
PARAM_FIXED_OPT(radiusoffset) { radiusoffset = 0; }
PARAM_ANGLE_OPT(pitch) { pitch = 0; }
AActor *reference;
@ -5059,7 +5070,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
return numret;
}
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset))
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch))
{
if (success_state)
{
@ -5238,11 +5249,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
PARAM_INT_OPT (amount) { amount = 0; }
PARAM_CLASS_OPT (filter, AActor) { filter = NULL; }
PARAM_NAME_OPT (species) { species = NAME_None; }
PARAM_FIXED_OPT (mindist) { mindist = 0; }
// We need a valid item, valid targets, and a valid range
if (item == NULL || (flags & RGF_MASK) == 0 || !flags || distance <= 0)
if (item == NULL || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance)
{
return 0;
ACTION_SET_RESULT(false);
return numret;
}
if (amount == 0)
@ -5250,9 +5263,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
amount = 1;
}
FBlockThingsIterator it(FBoundingBox(self->x, self->y, distance));
double distsquared = double(distance) * double(distance);
AActor *thing;
bool given = false;
while ((thing = it.Next()))
{
//[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s).
@ -5297,7 +5310,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
bool corpsePass = !!((flags & RGF_CORPSES) && thing->flags & MF_CORPSE);
bool killedPass = !!((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED);
bool monsterPass = !!((flags & RGF_MONSTERS) && thing->flags3 & MF3_ISMONSTER);
bool objectPass = !!((flags & RGF_OBJECTS) && ((thing->flags & MF_SHOOTABLE) || (thing->flags6 & MF6_VULNERABLE)));
bool objectPass = !!((flags & RGF_OBJECTS) && (thing->player == NULL) && (!(thing->flags3 & MF3_ISMONSTER))
&& ((thing->flags & MF_SHOOTABLE) || (thing->flags6 & MF6_VULNERABLE)));
bool playerPass = !!((flags & RGF_PLAYERS) && (thing->player != NULL) && (thing->player->mo == thing));
bool voodooPass = !!((flags & RGF_VOODOO) && (thing->player != NULL) && (thing->player->mo != thing));
//Self calls priority over the rest of this.
@ -5320,20 +5334,26 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass)
{
if (flags & RGF_CUBE)
{ // check if inside a cube
if (fabs((double)thing->x - self->x) > (double)distance ||
fabs((double)thing->y - self->y) > (double)distance ||
fabs((double)(thing->z + thing->height / 2) - (self->z + self->height / 2)) > (double)distance)
double dx = fabs((double)(thing->x - self->x));
double dy = fabs((double)(thing->y - self->y));
double dz = fabs((double)(thing->z + thing->height / 2) - (self->z + self->height / 2));
double dist = (double)distance;
double min = (double)mindist;
if ((dx > dist || dy > dist || dz > dist) || (min && (dx < min && dy < min && dz < min)))
{
continue;
}
}
else
{ // check if inside a sphere
double distsquared = double(distance) * double(distance);
double minsquared = double(mindist) * double(mindist);
TVector3<double> tpos(thing->x, thing->y, thing->z + thing->height / 2);
TVector3<double> spos(self->x, self->y, self->z + self->height / 2);
if ((tpos - spos).LengthSquared() > distsquared)
if ((tpos - spos).LengthSquared() > distsquared || (minsquared && ((tpos - spos).LengthSquared() < minsquared)))
{
continue;
}
@ -5356,10 +5376,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
{
gift->Destroy();
}
else
{
given = true;
}
}
}
return 0;
}
ACTION_SET_RESULT(given);
return numret;
}
@ -5465,6 +5491,29 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed)
return 0;
}
//==========================================================================
//
// A_SetPainThreshold
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT(threshold);
PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; }
AActor *ref = COPY_AAPTR(self, ptr);
if (!ref)
{
ACTION_SET_RESULT(false);
return numret;
}
ref->PainThreshold = threshold;
return numret;
}
//===========================================================================
//
// Common A_Damage handler
@ -6214,3 +6263,63 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
return 0;
}
/*===========================================================================
A_CheckBlock
(state block, int flags, int ptr)
Checks if something is blocking the actor('s pointer) 'ptr'.
The SET pointer flags only affect the caller, not the pointer.
===========================================================================*/
enum CBF
{
CBF_NOLINES = 1 << 0, //Don't check actors.
CBF_SETTARGET = 1 << 1, //Sets the caller/pointer's target to the actor blocking it. Actors only.
CBF_SETMASTER = 1 << 2, //^ but with master.
CBF_SETTRACER = 1 << 3, //^ but with tracer.
CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self.
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
{
PARAM_ACTION_PROLOGUE;
PARAM_STATE(block)
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; }
AActor *mobj = COPY_AAPTR(self, ptr);
ACTION_SET_RESULT(false);
//Needs at least one state jump to work.
if (!mobj)
{
return numret;
}
//Nothing to block it so skip the rest.
if (P_TestMobjLocation(mobj)) return numret;
if (mobj->BlockingMobj)
{
AActor *setter = (flags & CBF_SETONPTR) ? mobj : self;
if (setter)
{
if (flags & CBF_SETTARGET) setter->target = mobj->BlockingMobj;
if (flags & CBF_SETMASTER) setter->master = mobj->BlockingMobj;
if (flags & CBF_SETTRACER) setter->tracer = mobj->BlockingMobj;
}
}
//[MC] If modders don't want jumping, but just getting the pointer, only abort at
//this point. I.e. A_CheckBlock("",CBF_SETTRACER) is like having CBF_NOLINES.
//It gets the mobj blocking, if any, and doesn't jump at all.
if (!block)
return numret;
//[MC] Easiest way to tell if an actor is blocking it, use the pointers.
if (mobj->BlockingMobj || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL))
{
ACTION_JUMP(block);
}
return numret;
}

View file

@ -252,12 +252,10 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF7, HITTARGET, AActor, flags7),
DEFINE_FLAG(MF7, HITMASTER, AActor, flags7),
DEFINE_FLAG(MF7, HITTRACER, AActor, flags7),
// [ZK] Decal flags
DEFINE_FLAG(MF7, NODECAL, AActor, flags7),
DEFINE_FLAG(MF7, NODECAL, AActor, flags7), // [ZK] Decal flags
DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7),
DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7),
DEFINE_FLAG(MF7, ICESHATTER, AActor, flags7),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),

View file

@ -1807,13 +1807,11 @@ void WI_updateStats ()
WI_updateAnimatedBack ();
if (acceleratestage && sp_state != 10)
{
if (acceleratestage)
{
acceleratestage = 0;
sp_state = 10;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
}
cnt_kills[0] = plrs[me].skills;
cnt_items[0] = plrs[me].sitems;
cnt_secret[0] = plrs[me].ssecret;

View file

@ -180,9 +180,9 @@ ACTOR Actor native //: Thinker
action native A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET);
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270);
action native A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT);
action native A_JumpIfCloser(float distance, state label);
action native A_JumpIfTracerCloser(float distance, state label);
action native A_JumpIfMasterCloser(float distance, state label);
action native A_JumpIfCloser(float distance, state label, bool noz = false);
action native A_JumpIfTracerCloser(float distance, state label, bool noz = false);
action native A_JumpIfMasterCloser(float distance, state label, bool noz = false);
action native A_JumpIfTargetOutsideMeleeRange(state label);
action native A_JumpIfTargetInsideMeleeRange(state label);
action native A_JumpIfInventory(class<Inventory> itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT);
@ -217,7 +217,7 @@ ACTOR Actor native //: Thinker
action native A_PlayerSkinCheck(state label);
action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight);
action native A_Teleport(state teleportstate = "", class<SpecialSpot> targettype = "BossSpot", class<Actor> fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT);
action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0);
action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0, float radiusoffset = 0, float pitch = 0);
action native A_ThrowGrenade(class<Actor> itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true);
action native A_Weave(int xspeed, int yspeed, float xdist, float ydist);
@ -225,7 +225,7 @@ ACTOR Actor native //: Thinker
action native A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT);
action native A_GiveToTarget(class<Inventory> itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT);
action native A_TakeFromTarget(class<Inventory> itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT);
action native A_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None");
action native A_RadiusGive(class<Inventory> itemtype, int distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0);
action native A_CountdownArg(int argnum, state targstate = "");
action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);
action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
@ -273,6 +273,7 @@ ACTOR Actor native //: Thinker
action native A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT);
action native A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT);
action native A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT);
action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
@ -304,7 +305,7 @@ ACTOR Actor native //: Thinker
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
action native A_CheckRange(float distance, state label, bool two_dimension = false);

View file

@ -362,6 +362,8 @@ Const Int WARPF_ABSOLUTEPOSITION = 0x400;
Const Int WARPF_BOB = 0x800;
Const Int WARPF_MOVEPTR = 0x1000;
Const Int WARPF_USETID = 0x2000;
Const Int WARPF_COPYVELOCITY = 0x4000;
Const Int WARPF_COPYPITCH = 0x8000;
// flags for A_SetPitch/SetAngle/SetRoll
const int SPF_FORCECLAMP = 1;
@ -482,3 +484,17 @@ enum
QF_WAVE = 1 << 5,
};
// Flags for A_CheckBlock
// These flags only affect the calling actor('s pointer), not the ones being searched.
enum
{
CBF_NOLINES = 1 << 0, //Don't check actors.
CBF_SETTARGET = 1 << 1, //Sets the caller/pointer's target to the actor blocking it. Actors only.
CBF_SETMASTER = 1 << 2, //^ but with master.
CBF_SETTRACER = 1 << 3, //^ but with tracer.
CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self.
};
// This is only here to provide one global variable for testing.
native int testglobalvar;

View file

@ -8,7 +8,7 @@ ACTOR Inventory native
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG"
action native A_JumpIfNoAmmo(state label);
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus");
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = "", sound MissSound = "");
action native A_FireBullets(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0);
action native A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270);

View file

@ -44,7 +44,7 @@ ACTOR Macil1
Death:
LEAD E 2 A_FaceTarget
LEAD F 2 BRIGHT A_ShootGun
LEAD E 2 A_SentinelRefire
LEAD E 1 A_SentinelRefire
Loop
Pain:
LEAD Y 3
@ -80,7 +80,7 @@ ACTOR Macil2 : Macil1
LEAD K 3
LEAD L 3 A_NoBlocking
LEAD MNOPQRSTUV 3
LEAD W 4 Bright A_SpawnItemEx("AlienSpectre4", 0, 0, 0, 0, 0, random[spectrespawn](0,255)*0.0078125, 0, SXF_NOCHECKPOSITION)
LEAD W 3 A_SpawnItemEx("AlienSpectre4", 0, 0, 0, 0, 0, random[spectrespawn](0,255)*0.0078125, 0, SXF_NOCHECKPOSITION)
LEAD X -1
Stop
}

View file

@ -1550,6 +1550,10 @@ TXT_RANDOMGOODBYE_3 = "See you later!";
TXT_HAVEENOUGH = "You seem to have enough!";
TXT_GOAWAY = "Go away!";
TXT_COMM0 = "Incoming Message";
TXT_COMM1 = "Incoming Message from BlackBird";
// Skills:
SKILL_BABY = "I'm too young to die";

View file

@ -456,6 +456,7 @@ OptionMenu "CustomizeControls"
Control "Look down", "+lookdown"
Control "Center view", "centerview"
Control "Run", "+speed"
Control "Toggle Run", "toggle cl_run"
Control "Strafe", "+strafe"
Control "Show Scoreboard", "+showscores"
Control "Toggle Scoreboard", "togglescoreboard"
@ -1589,10 +1590,24 @@ OptionMenu AdvSoundOptions
Option "OPL Emulator Core", "opl_core", "OplCores"
StaticText " "
StaticText "GUS Emulation", 1
TextField "GUS config file", "midi_config"
Slider "MIDI voices", "midi_voices", 16, 256, 4, 0
Option "Emulate TiMidity", "midi_timiditylike", "OnOff"
Option "Read DMXGUS lumps", "midi_dmxgus", "OnOff"
Option "GUS memory size", "gus_memsize", "GusMemory"
StaticText " "
StaticText "FluidSynth", 1
TextField "Patch set", "fluid_patchset"
Slider "Gain", "fluid_gain", 0, 10, 0.5, 1
Option "Reverb", "fluid_reverb", "OnOff"
Slider "MIDI voices", "fluid_voices", 16, 4096, 16, 1
// Leaving out the more advanced stuff for now.
StaticText " "
StaticText "Timidity++", 1
TextField "Path for executable", "timidity_exe"
Option "Reverb", "timidity_reverb", "OnOff"
Option "Chorus", "timidity_chorus", "OnOff"
Slider "Relative volume", "timidity_mastervolume", 0, 4, 0.2, 1
}
/*=======================================