mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Fixed: Hires texture replacements and auto-scaled flats require the
bWorldPanning flag. Also added some NULL pointer checks to the hires texture loading code. - Added Sector_SetFloorScale2 and Sector_SetCeilingScale2 line specials. They are mostly the same as Sector_Set*Scale but take fixed point parameters. This makes them easier to use and more precise than the old ones which offered very small fractional precision. - Changed Thing_Deactivate so that passing a tid of 0 deactivates the calling actor. - Added MeansOfDeath parameter to DamageThing. SVN r350 (trunk)
This commit is contained in:
parent
2c2261884c
commit
6fe9c98b47
5 changed files with 137 additions and 53 deletions
|
@ -1,3 +1,15 @@
|
|||
October 5, 2006 (Changes by Graf Zahl)
|
||||
- Fixed: Hires texture replacements and auto-scaled flats require the
|
||||
bWorldPanning flag. Also added some NULL pointer checks to the
|
||||
hires texture loading code.
|
||||
- Added Sector_SetFloorScale2 and Sector_SetCeilingScale2 line specials.
|
||||
They are mostly the same as Sector_Set*Scale but take fixed point parameters.
|
||||
This makes them easier to use and more precise than the old ones which
|
||||
offered very small fractional precision.
|
||||
- Changed Thing_Deactivate so that passing a tid of 0 deactivates the calling
|
||||
actor.
|
||||
- Added MeansOfDeath parameter to DamageThing.
|
||||
|
||||
October 4, 2006
|
||||
- Added alias parameter substitution. Instances of %x in the alias command
|
||||
string will be replaced with parameter x when the alias is executed.
|
||||
|
|
|
@ -916,7 +916,7 @@ FUNC(LS_Thing_ChangeTID)
|
|||
}
|
||||
|
||||
FUNC(LS_DamageThing)
|
||||
// DamageThing (damage)
|
||||
// DamageThing (damage, mod)
|
||||
{
|
||||
if (it)
|
||||
{
|
||||
|
@ -935,11 +935,11 @@ FUNC(LS_DamageThing)
|
|||
}
|
||||
else if (arg0 > 0)
|
||||
{
|
||||
P_DamageMobj (it, NULL, NULL, arg0, MOD_UNKNOWN);
|
||||
P_DamageMobj (it, NULL, NULL, arg0, arg1);
|
||||
}
|
||||
else
|
||||
{ // If zero damage, guarantee a kill
|
||||
P_DamageMobj (it, NULL, NULL, 1000000, MOD_UNKNOWN);
|
||||
P_DamageMobj (it, NULL, NULL, 1000000, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1013,22 +1013,31 @@ FUNC(LS_Thing_Activate)
|
|||
FUNC(LS_Thing_Deactivate)
|
||||
// Thing_Deactivate (tid)
|
||||
{
|
||||
AActor *actor;
|
||||
FActorIterator iterator (arg0);
|
||||
int count = 0;
|
||||
|
||||
actor = iterator.Next ();
|
||||
while (actor)
|
||||
if (arg0 != 0)
|
||||
{
|
||||
// Actor might removes itself as part of deactivation, so get next
|
||||
// one before we activate it.
|
||||
AActor *temp = iterator.Next ();
|
||||
actor->Deactivate (it);
|
||||
actor = temp;
|
||||
count++;
|
||||
AActor *actor;
|
||||
FActorIterator iterator (arg0);
|
||||
int count = 0;
|
||||
|
||||
actor = iterator.Next ();
|
||||
while (actor)
|
||||
{
|
||||
// Actor might removes itself as part of deactivation, so get next
|
||||
// one before we activate it.
|
||||
AActor *temp = iterator.Next ();
|
||||
actor->Deactivate (it);
|
||||
actor = temp;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count != 0;
|
||||
}
|
||||
|
||||
return count != 0;
|
||||
else if (it != NULL)
|
||||
{
|
||||
it->Deactivate(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void RemoveThing(AActor * actor)
|
||||
|
@ -2068,6 +2077,46 @@ FUNC(LS_Sector_SetCeilingScale)
|
|||
return true;
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetFloorScale2)
|
||||
// Sector_SetFloorScale2 (tag, x-factor, y-factor)
|
||||
{
|
||||
int secnum = -1;
|
||||
|
||||
if (arg1)
|
||||
arg1 = FixedDiv (FRACUNIT, arg1);
|
||||
if (arg2)
|
||||
arg2 = FixedDiv (FRACUNIT, arg2);
|
||||
|
||||
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
|
||||
{
|
||||
if (arg1)
|
||||
sectors[secnum].floor_xscale = arg1;
|
||||
if (arg2)
|
||||
sectors[secnum].floor_yscale = arg2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetCeilingScale2)
|
||||
// Sector_SetFloorScale2 (tag, x-factor, y-factor)
|
||||
{
|
||||
int secnum = -1;
|
||||
|
||||
if (arg1)
|
||||
arg1 = FixedDiv (FRACUNIT, arg1);
|
||||
if (arg2)
|
||||
arg2 = FixedDiv (FRACUNIT, arg2);
|
||||
|
||||
while ((secnum = P_FindSectorFromTag (arg0, secnum)) >= 0)
|
||||
{
|
||||
if (arg1)
|
||||
sectors[secnum].ceiling_xscale = arg1;
|
||||
if (arg2)
|
||||
sectors[secnum].ceiling_yscale = arg2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FUNC(LS_Sector_SetFloorScale)
|
||||
// Sector_SetFloorScale (tag, x-int, x-frac, y-int, y-frac)
|
||||
{
|
||||
|
@ -2829,8 +2878,8 @@ lnSpecFunc LineSpecials[256] =
|
|||
LS_NOP, // 167
|
||||
LS_NOP, // 168
|
||||
LS_NOP, // 169
|
||||
LS_NOP, // 170
|
||||
LS_NOP, // 171
|
||||
LS_Sector_SetCeilingScale2,
|
||||
LS_Sector_SetFloorScale2,
|
||||
LS_Plat_UpNearestWaitDownStay,
|
||||
LS_NoiseAlert,
|
||||
LS_SendToCommunicator,
|
||||
|
|
|
@ -190,12 +190,15 @@ typedef enum {
|
|||
|
||||
Sector_ChangeSound = 140,
|
||||
|
||||
// GZDoom/Vavoom specials (put here so that they don't accidentally redefined)
|
||||
// GZDoom/Vavoom specials (put here so that they don't get accidentally redefined)
|
||||
Sector_SetPlaneReflection = 159,
|
||||
Sector_Set3DFloor = 160,
|
||||
Sector_SetContents = 161,
|
||||
|
||||
// [RH] Begin new specials for ZDoom
|
||||
Sector_SetCeilingScale2 = 170,
|
||||
Sector_SetFloorScale2 = 171,
|
||||
|
||||
Plat_UpNearestWaitDownStay = 172,
|
||||
NoiseAlert = 173,
|
||||
SendToCommunicator = 174,
|
||||
|
|
|
@ -317,24 +317,28 @@ void FTextureManager::AddHiresTextures ()
|
|||
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
|
||||
{
|
||||
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
|
||||
int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny);
|
||||
|
||||
if (oldtexno<0)
|
||||
if (newtex != NULL)
|
||||
{
|
||||
// A texture with this name does not yet exist
|
||||
newtex->UseType=FTexture::TEX_Override;
|
||||
AddTexture(newtex);
|
||||
}
|
||||
else
|
||||
{
|
||||
FTexture * oldtex = Textures[oldtexno].Texture;
|
||||
|
||||
// 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);
|
||||
ReplaceTexture(oldtexno, newtex, true);
|
||||
int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny);
|
||||
|
||||
newtex->bWorldPanning = true;
|
||||
if (oldtexno<0)
|
||||
{
|
||||
// A texture with this name does not yet exist
|
||||
newtex->UseType=FTexture::TEX_Override;
|
||||
AddTexture(newtex);
|
||||
}
|
||||
else
|
||||
{
|
||||
FTexture * oldtex = Textures[oldtexno].Texture;
|
||||
|
||||
// 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);
|
||||
ReplaceTexture(oldtexno, newtex, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,12 +389,16 @@ void FTextureManager::LoadHiresTex()
|
|||
FTexture * oldtex = TexMan[tex];
|
||||
FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any);
|
||||
|
||||
// Replace the entire texture and adjust the scaling and offset factors.
|
||||
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetScaledWidth();
|
||||
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetScaledHeight();
|
||||
newtex->LeftOffset = MulScale3(oldtex->GetScaledLeftOffset(), newtex->ScaleX);
|
||||
newtex->TopOffset = MulScale3(oldtex->GetScaledTopOffset(), newtex->ScaleY);
|
||||
ReplaceTexture(tex, newtex, true);
|
||||
if (newtex != NULL)
|
||||
{
|
||||
// Replace the entire texture and adjust the scaling and offset factors.
|
||||
newtex->bWorldPanning = true;
|
||||
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetScaledWidth();
|
||||
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetScaledHeight();
|
||||
newtex->LeftOffset = MulScale3(oldtex->GetScaledLeftOffset(), newtex->ScaleX);
|
||||
newtex->TopOffset = MulScale3(oldtex->GetScaledTopOffset(), newtex->ScaleY);
|
||||
ReplaceTexture(tex, newtex, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SC_Compare("define")) // define a new "fake" texture
|
||||
|
@ -414,14 +422,18 @@ void FTextureManager::LoadHiresTex()
|
|||
{
|
||||
FTexture *newtex = FTexture::CreateTexture(lumpnum, FTexture::TEX_Override);
|
||||
|
||||
// Replace the entire texture and adjust the scaling and offset factors.
|
||||
newtex->ScaleX = 8 * newtex->GetWidth() / width;
|
||||
newtex->ScaleY = 8 * newtex->GetHeight() / height;
|
||||
memcpy(newtex->Name, src, sizeof(newtex->Name));
|
||||
|
||||
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override);
|
||||
if (oldtex>=0) TexMan.ReplaceTexture(oldtex, newtex, true);
|
||||
else TexMan.AddTexture(newtex);
|
||||
if (newtex != NULL)
|
||||
{
|
||||
// Replace the entire texture and adjust the scaling and offset factors.
|
||||
newtex->bWorldPanning = true;
|
||||
newtex->ScaleX = 8 * newtex->GetWidth() / width;
|
||||
newtex->ScaleY = 8 * newtex->GetHeight() / height;
|
||||
memcpy(newtex->Name, src, sizeof(newtex->Name));
|
||||
|
||||
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override);
|
||||
if (oldtex>=0) TexMan.ReplaceTexture(oldtex, newtex, true);
|
||||
else TexMan.AddTexture(newtex);
|
||||
}
|
||||
}
|
||||
//else Printf("Unable to define hires texture '%s'\n", tex->Name);
|
||||
}
|
||||
|
|
|
@ -94,8 +94,16 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
|
|||
int h = tex->GetHeight();
|
||||
|
||||
// Auto-scale flats with dimensions 128x128 and 256x256
|
||||
if (w==128 && h==128) tex->ScaleX = tex->ScaleY = 16;
|
||||
else if (w==256 && h==256) tex->ScaleX = tex->ScaleY = 32;
|
||||
if (w==128 && h==128)
|
||||
{
|
||||
tex->ScaleX = tex->ScaleY = 16;
|
||||
tex->bWorldPanning = true;
|
||||
}
|
||||
else if (w==256 && h==256)
|
||||
{
|
||||
tex->ScaleX = tex->ScaleY = 32;
|
||||
tex->bWorldPanning = true;
|
||||
}
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue