- 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:
Christoph Oelckers 2006-10-05 20:32:16 +00:00
parent 2c2261884c
commit 6fe9c98b47
5 changed files with 137 additions and 53 deletions

View file

@ -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 October 4, 2006
- Added alias parameter substitution. Instances of %x in the alias command - Added alias parameter substitution. Instances of %x in the alias command
string will be replaced with parameter x when the alias is executed. string will be replaced with parameter x when the alias is executed.

View file

@ -916,7 +916,7 @@ FUNC(LS_Thing_ChangeTID)
} }
FUNC(LS_DamageThing) FUNC(LS_DamageThing)
// DamageThing (damage) // DamageThing (damage, mod)
{ {
if (it) if (it)
{ {
@ -935,11 +935,11 @@ FUNC(LS_DamageThing)
} }
else if (arg0 > 0) else if (arg0 > 0)
{ {
P_DamageMobj (it, NULL, NULL, arg0, MOD_UNKNOWN); P_DamageMobj (it, NULL, NULL, arg0, arg1);
} }
else else
{ // If zero damage, guarantee a kill { // 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) FUNC(LS_Thing_Deactivate)
// Thing_Deactivate (tid) // Thing_Deactivate (tid)
{ {
AActor *actor; if (arg0 != 0)
FActorIterator iterator (arg0);
int count = 0;
actor = iterator.Next ();
while (actor)
{ {
// Actor might removes itself as part of deactivation, so get next AActor *actor;
// one before we activate it. FActorIterator iterator (arg0);
AActor *temp = iterator.Next (); int count = 0;
actor->Deactivate (it);
actor = temp; actor = iterator.Next ();
count++; 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;
} }
else if (it != NULL)
return count != 0; {
it->Deactivate(it);
return true;
}
return false;
} }
static void RemoveThing(AActor * actor) static void RemoveThing(AActor * actor)
@ -2068,6 +2077,46 @@ FUNC(LS_Sector_SetCeilingScale)
return true; 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) FUNC(LS_Sector_SetFloorScale)
// Sector_SetFloorScale (tag, x-int, x-frac, y-int, y-frac) // Sector_SetFloorScale (tag, x-int, x-frac, y-int, y-frac)
{ {
@ -2829,8 +2878,8 @@ lnSpecFunc LineSpecials[256] =
LS_NOP, // 167 LS_NOP, // 167
LS_NOP, // 168 LS_NOP, // 168
LS_NOP, // 169 LS_NOP, // 169
LS_NOP, // 170 LS_Sector_SetCeilingScale2,
LS_NOP, // 171 LS_Sector_SetFloorScale2,
LS_Plat_UpNearestWaitDownStay, LS_Plat_UpNearestWaitDownStay,
LS_NoiseAlert, LS_NoiseAlert,
LS_SendToCommunicator, LS_SendToCommunicator,

View file

@ -190,12 +190,15 @@ typedef enum {
Sector_ChangeSound = 140, 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_SetPlaneReflection = 159,
Sector_Set3DFloor = 160, Sector_Set3DFloor = 160,
Sector_SetContents = 161, Sector_SetContents = 161,
// [RH] Begin new specials for ZDoom // [RH] Begin new specials for ZDoom
Sector_SetCeilingScale2 = 170,
Sector_SetFloorScale2 = 171,
Plat_UpNearestWaitDownStay = 172, Plat_UpNearestWaitDownStay = 172,
NoiseAlert = 173, NoiseAlert = 173,
SendToCommunicator = 174, SendToCommunicator = 174,

View file

@ -317,24 +317,28 @@ void FTextureManager::AddHiresTextures ()
if (Wads.CheckNumForName (name, ns_hires) == firsttx) if (Wads.CheckNumForName (name, ns_hires) == firsttx)
{ {
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any); FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny); if (newtex != NULL)
if (oldtexno<0)
{ {
// A texture with this name does not yet exist int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny);
newtex->UseType=FTexture::TEX_Override;
AddTexture(newtex); newtex->bWorldPanning = true;
} if (oldtexno<0)
else {
{ // A texture with this name does not yet exist
FTexture * oldtex = Textures[oldtexno].Texture; newtex->UseType=FTexture::TEX_Override;
AddTexture(newtex);
// Replace the entire texture and adjust the scaling and offset factors. }
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetWidth(); else
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetHeight(); {
newtex->LeftOffset = Scale(oldtex->LeftOffset, newtex->ScaleX, 8); FTexture * oldtex = Textures[oldtexno].Texture;
newtex->TopOffset = Scale(oldtex->TopOffset, newtex->ScaleY, 8);
ReplaceTexture(oldtexno, newtex, true); // 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 * oldtex = TexMan[tex];
FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any); FTexture * newtex = FTexture::CreateTexture (lumpnum, FTexture::TEX_Any);
// Replace the entire texture and adjust the scaling and offset factors. if (newtex != NULL)
newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetScaledWidth(); {
newtex->ScaleY = 8 * newtex->GetHeight() / oldtex->GetScaledHeight(); // Replace the entire texture and adjust the scaling and offset factors.
newtex->LeftOffset = MulScale3(oldtex->GetScaledLeftOffset(), newtex->ScaleX); newtex->bWorldPanning = true;
newtex->TopOffset = MulScale3(oldtex->GetScaledTopOffset(), newtex->ScaleY); newtex->ScaleX = 8 * newtex->GetWidth() / oldtex->GetScaledWidth();
ReplaceTexture(tex, newtex, true); 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 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); FTexture *newtex = FTexture::CreateTexture(lumpnum, FTexture::TEX_Override);
// Replace the entire texture and adjust the scaling and offset factors. if (newtex != NULL)
newtex->ScaleX = 8 * newtex->GetWidth() / width; {
newtex->ScaleY = 8 * newtex->GetHeight() / height; // Replace the entire texture and adjust the scaling and offset factors.
memcpy(newtex->Name, src, sizeof(newtex->Name)); newtex->bWorldPanning = true;
newtex->ScaleX = 8 * newtex->GetWidth() / width;
int oldtex = TexMan.CheckForTexture(src, FTexture::TEX_Override); newtex->ScaleY = 8 * newtex->GetHeight() / height;
if (oldtex>=0) TexMan.ReplaceTexture(oldtex, newtex, true); memcpy(newtex->Name, src, sizeof(newtex->Name));
else TexMan.AddTexture(newtex);
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); //else Printf("Unable to define hires texture '%s'\n", tex->Name);
} }

View file

@ -94,8 +94,16 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
int h = tex->GetHeight(); int h = tex->GetHeight();
// Auto-scale flats with dimensions 128x128 and 256x256 // Auto-scale flats with dimensions 128x128 and 256x256
if (w==128 && h==128) tex->ScaleX = tex->ScaleY = 16; if (w==128 && h==128)
else if (w==256 && h==256) tex->ScaleX = tex->ScaleY = 32; {
tex->ScaleX = tex->ScaleY = 16;
tex->bWorldPanning = true;
}
else if (w==256 && h==256)
{
tex->ScaleX = tex->ScaleY = 32;
tex->bWorldPanning = true;
}
} }
return tex; return tex;
} }