- Fixed: A_VileAttack positioned the fire on the wrong side of the target.

- Reorganized the HackHack code so that the image creation was moved into
  MakeTexture. This was necessary because Unload deleted the pixel data
  and broke the whole thing.
- Fixed: FPatchTexture::HackHack and FDoomStatusbarTexture::DrawToBar used the
  obsolete and uninitialized variable Near255. 
- Removed the span creation code specific to FPatchTexture. It only has an
  advantage when the lump has already been loaded in memory but since that
  is no longer the case now the generic version in FTexture is actually better.
- Changed: FTexture::CopyToBlock no longer uses the spans but the pixel buffer
  directly. Since most patches in multipatch textures are non transparent
  the added overhead from creating the spans far outweighs any savings they
  might provide. It is also simpler to handle for mirrored or rotated patches now.
- Changed: Textures only create the spans when really needed. Flats and native
  textures, for example, do not and it only created needless overhead that they
  were always created along with the pixel buffer.
- Made use of player and actor variables consistent in a_hereticweaps.cpp.
- Fixed: A few calls to P_SpawnPlayerMissile passed 0 as angle



SVN r911 (trunk)
This commit is contained in:
Christoph Oelckers 2008-04-14 12:10:45 +00:00
parent 5afb2b9aab
commit b54b9bad7a
20 changed files with 222 additions and 351 deletions

View file

@ -1,3 +1,23 @@
April 14, 2008 (Changes by Graf Zahl)
- Fixed: A_VileAttack positioned the fire on the wrong side of the target.
- Reorganized the HackHack code so that the image creation was moved into
MakeTexture. This was necessary because Unload deleted the pixel data
and broke the whole thing.
- Fixed: FPatchTexture::HackHack and FDoomStatusbarTexture::DrawToBar used the
obsolete and uninitialized variable Near255.
- Removed the span creation code specific to FPatchTexture. It only has an
advantage when the lump has already been loaded in memory but since that
is no longer the case now the generic version in FTexture is actually better.
- Changed: FTexture::CopyToBlock no longer uses the spans but the pixel buffer
directly. Since most patches in multipatch textures are non transparent
the added overhead from creating the spans far outweighs any savings they
might provide. It is also simpler to handle for mirrored or rotated patches now.
- Changed: Textures only create the spans when really needed. Flats and native
textures, for example, do not and it only created needless overhead that they
were always created along with the pixel buffer.
- Made use of player and actor variables consistent in a_hereticweaps.cpp.
- Fixed: A few calls to P_SpawnPlayerMissile passed 0 as angle
April 13, 2008 (Changes by Graf Zahl) April 13, 2008 (Changes by Graf Zahl)
- Fixed a few bufs in the parser for composite textures. - Fixed a few bufs in the parser for composite textures.
- Changed: When loading Zips all patches in the patches/ directory should - Changed: When loading Zips all patches in the patches/ directory should

View file

@ -116,8 +116,8 @@ void A_VileAttack (AActor *actor)
return; return;
// move the fire between the vile and the player // move the fire between the vile and the player
fire->SetOrigin (actor->target->x + FixedMul (24*FRACUNIT, finecosine[an]), fire->SetOrigin (actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]),
actor->target->y + FixedMul (24*FRACUNIT, finesine[an]), actor->target->y - FixedMul (24*FRACUNIT, finesine[an]),
actor->target->z); actor->target->z);
P_RadiusAttack (fire, actor, 70, 70, NAME_Fire, false); P_RadiusAttack (fire, actor, 70, 70, NAME_Fire, false);

View file

@ -1126,28 +1126,9 @@ int DDoomStatusBar::FDoomStatusBarTexture::CopyTrueColorPixels(BYTE *buffer, int
void DDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x, int y, const BYTE *colormap_in) void DDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x, int y, const BYTE *colormap)
{ {
FTexture *pic; FTexture *pic = TexMan[name];
BYTE colormap[256];
if (colormap_in != NULL)
{
for (int i = 0; i < 256; ++i)
{
colormap[i] = colormap_in[i] == 255 ? Near255 : colormap_in[i];
}
}
else
{
for (int i = 0; i < 255; ++i)
{
colormap[i] = i;
}
colormap[255] = Near255;
}
pic = TexMan[name];
if (pic != NULL) if (pic != NULL)
{ {
x -= pic->LeftOffset; x -= pic->LeftOffset;

View file

@ -208,23 +208,23 @@ void A_StaffAttackPL1 (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
damage = 5+(pr_sap()&15); damage = 5+(pr_sap()&15);
angle = player->mo->angle; angle = actor->angle;
angle += pr_sap.Random2() << 18; angle += pr_sap.Random2() << 18;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget); slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff), true); P_LineAttack (actor, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff), true);
if (linetarget) if (linetarget)
{ {
//S_StartSound(player->mo, sfx_stfhit); //S_StartSound(player->mo, sfx_stfhit);
// turn to face target // turn to face target
player->mo->angle = R_PointToAngle2 (player->mo->x, actor->angle = R_PointToAngle2 (actor->x,
player->mo->y, linetarget->x, linetarget->y); actor->y, linetarget->x, linetarget->y);
} }
} }
@ -247,7 +247,7 @@ void A_StaffAttackPL2 (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -255,16 +255,16 @@ void A_StaffAttackPL2 (AActor *actor)
} }
// P_inter.c:P_DamageMobj() handles target momentums // P_inter.c:P_DamageMobj() handles target momentums
damage = 18+(pr_sap2()&63); damage = 18+(pr_sap2()&63);
angle = player->mo->angle; angle = actor->angle;
angle += pr_sap2.Random2() << 18; angle += pr_sap2.Random2() << 18;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget); slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff2), true); P_LineAttack (actor, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff2), true);
if (linetarget) if (linetarget)
{ {
//S_StartSound(player->mo, sfx_stfpow); //S_StartSound(player->mo, sfx_stfpow);
// turn to face target // turn to face target
player->mo->angle = R_PointToAngle2 (player->mo->x, actor->angle = R_PointToAngle2 (actor->x,
player->mo->y, linetarget->x, linetarget->y); actor->y, linetarget->x, linetarget->y);
} }
} }
@ -432,7 +432,6 @@ END_DEFAULTS
void A_FireGoldWandPL1 (AActor *actor) void A_FireGoldWandPL1 (AActor *actor)
{ {
AActor *mo;
angle_t angle; angle_t angle;
int damage; int damage;
player_t *player; player_t *player;
@ -442,22 +441,21 @@ void A_FireGoldWandPL1 (AActor *actor)
return; return;
} }
mo = player->mo; AWeapon *weapon = player->ReadyWeapon;
AWeapon *weapon = actor->player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
angle_t pitch = P_BulletSlope(mo); angle_t pitch = P_BulletSlope(actor);
damage = 7+(pr_fgw()&7); damage = 7+(pr_fgw()&7);
angle = mo->angle; angle = actor->angle;
if (player->refire) if (player->refire)
{ {
angle += pr_fgw.Random2() << 18; angle += pr_fgw.Random2() << 18;
} }
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff1)); P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff1));
S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -469,7 +467,6 @@ void A_FireGoldWandPL1 (AActor *actor)
void A_FireGoldWandPL2 (AActor *actor) void A_FireGoldWandPL2 (AActor *actor)
{ {
int i; int i;
AActor *mo;
angle_t angle; angle_t angle;
int damage; int damage;
fixed_t momz; fixed_t momz;
@ -480,26 +477,25 @@ void A_FireGoldWandPL2 (AActor *actor)
return; return;
} }
mo = player->mo; AWeapon *weapon = player->ReadyWeapon;
AWeapon *weapon = actor->player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
angle_t pitch = P_BulletSlope(mo); angle_t pitch = P_BulletSlope(actor);
momz = FixedMul (GetDefault<AGoldWandFX2>()->Speed, momz = FixedMul (GetDefault<AGoldWandFX2>()->Speed,
finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]); finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]);
P_SpawnMissileAngle (mo, RUNTIME_CLASS(AGoldWandFX2), mo->angle-(ANG45/8), momz); P_SpawnMissileAngle (actor, RUNTIME_CLASS(AGoldWandFX2), actor->angle-(ANG45/8), momz);
P_SpawnMissileAngle (mo, RUNTIME_CLASS(AGoldWandFX2), mo->angle+(ANG45/8), momz); P_SpawnMissileAngle (actor, RUNTIME_CLASS(AGoldWandFX2), actor->angle+(ANG45/8), momz);
angle = mo->angle-(ANG45/8); angle = actor->angle-(ANG45/8);
for(i = 0; i < 5; i++) for(i = 0; i < 5; i++)
{ {
damage = 1+(pr_fgw2()&7); damage = 1+(pr_fgw2()&7);
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff2)); P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff2));
angle += ((ANG45/8)*2)/4; angle += ((ANG45/8)*2)/4;
} }
S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
} }
// --- Crossbow ------------------------------------------------------------- // --- Crossbow -------------------------------------------------------------
@ -714,7 +710,6 @@ END_DEFAULTS
void A_FireCrossbowPL1 (AActor *actor) void A_FireCrossbowPL1 (AActor *actor)
{ {
AActor *pmo;
player_t *player; player_t *player;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
@ -722,16 +717,15 @@ void A_FireCrossbowPL1 (AActor *actor)
return; return;
} }
pmo = player->mo; AWeapon *weapon = player->ReadyWeapon;
AWeapon *weapon = actor->player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX1)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX1));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle-(ANG45/10)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->angle-(ANG45/10));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle+(ANG45/10)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->angle+(ANG45/10));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -742,7 +736,6 @@ void A_FireCrossbowPL1 (AActor *actor)
void A_FireCrossbowPL2(AActor *actor) void A_FireCrossbowPL2(AActor *actor)
{ {
AActor *pmo;
player_t *player; player_t *player;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
@ -750,18 +743,17 @@ void A_FireCrossbowPL2(AActor *actor)
return; return;
} }
pmo = player->mo;
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = actor->player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2), pmo->angle-(ANG45/10)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2), actor->angle-(ANG45/10));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2), pmo->angle+(ANG45/10)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2), actor->angle+(ANG45/10));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle-(ANG45/5)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->angle-(ANG45/5));
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle+(ANG45/5)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->angle+(ANG45/5));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1134,7 +1126,6 @@ bool AMace::DoRespawn ()
void A_FireMacePL1B (AActor *actor) void A_FireMacePL1B (AActor *actor)
{ {
AActor *pmo;
AActor *ball; AActor *ball;
angle_t angle; angle_t angle;
player_t *player; player_t *player;
@ -1144,24 +1135,23 @@ void A_FireMacePL1B (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
pmo = player->mo; ball = Spawn<AMaceFX2> (actor->x, actor->y, actor->z + 28*FRACUNIT
ball = Spawn<AMaceFX2> (pmo->x, pmo->y, pmo->z + 28*FRACUNIT - actor->floorclip, ALLOW_REPLACE);
- pmo->floorclip, ALLOW_REPLACE);
ball->momz = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/ ball->momz = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/
finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)]; finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
angle = pmo->angle; angle = actor->angle;
ball->target = pmo; ball->target = actor;
ball->angle = angle; ball->angle = angle;
ball->z += 2*finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)]; ball->z += 2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
ball->momx = (pmo->momx>>1)+FixedMul(ball->Speed, finecosine[angle]); ball->momx = (actor->momx>>1)+FixedMul(ball->Speed, finecosine[angle]);
ball->momy = (pmo->momy>>1)+FixedMul(ball->Speed, finesine[angle]); ball->momy = (actor->momy>>1)+FixedMul(ball->Speed, finesine[angle]);
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM); S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
P_CheckMissileSpawn (ball); P_CheckMissileSpawn (ball);
} }
@ -1187,7 +1177,7 @@ void A_FireMacePL1 (AActor *actor)
A_FireMacePL1B (actor); A_FireMacePL1B (actor);
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -1195,8 +1185,8 @@ void A_FireMacePL1 (AActor *actor)
} }
player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT; player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
ball = P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(AMaceFX1), ball = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AMaceFX1),
player->mo->angle+(((pr_maceatk()&7)-4)<<24)); actor->angle+(((pr_maceatk()&7)-4)<<24));
if (ball) if (ball)
{ {
ball->special1 = 16; // tics till dropoff ball->special1 = 16; // tics till dropoff
@ -1348,25 +1338,25 @@ void A_FireMacePL2 (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
mo = P_SpawnPlayerMissile (player->mo, 0,0,0, RUNTIME_CLASS(AMaceFX4), 0, &linetarget); mo = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AMaceFX4), actor->angle, &linetarget);
if (mo) if (mo)
{ {
mo->momx += player->mo->momx; mo->momx += actor->momx;
mo->momy += player->mo->momy; mo->momy += actor->momy;
mo->momz = 2*FRACUNIT+ mo->momz = 2*FRACUNIT+
clamp<fixed_t>(finetangent[FINEANGLES/4-(player->mo->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT); clamp<fixed_t>(finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT);
if (linetarget) if (linetarget)
{ {
mo->tracer = linetarget; mo->tracer = linetarget;
} }
} }
S_Sound (player->mo, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM); S_Sound (actor, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1635,7 +1625,7 @@ void A_GauntletAttack (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -1643,8 +1633,8 @@ void A_GauntletAttack (AActor *actor)
} }
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT; player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
angle = player->mo->angle; angle = actor->angle;
power = player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2)); power = actor->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2));
if (power) if (power)
{ {
damage = pr_gatk.HitDice (2); damage = pr_gatk.HitDice (2);
@ -1659,15 +1649,15 @@ void A_GauntletAttack (AActor *actor)
angle += pr_gatk.Random2() << 18; angle += pr_gatk.Random2() << 18;
pufftype = RUNTIME_CLASS(AGauntletPuff1); pufftype = RUNTIME_CLASS(AGauntletPuff1);
} }
slope = P_AimLineAttack (player->mo, angle, dist, &linetarget); slope = P_AimLineAttack (actor, angle, dist, &linetarget);
P_LineAttack (player->mo, angle, dist, slope, damage, NAME_Melee, pufftype); P_LineAttack (actor, angle, dist, slope, damage, NAME_Melee, pufftype);
if (!linetarget) if (!linetarget)
{ {
if (pr_gatk() > 64) if (pr_gatk() > 64)
{ {
player->extralight = !player->extralight; player->extralight = !player->extralight;
} }
S_Sound (player->mo, CHAN_AUTO, "weapons/gauntletson", 1, ATTN_NORM); S_Sound (actor, CHAN_AUTO, "weapons/gauntletson", 1, ATTN_NORM);
return; return;
} }
randVal = pr_gatk(); randVal = pr_gatk();
@ -1685,31 +1675,31 @@ void A_GauntletAttack (AActor *actor)
} }
if (power) if (power)
{ {
P_GiveBody (player->mo, damage>>1); P_GiveBody (actor, damage>>1);
S_Sound (player->mo, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM); S_Sound (actor, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM);
} }
else else
{ {
S_Sound (player->mo, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM); S_Sound (actor, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM);
} }
// turn to face target // turn to face target
angle = R_PointToAngle2 (player->mo->x, player->mo->y, angle = R_PointToAngle2 (actor->x, actor->y,
linetarget->x, linetarget->y); linetarget->x, linetarget->y);
if (angle-player->mo->angle > ANG180) if (angle-actor->angle > ANG180)
{ {
if ((int)(angle-player->mo->angle) < -ANG90/20) if ((int)(angle-actor->angle) < -ANG90/20)
player->mo->angle = angle+ANG90/21; actor->angle = angle+ANG90/21;
else else
player->mo->angle -= ANG90/20; actor->angle -= ANG90/20;
} }
else else
{ {
if (angle-player->mo->angle > ANG90/20) if (angle-actor->angle > ANG90/20)
player->mo->angle = angle-ANG90/21; actor->angle = angle-ANG90/21;
else else
player->mo->angle += ANG90/20; actor->angle += ANG90/20;
} }
player->mo->flags |= MF_JUSTATTACKED; actor->flags |= MF_JUSTATTACKED;
} }
// --- Blaster (aka Claw) --------------------------------------------------- // --- Blaster (aka Claw) ---------------------------------------------------
@ -2371,13 +2361,13 @@ void A_FireSkullRodPL1 (AActor *actor)
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
mo = P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(AHornRodFX1)); mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AHornRodFX1));
// Randomize the first frame // Randomize the first frame
if (mo && pr_fsr1() > 128) if (mo && pr_fsr1() > 128)
{ {
@ -2404,13 +2394,13 @@ void A_FireSkullRodPL2 (AActor *actor)
{ {
return; return;
} }
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
P_SpawnPlayerMissile (player->mo, 0,0,0, RUNTIME_CLASS(AHornRodFX2), 0, &linetarget, &MissileActor); P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AHornRodFX2), actor->angle, &linetarget, &MissileActor);
// Use MissileActor instead of the return value from // Use MissileActor instead of the return value from
// P_SpawnPlayerMissile because we need to give info to the mobj // P_SpawnPlayerMissile because we need to give info to the mobj
// even if it exploded immediately. // even if it exploded immediately.
@ -2818,7 +2808,7 @@ void A_FirePhoenixPL1 (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(APhoenixFX1)); P_SpawnPlayerMissile (actor, RUNTIME_CLASS(APhoenixFX1));
angle = actor->angle + ANG180; angle = actor->angle + ANG180;
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
actor->momx += FixedMul (4*FRACUNIT, finecosine[angle]); actor->momx += FixedMul (4*FRACUNIT, finecosine[angle]);
@ -2881,7 +2871,6 @@ void A_InitPhoenixPL2 (AActor *actor)
void A_FirePhoenixPL2 (AActor *actor) void A_FirePhoenixPL2 (AActor *actor)
{ {
AActor *mo; AActor *mo;
AActor *pmo;
angle_t angle; angle_t angle;
fixed_t x, y, z; fixed_t x, y, z;
fixed_t slope; fixed_t slope;
@ -2901,25 +2890,24 @@ void A_FirePhoenixPL2 (AActor *actor)
{ // Out of flame { // Out of flame
P_SetPsprite (player, ps_weapon, &APhoenixRod::States[S_PHOENIXATK2+3]); P_SetPsprite (player, ps_weapon, &APhoenixRod::States[S_PHOENIXATK2+3]);
player->refire = 0; player->refire = 0;
S_StopSound (player->mo, CHAN_WEAPON); S_StopSound (actor, CHAN_WEAPON);
return; return;
} }
pmo = player->mo; angle = actor->angle;
angle = pmo->angle; x = actor->x + (pr_fp2.Random2() << 9);
x = pmo->x + (pr_fp2.Random2() << 9); y = actor->y + (pr_fp2.Random2() << 9);
y = pmo->y + (pr_fp2.Random2() << 9); z = actor->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
z = pmo->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)]; z -= actor->floorclip;
z -= pmo->floorclip; slope = finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
slope = finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
mo = Spawn<APhoenixFX2> (x, y, z, ALLOW_REPLACE); mo = Spawn<APhoenixFX2> (x, y, z, ALLOW_REPLACE);
mo->target = pmo; mo->target = actor;
mo->angle = angle; mo->angle = angle;
mo->momx = pmo->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]); mo->momx = actor->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);
mo->momy = pmo->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]); mo->momy = actor->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]);
mo->momz = FixedMul (mo->Speed, slope); mo->momz = FixedMul (mo->Speed, slope);
if (!player->refire || !S_IsActorPlayingSomething (pmo, CHAN_WEAPON, -1)) if (!player->refire || !S_IsActorPlayingSomething (actor, CHAN_WEAPON, -1))
{ {
S_SoundID (pmo, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM); S_SoundID (actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
} }
P_CheckMissileSpawn (mo); P_CheckMissileSpawn (mo);
} }
@ -2939,7 +2927,7 @@ void A_ShutdownPhoenixPL2 (AActor *actor)
return; return;
} }
S_StopSound (actor, CHAN_WEAPON); S_StopSound (actor, CHAN_WEAPON);
AWeapon *weapon = actor->player->ReadyWeapon; AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL) if (weapon != NULL)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))

View file

@ -571,7 +571,7 @@ void A_CHolyAttack (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return; return;
} }
AActor * missile = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AHolyMissile), 0, &linetarget); AActor * missile = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AHolyMissile), actor->angle, &linetarget);
if (missile != NULL) missile->tracer = linetarget; if (missile != NULL) missile->tracer = linetarget;
weapon->CHolyCount = 3; weapon->CHolyCount = 3;

View file

@ -2295,7 +2295,7 @@ void A_FireSigil4 (AActor *actor)
P_BulletSlope (actor, &linetarget); P_BulletSlope (actor, &linetarget);
if (linetarget != NULL) if (linetarget != NULL)
{ {
spot = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(ASpectralLightningBigV1), 0, &linetarget); spot = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(ASpectralLightningBigV1), actor->angle, &linetarget);
if (spot != NULL) if (spot != NULL)
{ {
spot->tracer = linetarget; spot->tracer = linetarget;

View file

@ -457,14 +457,14 @@ void R_PrecacheLevel (void)
for (i = numsectors - 1; i >= 0; i--) for (i = numsectors - 1; i >= 0; i--)
{ {
hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1; hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] |= 2;
} }
for (i = numsides - 1; i >= 0; i--) for (i = numsides - 1; i >= 0; i--)
{ {
hitlist[sides[i].GetTexture(side_t::top)] = hitlist[sides[i].GetTexture(side_t::top)] =
hitlist[sides[i].GetTexture(side_t::mid)] = hitlist[sides[i].GetTexture(side_t::mid)] =
hitlist[sides[i].GetTexture(side_t::bottom)] = 1; hitlist[sides[i].GetTexture(side_t::bottom)] |= 1;
} }
// Sky texture is always present. // Sky texture is always present.
@ -476,16 +476,16 @@ void R_PrecacheLevel (void)
if (sky1texture >= 0) if (sky1texture >= 0)
{ {
hitlist[sky1texture] = 1; hitlist[sky1texture] |= 1;
} }
if (sky2texture >= 0) if (sky2texture >= 0)
{ {
hitlist[sky2texture] = 1; hitlist[sky2texture] |= 1;
} }
for (i = TexMan.NumTextures() - 1; i >= 0; i--) for (i = TexMan.NumTextures() - 1; i >= 0; i--)
{ {
screen->PrecacheTexture(TexMan[i], !!hitlist[i]); screen->PrecacheTexture(TexMan[i], hitlist[i]);
} }
delete[] hitlist; delete[] hitlist;

View file

@ -59,6 +59,7 @@ protected:
int SourceLump; int SourceLump;
BYTE *Pixels; BYTE *Pixels;
Span **Spans; Span **Spans;
bool hackflag;
static bool Check(FileReader & file); static bool Check(FileReader & file);
static FTexture *Create(FileReader & file, int lumpnum); static FTexture *Create(FileReader & file, int lumpnum);

View file

@ -351,6 +351,10 @@ const BYTE *FDDSTexture::GetColumn (unsigned int column, const Span **spans_out)
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -389,10 +393,6 @@ void FDDSTexture::MakeTexture ()
{ {
DecompressDXT5 (lump, Format == ID_DXT4); DecompressDXT5 (lump, Format == ID_DXT4);
} }
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }
void FDDSTexture::ReadRGB (FWadLump &lump, BYTE *tcbuf) void FDDSTexture::ReadRGB (FWadLump &lump, BYTE *tcbuf)

View file

@ -121,6 +121,10 @@ const BYTE *FIMGZTexture::GetColumn (unsigned int column, const Span **spans_out
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -214,10 +218,5 @@ void FIMGZTexture::MakeTexture ()
dest_p -= dest_rew; dest_p -= dest_rew;
} }
} }
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }

View file

@ -265,6 +265,10 @@ const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spa
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -290,11 +294,6 @@ void FMultiPatchTexture::MakeTexture ()
Parts[i].Texture->CopyToBlock (Pixels, Width, Height, Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
Parts[i].OriginX, Parts[i].OriginY); Parts[i].OriginX, Parts[i].OriginY);
} }
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }
//========================================================================== //==========================================================================

View file

@ -92,7 +92,7 @@ FTexture *FPatchTexture::Create(FileReader & file, int lumpnum)
} }
FPatchTexture::FPatchTexture (int lumpnum, patch_t * header) FPatchTexture::FPatchTexture (int lumpnum, patch_t * header)
: SourceLump(lumpnum), Pixels(0), Spans(0) : SourceLump(lumpnum), Pixels(0), Spans(0), hackflag(false)
{ {
Wads.GetLumpName (Name, lumpnum); Wads.GetLumpName (Name, lumpnum);
Name[8] = 0; Name[8] = 0;
@ -151,6 +151,10 @@ const BYTE *FPatchTexture::GetColumn (unsigned int column, const Span **spans_ou
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans(Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -160,10 +164,8 @@ const BYTE *FPatchTexture::GetColumn (unsigned int column, const Span **spans_ou
void FPatchTexture::MakeTexture () void FPatchTexture::MakeTexture ()
{ {
BYTE *remap, remaptable[256]; BYTE *remap, remaptable[256];
Span *spanstuffer, *spanstarter;
const column_t *maxcol;
bool warned;
int numspans; int numspans;
const column_t *maxcol;
int x; int x;
FMemLump lump = Wads.ReadLump (SourceLump); FMemLump lump = Wads.ReadLump (SourceLump);
@ -185,15 +187,6 @@ void FPatchTexture::MakeTexture ()
Printf (PRINT_BOLD, "Patch %s is too big.\n", Name); Printf (PRINT_BOLD, "Patch %s is too big.\n", Name);
} }
// Add a little extra space at the end if the texture's height is not
// a power of 2, in case somebody accidentally makes it repeat vertically.
int numpix = Width * Height + (1 << HeightBits) - Height;
numspans = Width;
Pixels = new BYTE[numpix];
memset (Pixels, 0, numpix);
if (bNoRemap0) if (bNoRemap0)
{ {
memcpy (remaptable, GPalette.Remap, 256); memcpy (remaptable, GPalette.Remap, 256);
@ -205,6 +198,35 @@ void FPatchTexture::MakeTexture ()
remap = GPalette.Remap; remap = GPalette.Remap;
} }
if (hackflag)
{
Pixels = new BYTE[Width * Height];
BYTE *out;
// Draw the image to the buffer
for (x = 0, out = Pixels; x < Width; ++x)
{
const BYTE *in = (const BYTE *)patch + LittleLong(patch->columnofs[x]) + 3;
for (int y = Height; y > 0; --y)
{
*out = remap[*in];
out++, in++;
}
}
return;
}
// Add a little extra space at the end if the texture's height is not
// a power of 2, in case somebody accidentally makes it repeat vertically.
int numpix = Width * Height + (1 << HeightBits) - Height;
numspans = Width;
Pixels = new BYTE[numpix];
memset (Pixels, 0, numpix);
// Draw the image to the buffer // Draw the image to the buffer
for (x = 0; x < Width; ++x) for (x = 0; x < Width; ++x)
{ {
@ -246,146 +268,22 @@ void FPatchTexture::MakeTexture ()
column = (const column_t *)((const BYTE *)column + column->length + 4); column = (const column_t *)((const BYTE *)column + column->length + 4);
} }
} }
// Create the spans
if (Spans != NULL)
{
return;
}
Spans = (Span **)M_Malloc (sizeof(Span*)*Width + sizeof(Span)*numspans);
spanstuffer = (Span *)((BYTE *)Spans + sizeof(Span*)*Width);
warned = false;
for (x = 0; x < Width; ++x)
{
const column_t *column = (const column_t *)((const BYTE *)patch + LittleLong(patch->columnofs[x]));
int top = -1;
Spans[x] = spanstuffer;
spanstarter = spanstuffer;
while (column < maxcol && column->topdelta != 0xFF)
{
if (column->topdelta <= top)
{
top += column->topdelta;
}
else
{
top = column->topdelta;
}
int len = column->length;
if (len != 0)
{
if (top + len > Height) // Clip posts that extend past the bottom
{
len = Height - top;
}
if (len > 0)
{
// There is something of this post to draw. If it starts at the same
// place where the previous span ends, add it to that one. If it starts
// before the other one ends, that's bad, but deal with it. If it starts
// after the previous one ends, create another span.
// Assume we need to create another span.
spanstuffer->TopOffset = top;
spanstuffer->Length = len;
// Now check if that's really the case.
if (spanstuffer > spanstarter)
{
if ((spanstuffer - 1)->TopOffset + (spanstuffer - 1)->Length == top)
{
(--spanstuffer)->Length += len;
}
else
{
int prevbot;
while (spanstuffer > spanstarter &&
spanstuffer->TopOffset < (prevbot =
(spanstuffer - 1)->TopOffset + (spanstuffer - 1)->Length))
{
if (spanstuffer->TopOffset < (spanstuffer - 1)->TopOffset)
{
(spanstuffer - 1)->TopOffset = spanstuffer->TopOffset;
}
(spanstuffer - 1)->Length = MAX(prevbot,
spanstuffer->TopOffset + spanstuffer->Length)
- (spanstuffer - 1)->TopOffset;
spanstuffer--;
if (!warned)
{
warned = true;
Printf (PRINT_BOLD, "Patch %s is malformed.\n", Name);
}
}
}
}
spanstuffer++;
}
}
column = (const column_t *)((const BYTE *)column + column->length + 4);
}
spanstuffer->Length = spanstuffer->TopOffset = 0;
spanstuffer++;
}
} }
// Fix for certain special patches on single-patch textures. // Fix for certain special patches on single-patch textures.
void FPatchTexture::HackHack (int newheight) void FPatchTexture::HackHack (int newheight)
{ {
BYTE *out;
int x;
Unload (); Unload ();
if (Spans != NULL) if (Spans != NULL)
{ {
FreeSpans (Spans); FreeSpans (Spans);
} }
{
FMemLump lump = Wads.ReadLump (SourceLump);
const patch_t *patch = (const patch_t *)lump.GetMem();
Width = LittleShort(patch->width);
Height = newheight; Height = newheight;
LeftOffset = 0; LeftOffset = 0;
TopOffset = 0; TopOffset = 0;
Pixels = new BYTE[Width * Height]; hackflag = true;
bMasked = false; // Hacked textures don't have transparent parts.
// Draw the image to the buffer
for (x = 0, out = Pixels; x < Width; ++x)
{
const BYTE *in = (const BYTE *)patch + LittleLong(patch->columnofs[x]) + 3;
for (int y = newheight; y > 0; --y)
{
*out = *in != 255 ? *in : Near255;
out++, in++;
}
out += newheight;
}
}
// Create the spans
Spans = (Span **)M_Malloc (sizeof(Span *)*Width + sizeof(Span)*Width*2);
Span *span = (Span *)&Spans[Width];
for (x = 0; x < Width; ++x)
{
Spans[x] = span;
span[0].Length = newheight;
span[0].TopOffset = 0;
span[1].Length = 0;
span[1].TopOffset = 0;
span += 2;
}
} }

View file

@ -333,6 +333,10 @@ const BYTE *FPNGTexture::GetColumn (unsigned int column, const Span **spans_out)
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -478,10 +482,6 @@ void FPNGTexture::MakeTexture ()
} }
} }
delete lump; delete lump;
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }
//=========================================================================== //===========================================================================

View file

@ -272,56 +272,40 @@ void FTexture::FreeSpans (Span **spans) const
void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation) void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation)
{ {
int x1 = xpos, x2 = x1 + GetWidth(), xo = -x1; const BYTE *pixels = GetPixels();
int srcwidth = Width;
int srcheight = Height;
int step_x = Height;
int step_y = 1;
if (x1 < 0) if (ClipCopyPixelRect(dwidth, dheight, xpos, ypos, pixels, srcwidth, srcheight, step_x, step_y))
{
x1 = 0;
}
if (x2 > dwidth)
{
x2 = dwidth;
}
for (; x1 < x2; ++x1)
{
const BYTE *data;
const Span *span;
BYTE *outtop = &dest[dheight * x1];
data = GetColumn (x1 + xo, &span);
while (span->Length != 0)
{
int len = span->Length;
int y = ypos + span->TopOffset;
int adv = span->TopOffset;
if (y < 0)
{
adv -= y;
len += y;
y = 0;
}
if (y + len > dheight)
{
len = dheight - y;
}
if (len > 0)
{ {
dest += ypos + dheight * xpos;
if (translation == NULL) if (translation == NULL)
{ {
memcpy (outtop + y, data + adv, len); for (int x = 0; x < srcwidth; x++)
{
int pos = x * dheight;
for (int y = 0; y < srcheight; y++, pos++)
{
// the optimizer is doing a good enough job here so there's no need to make this harder to read.
BYTE v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = v;
}
}
} }
else else
{ {
for (int j = 0; j < len; ++j) for (int x = 0; x < srcwidth; x++)
{ {
outtop[y+j] = translation[data[adv+j]]; int pos = x * dheight;
for (int y = 0; y < srcheight; y++, pos++)
{
BYTE v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = translation[v];
} }
} }
} }
span++;
}
} }
} }

View file

@ -134,6 +134,10 @@ const BYTE *FTGATexture::GetColumn (unsigned int column, const Span **spans_out)
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -372,10 +376,6 @@ void FTGATexture::MakeTexture ()
break; break;
} }
delete [] buffer; delete [] buffer;
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }
//=========================================================================== //===========================================================================

View file

@ -1367,6 +1367,10 @@ const BYTE *FFontChar2::GetColumn (unsigned int column, const Span **spans_out)
} }
if (spans_out != NULL) if (spans_out != NULL)
{ {
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
*spans_out = Spans[column]; *spans_out = Spans[column];
} }
return Pixels + column*Height; return Pixels + column*Height;
@ -1466,11 +1470,6 @@ void FFontChar2::MakeTexture ()
name[8] = 0; name[8] = 0;
I_FatalError ("The font %s is corrupt", name); I_FatalError ("The font %s is corrupt", name);
} }
if (Spans == NULL)
{
Spans = CreateSpans (Pixels);
}
} }
//=========================================================================== //===========================================================================

View file

@ -64,7 +64,6 @@ BYTE GoldColormap[256];
// [BC] New Skulltag colormaps. // [BC] New Skulltag colormaps.
BYTE RedColormap[256]; BYTE RedColormap[256];
BYTE GreenColormap[256]; BYTE GreenColormap[256];
int Near255;
static void FreeSpecialLights();; static void FreeSpecialLights();;

View file

@ -93,8 +93,6 @@ extern FDynamicColormap NormalLight;
// The color overlay to use for depleted items // The color overlay to use for depleted items
#define DIM_OVERLAY MAKEARGB(170,0,0,0) #define DIM_OVERLAY MAKEARGB(170,0,0,0)
extern int Near255; // A color near 255 in appearance, but not 255
int BestColor (const uint32 *pal, int r, int g, int b, int first=1, int num=255); int BestColor (const uint32 *pal, int r, int g, int b, int first=1, int num=255);
void InitPalette (); void InitPalette ();

View file

@ -1197,7 +1197,7 @@ static CopyFunc copyfuncs[]={
// Clips the copy area for CopyPixelData functions // Clips the copy area for CopyPixelData functions
// //
//=========================================================================== //===========================================================================
bool DFrameBuffer::ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy, bool ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy,
const BYTE *&patch, int &srcwidth, int &srcheight, int step_x, int step_y) const BYTE *&patch, int &srcwidth, int &srcheight, int step_x, int step_y)
{ {
// clip source rectangle to destination // clip source rectangle to destination
@ -1295,11 +1295,16 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
// //
//=========================================================================== //===========================================================================
void DFrameBuffer::PrecacheTexture(FTexture *tex, bool cache) void DFrameBuffer::PrecacheTexture(FTexture *tex, int cache)
{ {
if (tex != NULL) if (tex != NULL)
{ {
if (cache) if (cache & 1)
{
const FTexture::Span *spanp;
tex->GetColumn(0, &spanp);
}
else if (cache != 0)
{ {
tex->GetPixels (); tex->GetPixels ();
} }

View file

@ -382,7 +382,7 @@ public:
int step_x, int step_y, PalEntry * palette); int step_x, int step_y, PalEntry * palette);
// Precaches or unloads a texture // Precaches or unloads a texture
virtual void PrecacheTexture(FTexture *tex, bool cache); virtual void PrecacheTexture(FTexture *tex, int cache);
// Screen wiping // Screen wiping
virtual bool WipeStartScreen(int type); virtual bool WipeStartScreen(int type);
@ -401,13 +401,13 @@ protected:
DFrameBuffer () {} DFrameBuffer () {}
bool ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy,
const BYTE *&patch, int &srcwidth, int &srcheight, int step_x, int step_y);
private: private:
DWORD LastMS, LastSec, FrameCount, LastCount, LastTic; DWORD LastMS, LastSec, FrameCount, LastCount, LastTic;
}; };
bool ClipCopyPixelRect(int texwidth, int texheight, int &originx, int &originy,
const BYTE *&patch, int &srcwidth, int &srcheight, int step_x, int step_y);
extern FColorMatcher ColorMatcher; extern FColorMatcher ColorMatcher;
// This is the screen updated by I_FinishUpdate. // This is the screen updated by I_FinishUpdate.