Update to ZDoom r1799:

- Added PinkSilver's SetActorVelocity code submission (with optimizations.)
- Added the frandom decorate function, which is exactly like random except
  that it works with floating point instead of integers.
- Split the bounce types completely into separate flags and consolidated
  the various bounce-related flags spread across the different Actor flags
  field into a single BounceFlags field.
- Fixed: P_BounceWall() should calculate the XY velocity using a real
  square root and not P_AproxDistance(), because the latter can cause
  them to speed up or slow down.
- made menu dimming a mapping option but kept the CVARS as user override.
- Fixed: R_CreatePlayerTranslation() only initialized the first truecolor
  palette entry.
- Fixed: D3DPal::Update() used BorderColor == 0 as the condition for skipping
  an entry. It should be SM14 as in UploadPalette().
- Fixed: The aliasing of CPUInfo was still wrong. (Yarr! The things I do
  for you, GCC!) The AMD feature flags weren't stored anywhere, either; not
  that it really matters.
- Add an alternate PIC-compliant __cpuid macro in x86.cpp.
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
  from DMX sounds.
- Fixed: PNGTexture must not use the FArchive >> operator as a short hand
  for reading 4-byte integers, because that operator works with little
  endian numbers--a no-op on Intel processors, but bad joojoo on PowerPCs.
- fixed: Weapons must first check if they can be switched and afterwards
  if they can be fired. These checks were reversed.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@443 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-09-06 16:58:38 +00:00
parent f4599d95ec
commit e213c8a39f
39 changed files with 1672 additions and 1376 deletions

View file

@ -1,4 +1,39 @@
September 2, 2009 (Changes by Graf Zahl)
September 6, 2009 (Changes by Graf Zahl)
- Added PinkSilver's SetActorVelocity code submission (with optimizations.)
September 5, 2009
- Added the frandom decorate function, which is exactly like random except
that it works with floating point instead of integers.
- Split the bounce types completely into separate flags and consolidated
the various bounce-related flags spread across the different Actor flags
field into a single BounceFlags field.
- Fixed: P_BounceWall() should calculate the XY velocity using a real
square root and not P_AproxDistance(), because the latter can cause
them to speed up or slow down.
September 5, 2009 (Changes by Graf Zahl)
- made menu dimming a mapping option but kept the CVARS as user override.
September 4, 2009
- Fixed: R_CreatePlayerTranslation() only initialized the first truecolor
palette entry.
- Fixed: D3DPal::Update() used BorderColor == 0 as the condition for skipping
an entry. It should be SM14 as in UploadPalette().
- Fixed: The aliasing of CPUInfo was still wrong. (Yarr! The things I do
for you, GCC!) The AMD feature flags weren't stored anywhere, either; not
that it really matters.
- Add an alternate PIC-compliant __cpuid macro in x86.cpp.
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
from DMX sounds.
- Fixed: PNGTexture must not use the FArchive >> operator as a short hand
for reading 4-byte integers, because that operator works with little
endian numbers--a no-op on Intel processors, but bad joojoo on PowerPCs.
September 3, 2009 (Changes by Graf Zahl)
- fixed: Weapons must first check if they can be switched and afterwards
if they can be fired. These checks were reversed.
September 2, 2009 (Changes by Graf Zahl)
- fixed: The newly altered WAD code could not load embedded WADs anymore.
September 1, 2009

View file

@ -192,14 +192,6 @@ enum
MF2_SEEKERMISSILE = 0x40000000, // is a seeker (for reflection)
MF2_REFLECTIVE = 0x80000000, // reflects missiles
// The three types of bounciness are:
// HERETIC - Missile will only bounce off the floor once and then enter
// its death state. It does not bounce off walls at all.
// HEXEN - Missile bounces off of walls and floors indefinitely.
// DOOM - Like Hexen, but the bounce turns off if its vertical velocity
// is too low.
// --- mobj.flags3 ---
MF3_FLOORHUGGER = 0x00000001, // Missile stays on floor
@ -225,8 +217,8 @@ enum
MF3_NOBLOCKMONST = 0x00100000, // Can cross ML_BLOCKMONSTERS lines
MF3_CRASHED = 0x00200000, // Actor entered its crash state
MF3_FULLVOLDEATH = 0x00400000, // DeathSound is played full volume (for missiles)
MF3_CANBOUNCEWATER = 0x00800000, // Missile can bounce on water
MF3_NOWALLBOUNCESND = 0x01000000, // Don't make noise when bouncing off a wall
/* = 0x00800000, */
/* = 0x01000000, */
MF3_FOILINVUL = 0x02000000, // Actor can hurt MF2_INVULNERABLE things
MF3_NOTELEOTHER = 0x04000000, // Monster is unaffected by teleport other artifact
MF3_BLOODLESSIMPACT = 0x08000000, // Projectile does not leave blood
@ -269,13 +261,13 @@ enum
MF4_NOEXTREMEDEATH = 0x10000000, // this projectile or weapon never gibs its victim
MF4_EXTREMEDEATH = 0x20000000, // this projectile or weapon always gibs its victim
MF4_FRIGHTENED = 0x40000000, // Monster runs away from player
MF4_NOBOUNCESOUND = 0x80000000, // Strife's grenades don't make a bouncing sound.
/* = 0x80000000, */
MF5_FASTER = 0x00000001, // moves faster when DF_FAST_MONSTERS or nightmare is on.
MF5_FASTMELEE = 0x00000002, // has a faster melee attack when DF_FAST_MONSTERS or nightmare is on.
MF5_NODROPOFF = 0x00000004, // cannot drop off under any circumstances.
MF5_BOUNCEONACTORS = 0x00000008, // bouncing missile doesn't explode when it hits an actor
MF5_EXPLODEONWATER = 0x00000010, // bouncing missile explodes when hitting a water surface
/* = 0x00000008, */
/* = 0x00000010, */
MF5_AVOIDINGDROPOFF = 0x00000020, // Used to move monsters away from dropoffs
MF5_NODAMAGE = 0x00000040, // Actor can be shot and reacts to being shot but takes no damage
MF5_CHASEGOAL = 0x00000080, // Walks to goal instead of target if a valid goal is set.
@ -380,19 +372,46 @@ enum replace_t
enum EBounceType
{
BOUNCE_None=0,
BOUNCE_Doom=1,
BOUNCE_Heretic=2,
BOUNCE_Hexen=3,
BOUNCE_Walls = 1<<0, // bounces off of walls
BOUNCE_Floors = 1<<1, // bounces off of floors
BOUNCE_Ceilings = 1<<2, // bounces off of ceilings
BOUNCE_Actors = 1<<3, // bounces off of some actors
BOUNCE_AllActors = 1<<4, // bounces off of all actors (requires BOUNCE_Actors to be set, too)
BOUNCE_AutoOff = 1<<5, // when bouncing off a floor, if the new Z velocity is below 3.0, disable further bouncing
BOUNCE_HereticType = 1<<6, // only works with floors and ceilings; you probably don't want to use it
BOUNCE_TypeMask = 3,
BOUNCE_UseSeeSound = 4, // compatibility fallback. Thios will only be
// set by the compatibility handlers for the old bounce flags.
BOUNCE_UseSeeSound = 1<<7, // compatibility fallback. This will only be set by
// the compatibility handlers for the old bounce flags.
BOUNCE_NoWallSound = 1<<8, // don't make noise when bouncing off a wall
BOUNCE_Quiet = 1<<9, // Strife's grenades don't make a bouncing sound
BOUNCE_ExplodeOnWater = 1<<10, // explodes when hitting a water surface
BOUNCE_CanBounceWater = 1<<11, // can bounce on water
BOUNCE_TypeMask = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors | BOUNCE_AutoOff | BOUNCE_HereticType,
// The three "standard" types of bounciness are:
// HERETIC - Missile will only bounce off the floor once and then enter
// its death state. It does not bounce off walls at all.
// HEXEN - Missile bounces off of walls and floors indefinitely.
// DOOM - Like Hexen, but the bounce turns off if its vertical velocity
// is too low.
BOUNCE_None = 0,
BOUNCE_Heretic = BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_HereticType,
BOUNCE_Doom = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors | BOUNCE_AutoOff,
BOUNCE_Hexen = BOUNCE_Walls | BOUNCE_Floors | BOUNCE_Ceilings | BOUNCE_Actors,
// combined types
BOUNCE_DoomCompat = BOUNCE_Doom | BOUNCE_UseSeeSound,
BOUNCE_HereticCompat = BOUNCE_Heretic | BOUNCE_UseSeeSound,
BOUNCE_HexenCompat = BOUNCE_Hexen | BOUNCE_UseSeeSound,
BOUNCE_HexenCompat = BOUNCE_Hexen | BOUNCE_UseSeeSound
// The distinction between BOUNCE_Actors and BOUNCE_AllActors: A missile with
// BOUNCE_Actors set will bounce off of reflective and "non-sentient" actors.
// A missile that also has BOUNCE_AllActors set will bounce off of any actor.
// For compatibility reasons when BOUNCE_Actors was implied by the bounce type
// being "Doom" or "Hexen" and BOUNCE_AllActors was the separate
// MF5_BOUNCEONACTORS, you must set BOUNCE_Actors for BOUNCE_AllActors to have
// an effect.
};
// [RH] Like msecnode_t, but for the blockmap
@ -734,13 +753,13 @@ public:
BYTE boomwaterlevel; // splash information for non-swimmable water sectors
BYTE MinMissileChance;// [RH] If a random # is > than this, then missile attack.
SBYTE LastLookPlayerNumber;// Player number last looked for (if TIDtoHate == 0)
WORD BounceFlags; // which bouncing type?
WORD SpawnFlags;
fixed_t meleerange; // specifies how far a melee attack reaches.
fixed_t meleethreshold; // Distance below which a monster doesn't try to shoot missiles anynore
// but instead tries to come closer for a melee attack.
// This is not the same as meleerange
fixed_t maxtargetrange; // any target farther away cannot be attacked
int bouncetype; // which bouncing type?
fixed_t bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70.
fixed_t wallbouncefactor; // The bounce factor for walls can be different.
int bouncecount; // Strife's grenades only bounce twice before exploding

View file

@ -839,7 +839,7 @@ static int PatchThing (int thingy)
if (info->flags2 & 0x00000004) // old BOUNCE1
{
info->flags2 &= ~4;
info->bouncetype = BOUNCE_DoomCompat;
info->BounceFlags = BOUNCE_DoomCompat;
}
// Damage types that once were flags but now are not
if (info->flags2 & 0x20000000)

View file

@ -483,7 +483,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact)
{ // Bounce
self->health = MAGIC_JUNK;
self->velz = (self->velz * 192) >> 8;
self->bouncetype = BOUNCE_None;
self->BounceFlags = BOUNCE_None;
self->SetState (self->SpawnState);
S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM);
}
@ -555,7 +555,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
boom:
self->velx = self->vely = self->velz = 0;
self->flags |= MF_NOGRAVITY;
self->bouncetype = BOUNCE_None;
self->BounceFlags = BOUNCE_None;
self->gravity = FRACUNIT;
}
}

View file

@ -372,7 +372,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
self->SetState (self->SpawnState + 6);
self->z = self->floorz;
self->velz = 0;
self->bouncetype = BOUNCE_None;
self->BounceFlags = BOUNCE_None;
self->flags &= ~MF_MISSILE;
}
CALL_ACTION(A_CheckThrowBomb, self);

View file

@ -65,7 +65,6 @@ extern HWND Window;
EXTERN_CVAR (Bool, con_centernotify)
EXTERN_CVAR (Int, msg0color)
EXTERN_CVAR (Color, dimcolor)
EXTERN_CVAR (Color, color)
EXTERN_CVAR (Float, dimamount)
EXTERN_CVAR (Int, msgmidcolor)
@ -285,6 +284,15 @@ void FGameConfigFile::DoGlobalSetup ()
}
}
}
if (last < 209)
{
// menu dimming is now a gameinfo option so switch user override off
FBaseCVar *dim = FindCVar ("dimamount", NULL);
if (dim != NULL)
{
dim->ResetToDefault ();
}
}
}
}
}
@ -639,7 +647,6 @@ void FGameConfigFile::SetRavenDefaults (bool isHexen)
{
con_centernotify.ResetToDefault ();
msg0color.ResetToDefault ();
dimcolor.ResetToDefault ();
color.ResetToDefault ();
}
@ -650,8 +657,6 @@ void FGameConfigFile::SetRavenDefaults (bool isHexen)
snd_pitched.SetGenericRepDefault (val, CVAR_Bool);
val.Int = 9;
msg0color.SetGenericRepDefault (val, CVAR_Int);
val.Int = 0x0000ff;
dimcolor.SetGenericRepDefault (val, CVAR_Int);
val.Int = CR_WHITE;
msgmidcolor.SetGenericRepDefault (val, CVAR_Int);
val.Int = CR_YELLOW;

View file

@ -259,6 +259,8 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_BOOL(noloopfinalemusic, "noloopfinalemusic")
GAMEINFOKEY_BOOL(drawreadthis, "drawreadthis")
GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter")
GAMEINFOKEY_COLOR(dimcolor, "dimcolor")
GAMEINFOKEY_FLOAT(dimamount, "dimamount")
else
{
// ignore unkown keys.

View file

@ -94,6 +94,8 @@ struct gameinfo_t
FString backpacktype;
FString statusbar;
FString intermissionMusic;
DWORD dimcolor;
float dimamount;
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -181,7 +181,7 @@ bool M_CreatePNG (FILE *file, const BYTE *buffer, const PalEntry *palette,
//
// M_CreateDummyPNG
//
// Like M_CreatePNG, but the image is always a grayscale 1x1 blacksquare.
// Like M_CreatePNG, but the image is always a grayscale 1x1 black square.
//
//==========================================================================

View file

@ -2873,6 +2873,7 @@ enum EACSFunctions
ACSF_SpawnSpotForced,
ACSF_SpawnSpotFacingForced,
ACSF_CheckActorProperty,
ACSF_SetActorVelocity,
};
int DLevelScript::SideFromID(int id, int side)
@ -3055,6 +3056,22 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
case ACSF_CheckActorProperty:
return (CheckActorProperty(args[0], args[1], args[2]));
case ACSF_SetActorVelocity:
if (args[0] == 0)
{
P_Thing_SetVelocity(activator, args[1], args[2], args[3], !!args[4]);
}
else
{
TActorIterator<AActor> iterator (args[0]);
while ( (actor = iterator.Next ()) )
{
P_Thing_SetVelocity(actor, args[1], args[2], args[3], !!args[4]);
}
}
return 0;
default:
break;
}

View file

@ -139,6 +139,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_na
bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog);
bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog);
int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type);
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add);
void P_RemoveThing(AActor * actor);
bool P_Thing_Raise(AActor *thing);

View file

@ -889,13 +889,11 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
return true;
}
int bt = tm.thing->bouncetype & BOUNCE_TypeMask;
if (bt == BOUNCE_Doom || bt == BOUNCE_Hexen)
// [RH] What is the point of this check, again? In Hexen, it is unconditional,
// but here we only do it if the missile's damage is 0.
if ((tm.thing->BounceFlags & BOUNCE_Actors) && tm.thing->Damage == 0)
{
if (tm.thing->Damage == 0)
{
return (tm.thing->target == thing || !(thing->flags & MF_SOLID));
}
return (tm.thing->target == thing || !(thing->flags & MF_SOLID));
}
switch (tm.thing->SpecialMissileHit (thing))
@ -2543,8 +2541,7 @@ bool FSlide::BounceWall (AActor *mo)
fixed_t movelen;
line_t *line;
int bt = mo->bouncetype & BOUNCE_TypeMask;
if (bt != BOUNCE_Doom && bt != BOUNCE_Hexen)
if (!(mo->BounceFlags & BOUNCE_Walls))
{
return false;
}
@ -2615,7 +2612,7 @@ bool FSlide::BounceWall (AActor *mo)
lineangle >>= ANGLETOFINESHIFT;
deltaangle >>= ANGLETOFINESHIFT;
movelen = P_AproxDistance (mo->velx, mo->vely);
movelen = fixed_t(sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely));
movelen = FixedMul(movelen, mo->wallbouncefactor);
FBoundingBox box(mo->x, mo->y, mo->radius);

View file

@ -281,9 +281,36 @@ void AActor::Serialize (FArchive &arc)
<< MeleeState
<< MissileState
<< MaxDropOffHeight
<< MaxStepHeight
<< bouncetype
<< bouncefactor
<< MaxStepHeight;
if (SaveVersion < 1796)
{
int bouncetype, bounceflags;
arc << bouncetype;
bounceflags = 0;
if (bouncetype & 4)
bounceflags |= BOUNCE_UseSeeSound;
bouncetype &= 3;
if (bouncetype == 1) bounceflags |= BOUNCE_Doom;
else if (bouncetype == 2) bounceflags |= BOUNCE_Heretic;
else if (bouncetype == 3) bounceflags |= BOUNCE_Hexen;
if (flags3 & 0x00800000)
flags3 &= ~0x00800000, bounceflags |= BOUNCE_CanBounceWater;
if (flags3 & 0x01000000)
flags3 &= ~0x01000000, bounceflags |= BOUNCE_NoWallSound;
if (flags4 & 0x80000000)
flags4 &= ~0x80000000, bounceflags |= BOUNCE_Quiet;
if (flags5 & 0x00000008)
flags5 &= ~0x00000008, bounceflags |= BOUNCE_AllActors;
if (flags5 & 0x00000010)
flags5 &= ~0x00000010, bounceflags |= BOUNCE_ExplodeOnWater;
BounceFlags = bounceflags;
}
else
{
arc << BounceFlags;
}
arc << bouncefactor
<< wallbouncefactor
<< bouncecount
<< maxtargetrange
@ -1261,14 +1288,14 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
void AActor::PlayBounceSound(bool onfloor)
{
if (!onfloor && (flags3 & MF3_NOWALLBOUNCESND))
if (!onfloor && (BounceFlags & BOUNCE_NoWallSound))
{
return;
}
if (!(flags4 & MF4_NOBOUNCESOUND))
if (!(BounceFlags & BOUNCE_Quiet))
{
if (bouncetype & BOUNCE_UseSeeSound)
if (BounceFlags & BOUNCE_UseSeeSound)
{
S_Sound (this, CHAN_VOICE, SeeSound, 1, ATTN_IDLE);
}
@ -1295,18 +1322,29 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
if (z <= floorz && P_HitFloor (this))
{
// Landed in some sort of liquid
if (flags5 & MF5_EXPLODEONWATER)
if (BounceFlags & BOUNCE_ExplodeOnWater)
{
P_ExplodeMissile(this, NULL, NULL);
return true;
}
if (!(flags3 & MF3_CANBOUNCEWATER))
if (!(BounceFlags & BOUNCE_CanBounceWater))
{
Destroy ();
return true;
}
}
if (plane.c < 0)
{ // on ceiling
if (!(BounceFlags & BOUNCE_Ceilings))
return true;
}
else
{ // on floor
if (!(BounceFlags & BOUNCE_Floors))
return true;
}
// The amount of bounces is limited
if (bouncecount>0 && --bouncecount==0)
{
@ -1315,9 +1353,8 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
}
fixed_t dot = TMulScale16 (velx, plane.a, vely, plane.b, velz, plane.c);
int bt = bouncetype & BOUNCE_TypeMask;
if (bt == BOUNCE_Heretic)
if (BounceFlags & BOUNCE_HereticType)
{
velx -= MulScale15 (plane.a, dot);
vely -= MulScale15 (plane.b, dot);
@ -1330,18 +1367,17 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
}
// The reflected velocity keeps only about 70% of its original speed
long bouncescale = 0x4000 * bouncefactor;
velx = MulScale30 (velx - MulScale15 (plane.a, dot), bouncescale);
vely = MulScale30 (vely - MulScale15 (plane.b, dot), bouncescale);
velz = MulScale30 (velz - MulScale15 (plane.c, dot), bouncescale);
velx = FixedMul (velx - MulScale15 (plane.a, dot), bouncefactor);
vely = FixedMul (vely - MulScale15 (plane.b, dot), bouncefactor);
velz = FixedMul (velz - MulScale15 (plane.c, dot), bouncefactor);
angle = R_PointToAngle2 (0, 0, velx, vely);
PlayBounceSound(true);
if (bt == BOUNCE_Doom)
if (BounceFlags & BOUNCE_AutoOff)
{
if (!(flags & MF_NOGRAVITY) && (velz < 3*FRACUNIT))
{
bouncetype = BOUNCE_None;
BounceFlags &= ~BOUNCE_TypeMask;
}
}
return false;
@ -1768,10 +1804,9 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
steps = 0;
if (BlockingMobj)
{
int bt = mo->bouncetype & BOUNCE_TypeMask;
if (bt == BOUNCE_Doom || bt == BOUNCE_Hexen)
if (mo->BounceFlags & BOUNCE_Actors)
{
if (mo->flags5&MF5_BOUNCEONACTORS ||
if ((mo->BounceFlags & BOUNCE_AllActors) ||
(BlockingMobj->flags2 & MF2_REFLECTIVE) ||
((!BlockingMobj->player) &&
(!(BlockingMobj->flags3 & MF3_ISMONSTER))))
@ -2132,7 +2167,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
(!(gameinfo.gametype & GAME_DoomChex) || !(mo->flags & MF_NOCLIP)))
{
mo->z = mo->floorz;
if (mo->bouncetype != BOUNCE_None)
if (mo->BounceFlags & BOUNCE_Floors)
{
mo->FloorBounceMissile (mo->floorsector->floorplane);
return;
@ -2225,7 +2260,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
if (mo->z + mo->height > mo->ceilingz)
{
mo->z = mo->ceilingz - mo->height;
if (mo->bouncetype != BOUNCE_None)
if (mo->BounceFlags & BOUNCE_Ceilings)
{ // ceiling bounce
mo->FloorBounceMissile (mo->ceilingsector->ceilingplane);
return;

View file

@ -478,6 +478,26 @@ bool P_Thing_Raise(AActor *thing)
return true;
}
void P_Thing_SetVelocity(AActor *actor, fixed_t vx, fixed_t vy, fixed_t vz, bool add)
{
if (actor != NULL)
{
if (!add)
{
actor->velx = actor->vely = actor->velz = 0;
if (actor->player != NULL) actor->player->velx = actor->player->vely = 0;
}
actor->velx += vx;
actor->vely += vy;
actor->velz += vz;
if (actor->player != NULL)
{
actor->player->velx += vx;
actor->player->vely += vy;
}
}
}
CCMD (dumpspawnables)
{

View file

@ -816,18 +816,18 @@ static void R_CreatePlayerTranslation (float h, float s, float v, FPlayerSkin *s
// the current one.
if (skin->othergame)
{
memcpy (table->Remap, OtherGameSkinRemap, 256);
memcpy (table->Palette, OtherGameSkinPalette, sizeof(table->Palette));
memcpy (table->Remap, OtherGameSkinRemap, table->NumEntries);
memcpy (table->Palette, OtherGameSkinPalette, sizeof(*table->Palette) * table->NumEntries);
}
else
{
for (i = 0; i < 256; ++i)
for (i = 0; i < table->NumEntries; ++i)
{
table->Remap[i] = i;
}
memcpy(table->Palette, GPalette.BaseColors, sizeof(table->Palette));
memcpy(table->Palette, GPalette.BaseColors, sizeof(*table->Palette) * table->NumEntries);
}
for (i = 1; i < 256; ++i)
for (i = 1; i < table->NumEntries; ++i)
{
table->Palette[i].a = 255;
}

View file

@ -1255,7 +1255,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum);
sfxstart = sfxdata = new BYTE[size];
wlump.Read(sfxdata, size);
SDWORD len = ((SDWORD *)sfxdata)[1];
SDWORD len = LittleLong(((SDWORD *)sfxdata)[1]);
// If the sound is raw, just load it as such.
// Otherwise, try the sound as DMX format.
@ -1272,7 +1272,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
}
else
{
frequency = ((WORD *)sfxdata)[1];
frequency = LittleShort(((WORD *)sfxdata)[1]);
if (frequency == 0)
{
frequency = 11025;

View file

@ -209,6 +209,7 @@ enum
TK_Abs,
TK_Random,
TK_Random2,
TK_FRandom,
TK_LastToken
};

File diff suppressed because it is too large Load diff

View file

@ -147,6 +147,7 @@ std2:
'abs' { RET(TK_Abs); }
'random' { RET(TK_Random); }
'random2' { RET(TK_Random2); }
'frandom' { RET(TK_FRandom); }
L (L|D)* { RET(TK_Identifier); }

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 "1789"
#define ZD_SVN_REVISION_NUMBER 1789
#define ZD_SVN_REVISION_STRING "1799"
#define ZD_SVN_REVISION_NUMBER 1799

View file

@ -131,7 +131,7 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
break;
case BLEND_GREENMAP:
// Skulltags's Guardsphere map
// Skulltag's Guardsphere map
for(i=0;i<count;i++)
{
a = TSrc::A(pin);

View file

@ -81,7 +81,7 @@ static bool CheckIfPatch(FileReader & file)
file.Seek(0, SEEK_SET);
file.Read(data, file.GetLength());
const patch_t * foo = (const patch_t *)data;
const patch_t *foo = (const patch_t *)data;
int height = LittleShort(foo->height);
int width = LittleShort(foo->width);

View file

@ -552,15 +552,15 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
}
else if (def == DEF_Projectile && sc.Compare ("DoomBounce"))
{
defaults->bouncetype = BOUNCE_DoomCompat;
defaults->BounceFlags = BOUNCE_DoomCompat;
}
else if (def == DEF_Projectile && sc.Compare ("HereticBounce"))
{
defaults->bouncetype = BOUNCE_HereticCompat;
defaults->BounceFlags = BOUNCE_HereticCompat;
}
else if (def == DEF_Projectile && sc.Compare ("HexenBounce"))
{
defaults->bouncetype = BOUNCE_HexenCompat;
defaults->BounceFlags = BOUNCE_HexenCompat;
}
else if (def == DEF_Pickup && sc.Compare ("PickupSound"))
{

View file

@ -142,8 +142,6 @@ static FFlagDef ActorFlags[]=
DEFINE_FLAG(MF3, DONTGIB, AActor, flags3),
DEFINE_FLAG(MF3, NOBLOCKMONST, AActor, flags3),
DEFINE_FLAG(MF3, FULLVOLDEATH, AActor, flags3),
DEFINE_FLAG(MF3, CANBOUNCEWATER, AActor, flags3),
DEFINE_FLAG(MF3, NOWALLBOUNCESND, AActor, flags3),
DEFINE_FLAG(MF3, FOILINVUL, AActor, flags3),
DEFINE_FLAG(MF3, NOTELEOTHER, AActor, flags3),
DEFINE_FLAG(MF3, BLOODLESSIMPACT, AActor, flags3),
@ -176,15 +174,12 @@ static FFlagDef ActorFlags[]=
DEFINE_FLAG(MF4, EXTREMEDEATH, AActor, flags4),
DEFINE_FLAG(MF4, NOEXTREMEDEATH, AActor, flags4),
DEFINE_FLAG(MF4, FRIGHTENED, AActor, flags4),
DEFINE_FLAG(MF4, NOBOUNCESOUND, AActor, flags4),
DEFINE_FLAG(MF4, NOSKIN, AActor, flags4),
DEFINE_FLAG(MF4, BOSSDEATH, AActor, flags4),
DEFINE_FLAG(MF5, FASTER, AActor, flags5),
DEFINE_FLAG(MF5, FASTMELEE, AActor, flags5),
DEFINE_FLAG(MF5, NODROPOFF, AActor, flags5),
DEFINE_FLAG(MF5, BOUNCEONACTORS, AActor, flags5),
DEFINE_FLAG(MF5, EXPLODEONWATER, AActor, flags5),
DEFINE_FLAG(MF5, NODAMAGE, AActor, flags5),
DEFINE_FLAG(MF5, BLOODSPLATTER, AActor, flags5),
DEFINE_FLAG(MF5, OLDRADIUSDMG, AActor, flags5),
@ -228,6 +223,19 @@ static FFlagDef ActorFlags[]=
DEFINE_FLAG(RF, FORCEYBILLBOARD, AActor, renderflags),
DEFINE_FLAG(RF, FORCEXYBILLBOARD, AActor, renderflags),
// Bounce flags
DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_Floors, BOUNCEONFLOORS, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_Ceilings, BOUNCEONCEILINGS, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_Actors, ALLOWBOUNCEONACTORS, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_AutoOff, BOUNCEAUTOOFF, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_HereticType, BOUNCELIKEHERETIC, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_CanBounceWater, CANBOUNCEWATER, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_NoWallSound, NOWALLBOUNCESND, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_Quiet, NOBOUNCESOUND, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_AllActors, BOUNCEONACTORS, AActor, BounceFlags),
DEFINE_FLAG2(BOUNCE_ExplodeOnWater, EXPLODEONWATER, AActor, BounceFlags),
// Deprecated flags. Handling must be performed in HandleDeprecatedFlags
DEFINE_DEPRECATED_FLAG(FIREDAMAGE),
DEFINE_DEPRECATED_FLAG(ICEDAMAGE),

View file

@ -359,6 +359,29 @@ static FxExpression *ParseExpression0 (FScanner &sc, const PClass *cls)
return new FxRandom(rng, min, max, sc);
}
else if (sc.CheckToken(TK_FRandom))
{
FRandom *rng;
if (sc.CheckToken('['))
{
sc.MustGetToken(TK_Identifier);
rng = FRandom::StaticFindRNG(sc.String);
sc.MustGetToken(']');
}
else
{
rng = &pr_exrandom;
}
sc.MustGetToken('(');
FxExpression *min = ParseExpressionM (sc, cls);
sc.MustGetToken(',');
FxExpression *max = ParseExpressionM (sc, cls);
sc.MustGetToken(')');
return new FxFRandom(rng, min, max, sc);
}
else if (sc.CheckToken(TK_Random2))
{
FRandom *rng;

View file

@ -540,6 +540,7 @@ public:
class FxRandom : public FxExpression
{
protected:
FRandom * rng;
FxExpression *min, *max;
@ -552,7 +553,18 @@ public:
ExpVal EvalExpression (AActor *self);
};
//==========================================================================
//
//
//
//==========================================================================
class FxFRandom : public FxRandom
{
public:
FxFRandom(FRandom *, FxExpression *mi, FxExpression *ma, const FScriptPosition &pos);
ExpVal EvalExpression (AActor *self);
};
//==========================================================================
//

View file

@ -1661,7 +1661,6 @@ ExpVal FxRandom::EvalExpression (AActor *self)
int minval = min->EvalExpression (self).GetInt();
int maxval = max->EvalExpression (self).GetInt();
if (maxval < minval)
{
swap (maxval, minval);
@ -1676,6 +1675,53 @@ ExpVal FxRandom::EvalExpression (AActor *self)
return val;
}
//==========================================================================
//
//
//
//==========================================================================
FxFRandom::FxFRandom(FRandom *r, FxExpression *mi, FxExpression *ma, const FScriptPosition &pos)
: FxRandom(r, NULL, NULL, pos)
{
if (mi != NULL && ma != NULL)
{
min = mi;
max = ma;
}
}
//==========================================================================
//
//
//
//==========================================================================
ExpVal FxFRandom::EvalExpression (AActor *self)
{
ExpVal val;
val.Type = VAL_Float;
int random = (*rng)(0x40000000);
double frandom = random / double(0x40000000);
if (min != NULL && max != NULL)
{
double minval = min->EvalExpression (self).GetFloat();
double maxval = max->EvalExpression (self).GetFloat();
if (maxval < minval)
{
swap (maxval, minval);
}
val.Float = frandom * (maxval - minval) + minval;
}
else
{
val.Float = frandom;
}
return val;
}
//==========================================================================
//
//

View file

@ -130,13 +130,16 @@ void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int ind
break;
// the bounce flags will set the compatibility bounce modes to remain compatible
case DEPF_HERETICBOUNCE:
defaults->bouncetype = set? BOUNCE_HereticCompat : 0;
defaults->BounceFlags &= ~BOUNCE_TypeMask;
if (set) defaults->BounceFlags |= BOUNCE_HereticCompat;
break;
case DEPF_HEXENBOUNCE:
defaults->bouncetype = set? BOUNCE_HexenCompat : 0;
defaults->BounceFlags &= ~BOUNCE_TypeMask;
if (set) defaults->BounceFlags |= BOUNCE_HexenCompat;
break;
case DEPF_DOOMBOUNCE:
defaults->bouncetype = set? BOUNCE_DoomCompat : 0;
defaults->BounceFlags &= ~BOUNCE_TypeMask;
if (set) defaults->BounceFlags |= BOUNCE_DoomCompat;
break;
case DEPF_PICKUPFLASH:
if (set)
@ -846,9 +849,19 @@ DEFINE_PROPERTY(bloodtype, Sss, Actor)
//==========================================================================
DEFINE_PROPERTY(bouncetype, S, Actor)
{
const char *names[] = { "None", "Doom", "Heretic", "Hexen", "*", "DoomCompat", "HereticCompat", "HexenCompat", NULL };
static const char *names[] = { "None", "Doom", "Heretic", "Hexen", "DoomCompat", "HereticCompat", "HexenCompat", NULL };
static const BYTE flags[] = { BOUNCE_None,
BOUNCE_Doom, BOUNCE_Heretic, BOUNCE_Hexen,
BOUNCE_DoomCompat, BOUNCE_HereticCompat, BOUNCE_HexenCompat };
PROP_STRING_PARM(id, 0);
defaults->bouncetype = MatchString(id, names);
int match = MatchString(id, names);
if (match < 0)
{
I_Error("Unknown bouncetype %s", id);
match = 0;
}
defaults->BounceFlags &= ~(BOUNCE_TypeMask | BOUNCE_UseSeeSound);
defaults->BounceFlags |= flags[match];
}
//==========================================================================

View file

@ -168,11 +168,11 @@ CUSTOM_CVAR (Int, vid_refreshrate, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
}
}
CUSTOM_CVAR (Float, dimamount, 0.2f, CVAR_ARCHIVE)
CUSTOM_CVAR (Float, dimamount, -1.f, CVAR_ARCHIVE)
{
if (self < 0.f)
if (self < 0.f && self != -1.f)
{
self = 0.f;
self = -1.f;
}
else if (self > 1.f)
{
@ -296,14 +296,24 @@ void DCanvas::FlatFill (int left, int top, int right, int bottom, FTexture *src,
void DCanvas::Dim (PalEntry color)
{
PalEntry dimmer;
float amount = dimamount;
float amount;
if (dimamount >= 0)
{
dimmer = PalEntry(dimcolor);
amount = dimamount;
}
else
{
dimmer = gameinfo.dimcolor;
amount = gameinfo.dimamount;
}
if (gameinfo.gametype == GAME_Hexen && gamestate == GS_DEMOSCREEN)
{ // On the Hexen title screen, the default dimming is not
// enough to make the menus readable.
amount = MIN<float> (1.f, amount*2.f);
}
dimmer = PalEntry(dimcolor);
// Add the cvar's dimming on top of the color passed to the function
if (color.a != 0)
{

View file

@ -61,7 +61,7 @@
// Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to
// be able to migrate in FGameConfigFile::DoGlobalSetup().
#define LASTRUNVERSION "208"
#define LASTRUNVERSION "209"
// Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones.

View file

@ -150,6 +150,7 @@ public:
IDirect3DTexture9 *Tex;
D3DCOLOR BorderColor;
bool DoColorSkip;
bool Update();
@ -2033,7 +2034,7 @@ D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb)
count = 256;
// If the palette isn't big enough, then we don't need to
// worry about setting the gamma ramp.
BorderColor = (remap->NumEntries >= 256 - 8) ? ~0 : 0;
DoColorSkip = (remap->NumEntries >= 256 - 8);
}
else
{
@ -2043,8 +2044,9 @@ D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb)
for (pow2count = 1; pow2count < remap->NumEntries; pow2count <<= 1)
{ }
count = pow2count;
BorderColor = 0;
DoColorSkip = false;
}
BorderColor = 0;
RoundedPaletteSize = count;
if (SUCCEEDED(fb->D3DDevice->CreateTexture(count, 1, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Tex, NULL)))
@ -2104,7 +2106,7 @@ bool D3DPal::Update()
pal = Remap->Palette;
// See explanation in UploadPalette() for skipat rationale.
skipat = MIN(Remap->NumEntries, BorderColor != 0 ? 256 - 8 : 256);
skipat = MIN(Remap->NumEntries, DoColorSkip ? 256 - 8 : 256);
for (i = 0; i < skipat; ++i)
{

View file

@ -25,10 +25,21 @@ void DumpCPUInfo(const CPUInfo *cpu)
#include <mmintrin.h>
#include <emmintrin.h>
#ifdef __GNUC__
#if defined(__i386__) && defined(__PIC__)
// %ebx may by the PIC register. */
#define __cpuid(output, func) \
__asm__ __volatile__("xchgl\t%%ebx, %1\n\t" \
"cpuid\n\t" \
"xchgl\t%%ebx, %1\n\t" \
: "=a" ((output)[0]), "=r" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) \
: "a" (func));
#else
#define __cpuid(output, func) __asm__ __volatile__("cpuid" : "=a" ((output)[0]),\
"=b" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) : "a" (func));
#endif
#endif
void CheckCPUID(CPUInfo *cpu)
{
@ -85,9 +96,9 @@ haveid:
// Get vendor ID
__cpuid(foo, 0);
cpu->VendorID[0] = foo[1];
cpu->VendorID[1] = foo[3];
cpu->VendorID[2] = foo[2];
cpu->dwVendorID[0] = foo[1];
cpu->dwVendorID[1] = foo[3];
cpu->dwVendorID[2] = foo[2];
if (foo[1] == MAKE_ID('A','u','t','h') &&
foo[3] == MAKE_ID('e','n','t','i') &&
foo[2] == MAKE_ID('c','A','M','D'))
@ -151,9 +162,9 @@ haveid:
cpu->AMDFamily += (foo[0] >> 20) & 0xFF;
cpu->AMDModel |= (foo[0] >> 12) & 0xF0;
}
cpu->FeatureFlags[3] = foo[3]; // AMD feature flags
}
}
#endif
}

108
src/x86.h
View file

@ -8,12 +8,12 @@ struct CPUInfo // 92 bytes
union
{
char VendorID[16];
DWORD dwVendorID[4];
uint32 dwVendorID[4];
};
union
{
char CPUString[48];
DWORD dwCPUString[12];
uint32 dwCPUString[12];
};
BYTE Stepping;
@ -21,64 +21,64 @@ struct CPUInfo // 92 bytes
BYTE Family;
BYTE Type;
BYTE BrandIndex;
BYTE CLFlush;
BYTE CPUCount;
BYTE APICID;
union
{
struct
{
DWORD bSSE3:1;
DWORD DontCare1:8;
DWORD bSSSE3:1;
DWORD DontCare1a:9;
DWORD bSSE41:1;
DWORD bSSE42:1;
DWORD DontCare2a:11;
BYTE BrandIndex;
BYTE CLFlush;
BYTE CPUCount;
BYTE APICID;
DWORD bFPU:1;
DWORD bVME:1;
DWORD bDE:1;
DWORD bPSE:1;
DWORD bRDTSC:1;
DWORD bMSR:1;
DWORD bPAE:1;
DWORD bMCE:1;
DWORD bCX8:1;
DWORD bAPIC:1;
DWORD bReserved1:1;
DWORD bSEP:1;
DWORD bMTRR:1;
DWORD bPGE:1;
DWORD bMCA:1;
DWORD bCMOV:1;
DWORD bPAT:1;
DWORD bPSE36:1;
DWORD bPSN:1;
DWORD bCFLUSH:1;
DWORD bReserved2:1;
DWORD bDS:1;
DWORD bACPI:1;
DWORD bMMX:1;
DWORD bFXSR:1;
DWORD bSSE:1;
DWORD bSSE2:1;
DWORD bSS:1;
DWORD bHTT:1;
DWORD bTM:1;
DWORD bReserved3:1;
DWORD bPBE:1;
uint32 bSSE3:1;
uint32 DontCare1:8;
uint32 bSSSE3:1;
uint32 DontCare1a:9;
uint32 bSSE41:1;
uint32 bSSE42:1;
uint32 DontCare2a:11;
DWORD DontCare2:22;
DWORD bMMXPlus:1; // AMD's MMX extensions
DWORD bMMXAgain:1; // Just a copy of bMMX above
DWORD DontCare3:6;
DWORD b3DNowPlus:1;
DWORD b3DNow:1;
uint32 bFPU:1;
uint32 bVME:1;
uint32 bDE:1;
uint32 bPSE:1;
uint32 bRDTSC:1;
uint32 bMSR:1;
uint32 bPAE:1;
uint32 bMCE:1;
uint32 bCX8:1;
uint32 bAPIC:1;
uint32 bReserved1:1;
uint32 bSEP:1;
uint32 bMTRR:1;
uint32 bPGE:1;
uint32 bMCA:1;
uint32 bCMOV:1;
uint32 bPAT:1;
uint32 bPSE36:1;
uint32 bPSN:1;
uint32 bCFLUSH:1;
uint32 bReserved2:1;
uint32 bDS:1;
uint32 bACPI:1;
uint32 bMMX:1;
uint32 bFXSR:1;
uint32 bSSE:1;
uint32 bSSE2:1;
uint32 bSS:1;
uint32 bHTT:1;
uint32 bTM:1;
uint32 bReserved3:1;
uint32 bPBE:1;
uint32 DontCare2:22;
uint32 bMMXPlus:1; // AMD's MMX extensions
uint32 bMMXAgain:1; // Just a copy of bMMX above
uint32 DontCare3:6;
uint32 b3DNowPlus:1;
uint32 b3DNow:1;
};
DWORD FeatureFlags[3];
uint32 FeatureFlags[4];
};
BYTE AMDStepping;
@ -95,7 +95,7 @@ struct CPUInfo // 92 bytes
BYTE DataL1Associativity;
BYTE DataL1SizeKB;
};
DWORD AMD_DataL1Info;
uint32 AMD_DataL1Info;
};
};

View file

@ -29,7 +29,6 @@ ACTOR Minotaur 9 native
action native A_MinotaurAtk2();
action native A_MinotaurAtk3();
action native A_MinotaurCharge();
action native A_MntrFloorFire();
action native A_MinotaurLook();
action native A_MinotaurRoam();
action native A_MinotaurChase();

View file

@ -33,6 +33,8 @@ gameinfo
weaponslot = 5, "ZorchPropulsor"
weaponslot = 6, "PhasingZorcher"
weaponslot = 7, "LAZDevice"
dimcolor = "ff d7 00"
dimamount = 0.2
}
skill baby

View file

@ -32,6 +32,8 @@ gameinfo
weaponslot = 5, "RocketLauncher"
weaponslot = 6, "PlasmaRifle"
weaponslot = 7, "BFG9000"
dimcolor = "ff d7 00"
dimamount = 0.2
}
skill baby

View file

@ -33,6 +33,8 @@ gameinfo
weaponslot = 5, "SkullRod"
weaponslot = 6, "PhoenixRod"
weaponslot = 7, "Mace"
dimcolor = "00 00 ff"
dimamount = 0.2
}
skill baby

View file

@ -33,6 +33,8 @@ gameinfo
weaponslot = 2, "FWeapAxe", "CWeapStaff", "MWeapFrost"
weaponslot = 3, "FWeapHammer", "CWeapFlame", "MWeapLightning"
weaponslot = 4, "FWeapQuietus", "CWeapWraithverge", "MWeapBloodscourge"
dimcolor = "00 00 ff"
dimamount = 0.2
}
skill baby

View file

@ -34,6 +34,8 @@ gameinfo
weaponslot = 6, "FlameThrower"
weaponslot = 7, "Mauler2", "Mauler"
weaponslot = 8, "Sigil"
dimcolor = "ff d7 00"
dimamount = 0.2
}
skill baby