- stuff that needs FromInt

This commit is contained in:
Christoph Oelckers 2021-12-18 12:28:48 +01:00
parent 955996dddc
commit 8b427e35c2
8 changed files with 20 additions and 19 deletions

View file

@ -225,7 +225,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
}
else if (currentsprite != -1 && validateSprite())
{
sprites.sprites[currentsprite].cstat &= ~sc.Number;
sprites.sprites[currentsprite].cstat &= ESpriteFlags::FromInt(~sc.Number);
}
}
}
@ -239,7 +239,7 @@ static int32_t LoadMapHack(const char *filename, SpawnSpriteDef& sprites)
}
else if (currentsprite != -1 && validateSprite())
{
sprites.sprites[currentsprite].cstat |= sc.Number;
sprites.sprites[currentsprite].cstat |= ESpriteFlags::FromInt(sc.Number);
}
}
}

View file

@ -293,7 +293,7 @@ static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
spr.pos.x = fr.ReadInt32();
spr.pos.y = fr.ReadInt32();
spr.pos.z = fr.ReadInt32();
spr.cstat = fr.ReadUInt16();
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
spr.picnum = fr.ReadInt16();
spr.shade = fr.ReadInt8();
spr.pal = fr.ReadUInt8();
@ -321,7 +321,7 @@ static void ReadSpriteV6(FileReader& fr, spritetype& spr, int& secno)
spr.pos.x = fr.ReadInt32();
spr.pos.y = fr.ReadInt32();
spr.pos.z = fr.ReadInt32();
spr.cstat = fr.ReadUInt16();
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
spr.shade = fr.ReadInt8();
spr.pal = fr.ReadUInt8();
spr.clipdist = fr.ReadUInt8();
@ -349,7 +349,7 @@ static void ReadSpriteV5(FileReader& fr, spritetype& spr, int& secno)
spr.pos.x = fr.ReadInt32();
spr.pos.y = fr.ReadInt32();
spr.pos.z = fr.ReadInt32();
spr.cstat = fr.ReadUInt16();
spr.cstat = ESpriteFlags::FromInt(fr.ReadUInt16());
spr.shade = fr.ReadInt8();
spr.xrepeat = fr.ReadUInt8();
spr.yrepeat = fr.ReadUInt8();

View file

@ -395,7 +395,7 @@ struct spritetypebase
sectortype* sectp;
uint16_t cstat;
ESpriteFlags cstat;
int16_t picnum;
int16_t statnum;
int16_t ang;

View file

@ -1521,7 +1521,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball)
if (s->picnum == stripeball)
{
s->cstat = CSTAT_SPRITE_BLOCK_ALL;
s->cstat |= int(CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP) & s->xvel;
s->cstat |= (CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP) & ESpriteFlags::FromInt(s->xvel);
}
}
else
@ -2524,7 +2524,8 @@ void glasspieces(DDukeActor* actor)
if (s->xvel > 0)
{
s->xvel -= 2;
s->cstat = ((s->xvel & 3) << 2);
static const ESpriteFlags flips[] = { 0, CSTAT_SPRITE_XFLIP, CSTAT_SPRITE_YFLIP, CSTAT_SPRITE_XFLIP | CSTAT_SPRITE_YFLIP };
s->cstat = flips[s->xvel & 3];
}
else s->xvel = 0;

View file

@ -1133,7 +1133,7 @@ static void movecrack(DDukeActor* actor)
}
else
{
s->cstat = t[0];
s->cstat = ESpriteFlags::FromInt(t[0]);
s->ang = t[1];
s->extra = 0;
}

View file

@ -899,7 +899,7 @@ static void movecrack(DDukeActor* actor)
}
else
{
s->cstat = t[0];
s->cstat = ESpriteFlags::FromInt(t[0]);
s->ang = t[1];
s->extra = 0;
}
@ -2789,15 +2789,15 @@ static int henstand(DDukeActor *actor)
s->cstat = CSTAT_SPRITE_BLOCK_ALL;
if (s->picnum == BOWLINGPIN)
{
s->cstat |= 4 & s->xvel;
s->cstat |= 8 & s->xvel;
s->cstat |= CSTAT_SPRITE_XFLIP & ESpriteFlags::FromInt(s->xvel);
s->cstat |= CSTAT_SPRITE_YFLIP & ESpriteFlags::FromInt(s->xvel);
if (krand() & 1)
s->picnum = BOWLINGPIN + 1;
}
else if (s->picnum == HENSTAND)
{
s->cstat |= 4 & s->xvel;
s->cstat |= 8 & s->xvel;
s->cstat |= CSTAT_SPRITE_XFLIP & ESpriteFlags::FromInt(s->xvel);
s->cstat |= CSTAT_SPRITE_YFLIP & ESpriteFlags::FromInt(s->xvel);
if (krand() & 1)
s->picnum = HENSTAND + 1;
if (!s->xvel)

View file

@ -67,7 +67,7 @@ static int ccmd_spawn(CCmdFuncPtr parm)
ang = atol(parm->parms[3]) & 2047; set |= 4;
[[fallthrough]];
case 3: // cstat
cstat = (unsigned short)atol(parm->parms[2]); set |= 2;
cstat = ESpriteFlags::FromInt(atol(parm->parms[2])); set |= 2;
[[fallthrough]];
case 2: // pal
pal = (uint8_t)atol(parm->parms[1]); set |= 1;
@ -97,7 +97,7 @@ static int ccmd_spawn(CCmdFuncPtr parm)
if (spawned)
{
if (set & 1) spawned->s->pal = (uint8_t)pal;
if (set & 2) spawned->s->cstat = (uint16_t)cstat;
if (set & 2) spawned->s->cstat = ESpriteFlags::FromInt(cstat);
if (set & 4) spawned->s->ang = ang;
if (set & 8) SetActor(spawned, { x, y, z });

View file

@ -1193,7 +1193,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
else SetGameVarID(lVar2, spr->z, sActor, sPlayer);
break;
case ACTOR_CSTAT:
if (bSet) spr->cstat = lValue;
if (bSet) spr->cstat = ESpriteFlags::FromInt(lValue);
else SetGameVarID(lVar2, spr->cstat, sActor, sPlayer);
break;
case ACTOR_PICNUM:
@ -2215,7 +2215,7 @@ int ParseState::parse(void)
break;
case concmd_cstator:
insptr++;
g_sp->cstat |= (short)*insptr;
g_sp->cstat |= ESpriteFlags::FromInt(*insptr);
insptr++;
break;
case concmd_clipdist:
@ -2225,7 +2225,7 @@ int ParseState::parse(void)
break;
case concmd_cstat:
insptr++;
g_sp->cstat = (uint16_t)*insptr;
g_sp->cstat = ESpriteFlags::FromInt(*insptr);
insptr++;
break;
case concmd_newpic: