- migrated Duke's added sector properties.

This commit is contained in:
Christoph Oelckers 2021-11-20 17:46:08 +01:00
parent 14907a9a97
commit cc41f4e7c6
9 changed files with 12 additions and 25 deletions

View file

@ -3819,7 +3819,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{ {
if (spr->sector()->ceilingstat & 1) if (spr->sector()->ceilingstat & 1)
{ {
if (shadedsector[spr->sectnum] == 1) if (spr->sector()->shadedsector == 1)
{ {
spr->shade += (16 - spr->shade) >> 1; spr->shade += (16 - spr->shade) >> 1;
} }
@ -3971,7 +3971,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{ {
if (spr->sector()->ceilingstat & 1) if (spr->sector()->ceilingstat & 1)
{ {
if (shadedsector[spr->sectnum] == 1) if (spr->sector()->shadedsector == 1)
{ {
spr->shade += (16 - spr->shade) >> 1; spr->shade += (16 - spr->shade) >> 1;
} }
@ -4179,7 +4179,7 @@ void destroyit(DDukeActor *actor)
destsect->floorxpan_ = srcsect->floorxpan_; destsect->floorxpan_ = srcsect->floorxpan_;
destsect->floorypan_ = srcsect->floorypan_; destsect->floorypan_ = srcsect->floorypan_;
destsect->visibility = srcsect->visibility; destsect->visibility = srcsect->visibility;
sectorextra[sectnum] = sectorextra[::sectnum(it_sect)]; // TRANSITIONAL: at least rename this. destsect->keyinfo = srcsect->keyinfo;
destsect->lotag = srcsect->lotag; destsect->lotag = srcsect->lotag;
destsect->hitag = srcsect->hitag; destsect->hitag = srcsect->hitag;
destsect->extra = srcsect->extra; destsect->extra = srcsect->extra;

View file

@ -110,7 +110,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
default: default:
if (((t->cstat & 16)) || (badguy(t) && t->extra > 0) || t->statnum == 10) if (((t->cstat & 16)) || (badguy(t) && t->extra > 0) || t->statnum == 10)
{ {
if (shadedsector[s->sectnum] == 1 && s->statnum != 1) if (s->sector()->shadedsector == 1 && s->statnum != 1)
{ {
s->shade = 16; s->shade = 16;
t->shade = 16; t->shade = 16;
@ -588,7 +588,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
stuff: stuff:
if (t->pal == 6) t->shade = -120; if (t->pal == 6) t->shade = -120;
if (shadedsector[s->sectnum] == 1) if (s->sector()->shadedsector == 1)
t->shade = 16; t->shade = 16;
[[fallthrough]]; [[fallthrough]];

View file

@ -91,10 +91,6 @@ TArray<CraneDef> cranes;
bool sound445done; // used in checksectors_r. This was local state inside a function, but this must be maintained globally and serialized bool sound445done; // used in checksectors_r. This was local state inside a function, but this must be maintained globally and serialized
// serialized
uint8_t sectorextra[MAXSECTORS]; // something about keys, all access through the haskey function.
uint8_t shadedsector[MAXSECTORS]; // display hackiness
DDukeActor hittype[MAXSPRITES + 1]; // +1 to have a blank entry for serialization, all access in game code through the iterators. DDukeActor hittype[MAXSPRITES + 1]; // +1 to have a blank entry for serialization, all access in game code through the iterators.
int spriteqamount = 64; // internal sprite queue int spriteqamount = 64; // internal sprite queue
int spriteqloc; int spriteqloc;

View file

@ -53,9 +53,6 @@ extern int show_shareware;
extern int screenpeek; extern int screenpeek;
// Variables that must be saved // Variables that must be saved
extern uint8_t sectorextra[MAXSECTORS]; // these hold fields that were formerly in sprite and sector. Move these back into the base structs!
extern uint8_t shadedsector[MAXSECTORS];
extern int rtsplaying; extern int rtsplaying;
extern int tempwallptr; extern int tempwallptr;

View file

@ -144,7 +144,7 @@ void displayweapon_r(int snum, double smoothratio)
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang; weapon_xoffset -= 58 + p->weapon_ang;
if (p->insector() && shadedsector[p->cursectnum] == 1) if (p->insector() && p->cursector()->shadedsector == 1)
shade = 16; shade = 16;
else else
shade = p->GetActor()->s->shade; shade = p->GetActor()->s->shade;

View file

@ -967,17 +967,17 @@ int haskey(sectortype* sectp, int snum)
{ {
int sect = sectnum(sectp); int sect = sectnum(sectp);
auto p = &ps[snum]; auto p = &ps[snum];
if (!sectorextra[sect]) if (!sectp->keyinfo)
return 1; return 1;
if (sectorextra[sect] > 6) if (sectp->keyinfo > 6)
return 1; return 1;
int wk = sectorextra[sect]; int wk = sectp->keyinfo;
if (wk > 3) if (wk > 3)
wk -= 3; wk -= 3;
if (p->keys[wk] == 1) if (p->keys[wk] == 1)
{ {
sectorextra[sect] = 0; sectp->keyinfo = 0;
return 1; return 1;
} }

View file

@ -682,8 +682,6 @@ void prelevel_common(int g)
numclouds = 0; numclouds = 0;
for (auto& h : hittype) h.clear(); for (auto& h : hittype) h.clear();
memset(sectorextra, 0, sizeof(sectorextra));
memset(shadedsector, 0, sizeof(shadedsector));
memset(geosectorwarp, -1, sizeof(geosectorwarp)); memset(geosectorwarp, -1, sizeof(geosectorwarp));
memset(geosectorwarp2, -1, sizeof(geosectorwarp2)); memset(geosectorwarp2, -1, sizeof(geosectorwarp2));
memset(ambienthitag, -1, sizeof(ambienthitag)); memset(ambienthitag, -1, sizeof(ambienthitag));

View file

@ -576,7 +576,7 @@ void prelevel_r(int g)
break; break;
case RRTILE68: case RRTILE68:
shadedsector[si->sectnum] = 1; si->sector()->shadedsector = 1;
deletesprite(ac); deletesprite(ac);
break; break;
@ -659,7 +659,7 @@ void prelevel_r(int g)
deletesprite(i); deletesprite(i);
if (spr->picnum == RRTILE34) if (spr->picnum == RRTILE34)
{ {
sectorextra[spr->sectnum] = uint8_t(spr->lotag); spr->sector()->keyinfo = uint8_t(spr->lotag);
deletesprite(i); deletesprite(i);
} }
} }

View file

@ -339,8 +339,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
if (arc.isReading()) if (arc.isReading())
{ {
for (auto& h : hittype) h.clear(); for (auto& h : hittype) h.clear();
memset(sectorextra, 0, sizeof(sectorextra));
memset(shadedsector, 0, sizeof(shadedsector));
memset(geosectorwarp, -1, sizeof(geosectorwarp)); memset(geosectorwarp, -1, sizeof(geosectorwarp));
memset(geosectorwarp2, -1, sizeof(geosectorwarp2)); memset(geosectorwarp2, -1, sizeof(geosectorwarp2));
memset(ambienthitag, -1, sizeof(ambienthitag)); memset(ambienthitag, -1, sizeof(ambienthitag));
@ -368,14 +366,12 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("levelclock", PlayClock) ("levelclock", PlayClock)
("bomb_tag", ud.bomb_tag) ("bomb_tag", ud.bomb_tag)
.Array("sectorextra", sectorextra, numsectors)
("rtsplaying", rtsplaying) ("rtsplaying", rtsplaying)
("tempwallptr", tempwallptr) ("tempwallptr", tempwallptr)
("cranes", cranes) ("cranes", cranes)
("sound445done", sound445done) ("sound445done", sound445done)
.Array("players", ps, ud.multimode) .Array("players", ps, ud.multimode)
("spriteqamount", spriteqamount) ("spriteqamount", spriteqamount)
.Array("shadedsector", shadedsector, numsectors)
("lastvisinc", lastvisinc) ("lastvisinc", lastvisinc)
("numanimwalls", numanimwalls) ("numanimwalls", numanimwalls)
.Array("animwall", animwall, numanimwalls) .Array("animwall", animwall, numanimwalls)