- Added support for scaled textures to DCanvas::DrawTexture.

- Changed deh.MaxHealth use to be consistent with other source ports.
- Added NULL pointer checks to APlayerPawn's state set functions. If these
  remove the player from the game a crash is the inevitable result.


SVN r325 (trunk)
This commit is contained in:
Christoph Oelckers 2006-09-09 08:55:47 +00:00
parent 4999c3b4aa
commit 06630b0fee
6 changed files with 39 additions and 33 deletions

View file

@ -1,3 +1,9 @@
September 9, 2006 (Changes by Graf Zahl)
- Added support for scaled textures to DCanvas::DrawTexture.
- Changed deh.MaxHealth use to be consistent with other source ports.
- Added NULL pointer checks to APlayerPawn's state set functions. If these
remove the player from the game a crash is the inevitable result.
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

View file

@ -129,7 +129,7 @@ DehInfo deh =
{
100, // .StartHealth
50, // .StartBullets
-1, // .MaxHealth
100, // .MaxHealth
200, // .MaxArmor
1, // .GreenAC
2, // .BlueAC
@ -1649,9 +1649,9 @@ static int PatchMisc (int dummy)
AHealth *health;
health = static_cast<AHealth *> (GetDefaultByName ("HealthBonus"));
if (deh.MaxHealth != -1 && health!=NULL)
if (health!=NULL)
{
health->MaxAmount = deh.MaxHealth;
health->MaxAmount = 2 * deh.MaxHealth;
}
health = static_cast<AHealth *> (GetDefaultByName ("Soulsphere"));
@ -2542,10 +2542,6 @@ void FinishDehPatch ()
DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
}
// Since deh.MaxHealth was used incorrectly this can only be set
// after finishing with the DEH stuff.
if (deh.MaxHealth == -1) deh.MaxHealth = 100;
// Now that all Dehacked patches have been processed, it's okay to free StateMap.
if (StateMap != NULL)
{

View file

@ -1426,6 +1426,7 @@ AActor *P_CheckOnmobj (AActor *thing)
oldz = thing->z;
P_FakeZMovement (thing);
good = P_TestMobjZ (thing, false);
thing->z = oldz;
return good ? NULL : onmobj;

View file

@ -838,18 +838,18 @@ void APlayerPawn::PlayIdle ()
void APlayerPawn::PlayRunning ()
{
if (state == SpawnState)
if (InStateSequence(state, SpawnState) && SeeState != NULL)
SetState (SeeState);
}
void APlayerPawn::PlayAttacking ()
{
SetState (MissileState);
if (MissileState != NULL) SetState (MissileState);
}
void APlayerPawn::PlayAttacking2 ()
{
SetState (MeleeState);
if (MeleeState != NULL) SetState (MeleeState);
}
void APlayerPawn::ThrowPoisonBag ()

View file

@ -388,8 +388,8 @@ void FTextureManager::LoadHiresTex()
// Replace the entire texture and adjust the scaling and offset factors.
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetWidth();
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetHeight();
newtex->LeftOffset = Scale(oldtex->LeftOffset, newtex->ScaleX, 8);
newtex->TopOffset = Scale(oldtex->TopOffset, newtex->ScaleY, 8);
newtex->LeftOffset = MulScale3(oldtex->LeftOffset, newtex->ScaleX);
newtex->TopOffset = MulScale3(oldtex->TopOffset, newtex->ScaleY);
ReplaceTexture(tex, newtex, true);
}
}
@ -417,8 +417,8 @@ void FTextureManager::LoadHiresTex()
// Replace the entire texture and adjust the scaling and offset factors.
newtex->ScaleX = 8 * width / newtex->GetWidth();
newtex->ScaleY = 8 * height / newtex->GetHeight();
newtex->LeftOffset = Scale(newtex->LeftOffset, newtex->ScaleX, 8);
newtex->TopOffset = Scale(newtex->TopOffset, newtex->ScaleY, 8);
newtex->LeftOffset = MulScale3(newtex->LeftOffset, newtex->ScaleX);
newtex->TopOffset = MulScale3(newtex->TopOffset, newtex->ScaleY);
memcpy(newtex->Name, src, sizeof(newtex->Name));
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override);

View file

@ -71,16 +71,19 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
return;
}
int texwidth = img->GetScaledWidth();
int texheight = img->GetScaledHeight();
int windowleft = 0;
int windowright = img->GetWidth();
int windowright = texwidth;
int dclip = this->GetHeight();
int uclip = 0;
int lclip = 0;
int rclip = this->GetWidth();
int destwidth = windowright << FRACBITS;
int destheight = img->GetHeight() << FRACBITS;
int top = img->TopOffset;
int left = img->LeftOffset;
int destheight = texheight << FRACBITS;
int top = img->GetScaledTopOffset();
int left = img->GetScaledLeftOffset();
fixed_t alpha = FRACUNIT;
int fillcolor = -1;
const BYTE *translation = NULL;
@ -137,8 +140,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
{
x0 = (x0 - 160*FRACUNIT) * CleanXfac + (Width * (FRACUNIT/2));
y0 = (y0 - 100*FRACUNIT) * CleanYfac + (Height * (FRACUNIT/2));
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
destwidth = texwidth * CleanXfac * FRACUNIT;
destheight = texheight * CleanYfac * FRACUNIT;
}
break;
@ -146,8 +149,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
boolval = va_arg (tags, BOOL);
if (boolval)
{
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
destwidth = texwidth * CleanXfac * FRACUNIT;
destheight = texheight * CleanYfac * FRACUNIT;
}
break;
@ -176,8 +179,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
y0 *= CleanYfac;
if (ybot)
y0 = Height * FRACUNIT + y0;
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
destwidth = texwidth * CleanXfac * FRACUNIT;
destheight = texheight * CleanYfac * FRACUNIT;
}
else
{
@ -230,16 +233,16 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
case DTA_CenterOffset:
if (va_arg (tags, int))
{
left = img->GetWidth() / 2;
top = img->GetHeight() / 2;
left = texwidth / 2;
top = texheight / 2;
}
break;
case DTA_CenterBottomOffset:
if (va_arg (tags, int))
{
left = img->GetWidth() / 2;
top = img->GetHeight();
left = texwidth / 2;
top = texheight;
}
break;
@ -395,8 +398,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
BYTE *destorgsave = dc_destorg;
dc_destorg = screen->GetBuffer();
x0 -= Scale (left, destwidth, img->GetWidth());
y0 -= Scale (top, destheight, img->GetHeight());
x0 -= Scale (left, destwidth, texwidth);
y0 -= Scale (top, destheight, texheight);
if (mode != DontDraw)
{
@ -461,12 +464,12 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
}
dc_x = x0 >> FRACBITS;
if (windowleft > 0 || windowright < img->GetWidth())
if (windowleft > 0 || windowright < texwidth)
{
fixed_t xscale = destwidth / img->GetWidth();
fixed_t xscale = destwidth / texwidth;
dc_x += (windowleft * xscale) >> FRACBITS;
frac += windowleft << FRACBITS;
x2 -= ((img->GetWidth() - windowright) * xscale) >> FRACBITS;
x2 -= ((texwidth - windowright) * xscale) >> FRACBITS;
}
if (dc_x < lclip)
{