Split r3159..r3161, part 8: make some members of base types unsigned.

NOTE: This will need very thorough review.

git-svn-id: https://svn.eduke32.com/eduke32@3174 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-15 14:28:18 +00:00
parent 7c07fee1b3
commit 2cb3734f85
7 changed files with 32 additions and 27 deletions

View file

@ -103,7 +103,7 @@ void yax_updategrays(int32_t posze);
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
// more user tag hijacking: lotag/extra :/ // more user tag hijacking: lotag/extra :/
# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].lotag + 2*Cf)) # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + 2*Cf))
# define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf) # define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf)
# define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1) # define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1)
@ -228,7 +228,7 @@ typedef struct
{ {
Tracker(Sector, int16_t) wallptr, wallnum; Tracker(Sector, int16_t) wallptr, wallnum;
Tracker(Sector, int32_t) ceilingz, floorz; Tracker(Sector, int32_t) ceilingz, floorz;
Tracker(Sector, int16_t) ceilingstat, floorstat; Tracker(Sector, uint16_t) ceilingstat, floorstat;
Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum; Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum;
Tracker(Sector, int8_t) ceilingshade; Tracker(Sector, int8_t) ceilingshade;
Tracker(Sector, uint8_t) ceilingpal, ceilingxpanning, ceilingypanning; Tracker(Sector, uint8_t) ceilingpal, ceilingxpanning, ceilingypanning;
@ -236,7 +236,8 @@ typedef struct
Tracker(Sector, int8_t) floorshade; Tracker(Sector, int8_t) floorshade;
Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning; Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning;
Tracker(Sector, uint8_t) visibility, filler; Tracker(Sector, uint8_t) visibility, filler;
Tracker(Sector, int16_t) lotag, hitag, extra; Tracker(Sector, uint16_t) lotag, hitag;
Tracker(Sector, int16_t) extra;
} sectortype; } sectortype;
//cstat: //cstat:
@ -257,11 +258,13 @@ typedef struct
typedef struct typedef struct
{ {
Tracker(Wall, int32_t) x, y; Tracker(Wall, int32_t) x, y;
Tracker(Wall, int16_t) point2, nextwall, nextsector, cstat; Tracker(Wall, int16_t) point2, nextwall, nextsector;
Tracker(Wall, uint16_t) cstat;
Tracker(Wall, int16_t) picnum, overpicnum; Tracker(Wall, int16_t) picnum, overpicnum;
Tracker(Wall, int8_t) shade; Tracker(Wall, int8_t) shade;
Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning; Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning;
Tracker(Wall, int16_t) lotag, hitag, extra; Tracker(Wall, uint16_t) lotag, hitag;
Tracker(Wall, int16_t) extra;
} walltype; } walltype;
//cstat: //cstat:
@ -287,14 +290,16 @@ typedef struct
typedef struct typedef struct
{ {
Tracker(Sprite, int32_t) x, y, z; Tracker(Sprite, int32_t) x, y, z;
Tracker(Sprite, int16_t) cstat, picnum; Tracker(Sprite, uint16_t) cstat;
Tracker(Sprite, int16_t) picnum;
Tracker(Sprite, int8_t) shade; Tracker(Sprite, int8_t) shade;
Tracker(Sprite, uint8_t) pal, clipdist, filler; Tracker(Sprite, uint8_t) pal, clipdist, filler;
Tracker(Sprite, uint8_t) xrepeat, yrepeat; Tracker(Sprite, uint8_t) xrepeat, yrepeat;
Tracker(Sprite, int8_t) xoffset, yoffset; Tracker(Sprite, int8_t) xoffset, yoffset;
Tracker(Sprite, int16_t) sectnum, statnum; Tracker(Sprite, int16_t) sectnum, statnum;
Tracker(Sprite, int16_t) ang, owner, xvel, yvel, zvel; Tracker(Sprite, int16_t) ang, owner, xvel, yvel, zvel;
Tracker(Sprite, int16_t) lotag, hitag, extra; Tracker(Sprite, uint16_t) lotag, hitag;
Tracker(Sprite, int16_t) extra;
} spritetype; } spritetype;
typedef struct { typedef struct {

View file

@ -1640,7 +1640,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
{ {
// if a bunch was discarded // if a bunch was discarded
sectortype *const sec = &mapinfo->sector[i]; sectortype *const sec = &mapinfo->sector[i];
int16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat; uint16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat;
uint8_t *const xp = j==YAX_CEILING ? &sec->ceilingxpanning : &sec->floorxpanning; uint8_t *const xp = j==YAX_CEILING ? &sec->ceilingxpanning : &sec->floorxpanning;
*cs &= ~YAX_BIT; *cs &= ~YAX_BIT;

View file

@ -1362,10 +1362,10 @@ ACTOR_STATIC void G_MoveFallers(void)
} }
else if (T1 == 1) else if (T1 == 1)
{ {
if (s->lotag > 0) if (s->lotag < INT16_MAX)
{ {
s->lotag-=3; s->lotag-=3;
if (s->lotag <= 0) if (s->lotag > INT16_MAX)
{ {
s->xvel = (32+(krand()&63)); s->xvel = (32+(krand()&63));
s->zvel = -(1024+(krand()&1023)); s->zvel = -(1024+(krand()&1023));
@ -1905,7 +1905,7 @@ ACTOR_STATIC void G_MoveStandables(void)
A_PlaySound(PIPEBOMB_EXPLODE,j); A_PlaySound(PIPEBOMB_EXPLODE,j);
A_PlaySound(GLASS_HEAVYBREAK,j); A_PlaySound(GLASS_HEAVYBREAK,j);
if (s->hitag > 0) if (s->hitag < INT16_MAX)
{ {
j = headspritestat[STAT_STANDABLE]; j = headspritestat[STAT_STANDABLE];
while (j >= 0) while (j >= 0)
@ -1959,10 +1959,10 @@ ACTOR_STATIC void G_MoveStandables(void)
{ {
if (s->shade == -32) if (s->shade == -32)
{ {
if (s->lotag > 0) if (s->lotag < INT16_MAX)
{ {
s->lotag-=3; s->lotag-=3;
if (s->lotag <= 0) s->lotag = -99; if (s->lotag > INT16_MAX) s->lotag = UINT16_MAX-99;
} }
else else
s->shade = -33; s->shade = -33;
@ -2023,7 +2023,7 @@ DETONATE:
if (s->xrepeat) if (s->xrepeat)
for (x=0; x<8; x++) RANDOMSCRAP; for (x=0; x<8; x++) RANDOMSCRAP;
if ((t[3] == 1 && s->xrepeat) || s->lotag == -99) if ((t[3] == 1 && s->xrepeat) || s->lotag == UINT16_MAX-99)
{ {
int32_t j = A_Spawn(i,EXPLOSION2); int32_t j = A_Spawn(i,EXPLOSION2);
x = s->extra; x = s->extra;
@ -2042,7 +2042,7 @@ DETONATE:
if (s->yvel == 1) if (s->yvel == 1)
{ {
s->hitag--; s->hitag--;
if (s->hitag <= 0) if (s->hitag == UINT16_MAX)
{ {
G_OperateSectors(sect,i); G_OperateSectors(sect,i);
@ -2264,7 +2264,7 @@ CLEAR_THE_BOLT:
goto BOLT; goto BOLT;
case TOUCHPLATE__STATIC: case TOUCHPLATE__STATIC:
if (t[1] == 1 && s->hitag >= 0) //Move the sector floor if (t[1] == 1 && s->hitag != UINT16_MAX) //Move the sector floor
{ {
x = sector[sect].floorz; x = sector[sect].floorz;
@ -2317,7 +2317,7 @@ CLEAR_THE_BOLT:
t[3] = !t[3]; t[3] = !t[3];
G_OperateMasterSwitches(s->lotag); G_OperateMasterSwitches(s->lotag);
G_OperateActivators(s->lotag,p); G_OperateActivators(s->lotag,p);
if (s->hitag > 0) if (s->hitag < INT16_MAX)
{ {
s->hitag--; s->hitag--;
if (s->hitag == 0) t[5] = 1; if (s->hitag == 0) t[5] = 1;
@ -5541,7 +5541,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = s->owner; j = s->owner;
if (sprite[j].lotag == (int16_t) 65535) if (sprite[j].lotag == UINT16_MAX)
KILLIT(i); KILLIT(i);
q = sc->extra>>3; q = sc->extra>>3;
@ -6421,7 +6421,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
case SE_10_DOOR_AUTO_CLOSE: case SE_10_DOOR_AUTO_CLOSE:
// XXX: 32791, what the hell? // XXX: 32791, what the hell?
if ((sc->lotag&0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != ST_23_SWINGING_DOOR) || sc->lotag == (int16_t) 32791) if ((sc->lotag&0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != ST_23_SWINGING_DOOR) || sc->lotag == 32791)
{ {
int32_t p; int32_t p;

View file

@ -4818,7 +4818,7 @@ static void toggle_cf_flipping(int32_t sectnum, int32_t floorp)
static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 }; static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 };
int16_t *stat = &SECTORFLD(sectnum,stat, floorp); uint16_t *stat = &SECTORFLD(sectnum,stat, floorp);
int32_t i = *stat; int32_t i = *stat;
i = (i&0x4)+((i>>4)&3); i = (i&0x4)+((i>>4)&3);
@ -6388,7 +6388,7 @@ static void Keys3d(void)
if (AIMING_AT_CEILING_OR_FLOOR) //Set masked/transluscent ceilings/floors if (AIMING_AT_CEILING_OR_FLOOR) //Set masked/transluscent ceilings/floors
{ {
int32_t nexti[4] = { 128, 256, 384, 0 }; int32_t nexti[4] = { 128, 256, 384, 0 };
int16_t *stat = &AIMED_CEILINGFLOOR(stat); uint16_t *stat = &AIMED_CEILINGFLOOR(stat);
const char *statmsg[4] = {"normal", "masked", "translucent", "translucent (2)"}; const char *statmsg[4] = {"normal", "masked", "translucent", "translucent (2)"};
i = (*stat&(128+256))>>7; i = (*stat&(128+256))>>7;
@ -11020,7 +11020,7 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr
if (showinvisibility && (tspr->cstat&32768)) if (showinvisibility && (tspr->cstat&32768))
{ {
tspr->pal = 6; tspr->pal = 6;
tspr->cstat &= ~32768; tspr->cstat &= (uint16_t)~32768;
tspr->cstat |= 2+512; tspr->cstat |= 2+512;
} }

View file

@ -5833,7 +5833,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
startwall = sector[sect].wallptr; startwall = sector[sect].wallptr;
endwall = startwall+sector[sect].wallnum; endwall = startwall+sector[sect].wallnum;
if (sector[sect].hitag == -1) if (sector[sect].hitag == UINT16_MAX)
sp->extra = 0; sp->extra = 0;
else sp->extra = 1; else sp->extra = 1;

View file

@ -1139,7 +1139,7 @@ static inline void prelevel(char g)
continue; continue;
} }
if (sector[i].lotag == -1) if (sector[i].lotag == UINT16_MAX)
{ {
g_player[0].ps->exitx = wall[sector[i].wallptr].x; g_player[0].ps->exitx = wall[sector[i].wallptr].x;
g_player[0].ps->exity = wall[sector[i].wallptr].y; g_player[0].ps->exity = wall[sector[i].wallptr].y;
@ -1154,7 +1154,7 @@ static inline void prelevel(char g)
A_ResetVars(i); A_ResetVars(i);
A_LoadActor(i); A_LoadActor(i);
VM_OnEvent(EVENT_LOADACTOR, i, -1, -1, 0); VM_OnEvent(EVENT_LOADACTOR, i, -1, -1, 0);
if (sprite[i].lotag == -1 && (sprite[i].cstat&16)) if (sprite[i].lotag == UINT16_MAX && (sprite[i].cstat&16))
{ {
g_player[0].ps->exitx = SX; g_player[0].ps->exitx = SX;
g_player[0].ps->exity = SY; g_player[0].ps->exity = SY;

View file

@ -3031,7 +3031,7 @@ void P_CheckSectors(int32_t snum)
P_DoQuote(QUOTE_FOUND_SECRET,p); P_DoQuote(QUOTE_FOUND_SECRET,p);
p->secret_rooms++; p->secret_rooms++;
return; return;
case -1: case UINT16_MAX:
for (TRAVERSE_CONNECT(i)) for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL; g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
@ -3049,7 +3049,7 @@ void P_CheckSectors(int32_t snum)
ud.m_level_number = ud.level_number; ud.m_level_number = ud.level_number;
} }
return; return;
case -2: case UINT16_MAX-1:
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
p->timebeforeexit = GAMETICSPERSEC*8; p->timebeforeexit = GAMETICSPERSEC*8;
p->customexitsound = sector[p->cursectnum].hitag; p->customexitsound = sector[p->cursectnum].hitag;