- almost done...

This commit is contained in:
Christoph Oelckers 2021-11-14 22:19:35 +01:00
parent 317f13d167
commit 352dbe74df
14 changed files with 44 additions and 47 deletions

View file

@ -538,7 +538,6 @@ static void checkexplgoblin(PLAYER& plr, DWHActor* actor)
while (auto sectactor = it.Next())
{
SPRITE& spri = sectactor->s();
int j = sectactor->GetSpriteIndex();
int dx = abs(spr.x - spri.x); // x distance to sprite
int dy = abs(spr.y - spri.y); // y distance to sprite

View file

@ -623,7 +623,6 @@ static DWHActor* searchpatrol(SPRITE& spr) {
while (auto itActor = it.Next())
{
SPRITE& tspr = itActor->s();
int j = itActor->GetSpriteIndex();
int dist = abs(tspr.x - spr.x) + abs(tspr.y - spr.y);
if (dist < mindist) {
@ -693,7 +692,6 @@ static void checkexplgonzo(PLAYER& plr, DWHActor* actor)
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

View file

@ -430,7 +430,6 @@ static void checkexplgron(PLAYER& plr, DWHActor* actor)
while (auto sectactor = it.Next())
{
SPRITE& spri = sectactor->s();
int j = sectactor->GetSpriteIndex();
int dx = abs(spr.x - spri.x); // x distance to sprite
int dy = abs(spr.y - spri.y); // y distance to sprite

View file

@ -311,7 +311,6 @@ static void checkexplimp(PLAYER& plr, DWHActor* actor)
while (auto sect = it.Next())
{
SPRITE& tspr = sect->s();
int j = sect->GetSpriteIndex();
int dx = abs(spr.x - tspr.x); // x distance to sprite
int dy = abs(spr.y - tspr.y); // y distance to sprite

View file

@ -330,7 +330,6 @@ static void checkexplkobold(PLAYER& plr, DWHActor* actor)
while (auto sect = it.Next())
{
SPRITE& tspr = sect->s();
int j = sect->GetSpriteIndex();
int dx = abs(spr.x - tspr.x); // x distance to sprite
int dy = abs(spr.y - tspr.y); // y distance to sprite

View file

@ -293,7 +293,6 @@ static void checkexplspider(PLAYER& plr, DWHActor* actor)
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

View file

@ -6,7 +6,7 @@ BEGIN_WH_NS
static int weaponuseless = 0;
static boolean madeahit;
static int weapondropgoal;
static int arrowcnt, throwpikecnt;
int arrowcnt, throwpikecnt;
// EG 17 Oct 2017: Backport shield toggle
@ -1692,9 +1692,9 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (pHitInfo.hitwall > 0 && pHitInfo.hitsprite < 0) { // XXX WH2 sector lotag < 6 || > 8
if (isWh2()) {
arrowcnt = (arrowcnt + 1) % ARROWCOUNTLIMIT;
if (arrowsprite[arrowcnt] != -1) {
deletesprite((short) arrowsprite[arrowcnt]);
arrowsprite[arrowcnt] = -1;
if (arrowsprite[arrowcnt] != nullptr) {
DeleteActor(arrowsprite[arrowcnt]);
arrowsprite[arrowcnt] = nullptr;
}
}
@ -1880,9 +1880,8 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
while (auto itActor = it.Next())
{
auto& spk = itActor->s();
int i = itActor->GetSpriteIndex();
// cansee
if (itActor->GetSpriteIndex() != plr.spritenum) {
if (itActor != plr.actor()) {
switch (spk.detail) {
case FREDTYPE:
case KOBOLDTYPE:
@ -1946,16 +1945,16 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (isWh2()) {
throwpikecnt = (throwpikecnt + 1) % THROWPIKELIMIT;
if (throwpikesprite[throwpikecnt] != -1) {
deletesprite(throwpikesprite[throwpikecnt]);
throwpikesprite[throwpikecnt] = -1;
if (throwpikesprite[throwpikecnt] != nullptr) {
DeleteActor(throwpikesprite[throwpikecnt]);
throwpikesprite[throwpikecnt] = nullptr;
}
if (plr.weapon[plr.currweapon] == 3) {
auto spawnedactor = InsertActor(plr.sector, MISSILE);
auto& spawned = spawnedactor->s();
throwpikesprite[throwpikecnt] = spawnedactor->GetSpriteIndex();
throwpikesprite[throwpikecnt] = spawnedactor;
spawned.x = plr.x;
spawned.y = plr.y;
spawned.z = plr.z + (24 << 8);
@ -1987,7 +1986,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
auto spawnedactor = InsertActor(plr.sector, MISSILE);
auto& spawned = spawnedactor->s();
throwpikesprite[throwpikecnt] = spawnedactor->GetSpriteIndex();
throwpikesprite[throwpikecnt] = spawnedactor;
spawned.x = plr.x;
spawned.y = plr.y;
spawned.z = plr.z + (24 << 8);
@ -2045,9 +2044,9 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
if (isWh2()) {
throwpikecnt = (throwpikecnt + 1) % THROWPIKELIMIT;
if (throwpikesprite[throwpikecnt] != -1) {
deletesprite((short) throwpikesprite[throwpikecnt]);
throwpikesprite[throwpikecnt] = -1;
if (throwpikesprite[throwpikecnt] != nullptr) {
DeleteActor(throwpikesprite[throwpikecnt]);
throwpikesprite[throwpikecnt] = nullptr;
}
if (plr.weapon[plr.currweapon] == 3) {
@ -2055,7 +2054,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
auto spawnedactor = InsertActor(plr.sector, MISSILE);
auto& spawned = spawnedactor->s();
throwpikesprite[throwpikecnt] = spawnedactor->GetSpriteIndex();
throwpikesprite[throwpikecnt] = spawnedactor;
spawned.x = plr.x;
spawned.y = plr.y;
spawned.z = plr.z + (24 << 8);
@ -2084,7 +2083,7 @@ void shootgun(PLAYER& plr, float ang, int guntype) {
auto spawnedactor = InsertActor(plr.sector, MISSILE);
auto& spawned = spawnedactor->s();
throwpikesprite[throwpikecnt] = spawnedactor->GetSpriteIndex();
throwpikesprite[throwpikecnt] = spawnedactor;
spawned.x = plr.x;
spawned.y = plr.y;
spawned.z = plr.z + (24 << 8);

View file

@ -15,7 +15,8 @@ int difficulty;
int treasurescnt, treasuresfound;
SPRITE tspritelist[MAXSPRITESONSCREEN + 1];
int tspritelistcnt;
short arrowsprite[ARROWCOUNTLIMIT], throwpikesprite[THROWPIKELIMIT];
DWHActor* arrowsprite[ARROWCOUNTLIMIT];
DWHActor* throwpikesprite[THROWPIKELIMIT];
int sparksx, sparksy, sparksz;
int playertorch = 0;
uint8_t ceilingshadearray[MAXSECTORS];

View file

@ -154,7 +154,8 @@ extern int expgained;
extern int difficulty;
extern SPRITE tspritelist[MAXSPRITESONSCREEN + 1];
extern int tspritelistcnt;
extern short arrowsprite[ARROWCOUNTLIMIT], throwpikesprite[THROWPIKELIMIT];
extern DWHActor* throwpikesprite[THROWPIKELIMIT];
extern DWHActor* arrowsprite[ARROWCOUNTLIMIT];
extern int sparksx, sparksy, sparksz;
extern int playertorch;
extern uint8_t ceilingshadearray[MAXSECTORS];
@ -162,6 +163,7 @@ extern uint8_t floorshadearray[MAXSECTORS];
extern uint8_t wallshadearray[MAXWALLS];
extern short floormirrorsector[64];
extern int floormirrorcnt;
extern int arrowcnt, throwpikecnt;
extern int zr_ceilz, zr_florz;
extern Collision zr_florHit;
@ -353,7 +355,7 @@ extern short skypanlist[64], skypancnt;
extern short lavadrylandsector[32];
extern short lavadrylandcnt;
extern short bobbingsectorlist[16], bobbingsectorcnt;
extern int lastbat;
extern DWHActor* lastbat;
extern short revolveclip[16];
extern short revolvesector[4], revolveang[4], revolvecnt;
extern int revolvex[4][32], revolvey[4][32];
@ -391,7 +393,6 @@ void lavadryland();
void warpfxsprite(DWHActor* s);
void resetEffects();
void weaponpowerup(PLAYER& plr);
void makesparks(short i, int type);
void shards(DWHActor* i, int type);

View file

@ -425,7 +425,6 @@ void animateobjs(PLAYER& plr) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
int i = actor->GetSpriteIndex();
spr.lotag -= TICSPERFRAME;
switch (spr.extra) {
@ -463,7 +462,7 @@ void animateobjs(PLAYER& plr) {
}
case 2: // fly to roof and get deleted
if (spr.lotag < 0) {
if (i == lastbat) {
if (actor == lastbat) {
soundEngine->StopSound(CHAN_BAT);
}
DeleteActor(actor);
@ -474,7 +473,7 @@ void animateobjs(PLAYER& plr) {
(bsin(spr.ang) * TICSPERFRAME) << 3, 0, 4 << 8, 4 << 8, 0);
SetActorPos(actor, &spr.pos);
if (moveStat.type == kHitSector) {// Hits a ceiling / floor
if (i == lastbat) {
if (actor == lastbat) {
soundEngine->StopSound(CHAN_BAT);
}
DeleteActor(actor);

View file

@ -20,7 +20,7 @@ short lavadrylandsector[32];
short lavadrylandcnt;
short bobbingsectorlist[16], bobbingsectorcnt;
int lastbat = -1;
DWHActor* lastbat = nullptr;
short revolveclip[16];
short revolvesector[4], revolveang[4], revolvecnt;
@ -916,7 +916,7 @@ void bats(PLAYER& plr, DWHActor* actor) {
SetNewStatus(spawnedactor, FLOCK);
if (spr.extra == 1)
lastbat = spawnedactor->GetSpriteIndex();
lastbat = spawnedactor;
}
void cracks() {
@ -1097,27 +1097,28 @@ void weaponpowerup(PLAYER& plr) {
}
}
void makesparks(short i, int type) {
void makesparks(DWHActor* actor, int type) {
auto& spr = actor->s();
DWHActor* spawnedactor = nullptr;
switch (type) {
case 1:
spawnedactor = InsertActor(sprite[i].sectnum, SPARKS);
spawnedactor = InsertActor(spr.sectnum, SPARKS);
break;
case 2:
spawnedactor = InsertActor(sprite[i].sectnum, SPARKSUP);
spawnedactor = InsertActor(spr.sectnum, SPARKSUP);
break;
case 3:
spawnedactor = InsertActor(sprite[i].sectnum, SPARKSDN);
spawnedactor = InsertActor(spr.sectnum, SPARKSDN);
break;
}
auto& spawned = spawnedactor->s();
spawned.x = sprite[i].x;
spawned.y = sprite[i].y;
spawned.z = sprite[i].z;
spawned.x = spr.x;
spawned.y = spr.y;
spawned.z = spr.z;
spawned.cstat = 0;
spawned.picnum = SPARKBALL;
spawned.shade = 0;

View file

@ -162,6 +162,9 @@ void SerializeSectorData(FSerializer& arc)
.Array("ironbarsgoal2", ironbarsgoal2, ironbarscnt)
.Array("ironbarsdone", ironbarsdone, ironbarscnt)
.Array("ironbarsanim", ironbarsanim, ironbarscnt)
("lastbat", lastbat)
("throwpikecnt", throwpikecnt)
.Array("throwpikesprite", throwpikesprite, throwpikecnt)
.EndObject();
}
}
@ -183,7 +186,8 @@ void SerializeStuff(FSerializer& arc)
("droptheshield", droptheshield)
("floormirrorcnt", floormirrorcnt)
.Array("floormirrorsector", floormirrorsector, floormirrorcnt)
.Array("arrowsprite", arrowsprite, countof(arrowsprite))
("arrowcnt", arrowcnt)
.Array("arrowsprite", arrowsprite, arrowcnt)
.Array("ceilingshadearray", ceilingshadearray, numsectors)
.Array("floorshadearray", floorshadearray, numsectors)
.Array("wallshadearray", wallshadearray, numwalls)

View file

@ -243,9 +243,9 @@ boolean prepareboard(const char* fname) {
tileDelete(FLOORMIRROR);
for (i = 0; i < ARROWCOUNTLIMIT; i++)
arrowsprite[i] = -1;
arrowsprite[i] = nullptr;
for (i = 0; i < THROWPIKELIMIT; i++)
throwpikesprite[i] = -1;
throwpikesprite[i] = nullptr;
lavadrylandcnt = 0;
aiInit();
@ -254,7 +254,6 @@ boolean prepareboard(const char* fname) {
while (auto actor = it.Next())
{
SPRITE& spr = actor->s();
i = actor->GetSpriteIndex();
if(!isWh2() && mapon == 5 && i == 0 && spr.lotag == 0 && spr.hitag == 0) {
spr.lotag = 1;
@ -266,13 +265,13 @@ boolean prepareboard(const char* fname) {
sparksy = spr.y;
sparksz = spr.z;
for (int j = 0; j < 10; j++) {
makesparks(i, 1);
makesparks(actor, 1);
}
for (int j = 10; j < 20; j++) {
makesparks(i, 2);
makesparks(actor, 2);
}
for (int j = 20; j < 30; j++) {
makesparks(i, 3);
makesparks(actor, 3);
}
spr.cstat &= ~3;
spr.cstat |= 0x8000;

View file

@ -20,7 +20,7 @@ int damage_vel, damage_svel, damage_angvel;
void viewBackupPlayerLoc( int nPlayer )
{
SPRITE& pSprite = sprite[player[nPlayer].spritenum];
SPRITE& pSprite = player[nPlayer].actor()->s();
PLOCATION& pPLocation = gPrevPlayerLoc[nPlayer];
pPLocation.x = pSprite.x;
pPLocation.y = pSprite.y;