* Updated to ZDoom 4150:

- Fixed: PCD_MORPHACTOR and P_MorphMonster() needed NULL pointer checks.
- Make the DOOM 3 BFG Edition the last Steam path checked, so it won't override the regular doom.wad.
- Allow negative parameters to A_Light.
- Added IF_NOSCREENFLASH.
- Added NOTRAIL flag for PowerSpeed.
- Added NoRandomPlayerclass flag for MAPINFO.
- Added time display for alt hud.
- Added Brazilian Portuguese translation.
- Fixed: APowerSpeed::Serialize needs to call the super method.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1529 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2013-02-20 00:59:47 +00:00
parent b9951b548d
commit 3c5ed0ae1b
18 changed files with 2009 additions and 38 deletions

View file

@ -437,12 +437,12 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
static const char *const steam_dirs[] =
{
"doom 2/base",
"DOOM 3 BFG Edition/base/wads",
"final doom/base",
"heretic shadow of the serpent riders/base",
"hexen/base",
"hexen deathkings of the dark citadel/base",
"ultimate doom/base"
"ultimate doom/base",
"DOOM 3 BFG Edition/base/wads"
};
steam_path += "/SteamApps/common/";
for (i = 0; i < countof(steam_dirs); ++i)

View file

@ -1156,6 +1156,25 @@ void APlayerSpeedTrail::Tick ()
IMPLEMENT_CLASS (APowerSpeed)
//===========================================================================
//
// APowerSpeed :: Serialize
//
//===========================================================================
void APowerSpeed::Serialize(FArchive &arc)
{
Super::Serialize (arc);
if (SaveVersion < 4146)
{
SpeedFlags = 0;
}
else
{
arc << SpeedFlags;
}
}
//===========================================================================
//
// APowerSpeed :: GetSpeedFactor
@ -1164,8 +1183,10 @@ IMPLEMENT_CLASS (APowerSpeed)
fixed_t APowerSpeed ::GetSpeedFactor ()
{
if (Inventory != NULL) return FixedMul(Speed, Inventory->GetSpeedFactor());
else return Speed;
if (Inventory != NULL)
return FixedMul(Speed, Inventory->GetSpeedFactor());
else
return Speed;
}
//===========================================================================
@ -1184,12 +1205,22 @@ void APowerSpeed::DoEffect ()
if (Owner->player->cheats & CF_PREDICTING)
return;
if (SpeedFlags & PSF_NOTRAIL)
return;
if (level.time & 1)
return;
// check if another speed item is present to avoid multiple drawing of the speed trail.
if (Inventory != NULL && Inventory->GetSpeedFactor() > FRACUNIT)
return;
// Check if another speed item is present to avoid multiple drawing of the speed trail.
// Only the last PowerSpeed without PSF_NOTRAIL set will actually draw the trail.
for (AInventory *item = Inventory; item != NULL; item = item->Inventory)
{
if (item->IsKindOf(RUNTIME_CLASS(APowerSpeed)) &&
!(static_cast<APowerSpeed *>(item)->SpeedFlags & PSF_NOTRAIL))
{
return;
}
}
if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT)
return;

View file

@ -143,9 +143,14 @@ class APowerSpeed : public APowerup
DECLARE_CLASS (APowerSpeed, APowerup)
protected:
void DoEffect ();
void Serialize(FArchive &arc);
fixed_t GetSpeedFactor();
public:
int SpeedFlags;
};
#define PSF_NOTRAIL 1
class APowerMinotaur : public APowerup
{
DECLARE_CLASS (APowerMinotaur, APowerup)

View file

@ -366,7 +366,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s
{
AMorphedMonster *morphed;
if (actor->player || spawntype == NULL ||
if (actor == NULL || actor->player || spawntype == NULL ||
actor->flags3 & MF3_DONTMORPH ||
!(actor->flags3 & MF3_ISMONSTER) ||
!spawntype->IsDescendantOf (RUNTIME_CLASS(AMorphedMonster)))

View file

@ -964,7 +964,10 @@ void AInventory::Touch (AActor *toucher)
if (toucher->player != NULL)
{
PlayPickupSound (toucher->player->mo);
toucher->player->bonuscount = BONUSADD;
if (!(ItemFlags & IF_NOSCREENFLASH))
{
toucher->player->bonuscount = BONUSADD;
}
}
else
{

View file

@ -133,6 +133,7 @@ enum
IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels
IF_RESTRICTABSOLUTELY = 1<<19, // RestrictedTo and ForbiddenTo do not allow pickup in any form by other classes
IF_NEVERRESPAWN = 1<<20, // Never, ever respawns
IF_NOSCREENFLASH = 1<<21, // No pickup flash on the player's screen
};

View file

@ -49,6 +49,8 @@
#include "doomstat.h"
#include "g_level.h"
#include <time.h>
#define HUMETA_AltIcon 0x10f000
@ -68,6 +70,8 @@ CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD
CVAR (Bool, hud_showitems, false,CVAR_ARCHIVE); // Show item stats on HUD
CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy.
CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
CVAR (Int , hud_timecolor, CR_GOLD,CVAR_ARCHIVE); // Color of in-game time on HUD
CVAR (Int, hud_ammo_red, 25, CVAR_ARCHIVE) // ammo percent less than which status is red
CVAR (Int, hud_ammo_yellow, 50, CVAR_ARCHIVE) // ammo percent less is yellow more green
@ -816,6 +820,84 @@ static void DrawCoordinates(player_t * CPlayer)
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE);
}
//---------------------------------------------------------------------------
//
// Draw in-game time
//
// Check AltHUDTime option value in wadsrc/static/menudef.txt
// for meaning of all display modes
//
//---------------------------------------------------------------------------
static void DrawTime()
{
if (hud_showtime <= 0 || hud_showtime > 9)
{
return;
}
int hours = 0;
int minutes = 0;
int seconds = 0;
if (hud_showtime < 8)
{
const int timeTicks =
hud_showtime < 4
? level.maptime
: (hud_showtime < 6
? level.time
: level.totaltime);
const int timeSeconds = timeTicks / TICRATE;
hours = timeSeconds / 3600;
minutes = (timeSeconds % 3600) / 60;
seconds = timeSeconds % 60;
}
else
{
time_t now;
time(&now);
struct tm* timeinfo = localtime(&now);
if (NULL != timeinfo)
{
hours = timeinfo->tm_hour;
minutes = timeinfo->tm_min;
seconds = timeinfo->tm_sec;
}
}
const bool showMillis = 1 == hud_showtime;
const bool showSeconds = showMillis || (0 == hud_showtime % 2);
char timeString[sizeof "HH:MM:SS.MMM"];
if (showMillis)
{
const int millis = (level.time % TICRATE) * (1000 / TICRATE);
mysnprintf(timeString, sizeof(timeString), "%02i:%02i:%02i.%03i", hours, minutes, seconds, millis);
}
else if (showSeconds)
{
mysnprintf(timeString, sizeof(timeString), "%02i:%02i:%02i", hours, minutes, seconds);
}
else
{
mysnprintf(timeString, sizeof(timeString), "%02i:%02i", hours, minutes);
}
const int characterCount = static_cast<int>( sizeof "HH:MM" - 1
+ (showSeconds ? sizeof ":SS" - 1 : 0)
+ (showMillis ? sizeof ".MMM" - 1 : 0) );
const int width = SmallFont->GetCharWidth('0') * characterCount + 2; // small offset from screen's border
const int height = SmallFont->GetHeight();
DrawHudText(SmallFont, hud_timecolor, timeString, hudwidth - width, height, FRACUNIT);
}
//---------------------------------------------------------------------------
//
@ -879,6 +961,8 @@ void DrawHUD()
StatusBar->DrawCrosshair();
}
if (idmypos) DrawCoordinates(CPlayer);
DrawTime();
}
else
{

View file

@ -338,6 +338,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch")
GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch")
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
else
{

View file

@ -139,6 +139,7 @@ struct gameinfo_t
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;
bool norandomplayerclass;
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -1098,7 +1098,7 @@ static void BuildPlayerclassMenu()
}
}
}
if (n > 1)
if (n > 1 && !gameinfo.norandomplayerclass)
{
FListMenuItemText *it = new FListMenuItemText(ld->mXpos, ld->mYpos, ld->mLinespacing, 'r',
"$MNU_RANDOM", ld->mFont,ld->mFontColor, NAME_Episodemenu, -1);

View file

@ -606,13 +606,16 @@ void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
}
else
{
li->SetString(0, "Random");
// [XA] Remove the "Random" option if the relevant gameinfo flag is set.
if(!gameinfo.norandomplayerclass)
li->SetString(0, "Random");
for(unsigned i=0; i< PlayerClasses.Size(); i++)
{
const char *cls = GetPrintableDisplayName(PlayerClasses[i].Type);
li->SetString(i+1, cls);
li->SetString(gameinfo.norandomplayerclass ? i : i+1, cls);
}
li->SetValue(0, players[consoleplayer].userinfo.PlayerClass + 1);
int pclass = players[consoleplayer].userinfo.PlayerClass;
li->SetValue(0, gameinfo.norandomplayerclass && pclass >= 0 ? pclass : pclass + 1);
}
}
@ -907,10 +910,10 @@ void DPlayerMenu::ClassChanged (FListMenuItem *li)
if (li->GetValue(0, &sel))
{
players[consoleplayer].userinfo.PlayerClass = sel-1;
players[consoleplayer].userinfo.PlayerClass = gameinfo.norandomplayerclass ? sel : sel-1;
PickPlayerClass();
cvar_set ("playerclass", sel == 0 ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName));
cvar_set ("playerclass", sel == 0 && !gameinfo.norandomplayerclass ? "Random" : PlayerClass->Type->Meta.GetMetaString (APMETA_DisplayName));
UpdateSkins();
UpdateColorsets();

View file

@ -7175,19 +7175,13 @@ scriptwait:
if (tag == 0)
{
if (activator->player)
if (activator != NULL && activator->player)
{
if (P_MorphPlayer(activator->player, activator->player, playerclass, duration, style, morphflash, unmorphflash))
{
changes++;
}
changes += P_MorphPlayer(activator->player, activator->player, playerclass, duration, style, morphflash, unmorphflash);
}
else
{
if (P_MorphMonster(activator, monsterclass, duration, style, morphflash, unmorphflash))
{
changes++;
}
changes += P_MorphMonster(activator, monsterclass, duration, style, morphflash, unmorphflash);
}
}
else
@ -7199,17 +7193,12 @@ scriptwait:
{
if (actor->player)
{
if (P_MorphPlayer(activator->player, actor->player, playerclass, duration, style, morphflash, unmorphflash))
{
changes++;
}
changes += P_MorphPlayer(activator == NULL ? NULL : activator->player,
actor->player, playerclass, duration, style, morphflash, unmorphflash);
}
else
{
if (P_MorphMonster(actor, monsterclass, duration, style, morphflash, unmorphflash))
{
changes++;
}
changes += P_MorphMonster(actor, monsterclass, duration, style, morphflash, unmorphflash);
}
}
}

View file

@ -997,7 +997,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light)
if (self->player != NULL)
{
self->player->extralight = clamp<int>(light, 0, 20);
self->player->extralight = clamp<int>(light, -20, 20);
}
}

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "4140"
#define ZD_SVN_REVISION_NUMBER 4140
#define ZD_SVN_REVISION_STRING "4150"
#define ZD_SVN_REVISION_NUMBER 4150

View file

@ -299,10 +299,10 @@ static FFlagDef InventoryFlags[] =
DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags),
DEFINE_FLAG(IF, RESTRICTABSOLUTELY, AInventory, ItemFlags),
DEFINE_FLAG(IF, NEVERRESPAWN, AInventory, ItemFlags),
DEFINE_FLAG(IF, NOSCREENFLASH, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),
};
DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),};
static FFlagDef WeaponFlags[] =
{
@ -338,12 +338,19 @@ static FFlagDef PlayerPawnFlags[] =
DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags),
};
static FFlagDef PowerSpeedFlags[] =
{
// PowerSpeed flags
DEFINE_FLAG(PSF, NOTRAIL, APowerSpeed, SpeedFlags),
};
static const struct FFlagList { const PClass *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
{
{ RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
{ RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ RUNTIME_CLASS(AWeapon), WeaponFlags, countof(WeaponFlags) },
{ RUNTIME_CLASS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
{ RUNTIME_CLASS(APowerSpeed), PowerSpeedFlags,countof(PowerSpeedFlags) },
};
#define NUM_FLAG_LISTS (countof(FlagLists))

View file

@ -226,7 +226,7 @@ ACTOR PowerWeaponLevel2 : Powerup native
Inventory.Icon "SPINBK0"
}
ACTOR PowerSpeed: Powerup native
ACTOR PowerSpeed : Powerup native
{
Powerup.Duration -45
Speed 1.5

1830
wadsrc/static/language.ptb Normal file

File diff suppressed because it is too large Load diff

View file

@ -780,6 +780,20 @@ OptionValue "AltHUDScale"
2, "Pixel double"
}
OptionValue "AltHUDTime"
{
0, "Off"
1, "Level, milliseconds"
2, "Level, seconds"
3, "Level"
4, "Hub, seconds"
5, "Hub"
6, "Total, seconds"
7, "Total"
8, "System, seconds"
9, "System"
}
OptionMenu "AltHUDOptions"
{
Title "Alternative HUD"
@ -791,6 +805,8 @@ OptionMenu "AltHUDOptions"
Option "Show item count", "hud_showitems", "OnOff"
Option "Show stamina and accuracy", "hud_showstats", "OnOff"
Option "Show berserk", "hud_berserk_health", "OnOff"
Option "Show time", "hud_showtime", "AltHUDTime"
Option "Time color", "hud_timecolor", "TextColors"
Slider "Red ammo display below %", "hud_ammo_red", 0, 100, 1, 0
Slider "Yellow ammo display below %", "hud_ammo_yellow", 0, 100, 1, 0
Slider "Red health display below", "hud_health_red", 0, 100, 1, 0