mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- reduction of 'short' noise in Blood.
Mainly using int16_t for deliberately sized struct fields, auto for temporary saves of global data and making several local variables full int. This changes nothing substantial.
This commit is contained in:
parent
345d9c87b6
commit
499dc9953b
19 changed files with 96 additions and 97 deletions
|
@ -280,7 +280,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
}
|
||||
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector, true);
|
||||
viewProcessSprites(pm_tsprite, pm_spritesortcnt, x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, FixedToInt(a), smooth);
|
||||
short fstat = sector[nSector].floorstat;
|
||||
auto fstat = sector[nSector].floorstat;
|
||||
sector[nSector].floorstat |= 1;
|
||||
renderDrawMasks();
|
||||
sector[nSector].floorstat = fstat;
|
||||
|
@ -312,7 +312,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int
|
|||
}
|
||||
renderDrawRoomsQ16(x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, a, horiz, nSector, true);
|
||||
viewProcessSprites(pm_tsprite, pm_spritesortcnt, x + mirror[i].dx, y + mirror[i].dy, z + mirror[i].dz, FixedToInt(a), smooth);
|
||||
short cstat = sector[nSector].ceilingstat;
|
||||
auto cstat = sector[nSector].ceilingstat;
|
||||
sector[nSector].ceilingstat |= 1;
|
||||
renderDrawMasks();
|
||||
sector[nSector].ceilingstat = cstat;
|
||||
|
|
|
@ -4629,7 +4629,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
const int bakCompat = enginecompatibility_mode;
|
||||
if (actor->xvel || actor->yvel)
|
||||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
auto bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode())
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
|
@ -4855,7 +4855,7 @@ void MoveDude(DBloodActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
auto bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12, actor->yvel >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
|
@ -5366,7 +5366,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
{
|
||||
vec3_t pos = pSprite->pos;
|
||||
int nSector2 = pSprite->sectnum;
|
||||
const short bakSpriteCstat = pSprite->cstat;
|
||||
const auto bakSpriteCstat = pSprite->cstat;
|
||||
if (pOwner && !isFlameSprite && !cl_bloodvanillaexplosions && !VanillaMode())
|
||||
{
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
|
|
|
@ -68,14 +68,14 @@ enum VECTOR_TYPE {
|
|||
|
||||
struct THINGINFO
|
||||
{
|
||||
short startHealth;
|
||||
short mass;
|
||||
int16_t startHealth;
|
||||
int16_t mass;
|
||||
uint8_t clipdist;
|
||||
short flags;
|
||||
int elastic; // elasticity
|
||||
int dmgResist; // damage resistance
|
||||
short cstat;
|
||||
short picnum;
|
||||
int16_t flags;
|
||||
int32_t elastic; // elasticity
|
||||
int32_t dmgResist; // damage resistance
|
||||
int16_t cstat;
|
||||
int16_t picnum;
|
||||
int8_t shade;
|
||||
uint8_t pal;
|
||||
uint8_t xrepeat; // xrepeat
|
||||
|
@ -85,44 +85,44 @@ struct THINGINFO
|
|||
|
||||
struct AMMOITEMDATA
|
||||
{
|
||||
short cstat;
|
||||
short picnum;
|
||||
int16_t cstat;
|
||||
int16_t picnum;
|
||||
int8_t shade;
|
||||
uint8_t pal;
|
||||
uint8_t xrepeat;
|
||||
uint8_t yrepeat;
|
||||
short count;
|
||||
int16_t count;
|
||||
uint8_t type;
|
||||
uint8_t weaponType;
|
||||
};
|
||||
|
||||
struct WEAPONITEMDATA
|
||||
{
|
||||
short cstat;
|
||||
short picnum;
|
||||
int16_t cstat;
|
||||
int16_t picnum;
|
||||
int8_t shade;
|
||||
uint8_t pal;
|
||||
uint8_t xrepeat;
|
||||
uint8_t yrepeat;
|
||||
short type;
|
||||
short ammoType;
|
||||
short count;
|
||||
int16_t type;
|
||||
int16_t ammoType;
|
||||
int16_t count;
|
||||
};
|
||||
|
||||
struct ITEMDATA
|
||||
{
|
||||
short cstat;
|
||||
short picnum;
|
||||
int16_t cstat;
|
||||
int16_t picnum;
|
||||
int8_t shade;
|
||||
uint8_t pal;
|
||||
uint8_t xrepeat;
|
||||
uint8_t yrepeat;
|
||||
short packSlot;
|
||||
int16_t packSlot;
|
||||
};
|
||||
|
||||
struct MissileType
|
||||
{
|
||||
short picnum;
|
||||
int16_t picnum;
|
||||
int velocity;
|
||||
int angleOfs;
|
||||
uint8_t xrepeat;
|
||||
|
|
|
@ -1297,7 +1297,7 @@ void RecoilDude(DBloodActor* actor)
|
|||
else aiGenDudeNewState(actor, &genDudeRecoilL);
|
||||
}
|
||||
|
||||
short rState = inRecoil(pXSprite->aiState);
|
||||
int rState = inRecoil(pXSprite->aiState);
|
||||
if (rState > 0)
|
||||
{
|
||||
if (!canWalk(actor))
|
||||
|
|
|
@ -105,7 +105,7 @@ const GENDUDESND gCustomDudeSnd[] = {
|
|||
};
|
||||
|
||||
// for kModernThingThrowableRock
|
||||
short gCustomDudeDebrisPics[6] = {
|
||||
const int16_t gCustomDudeDebrisPics[6] = {
|
||||
|
||||
2406, 2280, 2185, 2155, 2620, 3135
|
||||
|
||||
|
@ -235,7 +235,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
actor->xvel = actor->yvel = 0;
|
||||
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
short dispersion = pExtra->baseDispersion;
|
||||
int dispersion = pExtra->baseDispersion;
|
||||
if (inDuck(pXSprite->aiState))
|
||||
dispersion = ClipLow(dispersion >> 1, kGenDudeMinDispesion);
|
||||
|
||||
|
@ -1322,7 +1322,7 @@ bool playGenDudeSound(DBloodActor* actor, int mode)
|
|||
auto const pXSprite = &actor->x();
|
||||
if (mode < kGenDudeSndTargetSpot || mode >= kGenDudeSndMax) return false;
|
||||
const GENDUDESND* sndInfo = &gCustomDudeSnd[mode]; bool gotSnd = false;
|
||||
short sndStartId = pXSprite->sysData1;
|
||||
int sndStartId = pXSprite->sysData1;
|
||||
int rand = sndInfo->randomRange;
|
||||
int sndId = (sndStartId <= 0) ? sndInfo->defaultSndId : sndStartId + sndInfo->sndIdOffset;
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra;
|
||||
|
@ -1520,8 +1520,8 @@ bool dudeIsMelee(DBloodActor* actor)
|
|||
static void scaleDamage(DBloodActor* actor)
|
||||
{
|
||||
auto const pXSprite = &actor->x();
|
||||
short curWeapon = actor->genDudeExtra.curWeapon;
|
||||
short weaponType = actor->genDudeExtra.weaponType;
|
||||
int curWeapon = actor->genDudeExtra.curWeapon;
|
||||
int weaponType = actor->genDudeExtra.weaponType;
|
||||
signed short* curScale = actor->genDudeExtra.dmgControl;
|
||||
for (int i = 0; i < kDmgMax; i++)
|
||||
curScale[i] = getDudeInfo(kDudeModernCustom)->startDamage[i];
|
||||
|
@ -1630,7 +1630,7 @@ static void scaleDamage(DBloodActor* actor)
|
|||
}
|
||||
|
||||
// take in account yrepeat of sprite
|
||||
short yrepeat = actor->s().yrepeat;
|
||||
int yrepeat = actor->s().yrepeat;
|
||||
if (yrepeat < 64)
|
||||
{
|
||||
for (int i = 0; i < kDmgMax; i++) curScale[i] += (64 - yrepeat);
|
||||
|
@ -1756,7 +1756,7 @@ static int getRangeAttackDist(DBloodActor* actor, int minDist, int maxDist)
|
|||
{
|
||||
auto const pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
short yrepeat = pSprite->yrepeat;
|
||||
int yrepeat = pSprite->yrepeat;
|
||||
int dist = 0;
|
||||
int seqId = pXSprite->data2;
|
||||
int mul = 550;
|
||||
|
|
|
@ -159,16 +159,15 @@ extern const GENDUDESND gCustomDudeSnd[];
|
|||
// temporary, until normal DUDEEXTRA gets refactored
|
||||
struct GENDUDEEXTRA
|
||||
{
|
||||
unsigned short initVals[3]; // xrepeat, yrepeat, clipdist
|
||||
unsigned short availDeaths[kDamageMax]; // list of seqs with deaths for each damage type
|
||||
unsigned int moveSpeed;
|
||||
unsigned int fireDist; // counts from sprite size
|
||||
unsigned int throwDist; // counts from sprite size
|
||||
unsigned short curWeapon; // data1 duplicate to avoid potential problems when changing data dynamically
|
||||
unsigned short weaponType;
|
||||
unsigned short baseDispersion;
|
||||
unsigned short slaveCount; // how many dudes is summoned
|
||||
//unsigned short incarnationsCount;
|
||||
uint16_t initVals[3]; // xrepeat, yrepeat, clipdist
|
||||
uint16_t availDeaths[kDamageMax]; // list of seqs with deaths for each damage type
|
||||
uint32_t moveSpeed;
|
||||
uint32_t fireDist; // counts from sprite size
|
||||
uint32_t throwDist; // counts from sprite size
|
||||
uint16_t curWeapon; // data1 duplicate to avoid potential problems when changing data dynamically
|
||||
uint16_t weaponType;
|
||||
uint16_t baseDispersion;
|
||||
uint16_t slaveCount; // how many dudes is summoned
|
||||
DBloodActor* pLifeLeech; // spritenum of dropped dude's leech
|
||||
DBloodActor* slave[kGenDudeMaxSlaves]; // index of the ones dude is summon
|
||||
signed short dmgControl[kDamageMax]; // depends of current weapon, drop armor item, sprite yrepeat and surface type
|
||||
|
|
|
@ -104,8 +104,8 @@ static const int effectDetail[kViewEffectMax] = {
|
|||
|
||||
|
||||
struct WEAPONICON {
|
||||
short nTile;
|
||||
char zOffset;
|
||||
int16_t nTile;
|
||||
uint8_t zOffset;
|
||||
};
|
||||
|
||||
static const WEAPONICON gWeaponIcon[] = {
|
||||
|
|
|
@ -157,15 +157,15 @@ void RemoveSpriteStat(int nSprite)
|
|||
|
||||
void qinitspritelists(void) // Replace
|
||||
{
|
||||
for (short i = 0; i <= kMaxSectors; i++)
|
||||
for (int i = 0; i <= kMaxSectors; i++)
|
||||
{
|
||||
headspritesect[i] = -1;
|
||||
}
|
||||
for (short i = 0; i <= kMaxStatus; i++)
|
||||
for (int i = 0; i <= kMaxStatus; i++)
|
||||
{
|
||||
headspritestat[i] = -1;
|
||||
}
|
||||
for (short i = 0; i < kMaxSprites; i++)
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
{
|
||||
sprite[i].sectnum = -1;
|
||||
sprite[i].index = -1;
|
||||
|
|
|
@ -264,23 +264,23 @@ struct XWALL {
|
|||
|
||||
struct MAPSIGNATURE {
|
||||
char signature[4];
|
||||
short version;
|
||||
int16_t version;
|
||||
};
|
||||
|
||||
struct MAPHEADER {
|
||||
int x; // x
|
||||
int y; // y
|
||||
int z; // z
|
||||
short ang; // ang
|
||||
short sect; // sect
|
||||
short pskybits; // pskybits
|
||||
int visibility; // visibility
|
||||
int mattid; // song id, Matt
|
||||
char parallax; // parallaxtype
|
||||
int revision; // map revision
|
||||
short numsectors; // numsectors
|
||||
short numwalls; // numwalls
|
||||
short numsprites; // numsprites
|
||||
int32_t x; // x
|
||||
int32_t y; // y
|
||||
int32_t z; // z
|
||||
int16_t ang; // ang
|
||||
int16_t sect; // sect
|
||||
int16_t pskybits; // pskybits
|
||||
int32_t visibility; // visibility
|
||||
int32_t mattid; // song id, Matt
|
||||
uint8_t parallax; // parallaxtype
|
||||
int32_t revision; // map revision
|
||||
int16_t numsectors; // numsectors
|
||||
int16_t numwalls; // numwalls
|
||||
int16_t numsprites; // numsprites
|
||||
};
|
||||
|
||||
struct MAPHEADER2 {
|
||||
|
|
|
@ -26,9 +26,9 @@ BEGIN_BLD_NS
|
|||
|
||||
// By NoOne: renamed dude struct
|
||||
struct DUDEINFO {
|
||||
short seqStartID; // seq
|
||||
short startHealth; // health
|
||||
unsigned short mass; // mass
|
||||
int16_t seqStartID; // seq
|
||||
int16_t startHealth; // health
|
||||
uint16_t mass; // mass
|
||||
int at6; // unused?
|
||||
uint8_t clipdist; // clipdist
|
||||
int eyeHeight;
|
||||
|
|
|
@ -34,15 +34,15 @@ CFX gFX;
|
|||
struct FXDATA {
|
||||
CALLBACK_ID funcID; // callback
|
||||
uint8_t detail; // detail
|
||||
short seq; // seq
|
||||
short flags; // flags
|
||||
int gravity; // gravity
|
||||
int drag; // air drag
|
||||
int ate;
|
||||
short picnum; // picnum
|
||||
int16_t seq; // seq
|
||||
int16_t flags; // flags
|
||||
int32_t gravity; // gravity
|
||||
int32_t drag; // air drag
|
||||
int32_t ate;
|
||||
int16_t picnum; // picnum
|
||||
uint8_t xrepeat; // xrepeat
|
||||
uint8_t yrepeat; // yrepeat
|
||||
short cstat; // cstat
|
||||
int16_t cstat; // cstat
|
||||
int8_t shade; // shade
|
||||
uint8_t pal; // pal
|
||||
};
|
||||
|
|
|
@ -42,11 +42,11 @@ BEGIN_BLD_NS
|
|||
|
||||
|
||||
static struct {
|
||||
short nTile;
|
||||
int16_t nTile;
|
||||
uint8_t nStat;
|
||||
uint8_t nPal;
|
||||
int nScale;
|
||||
short nX, nY;
|
||||
int16_t nX, nY;
|
||||
} burnTable[9] = {
|
||||
{ 2101, 2, 0, 118784, 10, 220 },
|
||||
{ 2101, 2, 0, 110592, 40, 220 },
|
||||
|
|
|
@ -1725,7 +1725,7 @@ void debrisMove(int listIndex)
|
|||
if (actor->xvel || actor->yvel)
|
||||
{
|
||||
|
||||
short oldcstat = pSprite->cstat;
|
||||
auto oldcstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12,
|
||||
|
@ -3318,7 +3318,7 @@ void useSectorWindGen(DBloodActor* sourceactor, sectortype* pSector)
|
|||
StartInterpolation(pXSector->reference, Interp_Sect_FloorPanY);
|
||||
}
|
||||
|
||||
short oldPan = pXSector->panVel;
|
||||
int oldPan = pXSector->panVel;
|
||||
pXSector->panAngle = pXSector->windAng;
|
||||
pXSector->panVel = pXSector->windVel;
|
||||
|
||||
|
|
|
@ -189,12 +189,12 @@ kPatrolMoveBackward = 1,
|
|||
// - STRUCTS ------------------------------------------------------------------
|
||||
struct SPRITEMASS { // sprite mass info for getSpriteMassBySize();
|
||||
int seqId;
|
||||
short picnum; // mainly needs for moving debris
|
||||
short xrepeat;
|
||||
short yrepeat;
|
||||
short clipdist; // mass multiplier
|
||||
int16_t picnum; // mainly needs for moving debris
|
||||
int16_t xrepeat;
|
||||
int16_t yrepeat;
|
||||
int16_t clipdist; // mass multiplier
|
||||
int mass;
|
||||
short airVel; // mainly needs for moving debris
|
||||
int16_t airVel; // mainly needs for moving debris
|
||||
int fraction; // mainly needs for moving debris
|
||||
};
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ struct AMMOINFO
|
|||
|
||||
struct POWERUPINFO
|
||||
{
|
||||
short picnum;
|
||||
int16_t picnum;
|
||||
bool pickupOnce;
|
||||
int bonusTime;
|
||||
int maxTime;
|
||||
|
|
|
@ -89,7 +89,7 @@ void viewInitializePrediction(void)
|
|||
void viewUpdatePrediction(InputPacket *pInput)
|
||||
{
|
||||
predictOld = predict;
|
||||
short bakCstat = gMe->pSprite->cstat;
|
||||
auto bakCstat = gMe->pSprite->cstat;
|
||||
gMe->pSprite->cstat = 0;
|
||||
fakePlayerProcess(gMe, pInput);
|
||||
fakeActProcessSprites();
|
||||
|
@ -276,7 +276,7 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
int dzt = (predict.z-top)/4;
|
||||
|
||||
int dw = pSprite->clipdist<<2;
|
||||
short nSector = predict.sectnum;
|
||||
int nSector = predict.sectnum;
|
||||
if (!gNoClip)
|
||||
{
|
||||
pushmove(&predict.pos, &predict.sectnum, dw, dzt, dzb, CLIPMASK0);
|
||||
|
@ -382,7 +382,7 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
}
|
||||
else
|
||||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
auto bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
predict.at75.hit = ClipMove(&predict.pos, &nSector, predict.xvel >> 12, predict.yvel >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
|
|
|
@ -199,8 +199,8 @@ struct TILE_FRAME
|
|||
int z;
|
||||
int stat;
|
||||
int8_t shade;
|
||||
char palnum;
|
||||
unsigned short angle;
|
||||
int8_t palnum;
|
||||
uint16_t angle;
|
||||
};
|
||||
|
||||
struct SOUNDINFO
|
||||
|
@ -227,7 +227,7 @@ struct QAV
|
|||
int duration; // 10
|
||||
int x; // 14
|
||||
int y; // 18
|
||||
unsigned short res_id;
|
||||
uint16_t res_id;
|
||||
FRAMEINFO frames[1]; // 24
|
||||
void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536);
|
||||
void Draw(int ticks, int stat, int shade, int palnum, bool to3dview, double const smoothratio = 65536) { Draw(x, y, ticks, stat, shade, palnum, to3dview, smoothratio); }
|
||||
|
|
|
@ -53,10 +53,10 @@ struct SEQFRAME
|
|||
|
||||
struct Seq {
|
||||
char signature[4];
|
||||
short version;
|
||||
short nFrames;
|
||||
short ticksPerFrame;
|
||||
short soundId;
|
||||
int16_t version;
|
||||
int16_t nFrames;
|
||||
int16_t ticksPerFrame;
|
||||
int16_t soundId;
|
||||
int flags;
|
||||
SEQFRAME frames[1];
|
||||
void Precache(int palette);
|
||||
|
|
|
@ -64,12 +64,12 @@ struct VIEW {
|
|||
int zvel; //zvel
|
||||
int sectnum; // sectnum
|
||||
unsigned int floordist; // floordist
|
||||
char at6e; // look center
|
||||
char at6f;
|
||||
char at70; // run
|
||||
char at71; // jump
|
||||
char at72; // underwater
|
||||
short at73; // sprite flags
|
||||
uint8_t at6e; // look center
|
||||
uint8_t at6f;
|
||||
uint8_t at70; // run
|
||||
uint8_t at71; // jump
|
||||
uint8_t at72; // underwater
|
||||
int16_t at73; // sprite flags
|
||||
SPRITEHIT at75;
|
||||
binangle look_ang;
|
||||
binangle rotscrnang;
|
||||
|
|
Loading…
Reference in a new issue