mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- 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:
parent
5afb2b9aab
commit
b54b9bad7a
20 changed files with 222 additions and 351 deletions
|
@ -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)
|
||||
- Fixed a few bufs in the parser for composite textures.
|
||||
- Changed: When loading Zips all patches in the patches/ directory should
|
||||
|
|
|
@ -116,8 +116,8 @@ void A_VileAttack (AActor *actor)
|
|||
return;
|
||||
|
||||
// move the fire between the vile and the player
|
||||
fire->SetOrigin (actor->target->x + FixedMul (24*FRACUNIT, finecosine[an]),
|
||||
actor->target->y + FixedMul (24*FRACUNIT, finesine[an]),
|
||||
fire->SetOrigin (actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]),
|
||||
actor->target->y - FixedMul (24*FRACUNIT, finesine[an]),
|
||||
actor->target->z);
|
||||
|
||||
P_RadiusAttack (fire, actor, 70, 70, NAME_Fire, false);
|
||||
|
|
|
@ -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;
|
||||
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];
|
||||
FTexture *pic = TexMan[name];
|
||||
if (pic != NULL)
|
||||
{
|
||||
x -= pic->LeftOffset;
|
||||
|
|
|
@ -208,23 +208,23 @@ void A_StaffAttackPL1 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
damage = 5+(pr_sap()&15);
|
||||
angle = player->mo->angle;
|
||||
angle = actor->angle;
|
||||
angle += pr_sap.Random2() << 18;
|
||||
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
|
||||
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff), true);
|
||||
slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
|
||||
P_LineAttack (actor, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff), true);
|
||||
if (linetarget)
|
||||
{
|
||||
//S_StartSound(player->mo, sfx_stfhit);
|
||||
// turn to face target
|
||||
player->mo->angle = R_PointToAngle2 (player->mo->x,
|
||||
player->mo->y, linetarget->x, linetarget->y);
|
||||
actor->angle = R_PointToAngle2 (actor->x,
|
||||
actor->y, linetarget->x, linetarget->y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ void A_StaffAttackPL2 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
|
@ -255,16 +255,16 @@ void A_StaffAttackPL2 (AActor *actor)
|
|||
}
|
||||
// P_inter.c:P_DamageMobj() handles target momentums
|
||||
damage = 18+(pr_sap2()&63);
|
||||
angle = player->mo->angle;
|
||||
angle = actor->angle;
|
||||
angle += pr_sap2.Random2() << 18;
|
||||
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
|
||||
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff2), true);
|
||||
slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
|
||||
P_LineAttack (actor, angle, MELEERANGE, slope, damage, NAME_Melee, RUNTIME_CLASS(AStaffPuff2), true);
|
||||
if (linetarget)
|
||||
{
|
||||
//S_StartSound(player->mo, sfx_stfpow);
|
||||
// turn to face target
|
||||
player->mo->angle = R_PointToAngle2 (player->mo->x,
|
||||
player->mo->y, linetarget->x, linetarget->y);
|
||||
actor->angle = R_PointToAngle2 (actor->x,
|
||||
actor->y, linetarget->x, linetarget->y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,6 @@ END_DEFAULTS
|
|||
|
||||
void A_FireGoldWandPL1 (AActor *actor)
|
||||
{
|
||||
AActor *mo;
|
||||
angle_t angle;
|
||||
int damage;
|
||||
player_t *player;
|
||||
|
@ -442,22 +441,21 @@ void A_FireGoldWandPL1 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
mo = player->mo;
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
angle_t pitch = P_BulletSlope(mo);
|
||||
angle_t pitch = P_BulletSlope(actor);
|
||||
damage = 7+(pr_fgw()&7);
|
||||
angle = mo->angle;
|
||||
angle = actor->angle;
|
||||
if (player->refire)
|
||||
{
|
||||
angle += pr_fgw.Random2() << 18;
|
||||
}
|
||||
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff1));
|
||||
S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
||||
P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, RUNTIME_CLASS(AGoldWandPuff1));
|
||||
S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -469,7 +467,6 @@ void A_FireGoldWandPL1 (AActor *actor)
|
|||
void A_FireGoldWandPL2 (AActor *actor)
|
||||
{
|
||||
int i;
|
||||
AActor *mo;
|
||||
angle_t angle;
|
||||
int damage;
|
||||
fixed_t momz;
|
||||
|
@ -480,26 +477,25 @@ void A_FireGoldWandPL2 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
mo = player->mo;
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
angle_t pitch = P_BulletSlope(mo);
|
||||
angle_t pitch = P_BulletSlope(actor);
|
||||
momz = FixedMul (GetDefault<AGoldWandFX2>()->Speed,
|
||||
finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]);
|
||||
P_SpawnMissileAngle (mo, RUNTIME_CLASS(AGoldWandFX2), mo->angle-(ANG45/8), momz);
|
||||
P_SpawnMissileAngle (mo, RUNTIME_CLASS(AGoldWandFX2), mo->angle+(ANG45/8), momz);
|
||||
angle = mo->angle-(ANG45/8);
|
||||
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AGoldWandFX2), actor->angle-(ANG45/8), momz);
|
||||
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AGoldWandFX2), actor->angle+(ANG45/8), momz);
|
||||
angle = actor->angle-(ANG45/8);
|
||||
for(i = 0; i < 5; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
S_Sound (player->mo, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
||||
S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
// --- Crossbow -------------------------------------------------------------
|
||||
|
@ -714,7 +710,6 @@ END_DEFAULTS
|
|||
|
||||
void A_FireCrossbowPL1 (AActor *actor)
|
||||
{
|
||||
AActor *pmo;
|
||||
player_t *player;
|
||||
|
||||
if (NULL == (player = actor->player))
|
||||
|
@ -722,16 +717,15 @@ void A_FireCrossbowPL1 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
pmo = player->mo;
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX1));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle-(ANG45/10));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle+(ANG45/10));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX1));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->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)
|
||||
{
|
||||
AActor *pmo;
|
||||
player_t *player;
|
||||
|
||||
if (NULL == (player = actor->player))
|
||||
|
@ -750,18 +743,17 @@ void A_FireCrossbowPL2(AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
pmo = player->mo;
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2), pmo->angle-(ANG45/10));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX2), pmo->angle+(ANG45/10));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle-(ANG45/5));
|
||||
P_SpawnPlayerMissile (pmo, RUNTIME_CLASS(ACrossbowFX3), pmo->angle+(ANG45/5));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2), actor->angle-(ANG45/10));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX2), actor->angle+(ANG45/10));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACrossbowFX3), actor->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)
|
||||
{
|
||||
AActor *pmo;
|
||||
AActor *ball;
|
||||
angle_t angle;
|
||||
player_t *player;
|
||||
|
@ -1144,24 +1135,23 @@ void A_FireMacePL1B (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
pmo = player->mo;
|
||||
ball = Spawn<AMaceFX2> (pmo->x, pmo->y, pmo->z + 28*FRACUNIT
|
||||
- pmo->floorclip, ALLOW_REPLACE);
|
||||
ball = Spawn<AMaceFX2> (actor->x, actor->y, actor->z + 28*FRACUNIT
|
||||
- actor->floorclip, ALLOW_REPLACE);
|
||||
ball->momz = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/
|
||||
finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)];
|
||||
angle = pmo->angle;
|
||||
ball->target = pmo;
|
||||
finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
|
||||
angle = actor->angle;
|
||||
ball->target = actor;
|
||||
ball->angle = angle;
|
||||
ball->z += 2*finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)];
|
||||
ball->z += 2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
ball->momx = (pmo->momx>>1)+FixedMul(ball->Speed, finecosine[angle]);
|
||||
ball->momy = (pmo->momy>>1)+FixedMul(ball->Speed, finesine[angle]);
|
||||
ball->momx = (actor->momx>>1)+FixedMul(ball->Speed, finecosine[angle]);
|
||||
ball->momy = (actor->momy>>1)+FixedMul(ball->Speed, finesine[angle]);
|
||||
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
|
||||
P_CheckMissileSpawn (ball);
|
||||
}
|
||||
|
@ -1187,7 +1177,7 @@ void A_FireMacePL1 (AActor *actor)
|
|||
A_FireMacePL1B (actor);
|
||||
return;
|
||||
}
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
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].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
|
||||
ball = P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(AMaceFX1),
|
||||
player->mo->angle+(((pr_maceatk()&7)-4)<<24));
|
||||
ball = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AMaceFX1),
|
||||
actor->angle+(((pr_maceatk()&7)-4)<<24));
|
||||
if (ball)
|
||||
{
|
||||
ball->special1 = 16; // tics till dropoff
|
||||
|
@ -1348,25 +1338,25 @@ void A_FireMacePL2 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
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)
|
||||
{
|
||||
mo->momx += player->mo->momx;
|
||||
mo->momy += player->mo->momy;
|
||||
mo->momx += actor->momx;
|
||||
mo->momy += actor->momy;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
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].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
|
||||
angle = player->mo->angle;
|
||||
power = player->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2));
|
||||
angle = actor->angle;
|
||||
power = actor->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2));
|
||||
if (power)
|
||||
{
|
||||
damage = pr_gatk.HitDice (2);
|
||||
|
@ -1659,15 +1649,15 @@ void A_GauntletAttack (AActor *actor)
|
|||
angle += pr_gatk.Random2() << 18;
|
||||
pufftype = RUNTIME_CLASS(AGauntletPuff1);
|
||||
}
|
||||
slope = P_AimLineAttack (player->mo, angle, dist, &linetarget);
|
||||
P_LineAttack (player->mo, angle, dist, slope, damage, NAME_Melee, pufftype);
|
||||
slope = P_AimLineAttack (actor, angle, dist, &linetarget);
|
||||
P_LineAttack (actor, angle, dist, slope, damage, NAME_Melee, pufftype);
|
||||
if (!linetarget)
|
||||
{
|
||||
if (pr_gatk() > 64)
|
||||
{
|
||||
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;
|
||||
}
|
||||
randVal = pr_gatk();
|
||||
|
@ -1685,31 +1675,31 @@ void A_GauntletAttack (AActor *actor)
|
|||
}
|
||||
if (power)
|
||||
{
|
||||
P_GiveBody (player->mo, damage>>1);
|
||||
S_Sound (player->mo, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM);
|
||||
P_GiveBody (actor, damage>>1);
|
||||
S_Sound (actor, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM);
|
||||
}
|
||||
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
|
||||
angle = R_PointToAngle2 (player->mo->x, player->mo->y,
|
||||
angle = R_PointToAngle2 (actor->x, actor->y,
|
||||
linetarget->x, linetarget->y);
|
||||
if (angle-player->mo->angle > ANG180)
|
||||
if (angle-actor->angle > ANG180)
|
||||
{
|
||||
if ((int)(angle-player->mo->angle) < -ANG90/20)
|
||||
player->mo->angle = angle+ANG90/21;
|
||||
if ((int)(angle-actor->angle) < -ANG90/20)
|
||||
actor->angle = angle+ANG90/21;
|
||||
else
|
||||
player->mo->angle -= ANG90/20;
|
||||
actor->angle -= ANG90/20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (angle-player->mo->angle > ANG90/20)
|
||||
player->mo->angle = angle-ANG90/21;
|
||||
if (angle-actor->angle > ANG90/20)
|
||||
actor->angle = angle-ANG90/21;
|
||||
else
|
||||
player->mo->angle += ANG90/20;
|
||||
actor->angle += ANG90/20;
|
||||
}
|
||||
player->mo->flags |= MF_JUSTATTACKED;
|
||||
actor->flags |= MF_JUSTATTACKED;
|
||||
}
|
||||
|
||||
// --- Blaster (aka Claw) ---------------------------------------------------
|
||||
|
@ -2371,13 +2361,13 @@ void A_FireSkullRodPL1 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
mo = P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(AHornRodFX1));
|
||||
mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AHornRodFX1));
|
||||
// Randomize the first frame
|
||||
if (mo && pr_fsr1() > 128)
|
||||
{
|
||||
|
@ -2404,13 +2394,13 @@ void A_FireSkullRodPL2 (AActor *actor)
|
|||
{
|
||||
return;
|
||||
}
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
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
|
||||
// P_SpawnPlayerMissile because we need to give info to the mobj
|
||||
// even if it exploded immediately.
|
||||
|
@ -2818,7 +2808,7 @@ void A_FirePhoenixPL1 (AActor *actor)
|
|||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
P_SpawnPlayerMissile (player->mo, RUNTIME_CLASS(APhoenixFX1));
|
||||
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(APhoenixFX1));
|
||||
angle = actor->angle + ANG180;
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
actor->momx += FixedMul (4*FRACUNIT, finecosine[angle]);
|
||||
|
@ -2881,7 +2871,6 @@ void A_InitPhoenixPL2 (AActor *actor)
|
|||
void A_FirePhoenixPL2 (AActor *actor)
|
||||
{
|
||||
AActor *mo;
|
||||
AActor *pmo;
|
||||
angle_t angle;
|
||||
fixed_t x, y, z;
|
||||
fixed_t slope;
|
||||
|
@ -2901,25 +2890,24 @@ void A_FirePhoenixPL2 (AActor *actor)
|
|||
{ // Out of flame
|
||||
P_SetPsprite (player, ps_weapon, &APhoenixRod::States[S_PHOENIXATK2+3]);
|
||||
player->refire = 0;
|
||||
S_StopSound (player->mo, CHAN_WEAPON);
|
||||
S_StopSound (actor, CHAN_WEAPON);
|
||||
return;
|
||||
}
|
||||
pmo = player->mo;
|
||||
angle = pmo->angle;
|
||||
x = pmo->x + (pr_fp2.Random2() << 9);
|
||||
y = pmo->y + (pr_fp2.Random2() << 9);
|
||||
z = pmo->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)];
|
||||
z -= pmo->floorclip;
|
||||
slope = finetangent[FINEANGLES/4-(pmo->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
|
||||
angle = actor->angle;
|
||||
x = actor->x + (pr_fp2.Random2() << 9);
|
||||
y = actor->y + (pr_fp2.Random2() << 9);
|
||||
z = actor->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
|
||||
z -= actor->floorclip;
|
||||
slope = finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
|
||||
mo = Spawn<APhoenixFX2> (x, y, z, ALLOW_REPLACE);
|
||||
mo->target = pmo;
|
||||
mo->target = actor;
|
||||
mo->angle = angle;
|
||||
mo->momx = pmo->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);
|
||||
mo->momy = pmo->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]);
|
||||
mo->momx = actor->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);
|
||||
mo->momy = actor->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]);
|
||||
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);
|
||||
}
|
||||
|
@ -2939,7 +2927,7 @@ void A_ShutdownPhoenixPL2 (AActor *actor)
|
|||
return;
|
||||
}
|
||||
S_StopSound (actor, CHAN_WEAPON);
|
||||
AWeapon *weapon = actor->player->ReadyWeapon;
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
|
|
|
@ -571,7 +571,7 @@ void A_CHolyAttack (AActor *actor)
|
|||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
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;
|
||||
|
||||
weapon->CHolyCount = 3;
|
||||
|
|
|
@ -2295,7 +2295,7 @@ void A_FireSigil4 (AActor *actor)
|
|||
P_BulletSlope (actor, &linetarget);
|
||||
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)
|
||||
{
|
||||
spot->tracer = linetarget;
|
||||
|
|
|
@ -457,14 +457,14 @@ void R_PrecacheLevel (void)
|
|||
|
||||
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--)
|
||||
{
|
||||
hitlist[sides[i].GetTexture(side_t::top)] =
|
||||
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.
|
||||
|
@ -476,16 +476,16 @@ void R_PrecacheLevel (void)
|
|||
|
||||
if (sky1texture >= 0)
|
||||
{
|
||||
hitlist[sky1texture] = 1;
|
||||
hitlist[sky1texture] |= 1;
|
||||
}
|
||||
if (sky2texture >= 0)
|
||||
{
|
||||
hitlist[sky2texture] = 1;
|
||||
hitlist[sky2texture] |= 1;
|
||||
}
|
||||
|
||||
for (i = TexMan.NumTextures() - 1; i >= 0; i--)
|
||||
{
|
||||
screen->PrecacheTexture(TexMan[i], !!hitlist[i]);
|
||||
screen->PrecacheTexture(TexMan[i], hitlist[i]);
|
||||
}
|
||||
|
||||
delete[] hitlist;
|
||||
|
|
|
@ -59,6 +59,7 @@ protected:
|
|||
int SourceLump;
|
||||
BYTE *Pixels;
|
||||
Span **Spans;
|
||||
bool hackflag;
|
||||
|
||||
static bool Check(FileReader & file);
|
||||
static FTexture *Create(FileReader & file, int lumpnum);
|
||||
|
|
|
@ -351,6 +351,10 @@ const BYTE *FDDSTexture::GetColumn (unsigned int column, const Span **spans_out)
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -389,10 +393,6 @@ void FDDSTexture::MakeTexture ()
|
|||
{
|
||||
DecompressDXT5 (lump, Format == ID_DXT4);
|
||||
}
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
void FDDSTexture::ReadRGB (FWadLump &lump, BYTE *tcbuf)
|
||||
|
|
|
@ -121,6 +121,10 @@ const BYTE *FIMGZTexture::GetColumn (unsigned int column, const Span **spans_out
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -214,10 +218,5 @@ void FIMGZTexture::MakeTexture ()
|
|||
dest_p -= dest_rew;
|
||||
}
|
||||
}
|
||||
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,6 +265,10 @@ const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spa
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -290,11 +294,6 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
|
||||
Parts[i].OriginX, Parts[i].OriginY);
|
||||
}
|
||||
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -92,7 +92,7 @@ FTexture *FPatchTexture::Create(FileReader & file, int lumpnum)
|
|||
}
|
||||
|
||||
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);
|
||||
Name[8] = 0;
|
||||
|
@ -151,6 +151,10 @@ const BYTE *FPatchTexture::GetColumn (unsigned int column, const Span **spans_ou
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans(Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -160,10 +164,8 @@ const BYTE *FPatchTexture::GetColumn (unsigned int column, const Span **spans_ou
|
|||
void FPatchTexture::MakeTexture ()
|
||||
{
|
||||
BYTE *remap, remaptable[256];
|
||||
Span *spanstuffer, *spanstarter;
|
||||
const column_t *maxcol;
|
||||
bool warned;
|
||||
int numspans;
|
||||
const column_t *maxcol;
|
||||
int x;
|
||||
|
||||
FMemLump lump = Wads.ReadLump (SourceLump);
|
||||
|
@ -185,15 +187,6 @@ void FPatchTexture::MakeTexture ()
|
|||
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)
|
||||
{
|
||||
memcpy (remaptable, GPalette.Remap, 256);
|
||||
|
@ -205,6 +198,35 @@ void FPatchTexture::MakeTexture ()
|
|||
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
|
||||
for (x = 0; x < Width; ++x)
|
||||
{
|
||||
|
@ -246,146 +268,22 @@ void FPatchTexture::MakeTexture ()
|
|||
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.
|
||||
void FPatchTexture::HackHack (int newheight)
|
||||
{
|
||||
BYTE *out;
|
||||
int x;
|
||||
|
||||
Unload ();
|
||||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
}
|
||||
|
||||
{
|
||||
FMemLump lump = Wads.ReadLump (SourceLump);
|
||||
const patch_t *patch = (const patch_t *)lump.GetMem();
|
||||
Height = newheight;
|
||||
LeftOffset = 0;
|
||||
TopOffset = 0;
|
||||
|
||||
Width = LittleShort(patch->width);
|
||||
Height = newheight;
|
||||
LeftOffset = 0;
|
||||
TopOffset = 0;
|
||||
|
||||
Pixels = new BYTE[Width * Height];
|
||||
|
||||
// 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;
|
||||
}
|
||||
hackflag = true;
|
||||
bMasked = false; // Hacked textures don't have transparent parts.
|
||||
}
|
||||
|
|
|
@ -333,6 +333,10 @@ const BYTE *FPNGTexture::GetColumn (unsigned int column, const Span **spans_out)
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -478,10 +482,6 @@ void FPNGTexture::MakeTexture ()
|
|||
}
|
||||
}
|
||||
delete lump;
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -272,55 +272,39 @@ void FTexture::FreeSpans (Span **spans) const
|
|||
|
||||
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)
|
||||
dest += ypos + dheight * xpos;
|
||||
if (translation == NULL)
|
||||
{
|
||||
int len = span->Length;
|
||||
int y = ypos + span->TopOffset;
|
||||
int adv = span->TopOffset;
|
||||
|
||||
if (y < 0)
|
||||
for (int x = 0; x < srcwidth; x++)
|
||||
{
|
||||
adv -= y;
|
||||
len += y;
|
||||
y = 0;
|
||||
}
|
||||
if (y + len > dheight)
|
||||
{
|
||||
len = dheight - y;
|
||||
}
|
||||
if (len > 0)
|
||||
{
|
||||
if (translation == NULL)
|
||||
int pos = x * dheight;
|
||||
for (int y = 0; y < srcheight; y++, pos++)
|
||||
{
|
||||
memcpy (outtop + y, data + adv, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < len; ++j)
|
||||
{
|
||||
outtop[y+j] = translation[data[adv+j]];
|
||||
}
|
||||
// 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
|
||||
{
|
||||
for (int x = 0; x < srcwidth; x++)
|
||||
{
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,6 +134,10 @@ const BYTE *FTGATexture::GetColumn (unsigned int column, const Span **spans_out)
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -372,10 +376,6 @@ void FTGATexture::MakeTexture ()
|
|||
break;
|
||||
}
|
||||
delete [] buffer;
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -1367,6 +1367,10 @@ const BYTE *FFontChar2::GetColumn (unsigned int column, const Span **spans_out)
|
|||
}
|
||||
if (spans_out != NULL)
|
||||
{
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
*spans_out = Spans[column];
|
||||
}
|
||||
return Pixels + column*Height;
|
||||
|
@ -1466,11 +1470,6 @@ void FFontChar2::MakeTexture ()
|
|||
name[8] = 0;
|
||||
I_FatalError ("The font %s is corrupt", name);
|
||||
}
|
||||
|
||||
if (Spans == NULL)
|
||||
{
|
||||
Spans = CreateSpans (Pixels);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -64,7 +64,6 @@ BYTE GoldColormap[256];
|
|||
// [BC] New Skulltag colormaps.
|
||||
BYTE RedColormap[256];
|
||||
BYTE GreenColormap[256];
|
||||
int Near255;
|
||||
|
||||
static void FreeSpecialLights();;
|
||||
|
||||
|
|
|
@ -93,8 +93,6 @@ extern FDynamicColormap NormalLight;
|
|||
// The color overlay to use for depleted items
|
||||
#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);
|
||||
|
||||
void InitPalette ();
|
||||
|
|
|
@ -1197,7 +1197,7 @@ static CopyFunc copyfuncs[]={
|
|||
// 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)
|
||||
{
|
||||
// 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 (cache)
|
||||
if (cache & 1)
|
||||
{
|
||||
const FTexture::Span *spanp;
|
||||
tex->GetColumn(0, &spanp);
|
||||
}
|
||||
else if (cache != 0)
|
||||
{
|
||||
tex->GetPixels ();
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ public:
|
|||
int step_x, int step_y, PalEntry * palette);
|
||||
|
||||
// Precaches or unloads a texture
|
||||
virtual void PrecacheTexture(FTexture *tex, bool cache);
|
||||
virtual void PrecacheTexture(FTexture *tex, int cache);
|
||||
|
||||
// Screen wiping
|
||||
virtual bool WipeStartScreen(int type);
|
||||
|
@ -401,13 +401,13 @@ protected:
|
|||
|
||||
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:
|
||||
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;
|
||||
|
||||
// This is the screen updated by I_FinishUpdate.
|
||||
|
|
Loading…
Reference in a new issue