- we're done here!

This commit is contained in:
Christoph Oelckers 2021-11-14 22:31:46 +01:00
parent 352dbe74df
commit 8cb68f1b12
15 changed files with 29 additions and 61 deletions

View file

@ -419,7 +419,6 @@ void aiProcess() {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2, CLIPMASK0);
switch (checkfluid(actor, zr_florHit)) {

View file

@ -842,7 +842,7 @@ DEFINE_FIELD_X(WhPlayer,PLAYER,height);
DEFINE_FIELD_X(WhPlayer,PLAYER,hvel);
DEFINE_FIELD_X(WhPlayer,PLAYER, sector);
DEFINE_FIELD_X(WhPlayer,PLAYER, oldsector);
DEFINE_FIELD_X(WhPlayer,PLAYER, spritenum);
//DEFINE_FIELD_X(WhPlayer,PLAYER, spritenum);
DEFINE_FIELD_X(WhPlayer,PLAYER, keytoggle);
DEFINE_FIELD_X(WhPlayer,PLAYER,flags);
DEFINE_FIELD_X(WhPlayer,PLAYER,weapon);

View file

@ -22,8 +22,8 @@ struct PLAYER {
int hvel;
int sector;
int oldsector;
short spritenum;
DWHActor* actor() { return &whActors[spritenum]; }
DWHActor* theactor;
DWHActor* actor() { return theactor; }
sectortype* Sector() { return &::sector[sector]; }
int playerNum();
boolean keytoggle;

View file

@ -138,7 +138,7 @@ void GameInterface::UpdateSounds()
return false;
});
if (player[pyrn].spritenum >= 0)
if (player[pyrn].actor() != nullptr)
{
listener.angle = float(-FixedToFloat(player[pyrn].angle.ang.asq16()) * pi::pi() / 1024); // Build uses a period of 2048.
listener.velocity.Zero();

View file

@ -240,8 +240,7 @@ void speelbookprocess(PLAYER& plr) {
}
}
void nukespell(PLAYER& plr, short const j) {
auto actor = &whActors[j];
void nukespell(PLAYER& plr, DWHActor* actor) {
auto& spr = actor->s();
if(spr.detail != WILLOWTYPE && spr.pal == 6) //don't nuke freezed enemies

View file

@ -2230,7 +2230,6 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
while (auto itActor = it.Next())
{
auto& spk = itActor->s();
int j = itActor->GetSpriteIndex();
switch (spk.detail) {
case DEMONTYPE:
case NEWGUYTYPE:
@ -2257,7 +2256,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
spk.z - (tileHeight(spk.picnum) << 7), spk.sectnum))
if ((isWh2() && itActor->GetPlayerOwner() != plr.playerNum())
|| checkmedusadist(itActor, plr.x, plr.y, plr.z, 12))
nukespell(plr, j);
nukespell(plr, itActor);
break;
}
}

View file

@ -256,7 +256,8 @@ extern Delayitem delayitem[MAXSECTORS];
extern short ironbarsector[16];
extern short ironbarscnt;
extern int ironbarsgoal1[16], ironbarsgoal2[16];
extern short ironbarsdone[16], ironbarsanim[16];
extern short ironbarsdone[16];
extern DWHActor* ironbarsanim[16];
extern int ironbarsgoal[16];
extern short warpsectorlist[64], warpsectorcnt;
@ -334,7 +335,7 @@ void bookprocess(int snum);
boolean changebook(PLAYER& plr, int i);
boolean lvlspellcheck(PLAYER& plr);
void speelbookprocess(PLAYER& plr);
void nukespell(PLAYER& plr, short j);
void nukespell(PLAYER& plr, DWHActor* j);
void medusa(PLAYER& plr, DWHActor* j);
void displayspelltext(PLAYER& plr);
void orbpic(PLAYER& plr, int currentorb);

View file

@ -491,7 +491,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
osectnum = spr.sectnum;
j = (torchpattern[PlayClock % 38]);
@ -508,7 +507,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
osectnum = spr.sectnum;
j = (torchpattern[PlayClock % 38]);
@ -533,7 +531,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
switch (spr.lotag) {
case 1821:
@ -576,7 +573,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
int ironbarmove = 0;
@ -623,7 +619,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
spr.z = spr.sector()->floorz + (tileHeight(spr.picnum) << 8);
@ -646,7 +641,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
@ -666,7 +660,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
@ -698,7 +691,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2,
CLIPMASK0);
@ -744,7 +736,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
getzrange(spr.x, spr.y, spr.z - 1, spr.sectnum, (spr.clipdist) << 2,
CLIPMASK0);
@ -788,7 +779,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
@ -820,7 +810,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
if (isWh2()) {
osectnum = spr.sectnum;
@ -849,7 +838,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
if (isWh2()) {
spr.lotag -= TICSPERFRAME;
@ -888,7 +876,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
@ -960,9 +947,9 @@ void animateobjs(PLAYER& plr) {
if (moveStat.type != kHitNone && spr.picnum == MONSTERBALL)
if (actor->GetPlayerOwner() == plr.playerNum()) {
explosion2(actor, spr.x, spr.y, spr.z, i);
explosion2(actor, spr.x, spr.y, spr.z, 0);
} else {
explosion(actor, spr.x, spr.y, spr.z, i);
explosion(actor, spr.x, spr.y, spr.z, 0);
}
if (moveStat.type == kHitSector) { // Hits a ceiling / floor
@ -979,9 +966,9 @@ void animateobjs(PLAYER& plr) {
if (spr.picnum == MONSTERBALL) {
if (actor->GetPlayerOwner() == plr.playerNum())
explosion2(actor, spr.x, spr.y, spr.z, i);
explosion2(actor, spr.x, spr.y, spr.z, 0);
else
explosion(actor, spr.x, spr.y, spr.z, i);
explosion(actor, spr.x, spr.y, spr.z, 0);
}
if (spr.picnum == THROWPIKE) {
spr.picnum++;
@ -998,9 +985,9 @@ void animateobjs(PLAYER& plr) {
if (moveStat.type == kHitSprite) { // Bullet hit a sprite
if (spr.picnum == MONSTERBALL) {
if (actor->GetPlayerOwner() == plr.playerNum())
explosion2(actor, spr.x, spr.y, spr.z, i);
explosion2(actor, spr.x, spr.y, spr.z, 0);
else
explosion(actor, spr.x, spr.y, spr.z, i);
explosion(actor, spr.x, spr.y, spr.z, 0);
}
if (actor->GetOwner() != moveStat.actor)
@ -1035,7 +1022,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
if (isBlades(spr.picnum)) {
@ -1126,7 +1112,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
dax = spr.xvel >> 3;
@ -1156,7 +1141,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
@ -1213,7 +1197,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
if (spr.lotag < 0) {
@ -1231,7 +1214,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
if (plr.invisibletime < 0) {
spr.lotag -= TICSPERFRAME;
@ -1251,7 +1233,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
spr.z += spr.zvel;
@ -1274,17 +1255,12 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
//
// spr.z -= (TICSPERFRAME << 6);
if (spr.xrepeat > 1)
spr.xrepeat = spr.yrepeat -= TICSPERFRAME;
// SetActorPos(actor, &spr.pos);
if (spr.lotag < 0) {
DeleteActor(actor);
}
@ -1295,7 +1271,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
spr.x += ((spr.xvel * TICSPERFRAME) >> 5);
@ -1348,7 +1323,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
spr.picnum++;
@ -1360,7 +1334,6 @@ void animateobjs(PLAYER& plr) {
while (auto sectactor = it.Next())
{
SPRITE& tspr = sectactor->s();
int j = sectactor->GetSpriteIndex();
int dx = abs(spr.x - tspr.x); // x distance to sprite
int dy = abs(spr.y - tspr.y); // y distance to sprite
@ -1400,7 +1373,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
if (spr.lotag < 0) {
@ -1437,7 +1409,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;

View file

@ -536,8 +536,7 @@ void warpsprite(DWHActor* actor) {
void ironbars() {
for (int i = 0; i < ironbarscnt; i++) {
if (ironbarsdone[i] == 1) {
short spritenum = ironbarsanim[i];
auto actor = &whActors[spritenum];
auto actor = ironbarsanim[i];
auto& spr = actor->s();
switch (spr.hitag) {
case 1:
@ -1083,7 +1082,6 @@ void weaponpowerup(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& tspr = actor->s();
int j = actor->GetSpriteIndex();
if (tspr.picnum == CONE) {
DeleteActor(actor);

View file

@ -36,7 +36,7 @@ FSerializer& Serialize(FSerializer& arc, const char* key, PLAYER& sw, PLAYER* de
("hvel", sw.hvel)
("sector", sw.sector)
("oldsector", sw.oldsector)
("spritenum", sw.spritenum)
("spritenum", sw.theactor)
("keytoggle", sw.keytoggle)
("flags", sw.flags)
.Array("weapon", sw.weapon, countof(sw.weapon))

View file

@ -327,7 +327,7 @@ boolean prepareboard(const char* fname) {
if (spr.lotag == 80) {
ironbarsector[ironbarscnt] = spr.sectnum;
ironbarsdone[ironbarscnt] = 0;
ironbarsanim[ironbarscnt] = (short) i;
ironbarsanim[ironbarscnt] = actor;
ironbarsgoal[ironbarscnt] = 0;
ironbarscnt++;
}
@ -776,7 +776,7 @@ boolean prepareboard(const char* fname) {
auto pactor = InsertActor(plr.sector, (short)0);
auto& pspr = pactor->s();
plr.spritenum = pactor->GetSpriteIndex();
plr.theactor = pactor;
plr.oldsector = plr.sector;
pspr.x = plr.x;

View file

@ -1698,7 +1698,7 @@ boolean damageactor(PLAYER& plr, DWHActor* hitactor, DWHActor* actor)
// raf because monsters could shatter a guy thats been frozen
if (hitspr.pal == 6) {
for (int k = 0; k < 32; k++)
icecubes(hitactor, hitspr.x, hitspr.y, hitspr.z, hitactor->GetSpriteIndex());
icecubes(hitactor, hitspr.x, hitspr.y, hitspr.z, 0);
// EG 26 Oct 2017: Move this here from medusa (anti multi-freeze exploit)
addscore(&plr, 100);
DeleteActor(hitactor);

View file

@ -91,7 +91,7 @@ void initplayersprite(PLAYER& plr) {
plr.z = plr.Sector()->floorz - (plr.height << 8);
auto pactor = InsertActor(plr.sector, (short)0);
plr.spritenum = pactor->GetSpriteIndex();
plr.theactor = pactor;
auto& spr = pactor->s();
plr.onsomething = 1;

View file

@ -10,7 +10,8 @@ Delayitem delayitem[MAXSECTORS];
short ironbarsector[16];
short ironbarscnt;
int ironbarsgoal1[16], ironbarsgoal2[16];
short ironbarsdone[16], ironbarsanim[16];
short ironbarsdone[16];
DWHActor* ironbarsanim[16];
int ironbarsgoal[16];
short warpsectorlist[64], warpsectorcnt;
@ -798,7 +799,7 @@ void operatesector(PLAYER& plr, int s) {
if (ironbarsector[k] == s) {
ironbarsdone[k] = 1;
switch (sprite[ironbarsanim[k]].picnum) {
switch (ironbarsanim[k]->s().picnum) {
case SWINGDOOR:
@ -829,7 +830,7 @@ void operatesector(PLAYER& plr, int s) {
break;
}
int pic = sprite[ironbarsanim[k]].picnum;
int pic = ironbarsanim[k]->s().picnum;
if(pic == SWINGGATE3 || pic == SWINGGATE4 || pic == SWINGGATE5 || pic == GEARS2START)
SND_Sound(S_CREAKDOOR1);
}

View file

@ -232,7 +232,7 @@ struct WhPlayer native {
native int hvel;
native int sector;
native int oldsector;
native int16 spritenum;
//native int16 spritenum;
native bool keytoggle;
native int flags;
native int weapon[Witchaven.MAXWEAPONS], preenchantedweapon[Witchaven.MAXWEAPONS];