Merge branch 'master' of https://github.com/coelckers/gzdoom into stereo3d

Conflicts:
	src/win32/i_system.cpp
This commit is contained in:
Christopher Bruns 2015-12-09 18:34:20 -05:00
commit 10088544c3
50 changed files with 2403 additions and 2041 deletions

1
.gitignore vendored
View file

@ -40,3 +40,4 @@
/zlib/x64/ /zlib/x64/
/build_vc2013_64bit /build_vc2013_64bit
/build_vc2015 /build_vc2015
build_cmake

View file

@ -27,7 +27,8 @@ II. Implementation Semantics
II.A : Storage and Retrieval of Data II.A : Storage and Retrieval of Data
------------------------------------ ------------------------------------
No changes. Any TEXTMAP lump in the described namespaces must be encoded in ISO 8859-1 which
as of this writing is the only character encoding supported by ZDoom.
----------------------------------- -----------------------------------
II.B : Storage Within Archive Files II.B : Storage Within Archive Files
@ -237,6 +238,7 @@ Note: All <bool> fields default to false unless mentioned otherwise.
scalex = <float>; // Vertical scaling on thing. Default = 0 (ignored). scalex = <float>; // Vertical scaling on thing. Default = 0 (ignored).
scaley = <float>; // Horizontal 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). 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 * Note about arg0str

View file

@ -509,6 +509,11 @@ if( NOT MSVC )
add_definitions( -D__forceinline=inline ) add_definitions( -D__forceinline=inline )
endif( NOT MSVC ) endif( NOT MSVC )
# Fix stat in v140_xp (broken in RTM and Update 1 so far)
if( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
add_definitions( -D_stat64i32=VS14Stat )
endif( MSVC AND MSVC_VERSION EQUAL 1900 AND CMAKE_GENERATOR_TOOLSET STREQUAL "v140_xp" )
if( UNIX ) if( UNIX )
CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT ) CHECK_LIBRARY_EXISTS( rt clock_gettime "" CLOCK_GETTIME_IN_RT )
if( NOT CLOCK_GETTIME_IN_RT ) if( NOT CLOCK_GETTIME_IN_RT )

View file

@ -2328,7 +2328,9 @@ void AM_drawWalls (bool allmap)
AM_drawMline (&l, AMColors.LockedColor); // locked special 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_Open
&& lines[i].special != Door_Close && lines[i].special != Door_Close
&& lines[i].special != Door_CloseWaitOpen && lines[i].special != Door_CloseWaitOpen

View file

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

View file

@ -973,7 +973,7 @@ void NetUpdate (void)
{ {
I_StartTic (); I_StartTic ();
D_ProcessEvents (); D_ProcessEvents ();
if ((maketic - gametic) / ticdup >= BACKUPTICS/2-1) if (pauseext || (maketic - gametic) / ticdup >= BACKUPTICS/2-1)
break; // can't hold any more break; // can't hold any more
//Printf ("mk:%i ",maketic); //Printf ("mk:%i ",maketic);
@ -1204,7 +1204,7 @@ void NetUpdate (void)
// Send current network delay // Send current network delay
// The number of tics we just made should be removed from the count. // The number of tics we just made should be removed from the count.
netbuffer[k++] = ((maketic - newtics - gametic) / ticdup); netbuffer[k++] = ((maketic - numtics - gametic) / ticdup);
if (numtics > 0) if (numtics > 0)
{ {
@ -1810,7 +1810,8 @@ void TryRunTics (void)
// If paused, do not eat more CPU time than we need, because it // If paused, do not eat more CPU time than we need, because it
// will all be wasted anyway. // will all be wasted anyway.
if (pauseext) r_NoInterpolate = true; if (pauseext)
r_NoInterpolate = true;
bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/; bool doWait = cl_capfps || r_NoInterpolate /*|| netgame*/;
// get real tics // get real tics
@ -1828,6 +1829,9 @@ void TryRunTics (void)
// get available tics // get available tics
NetUpdate (); NetUpdate ();
if (pauseext)
return;
lowtic = INT_MAX; lowtic = INT_MAX;
numplaying = 0; numplaying = 0;
for (i = 0; i < doomcom.numnodes; i++) for (i = 0; i < doomcom.numnodes; i++)
@ -1935,7 +1939,7 @@ void TryRunTics (void)
C_Ticker (); C_Ticker ();
M_Ticker (); M_Ticker ();
I_GetTime (true); I_GetTime (true);
if (!pauseext) G_Ticker(); G_Ticker();
gametic++; gametic++;
NetUpdate (); // check for new console commands NetUpdate (); // check for new console commands

View file

@ -432,7 +432,7 @@ WORD FDecalLib::GetDecalID (FScanner &sc)
unsigned long num = strtoul (sc.String, NULL, 10); unsigned long num = strtoul (sc.String, NULL, 10);
if (num < 1 || num > 65535) 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; return (WORD)num;
} }
@ -603,16 +603,18 @@ void FDecalLib::ParseGenerator (FScanner &sc)
{ {
const PClass *type; const PClass *type;
FDecalBase *decal; FDecalBase *decal;
AActor *actor; bool optional = false;
// Get name of generator (actor) // Get name of generator (actor)
sc.MustGetString (); sc.MustGetString ();
optional = sc.Compare("optional");
if (optional) sc.MustGetString();
type = PClass::FindClass (sc.String); type = PClass::FindClass (sc.String);
if (type == NULL || type->ActorInfo == NULL) if (type == NULL || type->ActorInfo == 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 // Get name of generated decal
sc.MustGetString (); sc.MustGetString ();
@ -625,16 +627,19 @@ void FDecalLib::ParseGenerator (FScanner &sc)
decal = ScanTreeForName (sc.String, Root); decal = ScanTreeForName (sc.String, Root);
if (decal == NULL) 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; actor->DecalGenerator = decal;
if (decal != NULL) if (decal != NULL)
{ {
decal->Users.Push(type); decal->Users.Push(type);
} }
} }
}
void FDecalLib::ParseFader (FScanner &sc) void FDecalLib::ParseFader (FScanner &sc)
{ {

View file

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

View file

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

View file

@ -339,7 +339,7 @@ struct level_info_t
TArray<FSpecialAction> specialactions; TArray<FSpecialAction> specialactions;
TArray<FSoundID> PrecacheSounds; TArray<FSoundID> PrecacheSounds;
TArray<FTextureID> PrecacheTextures; TArray<FString> PrecacheTextures;
level_info_t() level_info_t()
{ {
@ -563,8 +563,10 @@ enum ESkillProperty
SKILLP_FriendlyHealth, SKILLP_FriendlyHealth,
SKILLP_NoPain, SKILLP_NoPain,
SKILLP_ArmorFactor, SKILLP_ArmorFactor,
SKILLP_HealthFactor,
SKILLP_EasyKey, SKILLP_EasyKey,
SKILLP_SlowMonsters, SKILLP_SlowMonsters,
SKILLP_Infight,
}; };
int G_SkillProperty(ESkillProperty prop); int G_SkillProperty(ESkillProperty prop);
const char * G_SkillName(); const char * G_SkillName();
@ -602,7 +604,9 @@ struct FSkillInfo
fixed_t MonsterHealth; fixed_t MonsterHealth;
fixed_t FriendlyHealth; fixed_t FriendlyHealth;
bool NoPain; bool NoPain;
int Infighting;
fixed_t ArmorFactor; fixed_t ArmorFactor;
fixed_t HealthFactor;
FSkillInfo() {} FSkillInfo() {}
FSkillInfo(const FSkillInfo &other) FSkillInfo(const FSkillInfo &other)

View file

@ -1077,15 +1077,8 @@ DEFINE_MAP_OPTION(PrecacheTextures, true)
do do
{ {
parse.sc.MustGetString(); parse.sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(parse.sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst); //the texture manager is not initialized here so all we can do is store the texture's name.
if (!tex.isValid()) info->PrecacheTextures.Push(parse.sc.String);
{
parse.sc.ScriptMessage("Unknown texture \"%s\"", parse.sc.String);
}
else
{
info->PrecacheTextures.Push(tex);
}
} while (parse.sc.CheckString(",")); } while (parse.sc.CheckString(","));
} }

View file

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

View file

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

View file

@ -134,6 +134,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
NoWrap = false; NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = 0; ClipX = ClipY = ClipWidth = ClipHeight = 0;
WrapWidth = 0; WrapWidth = 0;
HandleAspect = true;
Top = y; Top = y;
Next = NULL; Next = NULL;
Lines = NULL; Lines = NULL;
@ -196,6 +197,14 @@ void DHUDMessage::Serialize (FArchive &arc)
NoWrap = false; NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0; ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0;
} }
if (SaveVersion >= 4525)
{
arc << HandleAspect;
}
else
{
HandleAspect = true;
}
if (arc.IsLoading ()) if (arc.IsLoading ())
{ {
Lines = NULL; Lines = NULL;
@ -257,7 +266,7 @@ void DHUDMessage::CalcClipCoords(int hudheight)
else else
{ {
screen->VirtualToRealCoordsInt(x, y, w, h, screen->VirtualToRealCoordsInt(x, y, w, h,
HUDWidth, hudheight, false, true); HUDWidth, hudheight, false, HandleAspect);
ClipLeft = x; ClipLeft = x;
ClipTop = y; ClipTop = y;
ClipRight = x + w; ClipRight = x + w;

View file

@ -94,12 +94,13 @@ public:
NoWrap = nowrap; NoWrap = nowrap;
ResetText(SourceText); ResetText(SourceText);
} }
void SetClipRect(int x, int y, int width, int height) void SetClipRect(int x, int y, int width, int height, bool aspect)
{ {
ClipX = x; ClipX = x;
ClipY = y; ClipY = y;
ClipWidth = width; ClipWidth = width;
ClipHeight = height; ClipHeight = height;
HandleAspect = aspect;
} }
void SetWrapWidth(int wrap) void SetWrapWidth(int wrap)
{ {
@ -119,6 +120,7 @@ protected:
int HUDWidth, HUDHeight; int HUDWidth, HUDHeight;
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
bool HandleAspect;
EColorRange TextColor; EColorRange TextColor;
FFont *Font; FFont *Font;
FRenderStyle Style; FRenderStyle Style;

View file

@ -1338,17 +1338,17 @@ void DBaseStatusBar::Draw (EHudState state)
{ {
if (Scaled) if (Scaled)
{ {
y -= Scale (10, SCREENHEIGHT, 200); y -= Scale (11, SCREENHEIGHT, 200);
} }
else else
{ {
if (SCREENWIDTH < 640) if (SCREENWIDTH < 640)
{ {
y -= 11; y -= 12;
} }
else else
{ // Get past the tops of the gargoyles' wings { // 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.FriendlyHealth = FRACUNIT;
skill.NoPain = false; skill.NoPain = false;
skill.ArmorFactor = FRACUNIT; skill.ArmorFactor = FRACUNIT;
skill.Infighting = 0;
skill.HealthFactor = FRACUNIT;
sc.MustGetString(); sc.MustGetString();
skill.Name = sc.String; skill.Name = sc.String;
@ -266,6 +268,20 @@ void FMapInfoParser::ParseSkill ()
sc.MustGetFloat(); sc.MustGetFloat();
skill.ArmorFactor = FLOAT2FIXED(sc.Float); 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")) else if (sc.Compare("DefaultSkill"))
{ {
if (DefaultSkill >= 0) if (DefaultSkill >= 0)
@ -384,6 +400,17 @@ int G_SkillProperty(ESkillProperty prop)
case SKILLP_ArmorFactor: case SKILLP_ArmorFactor:
return AllSkills[gameskill].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; return 0;
@ -463,7 +490,9 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
MonsterHealth = other.MonsterHealth; MonsterHealth = other.MonsterHealth;
FriendlyHealth = other.FriendlyHealth; FriendlyHealth = other.FriendlyHealth;
NoPain = other.NoPain; NoPain = other.NoPain;
Infighting = other.Infighting;
ArmorFactor = other.ArmorFactor; ArmorFactor = other.ArmorFactor;
HealthFactor = other.HealthFactor;
return *this; return *this;
} }

View file

@ -227,7 +227,7 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
if (in_area==area_above) if (in_area==area_above)
{ {
if (sec->heightsec->MoreFlags&SECF_FAKEFLOORONLY || sec->GetTexture(sector_t::ceiling)==skyflatnum) in_area=area_normal; if (sec->heightsec->MoreFlags&SECF_FAKEFLOORONLY /*|| sec->GetTexture(sector_t::ceiling)==skyflatnum*/) in_area=area_normal;
} }
int diffTex = (sec->heightsec->MoreFlags & SECF_CLIPFAKEPLANES); int diffTex = (sec->heightsec->MoreFlags & SECF_CLIPFAKEPLANES);

View file

@ -80,8 +80,7 @@ void GLWall::SkyPlane(sector_t *sector, int plane, bool allowreflect)
else if (sector->GetTexture(plane)==skyflatnum) else if (sector->GetTexture(plane)==skyflatnum)
{ {
GLSkyInfo skyinfo; GLSkyInfo skyinfo;
ASkyViewpoint * skyboxx = plane == sector_t::floor? sector->FloorSkyBox : sector->CeilingSkyBox; ASkyViewpoint * skyboxx = sector->GetSkyBox(plane);
if (skyboxx == NULL) skyboxx = level.DefaultSkybox;
// JUSTHIT is used as an indicator that a skybox is in use. // JUSTHIT is used as an indicator that a skybox is in use.
// This is to avoid recursion // This is to avoid recursion

View file

@ -1420,7 +1420,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector)
sector_t * realback; sector_t * realback;
#ifdef _DEBUG #ifdef _DEBUG
if (seg->linedef-lines==4) if (seg->linedef-lines==5835)
{ {
int a = 0; int a = 0;
} }

View file

@ -1045,6 +1045,19 @@ public:
return text; 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 ) bool MenuEvent ( int mkey, bool fromcontroller )
{ {
if ( mkey == MKEY_Enter ) if ( mkey == MKEY_Enter )

View file

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

View file

@ -133,6 +133,16 @@ enum
ARMORINFO_ACTUALSAVEAMOUNT, 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 struct CallReturn
{ {
CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway) CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway)
@ -5305,6 +5315,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const
ClipRectWidth = argCount > 2 ? args[2] : 0; ClipRectWidth = argCount > 2 ? args[2] : 0;
ClipRectHeight = argCount > 3 ? args[3] : 0; ClipRectHeight = argCount > 3 ? args[3] : 0;
WrapWidth = argCount > 4 ? args[4] : 0; WrapWidth = argCount > 4 ? args[4] : 0;
HandleAspect = argCount > 5 ? !!args[5] : true;
break; break;
case ACSF_SetHUDWrapWidth: case ACSF_SetHUDWrapWidth:
@ -5779,11 +5790,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
wallMask = args[6]; wallMask = args[6];
} }
bool forceTID = 0; int flags = 0;
if (argCount >= 8) if (argCount >= 8)
{ {
if (args[7] != 0) flags = args[7];
forceTID = 1;
} }
AActor* pickedActor = P_LinePickActor(actor, args[1] << 16, args[3], args[2] << 16, actorMask, wallMask); AActor* pickedActor = P_LinePickActor(actor, args[1] << 16, args[3], args[2] << 16, actorMask, wallMask);
@ -5791,15 +5801,19 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return 0; return 0;
} }
if (!(forceTID) && (args[4] == 0) && (pickedActor->tid == 0)) if (!(flags & PICKAF_FORCETID) && (args[4] == 0) && (pickedActor->tid == 0))
return 0; return 0;
if ((pickedActor->tid == 0) || (forceTID)) if ((pickedActor->tid == 0) || (flags & PICKAF_FORCETID))
{ {
pickedActor->RemoveFromHash(); pickedActor->RemoveFromHash();
pickedActor->tid = args[4]; pickedActor->tid = args[4];
pickedActor->AddToHash(); pickedActor->AddToHash();
} }
if (flags & PICKAF_RETURNTID)
{
return pickedActor->tid;
}
return 1; return 1;
} }
break; break;
@ -5906,6 +5920,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
break; break;
} }
return 0; return 0;
} }
@ -7841,7 +7856,7 @@ scriptwait:
} }
break; break;
} }
msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight); msg->SetClipRect(ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight, HandleAspect);
if (WrapWidth != 0) if (WrapWidth != 0)
{ {
msg->SetWrapWidth(WrapWidth); msg->SetWrapWidth(WrapWidth);
@ -9453,6 +9468,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
activefont = SmallFont; activefont = SmallFont;
hudwidth = hudheight = 0; hudwidth = hudheight = 0;
ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0; ClipRectLeft = ClipRectTop = ClipRectWidth = ClipRectHeight = WrapWidth = 0;
HandleAspect = true;
state = SCRIPT_Running; state = SCRIPT_Running;
// Hexen waited one second before executing any open scripts. I didn't realize // Hexen waited one second before executing any open scripts. I didn't realize

View file

@ -891,6 +891,7 @@ protected:
int hudwidth, hudheight; int hudwidth, hudheight;
int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight; int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight;
int WrapWidth; int WrapWidth;
bool HandleAspect;
FBehavior *activeBehavior; FBehavior *activeBehavior;
int InModuleScriptNumber; int InModuleScriptNumber;

View file

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

View file

@ -1639,9 +1639,7 @@ bool AActor::OkayToSwitchTarget (AActor *other)
int infight; int infight;
if (flags5 & MF5_NOINFIGHTING) infight=-1; if (flags5 & MF5_NOINFIGHTING) infight=-1;
else if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1; else infight = G_SkillProperty(SKILLP_Infight);
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1;
else infight = infighting;
if (infight < 0 && other->player == NULL && !IsHostile (other)) if (infight < 0 && other->player == NULL && !IsHostile (other))
{ {

View file

@ -56,6 +56,7 @@
#include "p_3dmidtex.h" #include "p_3dmidtex.h"
#include "d_net.h" #include "d_net.h"
#include "d_event.h" #include "d_event.h"
#include "gstrings.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#define FUNC(a) static int a (line_t *ln, AActor *it, bool backSide, \ #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); return P_Thing_Move (arg0, it, arg1, arg2 ? false : true);
} }
enum
{
TRANSLATION_ICE = 0x100007
};
FUNC(LS_Thing_SetTranslation) FUNC(LS_Thing_SetTranslation)
// Thing_SetTranslation (tid, range) // Thing_SetTranslation (tid, range)
{ {
@ -1615,6 +1621,10 @@ FUNC(LS_Thing_SetTranslation)
{ {
range = TRANSLATION(TRANSLATION_LevelScripted, (arg1-1)); range = TRANSLATION(TRANSLATION_LevelScripted, (arg1-1));
} }
else if (arg1 == TRANSLATION_ICE)
{
range = TRANSLATION(TRANSLATION_Standard, 7);
}
else else
{ {
range = 0; range = 0;
@ -2985,13 +2995,14 @@ FUNC(LS_SendToCommunicator)
{ {
S_StopSound (CHAN_VOICE); S_StopSound (CHAN_VOICE);
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM); 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"); Printf (PRINT_CHAT, "%s\n", str);
}
else if (arg2 == 1)
{
Printf (PRINT_CHAT, "Incoming Message from BlackBird\n");
} }
} }
return true; return true;

View file

@ -938,10 +938,7 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter)
// to harm / be harmed by anything. // to harm / be harmed by anything.
if (!victim->player && !shooter->player) if (!victim->player && !shooter->player)
{ {
int infight; int infight = G_SkillProperty(SKILLP_Infight);
if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight = 1;
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight = -1;
else infight = infighting;
if (infight < 0) if (infight < 0)
{ {

View file

@ -4917,6 +4917,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->SpawnPoint[2] = mthing->z; mobj->SpawnPoint[2] = mthing->z;
mobj->SpawnAngle = mthing->angle; mobj->SpawnAngle = mthing->angle;
mobj->SpawnFlags = mthing->flags; mobj->SpawnFlags = mthing->flags;
if (mthing->FloatbobPhase >= 0 && mthing->FloatbobPhase < 64) mobj->FloatBobPhase = mthing->FloatbobPhase;
if (mthing->gravity < 0) mobj->gravity = -mthing->gravity; if (mthing->gravity < 0) mobj->gravity = -mthing->gravity;
else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity); else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity);
else mobj->flags &= ~MF_NOGRAVITY; else mobj->flags &= ~MF_NOGRAVITY;

View file

@ -29,6 +29,7 @@
#include "po_man.h" #include "po_man.h"
#include "farchive.h" #include "farchive.h"
#include "r_utility.h" #include "r_utility.h"
#include "a_sharedglobal.h"
#include "r_data/colormaps.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 sector_t *sector_t::GetHeightSec() const
{ {
if (heightsec == NULL) if (heightsec == NULL)

View file

@ -1758,6 +1758,7 @@ void P_LoadThings (MapData * map)
mti[i].RenderStyle = STYLE_Count; mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1; mti[i].alpha = -1;
mti[i].health = 1; mti[i].health = 1;
mti[i].FloatbobPhase = -1;
flags &= ~MTF_SKILLMASK; flags &= ~MTF_SKILLMASK;
mti[i].flags = (short)((flags & 0xf) | 0x7e0); mti[i].flags = (short)((flags & 0xf) | 0x7e0);
if (gameinfo.gametype == GAME_Strife) if (gameinfo.gametype == GAME_Strife)
@ -1842,6 +1843,7 @@ void P_LoadThings2 (MapData * map)
mti[i].RenderStyle = STYLE_Count; mti[i].RenderStyle = STYLE_Count;
mti[i].alpha = -1; mti[i].alpha = -1;
mti[i].health = 1; mti[i].health = 1;
mti[i].FloatbobPhase = -1;
} }
delete[] mtp; delete[] mtp;
} }

View file

@ -177,10 +177,47 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
if ((TexMan.FindSwitch(side->GetTexture(side_t::top))) != NULL) if ((TexMan.FindSwitch(side->GetTexture(side_t::top))) != NULL)
{ {
// Check 3D floors on back side
{
sector_t * back = line->sidedef[1 - sideno]->sector;
for (unsigned i = 0; i < back->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *rover = back->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_UPPERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky))
continue;
// This 3D floor depicts a switch texture in front of the player's eyes
return true;
}
}
return (user->z + user->height > open.top); return (user->z + user->height > open.top);
} }
else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL) else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
{ {
// Check 3D floors on back side
{
sector_t * back = line->sidedef[1 - sideno]->sector;
for (unsigned i = 0; i < back->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *rover = back->e->XFloor.ffloors[i];
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_LOWERTEXTURE)) continue;
if (user->z > rover->top.plane->ZatPoint(checkx, checky) ||
user->z + user->height < rover->bottom.plane->ZatPoint(checkx, checky))
continue;
// This 3D floor depicts a switch texture in front of the player's eyes
return true;
}
}
return (user->z < open.bottom); return (user->z < open.bottom);
} }
else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL) else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL)

View file

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

View file

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

View file

@ -377,6 +377,8 @@ enum
SECF_UNDERWATERMASK = 32+64, SECF_UNDERWATERMASK = 32+64,
SECF_DRAWN = 128, // sector has been drawn at least once SECF_DRAWN = 128, // sector has been drawn at least once
SECF_HIDDEN = 256, // Do not draw on textured automap 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 enum
@ -490,6 +492,8 @@ struct sector_t
DInterpolation *SetInterpolation(int position, bool attach); DInterpolation *SetInterpolation(int position, bool attach);
void StopInterpolation(int position); void StopInterpolation(int position);
ASkyViewpoint *GetSkyBox(int which);
enum enum
{ {
floor, floor,

View file

@ -254,7 +254,7 @@ void R_InitTextureMapping ()
void R_SetVisibility (float vis) void R_SetVisibility (float vis)
{ {
// Allow negative visibilities, just for novelty's sake // 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; 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() && if (!mus_playing.name.IsEmpty() &&
mus_playing.handle != NULL && mus_playing.handle != NULL &&
stricmp (mus_playing.name, musicname) == 0 && 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 length = 0;
int device = MDEV_DEFAULT; int device = MDEV_DEFAULT;
MusInfo *handle = NULL; MusInfo *handle = NULL;
FName musicasname = musicname;
FName *aliasp = MusicAliases.CheckKey(musicasname); int *devp = MidiDevices.CheckKey(musicname);
if (aliasp != NULL)
{
musicname = (musicasname = *aliasp).GetChars();
if (musicasname == NAME_None) return true;
}
int *devp = MidiDevices.CheckKey(musicasname);
if (devp != NULL) device = *devp; if (devp != NULL) device = *devp;
// Strip off any leading file:// component. // Strip off any leading file:// component.

View file

@ -713,11 +713,11 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
if ( hRT ) if ( hRT )
{ {
// Must wait process to terminate to guarantee that it has exited... // Must wait for process to terminate to guarantee that it has exited...
WaitForSingleObject(hProcess, INFINITE); DWORD res = WaitForSingleObject(hProcess, 1000);
CloseHandle(hRT); CloseHandle(hRT);
bSuccess = TRUE; bSuccess = (res == WAIT_OBJECT_0);
dwErr = WAIT_TIMEOUT;
} }
if ( !bSuccess ) 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); alSourcei(source, AL_LOOPING, (chanflags&SNDF_LOOP) ? AL_TRUE : AL_FALSE);
alSourcef(source, AL_MAX_GAIN, SfxVolume); alSourcef(source, AL_MAX_GAIN, SfxVolume);
alSourcef(source, AL_GAIN, SfxVolume); alSourcef(source, AL_GAIN, SfxVolume*vol);
if(EnvSlot) if(EnvSlot)
{ {

View file

@ -1248,7 +1248,8 @@ void FTextureManager::PrecacheLevel (void)
for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++) for (unsigned i = 0; i < level.info->PrecacheTextures.Size(); i++)
{ {
hitlist[level.info->PrecacheTextures[i].GetIndex()] |= FTextureManager::HIT_Wall; FTextureID tex = TexMan.CheckForTexture(level.info->PrecacheTextures[i], FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst);
if (tex.Exists()) hitlist[tex.GetIndex()] |= FTextureManager::HIT_Wall;
} }
for (int i = cnt - 1; i >= 0; i--) for (int i = cnt - 1; i >= 0; i--)

View file

@ -1414,6 +1414,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
ACTION_PARAM_FIXED(LifeSteal, 5); ACTION_PARAM_FIXED(LifeSteal, 5);
ACTION_PARAM_INT(lifestealmax, 6); ACTION_PARAM_INT(lifestealmax, 6);
ACTION_PARAM_CLASS(armorbonustype, 7); ACTION_PARAM_CLASS(armorbonustype, 7);
ACTION_PARAM_SOUND(MeleeSound, 8);
ACTION_PARAM_SOUND(MissSound, 9);
if (!self->player) return; if (!self->player) return;
@ -1443,7 +1445,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
P_LineAttack (self, angle, Range, pitch, Damage, NAME_Melee, PuffType, puffFlags, &linetarget, &actualdamage); 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)) if (LifeSteal && !(linetarget->flags5 & MF5_DONTDRAIN))
{ {
@ -1474,7 +1480,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
if (weapon != NULL) 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)) if (!(flags & CPF_NOTURN))
@ -4884,17 +4891,19 @@ enum RadiusGiveFlags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
{ {
ACTION_PARAM_START(6); ACTION_PARAM_START(7);
ACTION_PARAM_CLASS(item, 0); ACTION_PARAM_CLASS(item, 0);
ACTION_PARAM_FIXED(distance, 1); ACTION_PARAM_FIXED(distance, 1);
ACTION_PARAM_INT(flags, 2); ACTION_PARAM_INT(flags, 2);
ACTION_PARAM_INT(amount, 3); ACTION_PARAM_INT(amount, 3);
ACTION_PARAM_CLASS(filter, 4); ACTION_PARAM_CLASS(filter, 4);
ACTION_PARAM_NAME(species, 5); ACTION_PARAM_NAME(species, 5);
ACTION_PARAM_FIXED(mindist, 6);
// We need a valid item, valid targets, and a valid range // 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)
{ {
ACTION_SET_RESULT(false);
return; return;
} }
@ -4903,9 +4912,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
amount = 1; amount = 1;
} }
FBlockThingsIterator it(FBoundingBox(self->x, self->y, distance)); FBlockThingsIterator it(FBoundingBox(self->x, self->y, distance));
double distsquared = double(distance) * double(distance);
AActor *thing; AActor *thing;
bool given = false;
while ((thing = it.Next())) while ((thing = it.Next()))
{ {
//[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s). //[MC] Check for a filter, species, and the related exfilter/expecies/either flag(s).
@ -4950,7 +4959,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
bool corpsePass = !!((flags & RGF_CORPSES) && thing->flags & MF_CORPSE); bool corpsePass = !!((flags & RGF_CORPSES) && thing->flags & MF_CORPSE);
bool killedPass = !!((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED); bool killedPass = !!((flags & RGF_KILLED) && thing->flags6 & MF6_KILLED);
bool monsterPass = !!((flags & RGF_MONSTERS) && thing->flags3 & MF3_ISMONSTER); 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 playerPass = !!((flags & RGF_PLAYERS) && (thing->player != NULL) && (thing->player->mo == thing));
bool voodooPass = !!((flags & RGF_VOODOO) && (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. //Self calls priority over the rest of this.
@ -4973,20 +4983,26 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass) if (selfPass || monsterPass || corpsePass || killedPass || itemPass || objectPass || missilePass || playerPass || voodooPass)
{ {
if (flags & RGF_CUBE) if (flags & RGF_CUBE)
{ // check if inside a cube { // check if inside a cube
if (fabs((double)thing->x - self->x) > (double)distance || double dx = fabs((double)(thing->x - self->x));
fabs((double)thing->y - self->y) > (double)distance || double dy = fabs((double)(thing->y - self->y));
fabs((double)(thing->z + thing->height / 2) - (self->z + self->height / 2)) > (double)distance) 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; continue;
} }
} }
else else
{ // check if inside a sphere { // 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> tpos(thing->x, thing->y, thing->z + thing->height / 2);
TVector3<double> spos(self->x, self->y, self->z + self->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; continue;
} }
@ -5009,10 +5025,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
{ {
gift->Destroy(); gift->Destroy();
} }
else
{
given = true;
} }
} }
} }
} }
ACTION_SET_RESULT(given);
}
//========================================================================== //==========================================================================
@ -5872,6 +5893,103 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
self->RipLevelMax = max; self->RipLevelMax = max;
} }
//==========================================================================
//
// A_CheckProximity(jump, classname, distance, count, flags, ptr)
//
// Checks to see if a certain actor class is close to the
// actor/pointer within distance, in numbers.
//==========================================================================
enum CPXFflags
{
CPXF_ANCESTOR = 1,
CPXF_LESSOREQUAL = 1 << 1,
CPXF_NOZ = 1 << 2,
CPXF_COUNTDEAD = 1 << 3,
CPXF_DEADONLY = 1 << 4,
CPXF_EXACT = 1 << 5,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
{
ACTION_PARAM_START(6);
ACTION_PARAM_STATE(jump, 0);
ACTION_PARAM_CLASS(classname, 1);
ACTION_PARAM_FIXED(distance, 2);
ACTION_PARAM_INT(count, 3);
ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_INT(ptr, 5);
ACTION_SET_RESULT(false); //No inventory chain results please.
AActor *ref = COPY_AAPTR(self, ptr);
//We need these to check out.
if (!ref || !jump || !classname || distance <= 0)
return;
int counter = 0;
bool result = false;
TThinkerIterator<AActor> it;
AActor * mo;
//[MC] Process of elimination, I think, will get through this as quickly and
//efficiently as possible.
while ((mo = it.Next()))
{
if (mo == ref) //Don't count self.
continue;
//Check inheritance for the classname. Taken partly from CheckClass DECORATE function.
if (flags & CPXF_ANCESTOR)
{
if (!(mo->GetClass()->IsAncestorOf(classname)))
continue;
}
//Otherwise, just check for the regular class name.
else if (classname != mo->GetClass())
continue;
//Make sure it's in range and respect the desire for Z or not.
if (P_AproxDistance(ref->x - mo->x, ref->y - mo->y) < distance &&
((flags & CPXF_NOZ) ||
((ref->z > mo->z && ref->z - (mo->z + mo->height) < distance) ||
(ref->z <= mo->z && mo->z - (ref->z + ref->height) < distance))))
{
if (mo->flags6 & MF6_KILLED)
{
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
continue;
counter++;
}
else
{
if (flags & CPXF_DEADONLY)
continue;
counter++;
}
//Abort if the number of matching classes nearby is greater, we have obviously succeeded in our goal.
if (counter > count)
{
result = (flags & (CPXF_LESSOREQUAL | CPXF_EXACT)) ? false : true;
break;
}
}
}
if (counter == count)
result = true;
else if (counter < count)
result = !!((flags & CPXF_LESSOREQUAL) && !(flags & CPXF_EXACT));
if (result)
{
ACTION_JUMP(jump);
}
}
/*=========================================================================== /*===========================================================================
A_CheckBlock A_CheckBlock
(state block, int flags, int ptr) (state block, int flags, int ptr)

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4524 #define SAVEVER 4525
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)

View file

@ -1726,3 +1726,36 @@ FString I_GetLongPathName(FString shortpath)
delete[] buff; delete[] buff;
return longpath; return longpath;
} }
#if _MSC_VER == 1900 && defined(_USING_V110_SDK71_)
//==========================================================================
//
// VS14Stat
//
// Work around an issue where stat doesn't work with v140_xp. This was
// supposedly fixed, but as of Update 1 continues to not function on XP.
//
//==========================================================================
#include <sys/stat.h>
int VS14Stat(const char *path, struct _stat64i32 *buffer)
{
WIN32_FILE_ATTRIBUTE_DATA data;
if(!GetFileAttributesEx(path, GetFileExInfoStandard, &data))
return -1;
buffer->st_ino = 0;
buffer->st_mode = ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? S_IFDIR : S_IFREG)|
((data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? S_IREAD : S_IREAD|S_IWRITE);
buffer->st_dev = buffer->st_rdev = 0;
buffer->st_nlink = 1;
buffer->st_uid = 0;
buffer->st_gid = 0;
buffer->st_size = data.nFileSizeLow;
buffer->st_atime = (*(QWORD*)&data.ftLastAccessTime) / 10000000 - 11644473600LL;
buffer->st_mtime = (*(QWORD*)&data.ftLastWriteTime) / 10000000 - 11644473600LL;
buffer->st_ctime = (*(QWORD*)&data.ftCreationTime) / 10000000 - 11644473600LL;
return 0;
}
#endif

View file

@ -3061,6 +3061,7 @@ struct lemon *lemp;
FILE *in; FILE *in;
char *tpltname; char *tpltname;
char *cp; char *cp;
Boolean tpltnameinbuf;
cp = strrchr(lemp->filename,'.'); cp = strrchr(lemp->filename,'.');
if( cp ){ if( cp ){
@ -3070,10 +3071,13 @@ struct lemon *lemp;
} }
if( access(buf,004)==0 ){ if( access(buf,004)==0 ){
tpltname = buf; tpltname = buf;
tpltnameinbuf = LEMON_TRUE;
}else if( access(templatename,004)==0 ){ }else if( access(templatename,004)==0 ){
tpltname = templatename; tpltname = templatename;
tpltnameinbuf = LEMON_TRUE;
}else{ }else{
tpltname = pathsearch(lemp->argv0,templatename,0); tpltname = pathsearch(lemp->argv0,templatename,0);
tpltnameinbuf = LEMON_FALSE;
} }
if( tpltname==0 ){ if( tpltname==0 ){
fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", fprintf(stderr,"Can't find the parser driver template file \"%s\".\n",
@ -3084,11 +3088,11 @@ struct lemon *lemp;
in = fopen(tpltname,"rb"); in = fopen(tpltname,"rb");
if( in==0 ){ if( in==0 ){
fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); fprintf(stderr,"Can't open the template file \"%s\".\n",templatename);
free(tpltname); if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
lemp->errorcnt++; lemp->errorcnt++;
return 0; return 0;
} }
free(tpltname); if (tpltnameinbuf == LEMON_FALSE) free(tpltname);
return in; return in;
} }

View file

@ -257,7 +257,7 @@ ACTOR Actor native //: Thinker
action native A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); 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_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_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_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_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); action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
@ -337,6 +337,7 @@ ACTOR Actor native //: Thinker
action native A_SetRipperLevel(int level); action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min); action native A_SetRipMin(int min);
action native A_SetRipMax(int max); action native A_SetRipMax(int max);
action native A_CheckProximity(state jump, class<Actor> classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT);
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT); 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_CheckSightOrRange(float distance, state label, bool two_dimension = false);
action native A_CheckRange(float distance, state label, bool two_dimension = false); action native A_CheckRange(float distance, state label, bool two_dimension = false);

View file

@ -484,6 +484,17 @@ enum
QF_WAVE = 1 << 5, QF_WAVE = 1 << 5,
}; };
// A_CheckProximity flags
enum
{
CPXF_ANCESTOR = 1,
CPXF_LESSOREQUAL = 1 << 1,
CPXF_NOZ = 1 << 2,
CPXF_COUNTDEAD = 1 << 3,
CPXF_DEADONLY = 1 << 4,
CPXF_EXACT = 1 << 5,
};
// Flags for A_CheckBlock // Flags for A_CheckBlock
// These flags only affect the calling actor('s pointer), not the ones being searched. // These flags only affect the calling actor('s pointer), not the ones being searched.
enum enum

View file

@ -8,7 +8,7 @@ ACTOR Inventory native
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG" Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG"
action native A_JumpIfNoAmmo(state label); 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 spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0); action native A_FireBullets(float spread_xy, float 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_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, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float 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_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float 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: Death:
LEAD E 2 A_FaceTarget LEAD E 2 A_FaceTarget
LEAD F 2 BRIGHT A_ShootGun LEAD F 2 BRIGHT A_ShootGun
LEAD E 2 A_SentinelRefire LEAD E 1 A_SentinelRefire
Loop Loop
Pain: Pain:
LEAD Y 3 LEAD Y 3
@ -80,7 +80,7 @@ ACTOR Macil2 : Macil1
LEAD K 3 LEAD K 3
LEAD L 3 A_NoBlocking LEAD L 3 A_NoBlocking
LEAD MNOPQRSTUV 3 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 LEAD X -1
Stop Stop
} }

View file

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

View file

@ -1602,10 +1602,24 @@ OptionMenu AdvSoundOptions
Option "OPL Emulator Core", "opl_core", "OplCores" Option "OPL Emulator Core", "opl_core", "OplCores"
StaticText " " StaticText " "
StaticText "GUS Emulation", 1 StaticText "GUS Emulation", 1
TextField "GUS config file", "midi_config"
Slider "MIDI voices", "midi_voices", 16, 256, 4, 0 Slider "MIDI voices", "midi_voices", 16, 256, 4, 0
Option "Emulate TiMidity", "midi_timiditylike", "OnOff" Option "Emulate TiMidity", "midi_timiditylike", "OnOff"
Option "Read DMXGUS lumps", "midi_dmxgus", "OnOff" Option "Read DMXGUS lumps", "midi_dmxgus", "OnOff"
Option "GUS memory size", "gus_memsize", "GusMemory" 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
} }
/*======================================= /*=======================================