- converted scale variables in AActor, FMapThing and skin to float.

This commit is contained in:
Christoph Oelckers 2016-03-20 12:13:00 +01:00
parent 5875e91f39
commit ada5097e34
33 changed files with 112 additions and 123 deletions

View file

@ -1089,7 +1089,7 @@ public:
WORD sprite; // used to find patch_t and flip value WORD sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw BYTE frame; // sprite frame to draw
fixed_t scaleX, scaleY; // Scaling values; FRACUNIT is normal size DVector2 Scale; // Scaling values; 1 is normal size
FRenderStyle RenderStyle; // Style to draw this actor with FRenderStyle RenderStyle; // Style to draw this actor with
ActorRenderFlags renderflags; // Different rendering flags ActorRenderFlags renderflags; // Different rendering flags
FTextureID picnum; // Draw this instead of sprite if valid FTextureID picnum; // Draw this instead of sprite if valid

View file

@ -2844,8 +2844,8 @@ void AM_drawThings ()
if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found. if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found.
const fixed_t spriteXScale = FixedMul(t->scaleX, 10 * scale_mtof); const fixed_t spriteXScale = fixed_t(t->Scale.X * 10 * scale_mtof);
const fixed_t spriteYScale = FixedMul(t->scaleY, 10 * scale_mtof); const fixed_t spriteYScale = fixed_t(t->Scale.Y * 10 * scale_mtof);
DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)), DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)),
spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]); spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]);
@ -3042,7 +3042,7 @@ void AM_drawAuthorMarkers ()
marked->Sector->MoreFlags & SECF_DRAWN))) marked->Sector->MoreFlags & SECF_DRAWN)))
{ {
DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0, DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0,
flip, mark->scaleX, mark->scaleY, mark->Translation, flip, FLOAT2FIXED(mark->Scale.X), FLOAT2FIXED(mark->Scale.Y), mark->Translation,
mark->alpha, mark->fillcolor, mark->RenderStyle); mark->alpha, mark->fillcolor, mark->RenderStyle);
} }
marked = mark->args[0] != 0 ? it.Next() : NULL; marked = mark->args[0] != 0 ? it.Next() : NULL;

View file

@ -928,7 +928,7 @@ static int PatchThing (int thingy)
} }
else if (stricmp (Line1, "Scale") == 0) else if (stricmp (Line1, "Scale") == 0)
{ {
info->scaleY = info->scaleX = clamp<fixed_t> (FLOAT2FIXED(atof (Line2)), 1, 256*FRACUNIT); info->Scale.Y = info->Scale.X = clamp(atof (Line2), 1./65536, 256.);
} }
else if (stricmp (Line1, "Decal") == 0) else if (stricmp (Line1, "Decal") == 0)
{ {

View file

@ -533,7 +533,7 @@ extern player_t players[MAXPLAYERS];
FArchive &operator<< (FArchive &arc, player_t *&p); FArchive &operator<< (FArchive &arc, player_t *&p);
void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley); void P_CheckPlayerSprite(AActor *mo, int &spritenum, DVector2 &scale);
inline void AActor::SetFriendPlayer(player_t *player) inline void AActor::SetFriendPlayer(player_t *player)
{ {

View file

@ -26,6 +26,7 @@
// The most basic types we use, portability. // The most basic types we use, portability.
#include "doomtype.h" #include "doomtype.h"
#include "vectors.h"
// Some global defines, that configure the game. // Some global defines, that configure the game.
#include "doomdef.h" #include "doomdef.h"
@ -360,8 +361,7 @@ struct FMapThing
fixed_t gravity; fixed_t gravity;
fixed_t alpha; fixed_t alpha;
DWORD fillcolor; DWORD fillcolor;
fixed_t scaleX; DVector2 Scale;
fixed_t scaleY;
int health; int health;
int score; int score;
short pitch; short pitch;

View file

@ -649,13 +649,11 @@ void AScriptedMarine::SetSprite (PClassActor *source)
{ // A valid actor class wasn't passed, so use the standard sprite { // A valid actor class wasn't passed, so use the standard sprite
SpriteOverride = sprite = GetClass()->OwnedStates[0].sprite; SpriteOverride = sprite = GetClass()->OwnedStates[0].sprite;
// Copy the standard scaling // Copy the standard scaling
scaleX = GetDefault()->scaleX; Scale = GetDefault()->Scale;
scaleY = GetDefault()->scaleY;
} }
else else
{ // Use the same sprite and scaling the passed class spawns with { // Use the same sprite and scaling the passed class spawns with
SpriteOverride = sprite = GetDefaultByType (source)->SpawnState->sprite; SpriteOverride = sprite = GetDefaultByType (source)->SpawnState->sprite;
scaleX = GetDefaultByType(source)->scaleX; Scale = GetDefaultByType(source)->Scale;
scaleY = GetDefaultByType(source)->scaleY;
} }
} }

View file

@ -1645,8 +1645,8 @@ static void G_QueueBody (AActor *body)
const AActor *const defaultActor = body->GetDefault(); const AActor *const defaultActor = body->GetDefault();
const FPlayerSkin &skin = skins[skinidx]; const FPlayerSkin &skin = skins[skinidx];
body->scaleX = Scale(body->scaleX, skin.ScaleX, defaultActor->scaleX); body->Scale.X *= skin.Scale.X / defaultActor->Scale.X;
body->scaleY = Scale(body->scaleY, skin.ScaleY, defaultActor->scaleY); body->Scale.Y *= skin.Scale.Y / defaultActor->Scale.Y;
} }
bodyqueslot++; bodyqueslot++;

View file

@ -520,9 +520,9 @@ void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
// -O1 optimizer bug work around. Only needed for // -O1 optimizer bug work around. Only needed for
// GCC 4.2.1 on OS X for 10.4/10.5 tools compatibility. // GCC 4.2.1 on OS X for 10.4/10.5 tools compatibility.
volatile fixed_t tmp = 300; volatile fixed_t tmp = 300;
Slots[i] -= Scale (damage, SlotsIncrement[i], tmp); Slots[i] -= ::Scale (damage, SlotsIncrement[i], tmp);
#else #else
Slots[i] -= Scale (damage, SlotsIncrement[i], 300); Slots[i] -= ::Scale (damage, SlotsIncrement[i], 300);
#endif #endif
if (Slots[i] < 2*FRACUNIT) if (Slots[i] < 2*FRACUNIT)
{ {
@ -535,7 +535,7 @@ void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
} }
} }
} }
int saved = Scale (damage, savedPercent, 100*FRACUNIT); int saved = ::Scale (damage, savedPercent, 100*FRACUNIT);
if (saved > savedPercent >> (FRACBITS-1)) if (saved > savedPercent >> (FRACBITS-1))
{ {
saved = savedPercent >> (FRACBITS-1); saved = savedPercent >> (FRACBITS-1);

View file

@ -1275,8 +1275,7 @@ void APowerSpeed::DoEffect ()
speedMo->floorclip = Owner->floorclip; speedMo->floorclip = Owner->floorclip;
// [BC] Also get the scale from the owner. // [BC] Also get the scale from the owner.
speedMo->scaleX = Owner->scaleX; speedMo->Scale = Owner->Scale;
speedMo->scaleY = Owner->scaleY;
if (Owner == players[consoleplayer].camera && if (Owner == players[consoleplayer].camera &&
!(Owner->player->cheats & CF_CHASECAM)) !(Owner->player->cheats & CF_CHASECAM))

View file

@ -92,7 +92,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
DBaseDecal::DBaseDecal (const AActor *basis) DBaseDecal::DBaseDecal (const AActor *basis)
: DThinker(STAT_DECAL), : DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(basis->scaleX), ScaleY(basis->scaleY), WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(FLOAT2FIXED(basis->Scale.X)), ScaleY(FLOAT2FIXED(basis->Scale.Y)),
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum), Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle) RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{ {

View file

@ -310,8 +310,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (applyscale) if (applyscale)
{ {
spawnScaleX = FIXED2DBL(item->scaleX); spawnScaleX = item->Scale.X;
spawnScaleY = FIXED2DBL(item->scaleY); spawnScaleY = item->Scale.Y;
} }
texture = TexMan[icon]; texture = TexMan[icon];

View file

@ -591,8 +591,7 @@ void DIntermissionScreenCast::Drawer ()
// draw the current frame in the middle of the screen // draw the current frame in the middle of the screen
if (caststate != NULL) if (caststate != NULL)
{ {
double castscalex = FIXED2DBL(mDefaults->scaleX); DVector2 castscale = mDefaults->Scale;
double castscaley = FIXED2DBL(mDefaults->scaleY);
int castsprite = caststate->sprite; int castsprite = caststate->sprite;
@ -612,8 +611,7 @@ void DIntermissionScreenCast::Drawer ()
if (!(mDefaults->flags4 & MF4_NOSKIN)) if (!(mDefaults->flags4 & MF4_NOSKIN))
{ {
castscaley = FIXED2DBL(skin->ScaleY); castscale = skin->Scale;
castscalex = FIXED2DBL(skin->ScaleX);
} }
} }
@ -626,8 +624,8 @@ void DIntermissionScreenCast::Drawer ()
screen->DrawTexture (pic, 160, 170, screen->DrawTexture (pic, 160, 170,
DTA_320x200, true, DTA_320x200, true,
DTA_FlipX, sprframe->Flip & 1, DTA_FlipX, sprframe->Flip & 1,
DTA_DestHeightF, pic->GetScaledHeightDouble() * castscaley, DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y,
DTA_DestWidthF, pic->GetScaledWidthDouble() * castscalex, DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X,
DTA_RenderStyle, mDefaults->RenderStyle, DTA_RenderStyle, mDefaults->RenderStyle,
DTA_Alpha, mDefaults->alpha, DTA_Alpha, mDefaults->alpha,
DTA_Translation, casttranslation, DTA_Translation, casttranslation,

View file

@ -563,21 +563,19 @@ void FListMenuItemPlayerDisplay::Drawer(bool selected)
V_DrawFrame (x, y, 72*CleanXfac, 80*CleanYfac-1); V_DrawFrame (x, y, 72*CleanXfac, 80*CleanYfac-1);
spriteframe_t *sprframe = NULL; spriteframe_t *sprframe = NULL;
fixed_t scaleX, scaleY; DVector2 Scale;
if (mPlayerState != NULL) if (mPlayerState != NULL)
{ {
if (mSkin == 0) if (mSkin == 0)
{ {
sprframe = &SpriteFrames[sprites[mPlayerState->sprite].spriteframes + mPlayerState->GetFrame()]; sprframe = &SpriteFrames[sprites[mPlayerState->sprite].spriteframes + mPlayerState->GetFrame()];
scaleX = GetDefaultByType(mPlayerClass->Type)->scaleX; Scale = GetDefaultByType(mPlayerClass->Type)->Scale;
scaleY = GetDefaultByType(mPlayerClass->Type)->scaleY;
} }
else else
{ {
sprframe = &SpriteFrames[sprites[skins[mSkin].sprite].spriteframes + mPlayerState->GetFrame()]; sprframe = &SpriteFrames[sprites[skins[mSkin].sprite].spriteframes + mPlayerState->GetFrame()];
scaleX = skins[mSkin].ScaleX; Scale = skins[mSkin].Scale;
scaleY = skins[mSkin].ScaleY;
} }
} }
@ -590,8 +588,8 @@ void FListMenuItemPlayerDisplay::Drawer(bool selected)
if (mTranslate) trans = translationtables[TRANSLATION_Players](MAXPLAYERS); if (mTranslate) trans = translationtables[TRANSLATION_Players](MAXPLAYERS);
screen->DrawTexture (tex, screen->DrawTexture (tex,
x + 36*CleanXfac, y + 71*CleanYfac, x + 36*CleanXfac, y + 71*CleanYfac,
DTA_DestWidth, MulScale16 (tex->GetScaledWidth() * CleanXfac, scaleX), DTA_DestWidthF, tex->GetScaledWidthDouble() * CleanXfac * Scale.X,
DTA_DestHeight, MulScale16 (tex->GetScaledHeight() * CleanYfac, scaleY), DTA_DestHeightF, tex->GetScaledHeightDouble() * CleanYfac * Scale.Y,
DTA_Translation, trans, DTA_Translation, trans,
DTA_FlipX, sprframe->Flip & (1 << mRotation), DTA_FlipX, sprframe->Flip & (1 << mRotation),
TAG_DONE); TAG_DONE);

View file

@ -3938,11 +3938,11 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break; break;
case APROP_ScaleX: case APROP_ScaleX:
actor->scaleX = value; actor->Scale.X = FIXED2DBL(value);
break; break;
case APROP_ScaleY: case APROP_ScaleY:
actor->scaleY = value; actor->Scale.Y = FIXED2DBL(value);
break; break;
case APROP_Mass: case APROP_Mass:
@ -4052,8 +4052,8 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_TargetTID: return (actor->target != NULL)? actor->target->tid : 0; case APROP_TargetTID: return (actor->target != NULL)? actor->target->tid : 0;
case APROP_TracerTID: return (actor->tracer != NULL)? actor->tracer->tid : 0; case APROP_TracerTID: return (actor->tracer != NULL)? actor->tracer->tid : 0;
case APROP_WaterLevel: return actor->waterlevel; case APROP_WaterLevel: return actor->waterlevel;
case APROP_ScaleX: return actor->scaleX; case APROP_ScaleX: return FLOAT2FIXED(actor->Scale.X);
case APROP_ScaleY: return actor->scaleY; case APROP_ScaleY: return FLOAT2FIXED(actor->Scale.Y);
case APROP_Mass: return actor->Mass; case APROP_Mass: return actor->Mass;
case APROP_Accuracy: return actor->accuracy; case APROP_Accuracy: return actor->accuracy;
case APROP_Stamina: return actor->stamina; case APROP_Stamina: return actor->stamina;

View file

@ -883,8 +883,8 @@ void ACustomSprite::BeginPlay ()
mysnprintf (name, countof(name), "BTIL%04d", args[0] & 0xffff); mysnprintf (name, countof(name), "BTIL%04d", args[0] & 0xffff);
picnum = TexMan.GetTexture (name, FTexture::TEX_Build); picnum = TexMan.GetTexture (name, FTexture::TEX_Build);
scaleX = args[2] * (FRACUNIT/64); Scale.X = args[2] / 64.;
scaleY = args[3] * (FRACUNIT/64); Scale.Y = args[3] / 64.;
int cstat = args[4]; int cstat = args[4];
if (cstat & 2) if (cstat & 2)

View file

@ -294,8 +294,8 @@ void P_ThinkParticles ()
AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::ceiling]; AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::ceiling];
if (particle->z > skybox->threshold) if (particle->z > skybox->threshold)
{ {
particle->x += skybox->scaleX; particle->x += FLOAT2FIXED(skybox->Scale.X);
particle->y += skybox->scaleY; particle->y += FLOAT2FIXED(skybox->Scale.Y);
particle->subsector = NULL; particle->subsector = NULL;
} }
} }
@ -304,8 +304,8 @@ void P_ThinkParticles ()
AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::floor]; AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::floor];
if (particle->z < skybox->threshold) if (particle->z < skybox->threshold)
{ {
particle->x += skybox->scaleX; particle->x += FLOAT2FIXED(skybox->Scale.X);
particle->y += skybox->scaleY; particle->y += FLOAT2FIXED(skybox->Scale.Y);
particle->subsector = NULL; particle->subsector = NULL;
} }
} }

View file

@ -162,16 +162,16 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
if (checkabove) if (checkabove)
{ {
sector_t *upper = sector_t *upper =
P_PointInSector(check->v1->x + check->dx / 2 + sec->SkyBoxes[sector_t::ceiling]->scaleX, P_PointInSector(check->v1->x + check->dx / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.X),
check->v1->y + check->dy / 2 + sec->SkyBoxes[sector_t::ceiling]->scaleY); check->v1->y + check->dy / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.Y));
P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist); P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist);
} }
if (checkbelow) if (checkbelow)
{ {
sector_t *lower = sector_t *lower =
P_PointInSector(check->v1->x + check->dx / 2 + sec->SkyBoxes[sector_t::floor]->scaleX, P_PointInSector(check->v1->x + check->dx / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.X),
check->v1->y + check->dy / 2 + sec->SkyBoxes[sector_t::floor]->scaleY); check->v1->y + check->dy / 2 + FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->Scale.Y));
P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist); P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist);
} }

View file

@ -3667,7 +3667,7 @@ struct aim_t
newtrace.toppitch = newtoppitch; newtrace.toppitch = newtoppitch;
newtrace.bottompitch = newbottompitch; newtrace.bottompitch = newbottompitch;
newtrace.aimdir = position == sector_t::ceiling? aim_t::aim_up : aim_t::aim_down; newtrace.aimdir = position == sector_t::ceiling? aim_t::aim_up : aim_t::aim_down;
newtrace.startpos = { startpos.x + portal->scaleX, startpos.y + portal->scaleY, startpos.z }; newtrace.startpos = { startpos.x + FLOAT2FIXED(portal->Scale.X), startpos.y + FLOAT2FIXED(portal->Scale.Y), startpos.z };
newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which would produce a bogus opening newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which would produce a bogus opening
newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac)); newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac));
newtrace.limitz = portal->threshold; newtrace.limitz = portal->threshold;

View file

@ -239,8 +239,7 @@ void AActor::Serialize(FArchive &arc)
<< __pos.z << __pos.z
<< Angles.Yaw << Angles.Yaw
<< frame << frame
<< scaleX << Scale
<< scaleY
<< RenderStyle << RenderStyle
<< renderflags << renderflags
<< picnum << picnum
@ -5172,10 +5171,10 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->alpha = mthing->alpha; mobj->alpha = mthing->alpha;
if (mthing->RenderStyle != STYLE_Count) if (mthing->RenderStyle != STYLE_Count)
mobj->RenderStyle = (ERenderStyle)mthing->RenderStyle; mobj->RenderStyle = (ERenderStyle)mthing->RenderStyle;
if (mthing->scaleX) if (mthing->Scale.X != 0)
mobj->scaleX = FixedMul(mthing->scaleX, mobj->scaleX); mobj->Scale.X = mthing->Scale.X * mobj->Scale.X;
if (mthing->scaleY) if (mthing->Scale.Y != 0)
mobj->scaleY = FixedMul(mthing->scaleY, mobj->scaleY); mobj->Scale.X = mthing->Scale.Y * mobj->Scale.Y;
if (mthing->pitch) if (mthing->pitch)
mobj->Angles.Pitch = (double)mthing->pitch; mobj->Angles.Pitch = (double)mthing->pitch;
if (mthing->roll) if (mthing->roll)

View file

@ -1049,8 +1049,8 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha, int linked
reference->special1 = linked ? SKYBOX_LINKEDPORTAL : SKYBOX_PORTAL; reference->special1 = linked ? SKYBOX_LINKEDPORTAL : SKYBOX_PORTAL;
anchor->special1 = SKYBOX_ANCHOR; anchor->special1 = SKYBOX_ANCHOR;
// store the portal displacement in the unused scaleX/Y members of the portal reference actor. // store the portal displacement in the unused scaleX/Y members of the portal reference actor.
anchor->scaleX = -(reference->scaleX = x2 - x1); anchor->Scale.X = -(reference->Scale.X = FIXED2DBL(x2 - x1));
anchor->scaleY = -(reference->scaleY = y2 - y1); anchor->Scale.Y = -(reference->Scale.Y = FIXED2DBL(y2 - y1));
anchor->threshold = reference->threshold = z; anchor->threshold = reference->threshold = z;
reference->Mate = anchor; reference->Mate = anchor;

View file

@ -203,8 +203,8 @@ void FTraceInfo::EnterSectorPortal(int position, fixed_t frac, sector_t *enterse
memset(&results, 0, sizeof(results)); memset(&results, 0, sizeof(results));
newtrace.StartX = StartX + portal->scaleX; newtrace.StartX = StartX + FLOAT2FIXED(portal->Scale.X);
newtrace.StartY = StartY + portal->scaleY; newtrace.StartY = StartY + FLOAT2FIXED(portal->Scale.Y);
newtrace.StartZ = StartZ; newtrace.StartZ = StartZ;
frac += FixedDiv(FRACUNIT, MaxDist); frac += FixedDiv(FRACUNIT, MaxDist);

View file

@ -718,15 +718,15 @@ public:
break; break;
case NAME_ScaleX: case NAME_ScaleX:
th->scaleX = CheckFixed(key); th->Scale.X = CheckFloat(key);
break; break;
case NAME_ScaleY: case NAME_ScaleY:
th->scaleY = CheckFixed(key); th->Scale.Y = CheckFloat(key);
break; break;
case NAME_Scale: case NAME_Scale:
th->scaleX = th->scaleY = CheckFixed(key); th->Scale.X = th->Scale.Y = CheckFloat(key);
break; break;
default: default:

View file

@ -1703,7 +1703,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckPlayerDone)
// //
//=========================================================================== //===========================================================================
void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t &scaley) void P_CheckPlayerSprite(AActor *actor, int &spritenum, DVector2 &scale)
{ {
player_t *player = actor->player; player_t *player = actor->player;
int crouchspriteno; int crouchspriteno;
@ -1711,10 +1711,9 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t
if (player->userinfo.GetSkin() != 0 && !(actor->flags4 & MF4_NOSKIN)) if (player->userinfo.GetSkin() != 0 && !(actor->flags4 & MF4_NOSKIN))
{ {
// Convert from default scale to skin scale. // Convert from default scale to skin scale.
fixed_t defscaleY = actor->GetDefault()->scaleY; DVector2 defscale = actor->GetDefault()->Scale;
fixed_t defscaleX = actor->GetDefault()->scaleX; scale.X *= skins[player->userinfo.GetSkin()].Scale.X / defscale.X;
scaley = Scale(scaley, skins[player->userinfo.GetSkin()].ScaleY, defscaleY); scale.Y *= skins[player->userinfo.GetSkin()].Scale.Y / defscale.Y;
scalex = Scale(scalex, skins[player->userinfo.GetSkin()].ScaleX, defscaleX);
} }
// Set the crouch sprite? // Set the crouch sprite?
@ -1741,7 +1740,7 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t
} }
else if (player->playerstate != PST_DEAD && player->crouchfactor < 0.75) else if (player->playerstate != PST_DEAD && player->crouchfactor < 0.75)
{ {
scaley /= 2; scale.Y *= 0.5;
} }
} }
} }

View file

@ -813,13 +813,13 @@ static void AddDisplacementForPortal(AStackPoint *portal)
FDisplacement & disp = Displacements(thisgroup, othergroup); FDisplacement & disp = Displacements(thisgroup, othergroup);
if (!disp.isSet) if (!disp.isSet)
{ {
disp.pos.x = portal->scaleX; disp.pos.x = FLOAT2FIXED(portal->Scale.X);
disp.pos.y = portal->scaleY; disp.pos.y = FLOAT2FIXED(portal->Scale.Y);
disp.isSet = true; disp.isSet = true;
} }
else else
{ {
if (disp.pos.x != portal->scaleX || disp.pos.y != portal->scaleY) if (disp.pos.x != FLOAT2FIXED(portal->Scale.X) || disp.pos.y != FLOAT2FIXED(portal->Scale.Y))
{ {
Printf("Portal between sectors %d and %d has displacement mismatch and will be disabled\n", portal->Sector->sectornum, portal->Mate->Sector->sectornum); Printf("Portal between sectors %d and %d has displacement mismatch and will be disabled\n", portal->Sector->sectornum, portal->Mate->Sector->sectornum);
portal->special1 = portal->Mate->special1 = SKYBOX_PORTAL; portal->special1 = portal->Mate->special1 = SKYBOX_PORTAL;

View file

@ -594,8 +594,8 @@ void R_InitSkins (void)
} }
else if (0 == stricmp (key, "scale")) else if (0 == stricmp (key, "scale"))
{ {
skins[i].ScaleX = clamp<fixed_t> (FLOAT2FIXED(atof (sc.String)), 1, 256*FRACUNIT); skins[i].Scale.X = clamp(atof (sc.String), 1./65536, 256.);
skins[i].ScaleY = skins[i].ScaleX; skins[i].Scale.Y = skins[i].Scale.X;
} }
else if (0 == stricmp (key, "game")) else if (0 == stricmp (key, "game"))
{ {
@ -935,8 +935,7 @@ void R_InitSprites ()
PClassPlayerPawn *type = PlayerClasses[0].Type; PClassPlayerPawn *type = PlayerClasses[0].Type;
skins[i].range0start = type->ColorRangeStart; skins[i].range0start = type->ColorRangeStart;
skins[i].range0end = type->ColorRangeEnd; skins[i].range0end = type->ColorRangeEnd;
skins[i].ScaleX = GetDefaultByType (type)->scaleX; skins[i].Scale = GetDefaultByType (type)->Scale;
skins[i].ScaleY = GetDefaultByType (type)->scaleY;
} }
R_InitSpriteDefs (); R_InitSpriteDefs ();
@ -965,8 +964,7 @@ void R_InitSprites ()
} }
skins[i].range0start = basetype->ColorRangeStart; skins[i].range0start = basetype->ColorRangeStart;
skins[i].range0end = basetype->ColorRangeEnd; skins[i].range0end = basetype->ColorRangeEnd;
skins[i].ScaleX = GetDefaultByType (basetype)->scaleX; skins[i].Scale = GetDefaultByType (basetype)->Scale;
skins[i].ScaleY = GetDefaultByType (basetype)->scaleY;
skins[i].sprite = GetDefaultByType (basetype)->SpawnState->sprite; skins[i].sprite = GetDefaultByType (basetype)->SpawnState->sprite;
skins[i].namespc = ns_global; skins[i].namespc = ns_global;

View file

@ -1,6 +1,8 @@
#ifndef __RES_SPRITES_H #ifndef __RES_SPRITES_H
#define __RES_SPRITES_H #define __RES_SPRITES_H
#include "vectors.h"
#define MAX_SPRITE_FRAMES 29 // [RH] Macro-ized as in BOOM. #define MAX_SPRITE_FRAMES 29 // [RH] Macro-ized as in BOOM.
// //
@ -51,8 +53,7 @@ public:
BYTE range0start; BYTE range0start;
BYTE range0end; BYTE range0end;
bool othergame; // [GRB] bool othergame; // [GRB]
fixed_t ScaleX; DVector2 Scale;
fixed_t ScaleY;
int sprite; int sprite;
int crouchsprite; int crouchsprite;
int namespc; // namespace for this skin int namespc; // namespace for this skin

View file

@ -776,17 +776,16 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
voxel = NULL; voxel = NULL;
int spritenum = thing->sprite; int spritenum = thing->sprite;
fixed_t spritescaleX = thing->scaleX; DVector2 spriteScale = thing->Scale;
fixed_t spritescaleY = thing->scaleY;
int renderflags = thing->renderflags; int renderflags = thing->renderflags;
if (spritescaleY < 0) if (spriteScale.Y < 0)
{ {
spritescaleY = -spritescaleY; spriteScale.Y = -spriteScale.Y;
renderflags ^= RF_YFLIP; renderflags ^= RF_YFLIP;
} }
if (thing->player != NULL) if (thing->player != NULL)
{ {
P_CheckPlayerSprite(thing, spritenum, spritescaleX, spritescaleY); P_CheckPlayerSprite(thing, spritenum, spriteScale);
} }
if (thing->picnum.isValid()) if (thing->picnum.isValid())
@ -864,9 +863,9 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
} }
} }
} }
if (spritescaleX < 0) if (spriteScale.X < 0)
{ {
spritescaleX = -spritescaleX; spriteScale.X = -spriteScale.X;
renderflags ^= RF_XFLIP; renderflags ^= RF_XFLIP;
} }
if (voxel == NULL && (tex == NULL || tex->UseType == FTexture::TEX_Null)) if (voxel == NULL && (tex == NULL || tex->UseType == FTexture::TEX_Null))
@ -874,6 +873,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
return; return;
} }
fixed_t spritescaleX = FLOAT2FIXED(spriteScale.X);
fixed_t spritescaleY = FLOAT2FIXED(spriteScale.Y);
if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) if ((renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE)
{ {
R_ProjectWallSprite(thing, fx, fy, fz, picnum, spritescaleX, spritescaleY, renderflags); R_ProjectWallSprite(thing, fx, fy, fz, picnum, spritescaleX, spritescaleY, renderflags);

View file

@ -715,8 +715,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
AActor *point = viewsector->SkyBoxes[sector_t::ceiling]; AActor *point = viewsector->SkyBoxes[sector_t::ceiling];
if (viewz > point->threshold) if (viewz > point->threshold)
{ {
viewx += point->scaleX; viewx += FLOAT2FIXED(point->Scale.X);
viewy += point->scaleY; viewy += FLOAT2FIXED(point->Scale.Y);
viewsector = R_PointInSubsector(viewx, viewy)->sector; viewsector = R_PointInSubsector(viewx, viewy)->sector;
moved = true; moved = true;
} }
@ -729,8 +729,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
AActor *point = viewsector->SkyBoxes[sector_t::floor]; AActor *point = viewsector->SkyBoxes[sector_t::floor];
if (viewz < point->threshold) if (viewz < point->threshold)
{ {
viewx += point->scaleX; viewx += FLOAT2FIXED(point->Scale.X);
viewy += point->scaleY; viewy += FLOAT2FIXED(point->Scale.Y);
viewsector = R_PointInSubsector(viewx, viewy)->sector; viewsector = R_PointInSubsector(viewx, viewy)->sector;
moved = true; moved = true;
} }

View file

@ -2281,7 +2281,7 @@ void AAmbientSound::Activate (AActor *activator)
Destroy (); Destroy ();
return; return;
} }
amb->periodmin = Scale(S_GetMSLength(sndnum), TICRATE, 1000); amb->periodmin = ::Scale(S_GetMSLength(sndnum), TICRATE, 1000);
} }
NextCheck = level.maptime; NextCheck = level.maptime;

View file

@ -445,7 +445,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
else if (sc.Compare ("Scale")) else if (sc.Compare ("Scale"))
{ {
sc.MustGetFloat (); sc.MustGetFloat ();
defaults->scaleX = defaults->scaleY = FLOAT2FIXED(sc.Float); defaults->Scale.X = defaults->Scale.Y = sc.Float;
} }
else if (sc.Compare ("RenderStyle")) else if (sc.Compare ("RenderStyle"))
{ {

View file

@ -2310,8 +2310,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
} }
if (flags & SIXF_TRANSFERSCALE) if (flags & SIXF_TRANSFERSCALE)
{ {
mo->scaleX = self->scaleX; mo->Scale = self->Scale;
mo->scaleY = self->scaleY;
} }
if (flags & SIXF_TRANSFERAMBUSHFLAG) if (flags & SIXF_TRANSFERAMBUSHFLAG)
{ {
@ -2884,8 +2883,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
PARAM_FIXED (scalex); PARAM_FLOAT (scalex);
PARAM_FIXED_OPT (scaley) { scaley = scalex; } PARAM_FLOAT_OPT (scaley) { scaley = scalex; }
PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; }
PARAM_BOOL_OPT (usezero) { usezero = false; } PARAM_BOOL_OPT (usezero) { usezero = false; }
@ -2897,8 +2896,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale)
{ {
scaley = scalex; scaley = scalex;
} }
ref->scaleX = scalex; ref->Scale = { scalex, scaley };
ref->scaleY = scaley;
} }
return 0; return 0;
} }

View file

@ -620,18 +620,18 @@ void InitThingdef()
PSymbolTable &symt = RUNTIME_CLASS(AActor)->Symbols; PSymbolTable &symt = RUNTIME_CLASS(AActor)->Symbols;
PType *array5 = NewArray(TypeSInt32, 5); PType *array5 = NewArray(TypeSInt32, 5);
symt.AddSymbol(new PField(NAME_Alpha, TypeFixed, VARF_Native, myoffsetof(AActor,alpha))); symt.AddSymbol(new PField(NAME_Alpha, TypeFixed, VARF_Native, myoffsetof(AActor,alpha)));
symt.AddSymbol(new PField(NAME_Angle, TypeFloat64,VARF_Native, myoffsetof(AActor,Angles.Yaw))); symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw)));
symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args))); symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args)));
symt.AddSymbol(new PField(NAME_CeilingZ, TypeFixed, VARF_Native, myoffsetof(AActor,ceilingz))); symt.AddSymbol(new PField(NAME_CeilingZ, TypeFixed, VARF_Native, myoffsetof(AActor,ceilingz)));
symt.AddSymbol(new PField(NAME_FloorZ, TypeFixed, VARF_Native, myoffsetof(AActor,floorz))); symt.AddSymbol(new PField(NAME_FloorZ, TypeFixed, VARF_Native, myoffsetof(AActor,floorz)));
symt.AddSymbol(new PField(NAME_Health, TypeSInt32, VARF_Native, myoffsetof(AActor,health))); symt.AddSymbol(new PField(NAME_Health, TypeSInt32, VARF_Native, myoffsetof(AActor,health)));
symt.AddSymbol(new PField(NAME_Mass, TypeSInt32, VARF_Native, myoffsetof(AActor,Mass))); symt.AddSymbol(new PField(NAME_Mass, TypeSInt32, VARF_Native, myoffsetof(AActor,Mass)));
symt.AddSymbol(new PField(NAME_Pitch, TypeFloat64,VARF_Native, myoffsetof(AActor,Angles.Pitch))); symt.AddSymbol(new PField(NAME_Pitch, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Pitch)));
symt.AddSymbol(new PField(NAME_Roll, TypeFloat64,VARF_Native, myoffsetof(AActor,Angles.Roll))); symt.AddSymbol(new PField(NAME_Roll, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Roll)));
symt.AddSymbol(new PField(NAME_Special, TypeSInt32, VARF_Native, myoffsetof(AActor,special))); symt.AddSymbol(new PField(NAME_Special, TypeSInt32, VARF_Native, myoffsetof(AActor,special)));
symt.AddSymbol(new PField(NAME_TID, TypeSInt32, VARF_Native, myoffsetof(AActor,tid))); symt.AddSymbol(new PField(NAME_TID, TypeSInt32, VARF_Native, myoffsetof(AActor,tid)));
symt.AddSymbol(new PField(NAME_TIDtoHate, TypeSInt32, VARF_Native, myoffsetof(AActor,TIDtoHate))); symt.AddSymbol(new PField(NAME_TIDtoHate, TypeSInt32, VARF_Native, myoffsetof(AActor,TIDtoHate)));
symt.AddSymbol(new PField(NAME_WaterLevel, TypeSInt32, VARF_Native, myoffsetof(AActor,waterlevel))); symt.AddSymbol(new PField(NAME_WaterLevel, TypeSInt32, VARF_Native, myoffsetof(AActor,waterlevel)));
symt.AddSymbol(new PField(NAME_X, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.x))); // must remain read-only! symt.AddSymbol(new PField(NAME_X, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.x))); // must remain read-only!
symt.AddSymbol(new PField(NAME_Y, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.y))); // must remain read-only! symt.AddSymbol(new PField(NAME_Y, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.y))); // must remain read-only!
symt.AddSymbol(new PField(NAME_Z, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.z))); // must remain read-only! symt.AddSymbol(new PField(NAME_Z, TypeFixed, VARF_Native, myoffsetof(AActor,__pos.z))); // must remain read-only!
@ -641,16 +641,16 @@ void InitThingdef()
symt.AddSymbol(new PField(NAME_MomX, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.X))); symt.AddSymbol(new PField(NAME_MomX, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.X)));
symt.AddSymbol(new PField(NAME_MomY, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.Y))); symt.AddSymbol(new PField(NAME_MomY, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.Y)));
symt.AddSymbol(new PField(NAME_MomZ, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.Z))); symt.AddSymbol(new PField(NAME_MomZ, TypeFloat64, VARF_Native, myoffsetof(AActor, Vel.Z)));
symt.AddSymbol(new PField(NAME_ScaleX, TypeFixed, VARF_Native, myoffsetof(AActor,scaleX))); symt.AddSymbol(new PField(NAME_ScaleX, TypeFloat64, VARF_Native, myoffsetof(AActor, Scale.X)));
symt.AddSymbol(new PField(NAME_ScaleY, TypeFixed, VARF_Native, myoffsetof(AActor,scaleY))); symt.AddSymbol(new PField(NAME_ScaleY, TypeFloat64, VARF_Native, myoffsetof(AActor, Scale.Y)));
symt.AddSymbol(new PField(NAME_Score, TypeSInt32, VARF_Native, myoffsetof(AActor,Score))); symt.AddSymbol(new PField(NAME_Score, TypeSInt32, VARF_Native, myoffsetof(AActor,Score)));
symt.AddSymbol(new PField(NAME_Accuracy, TypeSInt32, VARF_Native, myoffsetof(AActor,accuracy))); symt.AddSymbol(new PField(NAME_Accuracy, TypeSInt32, VARF_Native, myoffsetof(AActor,accuracy)));
symt.AddSymbol(new PField(NAME_Stamina, TypeSInt32, VARF_Native, myoffsetof(AActor,stamina))); symt.AddSymbol(new PField(NAME_Stamina, TypeSInt32, VARF_Native, myoffsetof(AActor,stamina)));
symt.AddSymbol(new PField(NAME_Height, TypeFixed, VARF_Native, myoffsetof(AActor,height))); symt.AddSymbol(new PField(NAME_Height, TypeFixed, VARF_Native, myoffsetof(AActor,height)));
symt.AddSymbol(new PField(NAME_Radius, TypeFixed, VARF_Native, myoffsetof(AActor,radius))); symt.AddSymbol(new PField(NAME_Radius, TypeFixed, VARF_Native, myoffsetof(AActor,radius)));
symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime))); symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime)));
symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange))); symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange)));
symt.AddSymbol(new PField(NAME_Speed, TypeFloat64, VARF_Native, myoffsetof(AActor,Speed))); symt.AddSymbol(new PField(NAME_Speed, TypeFloat64, VARF_Native, myoffsetof(AActor,Speed)));
symt.AddSymbol(new PField(NAME_Threshold, TypeSInt32, VARF_Native, myoffsetof(AActor,threshold))); symt.AddSymbol(new PField(NAME_Threshold, TypeSInt32, VARF_Native, myoffsetof(AActor,threshold)));
symt.AddSymbol(new PField(NAME_DefThreshold,TypeSInt32, VARF_Native, myoffsetof(AActor,DefThreshold))); symt.AddSymbol(new PField(NAME_DefThreshold,TypeSInt32, VARF_Native, myoffsetof(AActor,DefThreshold)));
} }

View file

@ -660,8 +660,8 @@ DEFINE_PROPERTY(mass, I, Actor)
//========================================================================== //==========================================================================
DEFINE_PROPERTY(xscale, F, Actor) DEFINE_PROPERTY(xscale, F, Actor)
{ {
PROP_FIXED_PARM(id, 0); PROP_DOUBLE_PARM(id, 0);
defaults->scaleX = id; defaults->Scale.X = id;
} }
//========================================================================== //==========================================================================
@ -669,8 +669,8 @@ DEFINE_PROPERTY(xscale, F, Actor)
//========================================================================== //==========================================================================
DEFINE_PROPERTY(yscale, F, Actor) DEFINE_PROPERTY(yscale, F, Actor)
{ {
PROP_FIXED_PARM(id, 0); PROP_DOUBLE_PARM(id, 0);
defaults->scaleY = id; defaults->Scale.Y = id;
} }
//========================================================================== //==========================================================================
@ -678,8 +678,8 @@ DEFINE_PROPERTY(yscale, F, Actor)
//========================================================================== //==========================================================================
DEFINE_PROPERTY(scale, F, Actor) DEFINE_PROPERTY(scale, F, Actor)
{ {
PROP_FIXED_PARM(id, 0); PROP_DOUBLE_PARM(id, 0);
defaults->scaleX = defaults->scaleY = id; defaults->Scale.X = defaults->Scale.Y = id;
} }
//========================================================================== //==========================================================================