Update to ZDoom r1931:

- Fixed: When giving completely new ammo, the backpack did not clamp the
  amount given to the ammo's max amount.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@573 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-10-24 06:56:15 +00:00
parent a24b6a2fdd
commit 43d72064a7
7 changed files with 68 additions and 18 deletions

View file

@ -1569,7 +1569,7 @@ void ABackpackItem::Serialize (FArchive &arc)
AInventory *ABackpackItem::CreateCopy (AActor *other)
{
// Find every unique type of ammo. Give it to the player if
// he doesn't have it already, and double it's maximum capacity.
// he doesn't have it already, and double its maximum capacity.
for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{
const PClass *type = PClass::m_Types[i];
@ -1588,7 +1588,14 @@ AInventory *ABackpackItem::CreateCopy (AActor *other)
{ // The player did not have the ammo. Add it.
ammo = static_cast<AAmmo *>(Spawn (type, 0, 0, 0, NO_REPLACE));
ammo->Amount = bDepleted ? 0 : amount;
if (ammo->BackpackMaxAmount > ammo->MaxAmount) ammo->MaxAmount = ammo->BackpackMaxAmount;
if (ammo->BackpackMaxAmount > ammo->MaxAmount)
{
ammo->MaxAmount = ammo->BackpackMaxAmount;
}
if (ammo->Amount > ammo->MaxAmount)
{
ammo->Amount = ammo->MaxAmount;
}
ammo->AttachToOwner (other);
}
else

View file

@ -717,7 +717,8 @@ void GLWall::CheckTexturePosition()
lolft.v -= sub;
lorgt.v -= sub;
if (uplft.v >= 0.f && uprgt.v >= 0.f && lolft.v <= 1.f && lorgt.v <= 1.f)
if ((uplft.v == 0.f && uprgt.v == 0.f && lolft.v <= 1.f && lorgt.v <= 1.f) ||
(uplft.v >= 0.f && uprgt.v >= 0.f && lolft.v == 1.f && lorgt.v == 1.f))
{
flags|=GLT_CLAMPY;
}

View file

@ -42,6 +42,7 @@
#include "sbar.h"
#include "gi.h"
#include "cmdlib.h"
#include "c_dispatch.h"
#include "stats.h"
#include "r_main.h"
#include "templates.h"
@ -989,3 +990,42 @@ void FMaterial::DeleteAll()
mMaterials.Clear();
mMaterials.ShrinkToFit();
}
//==========================================================================
//
// Prints some texture info
//
//==========================================================================
int FGLTexture::Dump(int i)
{
int cnt = 0;
int lump = tex->GetSourceLump();
Printf(PRINT_LOG, "Texture '%s' (Index %d, Lump %d, Name '%s'):\n", tex->Name, i, lump, Wads.GetLumpFullName(lump));
if (hirestexture) Printf(PRINT_LOG, "\tHirestexture\n");
if (glpatch) Printf(PRINT_LOG, "\tPatch\n"),cnt++;
if (gltexture[0]) Printf(PRINT_LOG, "\tTexture (x:no, y:no )\n"),cnt++;
if (gltexture[1]) Printf(PRINT_LOG, "\tTexture (x:yes, y:no )\n"),cnt++;
if (gltexture[2]) Printf(PRINT_LOG, "\tTexture (x:no, y:yes)\n"),cnt++;
if (gltexture[3]) Printf(PRINT_LOG, "\tTexture (x:yes, y:yes)\n"),cnt++;
if (gltexture[4]) Printf(PRINT_LOG, "\tTexture precache\n"),cnt++;
return cnt;
}
CCMD(textureinfo)
{
int cnth = 0, cntt = 0, pix = 0;
for(int i=0; i<TexMan.NumTextures(); i++)
{
FTexture *tex = TexMan.ByIndex(i);
FGLTexture *systex = tex->gl_info.SystemTexture;
if (systex != NULL)
{
int cnt = systex->Dump(i);
cnth+=cnt;
cntt++;
pix += cnt * tex->GetWidth() * tex->GetHeight();
}
}
Printf(PRINT_LOG, "%d system textures, %d hardware textures, %d pixels\n", cntt, cnth, pix);
}

View file

@ -105,6 +105,7 @@ public:
unsigned char * CreateTexBuffer(int cm, int translation, int & w, int & h, bool expand, bool allowhires, int warp);
void Clean(bool all);
int Dump(int i);
};

View file

@ -834,6 +834,6 @@ void R_UpdateAnimations (DWORD mstime)
// Scroll the sky
double ms = (double)mstime * FRACUNIT;
sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetWidth() << FRACBITS)));
sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetWidth() << FRACBITS)));
sky1pos = fixed_t(fmod (ms * level.skyspeed1, double(TexMan[sky1texture]->GetScaledWidth() << FRACBITS)));
sky2pos = fixed_t(fmod (ms * level.skyspeed2, double(TexMan[sky2texture]->GetScaledWidth() << FRACBITS)));
}

View file

@ -764,17 +764,16 @@ static int skycolplace;
// Get a column of sky when there is only one sky texture.
static const BYTE *R_GetOneSkyColumn (FTexture *fronttex, int x)
{
angle_t column = MulScale16 (frontxScale, viewangle + xtoviewangle[x]);
return fronttex->GetColumn ((((column^skyflip) >> sky1shift) + frontpos) >> FRACBITS, NULL);
angle_t column = (viewangle + xtoviewangle[x]) ^ skyflip;
return fronttex->GetColumn (MulScale32((column >> sky1shift) + frontpos, frontxScale), NULL);
}
// Get a column of sky when there are two overlapping sky textures
static const BYTE *R_GetTwoSkyColumns (FTexture *fronttex, int x)
{
DWORD ang = (viewangle + xtoviewangle[x])^skyflip;
DWORD angle1 = (((DWORD)MulScale16 (frontxScale, ang) >> sky1shift) + frontpos) >> FRACBITS;
DWORD angle2 = (((DWORD)MulScale16 (backxScale, ang) >> sky2shift) + backpos) >> FRACBITS;
DWORD ang = (viewangle + xtoviewangle[x]) ^ skyflip;
DWORD angle1 = (DWORD)MulScale32((ang >> sky1shift) + frontpos, frontxScale);
DWORD angle2 = (DWORD)MulScale32((ang >> sky2shift) + backpos, backxScale);
// Check if this column has already been built. If so, there's
// no reason to waste time building it again.
@ -825,7 +824,6 @@ static void R_DrawSky (visplane_t *pl)
dc_iscale = skyiscale >> skystretch;
clearbuf (swall+pl->minx, pl->maxx-pl->minx+1, dc_iscale<<2);
rw_offset = frontpos;
if (MirrorFlags & RF_XFLIP)
{
@ -1328,6 +1326,11 @@ void R_DrawSkyPlane (visplane_t *pl)
skyflip = l->args[2] ? 0u : ~0u;
}
}
// frontpos = FixedMul(frontpos, frontskytex->xScale/2);
if (backskytex != NULL)
{
backpos = FixedMul(backpos, backskytex->xScale);
}
bool fakefixed = false;
if (fixedcolormap)

View file

@ -115,11 +115,9 @@ void R_InitSkyMap ()
}
// The (standard Doom) sky map is 256*128*4 maps.
sky1shift = 22+skystretch-16;
sky2shift = 22+skystretch-16;
if (skytex1->WidthBits >= 9)
sky1shift -= skystretch;
if (skytex2->WidthBits >= 9)
sky2shift -= skystretch;
int swidth = skytex1->GetScaledWidth();
sky1shift = 22 - 16 + (skystretch && swidth < 512) - (swidth >= 1024 && skytex1->xScale >= 4*FRACUNIT);
swidth = skytex2->GetScaledWidth();
sky2shift = 22 - 16 + (skystretch && swidth < 512) - (swidth >= 1024 && skytex2->xScale >= 4*FRACUNIT);
}