This commit is contained in:
Christoph Oelckers 2015-09-06 08:41:27 +02:00
commit 61e09da1be
26 changed files with 200 additions and 59 deletions

View file

@ -422,7 +422,7 @@ CCMD (take)
CCMD (gameversion)
{
Printf ("%s @ %s\nCommit %s", GetVersionString(), GetGitTime(), GetGitHash());
Printf ("%s @ %s\nCommit %s\n", GetVersionString(), GetGitTime(), GetGitHash());
}
CCMD (print)

View file

@ -435,6 +435,11 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
}
}
}
TArray<FString> gog_paths = I_GetGogPaths();
for (i = 0; i < gog_paths.Size(); ++i)
{
CheckIWAD (gog_paths[i], &wads[0]);
}
TArray<FString> steam_path = I_GetSteamPath();
for (i = 0; i < steam_path.Size(); ++i)
{

View file

@ -1793,8 +1793,14 @@ void G_ReadSnapshots (PNGHandle *png)
DWORD snapver;
arc << snapver;
arc << namelen;
arc.Read (mapname, namelen);
if (SaveVersion < 4508)
{
arc << namelen;
arc.Read(mapname, namelen);
mapname[namelen] = 0;
MapName = mapname;
}
else arc << MapName;
TheDefaultLevelInfo.snapshotVer = snapver;
TheDefaultLevelInfo.snapshot = new FCompressedMemFile;
TheDefaultLevelInfo.snapshot->Serialize (arc);

View file

@ -72,7 +72,7 @@ bool APowerupGiver::Use (bool pickup)
power->Strength = Strength;
}
power->ItemFlags |= ItemFlags & (IF_ALWAYSPICKUP|IF_ADDITIVETIME);
power->ItemFlags |= ItemFlags & (IF_ALWAYSPICKUP|IF_ADDITIVETIME|IF_NOTELEPORTFREEZE);
if (power->CallTryPickup (Owner))
{
return true;
@ -342,6 +342,18 @@ void APowerup::OwnerDied ()
Destroy ();
}
//===========================================================================
//
// AInventory :: GetNoTeleportFreeze
//
//===========================================================================
bool APowerup::GetNoTeleportFreeze ()
{
if (ItemFlags & IF_NOTELEPORTFREEZE) return true;
return Super::GetNoTeleportFreeze();
}
// Invulnerability Powerup ---------------------------------------------------
IMPLEMENT_CLASS (APowerInvulnerable)

View file

@ -18,6 +18,7 @@ public:
virtual AInventory *CreateTossable ();
virtual void Serialize (FArchive &arc);
virtual void OwnerDied ();
virtual bool GetNoTeleportFreeze();
virtual PalEntry GetBlend ();
virtual bool DrawPowerup (int x, int y);

View file

@ -850,6 +850,25 @@ fixed_t AInventory::GetSpeedFactor ()
}
}
//===========================================================================
//
// AInventory :: GetNoTeleportFreeze
//
//===========================================================================
bool AInventory::GetNoTeleportFreeze ()
{
// do not check the flag here because it's only active when used on PowerUps, not on PowerupGivers.
if (Inventory != NULL)
{
return Inventory->GetNoTeleportFreeze();
}
else
{
return false;
}
}
//===========================================================================
//
// AInventory :: AlterWeaponSprite

View file

@ -137,6 +137,7 @@ enum
IF_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop)
IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag
IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper
IF_NOTELEPORTFREEZE = 1<<25, // does not 'freeze' the player right after teleporting.
};
@ -201,6 +202,7 @@ public:
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive);
virtual fixed_t GetSpeedFactor();
virtual bool GetNoTeleportFreeze();
virtual int AlterWeaponSprite (visstyle_t *vis);
virtual PalEntry GetBlend ();

View file

@ -345,8 +345,8 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
for(unsigned i=0;i<opt->mItems.Size();i++)
{
delete opt->mItems[i];
opt->mItems.Clear();
}
opt->mItems.Clear();
int i;
int itemnum = -1;

View file

@ -5862,6 +5862,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
int flags = args[5];
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false;
fixed_t heightoffset = argCount > 8 ? args[8] : 0;
FState *state = argCount > 6 ? activator->GetClass()->ActorInfo->FindStateByString(statename, exact) : 0;
@ -5879,7 +5880,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (!reference)
return false;
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags))
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset))
{
if (state && argCount > 6)
{
@ -8879,7 +8880,22 @@ scriptwait:
break;
case PCD_STRLEN:
STACK(1) = SDWORD(strlen(FBehavior::StaticLookupString (STACK(1))));
{
const char *str = FBehavior::StaticLookupString(STACK(1));
if (str != NULL)
{
STACK(1) = SDWORD(strlen(str));
break;
}
static bool StrlenInvalidPrintedAlready = false;
if (!StrlenInvalidPrintedAlready)
{
Printf(PRINT_BOLD, "Warning: ACS function strlen called with invalid string argument.\n");
StrlenInvalidPrintedAlready = true;
}
STACK(1) = 0;
}
break;
case PCD_GETCVAR:

View file

@ -74,7 +74,6 @@ EXTERN_CVAR (Bool, show_obituaries)
FName MeansOfDeath;
bool FriendlyFire;
//
// GET STUFF
@ -198,10 +197,8 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
if (inflictor && inflictor->player && inflictor->player->mo != inflictor)
MeansOfDeath = NAME_None;
if (multiplayer && !deathmatch)
FriendlyFire = true;
friendly = (self->player != attacker->player && self->IsTeammate(attacker));
friendly = FriendlyFire;
mod = MeansOfDeath;
message = NULL;
messagename = NULL;
@ -271,8 +268,6 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
{
if (friendly)
{
attacker->player->fragcount -= 2;
attacker->player->frags[attacker->player - players]++;
self = attacker;
gender = self->player->userinfo.GetGender();
mysnprintf (gendermessage, countof(gendermessage), "OB_FRIENDLY%c", '1' + (pr_obituary() & 3));
@ -470,12 +465,21 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
if ((dmflags2 & DF2_YES_LOSEFRAG) && deathmatch)
player->fragcount--;
++source->player->fragcount;
++source->player->spreecount;
if (this->IsTeammate(source))
{
source->player->fragcount--;
}
else
{
++source->player->fragcount;
++source->player->spreecount;
}
if (source->player->morphTics)
{ // Make a super chicken
source->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2));
}
if (deathmatch && cl_showsprees)
{
const char *spreemsg;
@ -1024,7 +1028,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
MeansOfDeath = mod;
FriendlyFire = false;
// [RH] Andy Baker's Stealth monsters
if (target->flags & MF_STEALTH)
{
@ -1221,8 +1224,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
((player && player != source->player) || (!player && target != source)) &&
target->IsTeammate (source))
{
if (player)
FriendlyFire = true;
if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it.
{ // Still allow telefragging :-(
damage = (int)((float)damage * level.teamdamage);

View file

@ -176,7 +176,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser);
bool P_Thing_CanRaise(AActor *thing);
const PClass *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);
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);
enum WARPF
{

View file

@ -1013,6 +1013,10 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
bool solid;
int damage;
// don't clip against self
if (thing == tm.thing)
return true;
if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY))
return true; // can't hit thing
@ -1020,10 +1024,6 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm)
if (abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist)
return true;
// don't clip against self
if (thing == tm.thing)
return true;
if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS)
return true;

View file

@ -211,7 +211,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
if (thing->player && (useFog || !keepOrientation) && bHaltVelocity)
{
// Freeze player for about .5 sec
if (thing->Inventory == NULL || thing->Inventory->GetSpeedFactor() <= FRACUNIT)
if (thing->Inventory == NULL || !thing->Inventory->GetNoTeleportFreeze())
thing->reactiontime = 18;
}
if (thing->flags & MF_MISSILE)

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)
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)
{
if (flags & WARPF_MOVEPTR)
{
@ -693,6 +693,9 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
fixed_t oldy = caller->y;
fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset);
if (!(flags & WARPF_ABSOLUTEANGLE))
{
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
@ -715,30 +718,13 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_TOFLOOR)
{
// set correct xy
// now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with.
// extra unlink, link and environment calculation
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->z);
// now the caller's floorz should be appropriate for the assigned xy-position
// assigning position again with
if (zofs)
{
// extra unlink, link and environment calculation
caller->SetOrigin(
caller->x,
caller->y,
caller->floorz + zofs);
}
else
{
// if there is no offset, there should be no ill effect from moving down to the already defined floor
// A_Teleport does the same thing anyway
caller->z = caller->floorz;
}
reference->floorz + zofs);
}
else
{

View file

@ -758,3 +758,9 @@ unsigned int I_MakeRNGSeed()
}
return seed;
}
TArray<FString> I_GetGogPaths()
{
// GOG's Doom games are Windows only at the moment
return TArray<FString>();
}

View file

@ -124,6 +124,8 @@ int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad);
// directories for IWADs if the user purchased any through Steam.
TArray<FString> I_GetSteamPath();
TArray<FString> I_GetGogPaths();
// The ini could not be saved at exit
bool I_WriteIniFailed ();

View file

@ -4672,7 +4672,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
{
ACTION_PARAM_START(7);
ACTION_PARAM_START(8);
ACTION_PARAM_INT(destination_selector, 0);
ACTION_PARAM_FIXED(xofs, 1);
@ -4681,6 +4681,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
ACTION_PARAM_ANGLE(angle, 4);
ACTION_PARAM_INT(flags, 5);
ACTION_PARAM_STATE(success_state, 6);
ACTION_PARAM_FIXED(heightoffset,7)
AActor *reference;
@ -4700,7 +4701,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
return;
}
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags))
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset))
{
if (success_state)
{
@ -5764,6 +5765,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower)
ACTION_JUMP(low);
}
//===========================================================================
// A_SetSpecies(str species, ptr)
//
// Sets the species of the calling actor('s pointer).
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies)
{
ACTION_PARAM_START(2);
ACTION_PARAM_NAME(species, 0);
ACTION_PARAM_INT(ptr, 1);
AActor *mobj = COPY_AAPTR(self, ptr);
if (!mobj)
{
ACTION_SET_RESULT(false);
return;
}
mobj->Species = species;
}
//===========================================================================
//

View file

@ -331,9 +331,11 @@ static FFlagDef InventoryFlagDefs[] =
DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags),
DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags),
DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOTELEPORTFREEZE, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),};
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),
};
static FFlagDef WeaponFlagDefs[] =
{

View file

@ -309,7 +309,7 @@ FDInputJoystick::~FDInputJoystick()
{
Joy_GenerateButtonEvents(Axes[0].ButtonValue, 0, 2, KEY_JOYAXIS1PLUS);
}
else
else if (Axes.Size() > 1)
{
Joy_GenerateButtonEvents(Axes[1].ButtonValue, 0, 4, KEY_JOYAXIS1PLUS);
for (i = 2; i < Axes.Size(); ++i)

View file

@ -1504,30 +1504,83 @@ int I_FindClose(void *handle)
static bool QueryPathKey(HKEY key, const char *keypath, const char *valname, FString &value)
{
HKEY steamkey;
HKEY pathkey;
DWORD pathtype;
DWORD pathlen;
LONG res;
if(ERROR_SUCCESS == RegOpenKeyEx(key, keypath, 0, KEY_QUERY_VALUE, &steamkey))
if(ERROR_SUCCESS == RegOpenKeyEx(key, keypath, 0, KEY_QUERY_VALUE, &pathkey))
{
if (ERROR_SUCCESS == RegQueryValueEx(steamkey, valname, 0, &pathtype, NULL, &pathlen) &&
if (ERROR_SUCCESS == RegQueryValueEx(pathkey, valname, 0, &pathtype, NULL, &pathlen) &&
pathtype == REG_SZ && pathlen != 0)
{
// Don't include terminating null in count
char *chars = value.LockNewBuffer(pathlen - 1);
res = RegQueryValueEx(steamkey, valname, 0, NULL, (LPBYTE)chars, &pathlen);
res = RegQueryValueEx(pathkey, valname, 0, NULL, (LPBYTE)chars, &pathlen);
value.UnlockBuffer();
if (res != ERROR_SUCCESS)
{
value = "";
}
}
RegCloseKey(steamkey);
RegCloseKey(pathkey);
}
return value.IsNotEmpty();
}
//==========================================================================
//
// I_GetGogPaths
//
// Check the registry for GOG installation paths, so we can search for IWADs
// that were bought from GOG.com. This is a bit different from the Steam
// version because each game has its own independent installation path, no
// such thing as <steamdir>/SteamApps/common/<GameName>.
//
//==========================================================================
TArray<FString> I_GetGogPaths()
{
TArray<FString> result;
FString path;
FString gamepath;
#ifdef _WIN64
FString gogregistrypath = "Software\\Wow6432Node\\GOG.com\\Games";
#else
// If a 32-bit ZDoom runs on a 64-bit Windows, this will be transparently and
// automatically redirected to the Wow6432Node address instead, so this address
// should be safe to use in all cases.
FString gogregistrypath = "Software\\GOG.com\\Games";
#endif
// Look for Ultimate Doom
gamepath = gogregistrypath + "\\1435827232";
if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path))
{
result.Push(path); // directly in install folder
}
// Look for Doom II
gamepath = gogregistrypath + "\\1435848814";
if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path))
{
result.Push(path + "/doom2"); // in a subdirectory
// If direct support for the Master Levels is ever added, they are in path + /master/wads
}
// Look for Final Doom
gamepath = gogregistrypath + "\\1435848742";
if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path))
{
// in subdirectories
result.Push(path + "/TNT");
result.Push(path + "/Plutonia");
}
return result;
}
//==========================================================================
//
// I_GetSteamPath

View file

@ -168,6 +168,9 @@ void I_SetWndProc();
// directories for IWADs if the user purchased any through Steam.
TArray<FString> I_GetSteamPath();
// [GZ] Same deal for GOG paths
TArray<FString> I_GetGogPaths();
// Damn Microsoft for doing Get/SetWindowLongPtr half-assed. Instead of
// giving them proper prototypes under Win32, they are just macros for
// Get/SetWindowLong, meaning they take LONGs and not LONG_PTRs.

View file

@ -583,6 +583,7 @@ void FString::SwapCase ()
void FString::StripLeft ()
{
size_t max = Len(), i, j;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!isspace(Chars[i]))
@ -613,6 +614,7 @@ void FString::StripLeft (const FString &charset)
void FString::StripLeft (const char *charset)
{
size_t max = Len(), i, j;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!strchr (charset, Chars[i]))
@ -665,6 +667,7 @@ void FString::StripRight (const FString &charset)
void FString::StripRight (const char *charset)
{
size_t max = Len(), i;
if (max == 0) return;
for (i = max; i-- > 0; )
{
if (!strchr (charset, Chars[i]))
@ -687,6 +690,7 @@ void FString::StripRight (const char *charset)
void FString::StripLeftRight ()
{
size_t max = Len(), i, j, k;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!isspace(Chars[i]))
@ -723,6 +727,7 @@ void FString::StripLeftRight (const FString &charset)
void FString::StripLeftRight (const char *charset)
{
size_t max = Len(), i, j, k;
if (max == 0) return;
for (i = 0; i < max; ++i)
{
if (!strchr (charset, Chars[i]))

View file

@ -249,7 +249,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 = "");
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_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);
@ -331,6 +331,7 @@ ACTOR Actor native //: Thinker
action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
action native A_ResetHealth(int ptr = AAPTR_DEFAULT);
action native A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET);
action native A_SetSpecies(name species, int ptr = AAPTR_DEFAULT);
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);

View file

@ -6,7 +6,7 @@
ACTOR SpiderMastermind
{
Health 3000
Radius 100
Radius 128
Height 100
Mass 1000
Speed 12

View file

@ -121,12 +121,11 @@ ACTOR MummyFX1
States
{
Spawn:
FX15 A 1 Bright
FX15 A 5 Bright A_PlaySound("mummy/head")
FX15 B 5 Bright A_SeekerMissile(10,20)
FX15 C 5 Bright
FX15 B 5 Bright A_SeekerMissile(10,20)
Goto Spawn+1
Loop
Death:
FX15 DEFG 5 Bright
Stop

View file

@ -225,6 +225,7 @@ ACTOR PowerWeaponLevel2 : Powerup native
{
Powerup.Duration -40
Inventory.Icon "SPINBK0"
+INVENTORY.NOTELEPORTFREEZE
}
ACTOR PowerSpeed : Powerup native
@ -232,6 +233,7 @@ ACTOR PowerSpeed : Powerup native
Powerup.Duration -45
Speed 1.5
Inventory.Icon "SPBOOT0"
+INVENTORY.NOTELEPORTFREEZE
}
// Player Speed Trail (used by the Speed Powerup) ----------------------------