- Fixed: Weapons did not give you double ammo at baby and nightmare skills.

- Fixed: SetTexture() in p_setup.cpp assumed that all color values were
  six characters. Although this was the intended way to specify colors,
  earlier versions did no error checking, so other lengths worked too.
- Fixed: FPatchTexture waited until MakeTexture() to call CalcBitSize(),
  so the width and height bit sizes weren't available when using it as a
  source for a warp texture.
- Fixed: R_InitSkyMap() should only warn about two sky textures not being
  the same height when they are used as part of a double sky.
- Added a NULL state check in AActor::Tick() before advancing the current
  state. Note that this should not happen, so there's an assert there for
  the debug build as well as a regular check for the release build.


SVN r324 (trunk)
This commit is contained in:
Randy Heit 2006-09-09 01:14:13 +00:00
parent 05265c3213
commit 4999c3b4aa
8 changed files with 52 additions and 17 deletions

View file

@ -1,3 +1,17 @@
September 8, 2006
- Fixed: Weapons did not give you double ammo at baby and nightmare skills.
- Fixed: SetTexture() in p_setup.cpp assumed that all color values were
six characters. Although this was the intended way to specify colors,
earlier versions did no error checking, so other lengths worked too.
- Fixed: FPatchTexture waited until MakeTexture() to call CalcBitSize(),
so the width and height bit sizes weren't available when using it as a
source for a warp texture.
- Fixed: R_InitSkyMap() should only warn about two sky textures not being
the same height when they are used as part of a double sky.
- Added a NULL state check in AActor::Tick() before advancing the current
state. Note that this should not happen, so there's an assert there for
the debug build as well as a regular check for the release build.
September 1, 2006 September 1, 2006
- Version bump to 2.1.5. - Version bump to 2.1.5.
- Fixed: P_LoadSegs() checked for invalid vertices too late. - Fixed: P_LoadSegs() checked for invalid vertices too late.

View file

@ -79,7 +79,7 @@ bool AAmmo::HandlePickup (AInventory *item)
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife)) if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{ {
if (gameinfo.gametype & (GAME_Doom|GAME_Strife)) if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
receiving <<= 1; receiving += receiving;
else else
receiving += receiving >> 1; receiving += receiving >> 1;
} }

View file

@ -202,6 +202,7 @@ AInventory *AWeapon::CreateTossable ()
{ {
SisterWeapon->Destroy (); SisterWeapon->Destroy ();
} }
// To avoid exploits, the tossed weapon must not have any ammo.
copy->AmmoGive1 = 0; copy->AmmoGive1 = 0;
copy->AmmoGive2 = 0; copy->AmmoGive2 = 0;
} }
@ -250,6 +251,14 @@ AAmmo *AWeapon::AddAmmo (AActor *other, const PClass *ammotype, int amount)
{ {
return NULL; return NULL;
} }
// extra ammo in baby mode and nightmare mode
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
amount += amount;
else
amount += amount >> 1;
}
ammo = static_cast<AAmmo *>(other->FindInventory (ammotype)); ammo = static_cast<AAmmo *>(other->FindInventory (ammotype));
if (ammo == NULL) if (ammo == NULL)
{ {
@ -280,6 +289,14 @@ bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount)
{ {
if (ammo != NULL && ammo->Amount < ammo->MaxAmount) if (ammo != NULL && ammo->Amount < ammo->MaxAmount)
{ {
// extra ammo in baby mode and nightmare mode
if (gameskill == sk_baby || (gameskill == sk_nightmare && gameinfo.gametype != GAME_Strife))
{
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
amount += amount;
else
amount += amount >> 1;
}
ammo->Amount += amount; ammo->Amount += amount;
if (ammo->Amount > ammo->MaxAmount) if (ammo->Amount > ammo->MaxAmount)
{ {

View file

@ -2479,6 +2479,13 @@ void AActor::Tick ()
AActor *onmo; AActor *onmo;
int i; int i;
assert (state != NULL);
if (state == NULL)
{
Destroy();
return;
}
PrevX = x; PrevX = x;
PrevY = y; PrevY = y;
PrevZ = z; PrevZ = z;
@ -2895,6 +2902,12 @@ void AActor::Tick ()
// of 0 tics work as expected. // of 0 tics work as expected.
if (tics <= 0) if (tics <= 0)
{ {
assert (state != NULL);
if (state == NULL)
{
Destroy();
return;
}
if (!SetState (state->GetNextState())) if (!SetState (state->GetNextState()))
return; // freed itself return; // freed itself
} }

View file

@ -428,7 +428,7 @@ static void SetTextureNoErr (short *texture, DWORD *color, char *name8, bool *va
name2[8] = 0; name2[8] = 0;
*color = strtoul (name2, &stop, 16); *color = strtoul (name2, &stop, 16);
*texture = 0; *texture = 0;
*validcolor = (*stop == 0) && (stop == name2 + 6); *validcolor = (*stop == 0) && (stop >= name2 + 2) && (stop <= name2 + 6);
} }
else else
{ {

View file

@ -79,7 +79,7 @@ void R_InitSkyMap ()
if (skytex1 == NULL) if (skytex1 == NULL)
return; return;
if (skytex1->GetHeight() != skytex2->GetHeight()) if ((level.flags & LEVEL_DOUBLESKY) && skytex1->GetHeight() != skytex2->GetHeight())
{ {
Printf (TEXTCOLOR_BOLD "Both sky textures must be the same height." TEXTCOLOR_NORMAL "\n"); Printf (TEXTCOLOR_BOLD "Both sky textures must be the same height." TEXTCOLOR_NORMAL "\n");
sky2texture = sky1texture; sky2texture = sky1texture;

View file

@ -102,6 +102,7 @@ FPatchTexture::FPatchTexture (int lumpnum, patch_t * header)
Height = header->height; Height = header->height;
LeftOffset = header->leftoffset; LeftOffset = header->leftoffset;
TopOffset = header->topoffset; TopOffset = header->topoffset;
CalcBitSize ();
} }
FPatchTexture::~FPatchTexture () FPatchTexture::~FPatchTexture ()
@ -185,15 +186,6 @@ void FPatchTexture::MakeTexture ()
Printf (PRINT_BOLD, "Patch %s is too big.\n", Name); Printf (PRINT_BOLD, "Patch %s is too big.\n", Name);
} }
if (Width == 0xFFFF)
{
Width = LittleShort(patch->width);
Height = LittleShort(patch->height);
LeftOffset = LittleShort(patch->leftoffset);
TopOffset = LittleShort(patch->topoffset);
}
CalcBitSize ();
// Add a little extra space at the end if the texture's height is not // Add a little extra space at the end if the texture's height is not
// a power of 2, in case somebody accidentally makes it repeat vertically. // a power of 2, in case somebody accidentally makes it repeat vertically.
int numpix = Width * Height + (1 << HeightBits) - Height; int numpix = Width * Height + (1 << HeightBits) - Height;

View file

@ -214,9 +214,10 @@ void FWarp2Texture::MakeTexture (DWORD time)
} }
DWORD timebase = time * 40 / 28; DWORD timebase = time * 40 / 28;
for (x = xsize-1; x >= 0; x--) for (x = 0; x < xsize; ++x)
{ {
for (y = ysize-1; y >= 0; y--) BYTE *dest = Pixels + (x << ybits);
for (y = 0; y < ysize; ++y)
{ {
int xt = (x + 128 int xt = (x + 128
+ ((finesine[(y*128 + timebase*5 + 900) & FINEMASK]*2)>>FRACBITS) + ((finesine[(y*128 + timebase*5 + 900) & FINEMASK]*2)>>FRACBITS)
@ -224,9 +225,7 @@ void FWarp2Texture::MakeTexture (DWORD time)
int yt = (y + 128 int yt = (y + 128
+ ((finesine[(y*128 + timebase*3 + 700) & FINEMASK]*2)>>FRACBITS) + ((finesine[(y*128 + timebase*3 + 700) & FINEMASK]*2)>>FRACBITS)
+ ((finesine[(x*256 + timebase*4 + 1200) & FINEMASK]*2)>>FRACBITS)) & ymask; + ((finesine[(x*256 + timebase*4 + 1200) & FINEMASK]*2)>>FRACBITS)) & ymask;
const BYTE *source = otherpix + (xt << ybits) + yt; *dest++ = otherpix[(xt << ybits) + yt];
BYTE *dest = Pixels + (x << ybits) + y;
*dest = *source;
} }
} }
} }