mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- 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:
parent
4999c3b4aa
commit
06630b0fee
6 changed files with 39 additions and 33 deletions
|
@ -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
|
September 8, 2006
|
||||||
- Fixed: Weapons did not give you double ammo at baby and nightmare skills.
|
- 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
|
- Fixed: SetTexture() in p_setup.cpp assumed that all color values were
|
||||||
|
|
|
@ -129,7 +129,7 @@ DehInfo deh =
|
||||||
{
|
{
|
||||||
100, // .StartHealth
|
100, // .StartHealth
|
||||||
50, // .StartBullets
|
50, // .StartBullets
|
||||||
-1, // .MaxHealth
|
100, // .MaxHealth
|
||||||
200, // .MaxArmor
|
200, // .MaxArmor
|
||||||
1, // .GreenAC
|
1, // .GreenAC
|
||||||
2, // .BlueAC
|
2, // .BlueAC
|
||||||
|
@ -1649,9 +1649,9 @@ static int PatchMisc (int dummy)
|
||||||
|
|
||||||
AHealth *health;
|
AHealth *health;
|
||||||
health = static_cast<AHealth *> (GetDefaultByName ("HealthBonus"));
|
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"));
|
health = static_cast<AHealth *> (GetDefaultByName ("Soulsphere"));
|
||||||
|
@ -2542,10 +2542,6 @@ void FinishDehPatch ()
|
||||||
DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
|
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.
|
// Now that all Dehacked patches have been processed, it's okay to free StateMap.
|
||||||
if (StateMap != NULL)
|
if (StateMap != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1426,6 +1426,7 @@ AActor *P_CheckOnmobj (AActor *thing)
|
||||||
oldz = thing->z;
|
oldz = thing->z;
|
||||||
P_FakeZMovement (thing);
|
P_FakeZMovement (thing);
|
||||||
good = P_TestMobjZ (thing, false);
|
good = P_TestMobjZ (thing, false);
|
||||||
|
|
||||||
thing->z = oldz;
|
thing->z = oldz;
|
||||||
|
|
||||||
return good ? NULL : onmobj;
|
return good ? NULL : onmobj;
|
||||||
|
|
|
@ -838,18 +838,18 @@ void APlayerPawn::PlayIdle ()
|
||||||
|
|
||||||
void APlayerPawn::PlayRunning ()
|
void APlayerPawn::PlayRunning ()
|
||||||
{
|
{
|
||||||
if (state == SpawnState)
|
if (InStateSequence(state, SpawnState) && SeeState != NULL)
|
||||||
SetState (SeeState);
|
SetState (SeeState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APlayerPawn::PlayAttacking ()
|
void APlayerPawn::PlayAttacking ()
|
||||||
{
|
{
|
||||||
SetState (MissileState);
|
if (MissileState != NULL) SetState (MissileState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APlayerPawn::PlayAttacking2 ()
|
void APlayerPawn::PlayAttacking2 ()
|
||||||
{
|
{
|
||||||
SetState (MeleeState);
|
if (MeleeState != NULL) SetState (MeleeState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APlayerPawn::ThrowPoisonBag ()
|
void APlayerPawn::ThrowPoisonBag ()
|
||||||
|
|
|
@ -388,8 +388,8 @@ void FTextureManager::LoadHiresTex()
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
// Replace the entire texture and adjust the scaling and offset factors.
|
||||||
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetWidth();
|
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetWidth();
|
||||||
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetHeight();
|
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetHeight();
|
||||||
newtex->LeftOffset = Scale(oldtex->LeftOffset, newtex->ScaleX, 8);
|
newtex->LeftOffset = MulScale3(oldtex->LeftOffset, newtex->ScaleX);
|
||||||
newtex->TopOffset = Scale(oldtex->TopOffset, newtex->ScaleY, 8);
|
newtex->TopOffset = MulScale3(oldtex->TopOffset, newtex->ScaleY);
|
||||||
ReplaceTexture(tex, newtex, true);
|
ReplaceTexture(tex, newtex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,8 +417,8 @@ void FTextureManager::LoadHiresTex()
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
// Replace the entire texture and adjust the scaling and offset factors.
|
||||||
newtex->ScaleX = 8 * width / newtex->GetWidth();
|
newtex->ScaleX = 8 * width / newtex->GetWidth();
|
||||||
newtex->ScaleY = 8 * height / newtex->GetHeight();
|
newtex->ScaleY = 8 * height / newtex->GetHeight();
|
||||||
newtex->LeftOffset = Scale(newtex->LeftOffset, newtex->ScaleX, 8);
|
newtex->LeftOffset = MulScale3(newtex->LeftOffset, newtex->ScaleX);
|
||||||
newtex->TopOffset = Scale(newtex->TopOffset, newtex->ScaleY, 8);
|
newtex->TopOffset = MulScale3(newtex->TopOffset, newtex->ScaleY);
|
||||||
memcpy(newtex->Name, src, sizeof(newtex->Name));
|
memcpy(newtex->Name, src, sizeof(newtex->Name));
|
||||||
|
|
||||||
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override);
|
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override);
|
||||||
|
|
|
@ -71,16 +71,19 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int texwidth = img->GetScaledWidth();
|
||||||
|
int texheight = img->GetScaledHeight();
|
||||||
|
|
||||||
int windowleft = 0;
|
int windowleft = 0;
|
||||||
int windowright = img->GetWidth();
|
int windowright = texwidth;
|
||||||
int dclip = this->GetHeight();
|
int dclip = this->GetHeight();
|
||||||
int uclip = 0;
|
int uclip = 0;
|
||||||
int lclip = 0;
|
int lclip = 0;
|
||||||
int rclip = this->GetWidth();
|
int rclip = this->GetWidth();
|
||||||
int destwidth = windowright << FRACBITS;
|
int destwidth = windowright << FRACBITS;
|
||||||
int destheight = img->GetHeight() << FRACBITS;
|
int destheight = texheight << FRACBITS;
|
||||||
int top = img->TopOffset;
|
int top = img->GetScaledTopOffset();
|
||||||
int left = img->LeftOffset;
|
int left = img->GetScaledLeftOffset();
|
||||||
fixed_t alpha = FRACUNIT;
|
fixed_t alpha = FRACUNIT;
|
||||||
int fillcolor = -1;
|
int fillcolor = -1;
|
||||||
const BYTE *translation = NULL;
|
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));
|
x0 = (x0 - 160*FRACUNIT) * CleanXfac + (Width * (FRACUNIT/2));
|
||||||
y0 = (y0 - 100*FRACUNIT) * CleanYfac + (Height * (FRACUNIT/2));
|
y0 = (y0 - 100*FRACUNIT) * CleanYfac + (Height * (FRACUNIT/2));
|
||||||
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
|
destwidth = texwidth * CleanXfac * FRACUNIT;
|
||||||
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
|
destheight = texheight * CleanYfac * FRACUNIT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -146,8 +149,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
boolval = va_arg (tags, BOOL);
|
boolval = va_arg (tags, BOOL);
|
||||||
if (boolval)
|
if (boolval)
|
||||||
{
|
{
|
||||||
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
|
destwidth = texwidth * CleanXfac * FRACUNIT;
|
||||||
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
|
destheight = texheight * CleanYfac * FRACUNIT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -176,8 +179,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
y0 *= CleanYfac;
|
y0 *= CleanYfac;
|
||||||
if (ybot)
|
if (ybot)
|
||||||
y0 = Height * FRACUNIT + y0;
|
y0 = Height * FRACUNIT + y0;
|
||||||
destwidth = img->GetWidth() * CleanXfac * FRACUNIT;
|
destwidth = texwidth * CleanXfac * FRACUNIT;
|
||||||
destheight = img->GetHeight() * CleanYfac * FRACUNIT;
|
destheight = texheight * CleanYfac * FRACUNIT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -230,16 +233,16 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
case DTA_CenterOffset:
|
case DTA_CenterOffset:
|
||||||
if (va_arg (tags, int))
|
if (va_arg (tags, int))
|
||||||
{
|
{
|
||||||
left = img->GetWidth() / 2;
|
left = texwidth / 2;
|
||||||
top = img->GetHeight() / 2;
|
top = texheight / 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTA_CenterBottomOffset:
|
case DTA_CenterBottomOffset:
|
||||||
if (va_arg (tags, int))
|
if (va_arg (tags, int))
|
||||||
{
|
{
|
||||||
left = img->GetWidth() / 2;
|
left = texwidth / 2;
|
||||||
top = img->GetHeight();
|
top = texheight;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -395,8 +398,8 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
BYTE *destorgsave = dc_destorg;
|
BYTE *destorgsave = dc_destorg;
|
||||||
dc_destorg = screen->GetBuffer();
|
dc_destorg = screen->GetBuffer();
|
||||||
|
|
||||||
x0 -= Scale (left, destwidth, img->GetWidth());
|
x0 -= Scale (left, destwidth, texwidth);
|
||||||
y0 -= Scale (top, destheight, img->GetHeight());
|
y0 -= Scale (top, destheight, texheight);
|
||||||
|
|
||||||
if (mode != DontDraw)
|
if (mode != DontDraw)
|
||||||
{
|
{
|
||||||
|
@ -461,12 +464,12 @@ void STACK_ARGS DCanvas::DrawTexture (FTexture *img, int x0, int y0, DWORD tags_
|
||||||
}
|
}
|
||||||
|
|
||||||
dc_x = x0 >> FRACBITS;
|
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;
|
dc_x += (windowleft * xscale) >> FRACBITS;
|
||||||
frac += windowleft << FRACBITS;
|
frac += windowleft << FRACBITS;
|
||||||
x2 -= ((img->GetWidth() - windowright) * xscale) >> FRACBITS;
|
x2 -= ((texwidth - windowright) * xscale) >> FRACBITS;
|
||||||
}
|
}
|
||||||
if (dc_x < lclip)
|
if (dc_x < lclip)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue