Merge branch 'master' into newrenderer2

# Conflicts:
#	source/games/duke/src/actors.cpp
#	source/games/duke/src/hudweapon_d.cpp
#	source/games/duke/src/hudweapon_r.cpp
#	source/games/duke/src/render.cpp
This commit is contained in:
Christoph Oelckers 2021-04-15 19:34:03 +02:00
commit dc8b72b2ce
47 changed files with 1644 additions and 1652 deletions

View file

@ -102,7 +102,7 @@ struct GameInterface
virtual const char *CheckCheatMode() { return nullptr; }
virtual const char* GenericCheat(int player, int cheat) = 0;
virtual void NextLevel(MapRecord* map, int skill) {}
virtual void NewGame(MapRecord* map, int skill) {}
virtual void NewGame(MapRecord* map, int skill, bool special = false) {}
virtual void LevelCompleted(MapRecord* map, int skill) {}
virtual bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) { return false; }
virtual void SetTileProps(int tile, int surf, int vox, int shade) {}

View file

@ -197,7 +197,7 @@ static void GameTicker()
C_FlushDisplay();
gameaction = ga_level;
BackupSaveGame = "";
gi->NewGame(g_nextmap, g_nextskill);
gi->NewGame(g_nextmap, g_nextskill, ga == ga_newgamenostopsound);
break;
case ga_startup:

View file

@ -248,7 +248,7 @@ void NewLevel(MapRecord *sng, int skill)
}
void GameInterface::NewGame(MapRecord *sng, int skill)
void GameInterface::NewGame(MapRecord *sng, int skill, bool)
{
gGameOptions.uGameFlags = 0;
cheatReset();

View file

@ -132,7 +132,7 @@ struct GameInterface : ::GameInterface
void Startup() override;
void Render() override;
const char* GenericCheat(int player, int cheat) override;
void NewGame(MapRecord *sng, int skill) override;
void NewGame(MapRecord *sng, int skill, bool) override;
void NextLevel(MapRecord* map, int skill) override;
void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override;

View file

@ -30,7 +30,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (
spr->picnum == SECTOREFFECTOR &&
spr->lotag == fofmode &&
@ -50,7 +50,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (
spr->picnum == SECTOREFFECTOR &&
spr->lotag == k &&
@ -68,7 +68,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (spr->picnum == SECTOREFFECTOR &&
spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
@ -101,7 +101,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh
it.Reset(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (spr->picnum == 1 &&
spr->lotag == k + 2 &&
spr->hitag == floor1->hitag
@ -139,7 +139,7 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{
switch (act->s.lotag - tag + 40)
switch (act->s->lotag - tag + 40)
{
// case 40:
// case 41:
@ -149,8 +149,8 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
case 43:
case 44:
case 45:
if (ps[screenpeek].cursectnum == act->s.sectnum)
SE40_Draw(tag, &act->s, x, y, z, a, h, smoothratio);
if (ps[screenpeek].cursectnum == act->s->sectnum)
SE40_Draw(tag, act->s, x, y, z, a, h, smoothratio);
break;
}
}
@ -218,7 +218,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next())
{
changespritesect(act, geosectorwarp[gs]);
setsprite(act, act->s.x -= geox[gs], act->s.y -= geoy[gs], act->s.z);
setsprite(act, act->s->x -= geox[gs], act->s->y -= geoy[gs], act->s->z);
}
if (geosector[gs] == sect)
{
@ -238,7 +238,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next())
{
changespritesect(act, geosector[gs]);
setsprite(act, act->s.x += geox[gs], act->s.y += geoy[gs], act->s.z);
setsprite(act, act->s->x += geox[gs], act->s->y += geoy[gs], act->s->z);
}
}
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);
@ -250,7 +250,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next())
{
changespritesect(act, geosectorwarp2[gs]);
setsprite(act, act->s.x -= geox2[gs], act->s.y -= geoy2[gs], act->s.z);
setsprite(act, act->s->x -= geox2[gs], act->s->y -= geoy2[gs], act->s->z);
}
if (geosector[gs] == sect)
{
@ -270,7 +270,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
while (auto act = it.Next())
{
changespritesect(act, geosector[gs]);
setsprite(act, act->s.x += geox2[gs], act->s.y += geoy2[gs], act->s.z);
setsprite(act, act->s->x += geox2[gs], act->s->y += geoy2[gs], act->s->z);
}
}
fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -521,7 +521,7 @@ void moveminecart(void)
DukeSectIterator it(csect);
while (auto a2 = it.Next())
{
auto sj = &a2->s;
auto sj = a2->s;
if (badguy(sj))
setsprite(a2, cx, cy, sj->z);
}

File diff suppressed because it is too large Load diff

View file

@ -57,7 +57,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t = &tsprite[j];
i = t->owner;
h = &hittype[i];
s = &h->s;
s = h->s;
switch (t->picnum)
{
@ -149,9 +149,9 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t = &tsprite[j];
i = t->owner;
h = &hittype[i];
s = &h->s;
s = h->s;
auto OwnerAc = h->GetOwner();
auto Owner = OwnerAc ? &OwnerAc->s : nullptr;
auto Owner = OwnerAc ? OwnerAc->s : nullptr;
switch (s->picnum)
{
@ -227,7 +227,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
Owner->y - t->y);
if (abs(getincangle(sqa, sqb)) > 512)
if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner))
if (ldist(Owner, t) < ldist(ps[screenpeek].GetActor()->s, Owner))
t->xrepeat = t->yrepeat = 0;
}
continue;
@ -336,7 +336,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
}
}
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0)
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0)
{
auto newtspr = &tsprite[spritesortcnt];
memcpy(newtspr, t, sizeof(spritetype));

View file

@ -52,7 +52,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t = &tsprite[j];
i = t->owner;
h = &hittype[i];
s = &h->s;
s = h->s;
switch (t->picnum)
{
@ -139,9 +139,9 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t = &tsprite[j];
i = t->owner;
h = &hittype[i];
s = &h->s;
s = h->s;
auto OwnerAc = h->GetOwner();
auto Owner = OwnerAc ? &OwnerAc->s : nullptr;
auto Owner = OwnerAc ? OwnerAc->s : nullptr;
switch (s->picnum)
{
@ -226,7 +226,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
Owner->y - t->y);
if (abs(getincangle(sqa, sqb)) > 512)
if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner))
if (ldist(Owner, t) < ldist(ps[screenpeek].GetActor()->s, Owner))
t->xrepeat = t->yrepeat = 0;
}
continue;
@ -382,7 +382,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
}
}
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0)
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0)
{
auto newtspr = &tsprite[spritesortcnt];
memcpy(newtspr, t, sizeof(spritetype));

View file

@ -38,17 +38,17 @@ void ballreturn(DDukeActor *ball)
DukeStatIterator it(STAT_BOWLING);
while (auto act = it.Next())
{
if (act->s.picnum == RRTILE281 && ball->s.sectnum == act->s.sectnum)
if (act->s->picnum == RRTILE281 && ball->s->sectnum == act->s->sectnum)
{
DukeStatIterator it2(STAT_BOWLING);
while (auto act2 = it2.Next())
{
if (act2->s.picnum == RRTILE282 && act->s.hitag == act2->s.hitag)
if (act2->s->picnum == RRTILE282 && act->s->hitag == act2->s->hitag)
spawn(act2, BOWLINGBALLSPRITE);
if (act2->s.picnum == RRTILE280 && act->s.hitag == act2->s.hitag && act2->s.lotag == 0)
if (act2->s->picnum == RRTILE280 && act->s->hitag == act2->s->hitag && act2->s->lotag == 0)
{
act2->s.lotag = 100;
act2->s.extra++;
act2->s->lotag = 100;
act2->s->extra++;
}
}
}
@ -94,14 +94,14 @@ short checkpins(short sect)
DukeSectIterator it(sect);
while (auto a2 = it.Next())
{
if (a2->s.picnum == RRTILE3440)
if (a2->s->picnum == RRTILE3440)
{
pin++;
pins[a2->s.lotag] = 1;
pins[a2->s->lotag] = 1;
}
if (a2->s.picnum == RRTILE280)
if (a2->s->picnum == RRTILE280)
{
tag = a2->s.hitag;
tag = a2->s->hitag;
}
}
@ -171,28 +171,28 @@ void resetpins(short sect)
DukeSectIterator it(sect);
while (auto a2 = it.Next())
{
if (a2->s.picnum == RRTILE3440)
if (a2->s->picnum == RRTILE3440)
deletesprite(a2);
}
it.Reset(sect);
while (auto a2 = it.Next())
{
if (a2->s.picnum == 283)
if (a2->s->picnum == 283)
{
auto spawned = spawn(a2, RRTILE3440);
spawned->s.lotag = a2->s.lotag;
if (spawned->s.lotag == 3 || spawned->s.lotag == 5)
spawned->s->lotag = a2->s->lotag;
if (spawned->s->lotag == 3 || spawned->s->lotag == 5)
{
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
spawned->s->clipdist = (1 + (krand() % 1)) * 16 + 32;
}
else
{
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
spawned->s->clipdist = (1 + (krand() % 1)) * 16 + 32;
}
spawned->s.ang -= ((krand() & 32) - (krand() & 64)) & 2047;
spawned->s->ang -= ((krand() & 32) - (krand() & 64)) & 2047;
}
if (a2->s.picnum == 280)
tag = a2->s.hitag;
if (a2->s->picnum == 280)
tag = a2->s->hitag;
}
if (tag)
{

View file

@ -90,9 +90,9 @@ static int ccmd_spawn(CCmdFuncPtr parm)
}
auto spawned = spawn(ps[myconnectindex].GetActor(), picnum);
if (set & 1) spawned->s.pal = (char)pal;
if (set & 2) spawned->s.cstat = (short)cstat;
if (set & 4) spawned->s.ang = ang;
if (set & 1) spawned->s->pal = (char)pal;
if (set & 2) spawned->s->cstat = (short)cstat;
if (set & 4) spawned->s->ang = ang;
if (set & 8) {
if (setsprite(spawned, x, y, z) < 0)
{

View file

@ -67,12 +67,12 @@ static const char *cheatGod(int myconnectindex, int state)
auto act = p->GetActor();
p->resurrected = true;
act->s.extra = gs.max_player_health;
act->s->extra = gs.max_player_health;
act->extra = 0;
if (ud.god)
{
if (isRRRA()) S_PlaySound(218, CHAN_AUTO, CHANF_UI);
act->s.cstat = 257;
act->s->cstat = 257;
act->temp_data[0] = 0;
act->temp_data[1] = 0;
@ -81,9 +81,9 @@ static const char *cheatGod(int myconnectindex, int state)
act->temp_data[4] = 0;
act->temp_data[5] = 0;
act->s.hitag = 0;
act->s.lotag = 0;
act->s.pal =
act->s->hitag = 0;
act->s->lotag = 0;
act->s->pal =
ps[myconnectindex].palookup;
return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_ON);
@ -91,7 +91,7 @@ static const char *cheatGod(int myconnectindex, int state)
else
{
ud.god = 0;
act->s.extra = gs.max_player_health;
act->s->extra = gs.max_player_health;
act->extra = -1;
ps[myconnectindex].last_extra = gs.max_player_health;
return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_OFF);
@ -121,9 +121,9 @@ static const char *cheatKfc(int player)
for (int i = 0; i < 7; i++)
{
auto spr = spawn(ps[player].GetActor(), TILE_HEN);
spr->s.pal = 1;
spr->s.xrepeat = spr->s.xrepeat << 2;
spr->s.yrepeat = spr->s.yrepeat << 2;
spr->s->pal = 1;
spr->s->xrepeat = spr->s->xrepeat << 2;
spr->s->yrepeat = spr->s->yrepeat << 2;
}
return quoteMgr.GetQuote(QUOTE_CHEAT_KFC);
}
@ -197,7 +197,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
ps[player].gotweapon.Zero();
ps[player].curr_weapon = KNEE_WEAPON;
ps[player].nocheat = 1;
ps[player].GetActor()->s.extra = 1;
ps[player].GetActor()->s->extra = 1;
return quoteMgr.GetQuote(QUOTE_YERFUCKED);
case CHT_AARON:
@ -473,7 +473,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
int type = ReadByte(stream);
if (skip) return;
if (numplayers != 1 || gamestate != GS_LEVEL || ps[player].GetActor()->s.extra <= 0)
if (numplayers != 1 || gamestate != GS_LEVEL || ps[player].GetActor()->s->extra <= 0)
{
Printf("give: Cannot give while dead or not in a single-player game.\n");
return;
@ -487,7 +487,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
break;
case GIVE_HEALTH:
ps[player].GetActor()->s.extra = gs.max_player_health << 1;
ps[player].GetActor()->s->extra = gs.max_player_health << 1;
break;
case GIVE_WEAPONS:

View file

@ -92,7 +92,7 @@ bool GameInterface::CanSave()
{
if (ud.recstat == 2 || gamestate != GS_LEVEL) return false;
auto &myplayer = ps[myconnectindex];
return (myplayer.GetActor()->s.extra > 0);
return (myplayer.GetActor()->s->extra > 0);
}
bool GameInterface::StartGame(FNewGameStartup& gs)

View file

@ -54,7 +54,7 @@ struct GameInterface : public ::GameInterface
const char* GenericCheat(int player, int cheat) override;
const char* CheckCheatMode() override;
void NextLevel(MapRecord* map, int skill) override;
void NewGame(MapRecord* map, int skill) override;
void NewGame(MapRecord* map, int skill, bool) override;
void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override;
int playerKeyMove() override { return 40; }

View file

@ -78,7 +78,7 @@ public:
while (index < MAXSPRITES)
{
auto p = &hittype[index++];
if (p->s.statnum != MAXSTATUS) return p;
if (p->s->statnum != MAXSTATUS) return p;
}
return nullptr;
}
@ -91,7 +91,7 @@ inline DDukeActor* player_struct::GetActor()
inline int player_struct::GetPlayerNum()
{
return GetActor()->s.yvel;
return GetActor()->s->yvel;
}
// Refactoring helpers/intermediates
@ -141,7 +141,7 @@ inline int ActorToScriptIndex(DDukeActor* a)
inline DDukeActor* ScriptIndexToActor(int index)
{
// only allow valid actors to get through here. Everything else gets null'ed.
if (index < 0 || index >= MAXSPRITES || hittype[index].s.statnum == MAXSTATUS) return nullptr;
if (index < 0 || index >= MAXSPRITES || hittype[index].s->statnum == MAXSTATUS) return nullptr;
return &hittype[index];
}
@ -156,22 +156,22 @@ inline DDukeActor* spawn(DDukeActor* spawner, int type)
inline int ldist(DDukeActor* s1, DDukeActor* s2)
{
return ldist(&s1->s, &s2->s);
return ldist(s1->s, s2->s);
}
inline int dist(DDukeActor* s1, DDukeActor* s2)
{
return dist(&s1->s, &s2->s);
return dist(s1->s, s2->s);
}
inline int badguy(DDukeActor* pSprite)
{
return badguypic(pSprite->s.picnum);
return badguypic(pSprite->s->picnum);
}
inline int bossguy(DDukeActor* pSprite)
{
return bossguypic(pSprite->s.picnum);
return bossguypic(pSprite->s->picnum);
}
// old interface versions of already changed functions

View file

@ -251,7 +251,7 @@ void drawoverlays(double smoothratio)
{
fi.displayweapon(screenpeek, smoothratio);
if (pp->over_shoulder_on == 0)
fi.displaymasks(screenpeek, pp->GetActor()->s.pal == 1 ? 1 : sector[pp->cursectnum].floorpal, smoothratio);
fi.displaymasks(screenpeek, pp->GetActor()->s->pal == 1 ? 1 : sector[pp->cursectnum].floorpal, smoothratio);
}
if (!isRR())
moveclouds(smoothratio);
@ -414,7 +414,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
DukeSectIterator it(i);
while (auto act = it.Next())
{
spr = &act->s;
spr = act->s;
if (act == pactor || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue;
@ -555,7 +555,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang,
for (p = connecthead; p >= 0; p = connectpoint2[p])
{
auto act = ps[p].GetActor();
auto pspr = &act->s;
auto pspr = act->s;
auto spos = pspr->interpolatedvec2(smoothratio);
daang = ((!SyncInput() ? pspr->ang : pspr->interpolatedang(smoothratio)) - cang) & 2047;

View file

@ -1033,7 +1033,7 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
if (lVar1 == g_iThisActorID)
{
// if they've asked for 'this', then use 'this'...
iSector = sActor->s.sectnum;
iSector = sActor->s->sectnum;
}
else
{
@ -1161,7 +1161,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
iActor = GetGameVarID(lVar1, sActor, sPlayer);
act = ScriptIndexToActor(iActor);
}
auto spr = &act->s;
auto spr = act->s;
if (iActor < 0 || iActor >= MAXSPRITES || spr->statnum == MAXSTATUS)
{
@ -1404,7 +1404,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
{
short sclip, angdif;
if (badguy(actor) && actor->s.xrepeat > 56)
if (badguy(actor) && actor->s->xrepeat > 56)
{
sclip = 3084;
angdif = 48;
@ -1423,21 +1423,21 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
}
if (j > sclip)
{
if (hit != nullptr && hit->s.picnum == actor->s.picnum)
if (hit != nullptr && hit->s->picnum == actor->s->picnum)
j = 0;
else
{
actor->s.ang += angdif; j = hitasprite(actor, &hit); actor->s.ang -= angdif;
actor->s->ang += angdif; j = hitasprite(actor, &hit); actor->s->ang -= angdif;
if (j > sclip)
{
if (hit != nullptr && hit->s.picnum == actor->s.picnum)
if (hit != nullptr && hit->s->picnum == actor->s->picnum)
j = 0;
else
{
actor->s.ang -= angdif; j = hitasprite(actor, &hit); actor->s.ang += angdif;
actor->s->ang -= angdif; j = hitasprite(actor, &hit); actor->s->ang += angdif;
if (j > 768)
{
if (hit != nullptr && hit->s.picnum == actor->s.picnum)
if (hit != nullptr && hit->s->picnum == actor->s->picnum)
j = 0;
else j = 1;
}
@ -1463,7 +1463,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
{
int j;
DDukeActor* tosee;
auto spr = &actor->s;
auto spr = actor->s;
// select sprite for monster to target
// if holoduke is on, let them target holoduke first.
@ -1471,7 +1471,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
if (ps[pnum].holoduke_on != nullptr && !isRR())
{
tosee = ps[pnum].holoduke_on;
j = cansee(spr->x, spr->y, spr->z - (krand() & ((32 << 8) - 1)), spr->sectnum, tosee->s.x, tosee->s.y, tosee->s.z, tosee->s.sectnum);
j = cansee(spr->x, spr->y, spr->z - (krand() & ((32 << 8) - 1)), spr->sectnum, tosee->s->x, tosee->s->y, tosee->s->z, tosee->s->sectnum);
if (j == 0)
{
@ -1483,7 +1483,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
else tosee = ps[pnum].GetActor(); // holoduke not on. look for player
// can they see player, (or player's holoduke)
j = cansee(spr->x, spr->y, spr->z - (krand() & ((47 << 8))), spr->sectnum, tosee->s.x, tosee->s.y, tosee->s.z - ((isRR()? 28 : 24) << 8), tosee->s.sectnum);
j = cansee(spr->x, spr->y, spr->z - (krand() & ((47 << 8))), spr->sectnum, tosee->s->x, tosee->s->y, tosee->s->z - ((isRR()? 28 : 24) << 8), tosee->s->sectnum);
if (j == 0)
{
@ -1495,8 +1495,8 @@ static bool ifcansee(DDukeActor* actor, int pnum)
{
// else, they did see it.
// save where we were looking..
actor->lastvx = tosee->s.x;
actor->lastvy = tosee->s.y;
actor->lastvx = tosee->s->x;
actor->lastvy = tosee->s->y;
}
if (j == 1 && (spr->statnum == STAT_ACTOR || spr->statnum == STAT_STANDABLE))
@ -1511,7 +1511,7 @@ static bool ifcansee(DDukeActor* actor, int pnum)
int ParseState::parse(void)
{
int j, l, s;
auto g_sp = g_ac? &g_ac->s : nullptr;
auto g_sp = g_ac? g_ac->s : nullptr;
if(killit_flag) return 1;
@ -1535,12 +1535,12 @@ int ParseState::parse(void)
parseifelse(ifcanshoottarget(g_ac, g_p, g_x));
break;
case concmd_ifcanseetarget:
j = cansee(g_sp->x, g_sp->y, g_sp->z - ((krand() & 41) << 8), g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->s.sectnum);
j = cansee(g_sp->x, g_sp->y, g_sp->z - ((krand() & 41) << 8), g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->s->sectnum);
parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME;
break;
case concmd_ifnocover:
j = cansee(g_sp->x, g_sp->y, g_sp->z, g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz, ps[g_p].GetActor()->s.sectnum);
j = cansee(g_sp->x, g_sp->y, g_sp->z, g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz, ps[g_p].GetActor()->s->sectnum);
parseifelse(j);
if (j) g_ac->timetosleep = SLEEPTIME;
break;
@ -1953,7 +1953,7 @@ int ParseState::parse(void)
case concmd_isdrunk: // todo: move out to player_r.
insptr++;
ps[g_p].drink_amt += *insptr;
j = ps[g_p].GetActor()->s.extra;
j = ps[g_p].GetActor()->s->extra;
if (j > 0)
j += *insptr;
if (j > gs.max_player_health * 2)
@ -1972,14 +1972,14 @@ int ParseState::parse(void)
ps[g_p].last_extra = j;
}
ps[g_p].GetActor()->s.extra = j;
ps[g_p].GetActor()->s->extra = j;
}
if (ps[g_p].drink_amt > 100)
ps[g_p].drink_amt = 100;
if (ps[g_p].GetActor()->s.extra >= gs.max_player_health)
if (ps[g_p].GetActor()->s->extra >= gs.max_player_health)
{
ps[g_p].GetActor()->s.extra = gs.max_player_health;
ps[g_p].GetActor()->s->extra = gs.max_player_health;
ps[g_p].last_extra = gs.max_player_health;
}
insptr++;
@ -1994,8 +1994,8 @@ int ParseState::parse(void)
break;
case concmd_larrybird:
insptr++;
ps[g_p].posz = sector[ps[g_p].GetActor()->s.sectnum].ceilingz;
ps[g_p].GetActor()->s.z = ps[g_p].posz;
ps[g_p].posz = sector[ps[g_p].GetActor()->s->sectnum].ceilingz;
ps[g_p].GetActor()->s->z = ps[g_p].posz;
break;
case concmd_destroyit:
insptr++;
@ -2011,7 +2011,7 @@ int ParseState::parse(void)
ps[g_p].drink_amt -= *insptr;
if (ps[g_p].drink_amt < 0)
ps[g_p].drink_amt = 0;
j = ps[g_p].GetActor()->s.extra;
j = ps[g_p].GetActor()->s->extra;
if (g_sp->picnum != TILE_ATOMICHEALTH)
{
if (j > gs.max_player_health && *insptr > 0)
@ -2048,7 +2048,7 @@ int ParseState::parse(void)
ps[g_p].last_extra = j;
}
ps[g_p].GetActor()->s.extra = j;
ps[g_p].GetActor()->s->extra = j;
}
insptr++;
@ -2069,12 +2069,12 @@ int ParseState::parse(void)
DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next())
{
if (j->s.picnum == TILE_CAMERA1)
j->s.yvel = 0;
if (j->s->picnum == TILE_CAMERA1)
j->s->yvel = 0;
}
}
j = ps[g_p].GetActor()->s.extra;
j = ps[g_p].GetActor()->s->extra;
if(g_sp->picnum != TILE_ATOMICHEALTH)
{
@ -2112,7 +2112,7 @@ int ParseState::parse(void)
ps[g_p].last_extra = j;
}
ps[g_p].GetActor()->s.extra = j;
ps[g_p].GetActor()->s->extra = j;
}
insptr++;
@ -2188,9 +2188,9 @@ int ParseState::parse(void)
dnum + s, g_sp->shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
if(weap)
l->s.yvel = gs.weaponsandammosprites[j%14];
else l->s.yvel = -1;
l->s.pal = g_sp->pal;
l->s->yvel = gs.weaponsandammosprites[j%14];
else l->s->yvel = -1;
l->s->pal = g_sp->pal;
}
insptr++;
}
@ -2423,7 +2423,7 @@ int ParseState::parse(void)
j = 1;
else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
j = 1;
else if( (l& pshrunk) && ps[g_p].GetActor()->s.xrepeat < (isRR() ? 8 : 32))
else if( (l& pshrunk) && ps[g_p].GetActor()->s->xrepeat < (isRR() ? 8 : 32))
j = 1;
else if( (l& pjetpack) && ps[g_p].jetpack_on )
j = 1;
@ -2431,9 +2431,9 @@ int ParseState::parse(void)
j = 1;
else if( (l& ponground) && ps[g_p].on_ground)
j = 1;
else if( (l& palive) && ps[g_p].GetActor()->s.xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->s.extra > 0 && ps[g_p].timebeforeexit == 0 )
else if( (l& palive) && ps[g_p].GetActor()->s->xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->s->extra > 0 && ps[g_p].timebeforeexit == 0 )
j = 1;
else if( (l& pdead) && ps[g_p].GetActor()->s.extra <= 0)
else if( (l& pdead) && ps[g_p].GetActor()->s->extra <= 0)
j = 1;
else if( (l& pfacing) )
{
@ -2509,7 +2509,7 @@ int ParseState::parse(void)
DDukeActor* a2;
while ((a2 = it.Next()))
{
auto sj = &a2->s;
auto sj = a2->s;
if (sj->picnum == ACTIVATOR)
break;
}
@ -2542,7 +2542,7 @@ int ParseState::parse(void)
case concmd_ifrespawn:
if( badguy(g_ac) )
parseifelse( ud.respawn_monsters );
else if( inventory(&g_ac->s) )
else if( inventory(g_ac->s) )
parseifelse( ud.respawn_inventory );
else
parseifelse( ud.respawn_items );
@ -2726,7 +2726,7 @@ int ParseState::parse(void)
}
case concmd_ifphealthl:
insptr++;
parseifelse( ps[g_p].GetActor()->s.extra < *insptr);
parseifelse( ps[g_p].GetActor()->s->extra < *insptr);
break;
case concmd_ifpinventory:
@ -2777,8 +2777,8 @@ int ParseState::parse(void)
}
case concmd_pstomp:
insptr++;
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->s.xrepeat >= (isRR()? 9: 40) )
if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),ps[g_p].GetActor()->s.sectnum) )
if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->s->xrepeat >= (isRR()? 9: 40) )
if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),ps[g_p].GetActor()->s->sectnum) )
{
ps[g_p].knee_incs = 1;
if(ps[g_p].weapon_pos == 0)
@ -2929,7 +2929,7 @@ int ParseState::parse(void)
DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next())
{
if (j->s.picnum == lType)
if (j->s->picnum == lType)
{
lTemp = ldist(g_ac, j);
if (lTemp < lMaxDist)
@ -2972,7 +2972,7 @@ int ParseState::parse(void)
DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next())
{
if (j->s.picnum == lType)
if (j->s->picnum == lType)
{
lTemp = ldist(g_ac, j);
if (lTemp < lMaxDist)
@ -3660,14 +3660,14 @@ void LoadActor(DDukeActor *actor, int p, int x)
s.g_ac = actor;
s.g_t = &s.g_ac->temp_data[0]; // Sprite's 'extra' data
auto addr = gs.tileinfo[actor->s.picnum].loadeventscriptptr;
auto addr = gs.tileinfo[actor->s->picnum].loadeventscriptptr;
if (addr == 0) return;
int *insptr = &ScriptCode[addr + 1];
s.killit_flag = 0;
if (actor->s.sectnum < 0 || actor->s.sectnum >= MAXSECTORS)
if (actor->s->sectnum < 0 || actor->s->sectnum >= MAXSECTORS)
{
deletesprite(actor);
return;
@ -3690,14 +3690,14 @@ void LoadActor(DDukeActor *actor, int p, int x)
{
fi.move(actor, p, x);
if (actor->s.statnum == STAT_ACTOR)
if (actor->s->statnum == STAT_ACTOR)
{
if (badguy(actor))
{
if (actor->s.xrepeat > 60) return;
if (ud.respawn_monsters == 1 && actor->s.extra <= 0) return;
if (actor->s->xrepeat > 60) return;
if (ud.respawn_monsters == 1 && actor->s->extra <= 0) return;
}
else if (ud.respawn_items == 1 && (actor->s.cstat & 32768)) return;
else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) return;
if (actor->timetosleep > 1)
actor->timetosleep--;
@ -3705,7 +3705,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
changespritestat(actor, STAT_ZOMBIEACTOR);
}
else if (actor->s.statnum == 6)
else if (actor->s->statnum == 6)
{
#if 0
switch (actor->s.picnum)
@ -3741,7 +3741,7 @@ void LoadActor(DDukeActor *actor, int p, int x)
void execute(DDukeActor *actor,int p,int x)
{
if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return;
if (gs.actorinfo[actor->s->picnum].scriptaddress == 0) return;
int done;
@ -3751,12 +3751,12 @@ void execute(DDukeActor *actor,int p,int x)
s.g_ac = actor;
s.g_t = &actor->temp_data[0]; // Sprite's 'extra' data
if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return;
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->s.picnum].scriptaddress)];
if (gs.actorinfo[actor->s->picnum].scriptaddress == 0) return;
s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->s->picnum].scriptaddress)];
s.killit_flag = 0;
if(actor->s.sectnum < 0 || actor->s.sectnum >= MAXSECTORS)
if(actor->s->sectnum < 0 || actor->s->sectnum >= MAXSECTORS)
{
if(badguy(actor))
ps[p].actors_killed++;
@ -3772,11 +3772,11 @@ void execute(DDukeActor *actor,int p,int x)
int increment = ptr[3];
int delay = ptr[4];
actor->s.lotag += TICSPERFRAME;
if (actor->s.lotag > delay)
actor->s->lotag += TICSPERFRAME;
if (actor->s->lotag > delay)
{
s.g_t[2]++;
actor->s.lotag = 0;
actor->s->lotag = 0;
s.g_t[3] += increment;
}
if (abs(s.g_t[3]) >= abs(numframes * increment))
@ -3798,14 +3798,14 @@ void execute(DDukeActor *actor,int p,int x)
{
fi.move(actor, p, x);
if (actor->s.statnum == STAT_ACTOR)
if (actor->s->statnum == STAT_ACTOR)
{
if (badguy(actor))
{
if (actor->s.xrepeat > 60) goto quit;
if (ud.respawn_monsters == 1 && actor->s.extra <= 0) goto quit;
if (actor->s->xrepeat > 60) goto quit;
if (ud.respawn_monsters == 1 && actor->s->extra <= 0) goto quit;
}
else if (ud.respawn_items == 1 && (actor->s.cstat & 32768)) goto quit;
else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) goto quit;
if (actor->timetosleep > 1)
actor->timetosleep--;
@ -3813,7 +3813,7 @@ void execute(DDukeActor *actor,int p,int x)
changespritestat(actor, STAT_ZOMBIEACTOR);
}
else if (actor->s.statnum == STAT_STANDABLE)
else if (actor->s->statnum == STAT_STANDABLE)
fi.checktimetosleep(actor);
}
quit:

View file

@ -183,7 +183,7 @@ void GameInterface::NextLevel(MapRecord* map, int skill)
//
//---------------------------------------------------------------------------
void GameInterface::NewGame(MapRecord* map, int skill)
void GameInterface::NewGame(MapRecord* map, int skill, bool)
{
// Hmm... What about the other players?
ps[0].last_extra = gs.max_player_health;

View file

@ -120,7 +120,7 @@ int animatefist(int gs, player_struct* p, double look_anghalf, double looking_ar
int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
{
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->s.extra <= 0) return 0;
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
@ -139,7 +139,7 @@ int animateknee(int gs, player_struct* p, double look_anghalf, double looking_ar
int animateknuckles(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
{
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->s.extra <= 0) return 0;
if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 };
@ -191,7 +191,7 @@ static int animatetip(int gs, player_struct* p, double look_anghalf, double look
int animateaccess(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
{
if(p->access_incs == 0 || p->GetActor()->s.extra <= 0) return 0;
if(p->access_incs == 0 || p->GetActor()->s->extra <= 0) return 0;
static const short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16};
@ -249,22 +249,22 @@ void displayweapon_d(int snum, double smoothratio)
looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio);
hard_landing *= 8.;
gun_pos -= fabs(p->GetActor()->s.xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= fabs(p->GetActor()->s->xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= hard_landing;
weapon_xoffset = (160)-90;
weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.);
weapon_xoffset -= 58 + p->weapon_ang;
shade = p->GetActor()->s.shade;
shade = p->GetActor()->s->shade;
if(shade > 24) shade = 24;
pal = p->GetActor()->s.pal == 1 ? 1 : sector[p->cursectnum].floorpal;
pal = p->GetActor()->s->pal == 1 ? 1 : sector[p->cursectnum].floorpal;
if (pal == 0)
pal = p->palookup;
auto adjusted_arc = looking_arc - hard_landing;
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0);
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0);
bool playerAnims = animatefist(shade, p, look_anghalf, looking_arc, plravel, pal) || animateknuckles(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) ||
animatetip(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) || animateaccess(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal);
@ -308,13 +308,13 @@ void displayweapon_d(int snum, double smoothratio)
}
}
if (p->GetActor()->s.xrepeat < 40)
if (p->GetActor()->s->xrepeat < 40)
{
static int fistsign;
//shrunken..
if (p->jetpack_on == 0)
{
i = p->GetActor()->s.xvel;
i = p->GetActor()->s->xvel;
looking_arc += 32 - (i >> 1);
fistsign += i >> 1;
}
@ -440,7 +440,7 @@ void displayweapon_d(int snum, double smoothratio)
gun_pos -= bsinf(kickback_pic * 128., -12);
}
if (*kb > 0 && p->GetActor()->s.pal != 1)
if (*kb > 0 && p->GetActor()->s->pal != 1)
{
weapon_xoffset += 1 - (rand() & 3);
}
@ -560,7 +560,7 @@ void displayweapon_d(int snum, double smoothratio)
if (*kb > 0)
gun_pos -= bsinf(kickback_pic * 128., -12);
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3);
if (*kb == 0)
{
@ -661,7 +661,7 @@ void displayweapon_d(int snum, double smoothratio)
if (*kb > 0)
gun_pos -= bsinf(kickback_pic * 128., -12);
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3);
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, CHAINGUN, shade, o, pal);
switch(*kb)
@ -673,9 +673,9 @@ void displayweapon_d(int snum, double smoothratio)
if (*kb > 4 && *kb < 12)
{
i = 0;
if (p->GetActor()->s.pal != 1) i = rand() & 7;
if (p->GetActor()->s->pal != 1) i = rand() & 7;
hud_drawpal(i + weapon_xoffset - 4 + 140 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal);
if (p->GetActor()->s.pal != 1) i = rand() & 7;
if (p->GetActor()->s->pal != 1) i = rand() & 7;
hud_drawpal(i + weapon_xoffset - 4 + 184 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal);
}
if (*kb < 8)
@ -922,7 +922,7 @@ void displayweapon_d(int snum, double smoothratio)
{
char cat_frames[] = { 0,0,1,1,2,2 };
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += rand() & 3;
looking_arc += rand() & 3;
@ -972,7 +972,7 @@ void displayweapon_d(int snum, double smoothratio)
else
{
// the 'active' display.
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += rand() & 3;
gun_pos += (rand() & 3);
@ -1044,7 +1044,7 @@ void displayweapon_d(int snum, double smoothratio)
}
else
{
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += rand() & 3;
gun_pos += (rand() & 3);
@ -1133,7 +1133,7 @@ void displayweapon_d(int snum, double smoothratio)
}
else
{
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += rand() & 3;
gun_pos += (rand() & 3);
@ -1177,7 +1177,7 @@ void displayweapon_d(int snum, double smoothratio)
else
{
static const uint8_t cat_frames[] = { 0, 0, 1, 1, 2, 2 };
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += krand() & 1;
looking_arc += krand() & 1;

View file

@ -137,7 +137,7 @@ void displayweapon_r(int snum, double smoothratio)
looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio);
hard_landing *= 8.;
gun_pos -= fabs(p->GetActor()->s.xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= fabs(p->GetActor()->s->xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10));
gun_pos -= hard_landing;
weapon_xoffset = (160)-90;
@ -147,12 +147,12 @@ void displayweapon_r(int snum, double smoothratio)
if (shadedsector[p->cursectnum] == 1)
shade = 16;
else
shade = p->GetActor()->s.shade;
shade = p->GetActor()->s->shade;
if(shade > 24) shade = 24;
pal = p->GetActor()->s.pal == 1 ? 1 : pal = sector[p->cursectnum].floorpal;
pal = p->GetActor()->s->pal == 1 ? 1 : pal = sector[p->cursectnum].floorpal;
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0))
return;
if(p->last_weapon >= 0)
@ -162,7 +162,7 @@ void displayweapon_r(int snum, double smoothratio)
j = 14-p->quick_kick;
if(j != 14)
{
if(p->GetActor()->s.pal == 1)
if(p->GetActor()->s->pal == 1)
pal = 1;
else
pal = p->palookup;
@ -289,12 +289,12 @@ void displayweapon_r(int snum, double smoothratio)
return;
}
if (p->GetActor()->s.xrepeat < 8)
if (p->GetActor()->s->xrepeat < 8)
{
static int fistsign;
if (p->jetpack_on == 0)
{
i = p->GetActor()->s.xvel;
i = p->GetActor()->s->xvel;
looking_arc += 32 - (i >> 1);
fistsign += i >> 1;
}
@ -599,7 +599,7 @@ void displayweapon_r(int snum, double smoothratio)
if (*kb > 0)
gun_pos -= bsinf((*kb) << 7, -12);
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3);
switch (*kb)
{
@ -812,7 +812,7 @@ void displayweapon_r(int snum, double smoothratio)
}
else
{
if (p->GetActor()->s.pal != 1)
if (p->GetActor()->s->pal != 1)
{
weapon_xoffset += rand() & 3;
gun_pos += (rand() & 3);

View file

@ -39,7 +39,7 @@ inline int bossguy(spritetype const* const pSprite)
inline int actorflag(DDukeActor * actor, int mask)
{
return (((gs.actorinfo[actor->s.picnum].flags) & mask) != 0);
return (((gs.actorinfo[actor->s->picnum].flags) & mask) != 0);
}
inline int actorfella(DDukeActor* actor)
@ -70,14 +70,14 @@ inline void settileflag(int flag, const std::initializer_list<short>& types)
inline bool wallswitchcheck(DDukeActor* s)
{
return !!(gs.tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH);
return !!(gs.tileinfo[s->s->picnum].flags & TFLAG_WALLSWITCH);
}
inline int checkcursectnums(int se)
{
int i;
for(i=connecthead;i>=0;i=connectpoint2[i])
if(ps[i].GetActor() && ps[i].GetActor()->s.sectnum == se ) return i;
if(ps[i].GetActor() && ps[i].GetActor()->s->sectnum == se ) return i;
return -1;
}

View file

@ -76,18 +76,18 @@ void hud_input(int plnum)
{
if (PlayerInput(plnum, SB_QUICK_KICK) && p->last_pissed_time == 0)
{
if (!isRRRA() || p->GetActor()->s.extra > 0)
if (!isRRRA() || p->GetActor()->s->extra > 0)
{
p->last_pissed_time = 4000;
S_PlayActorSound(437, pact);
if (p->GetActor()->s.extra <= gs.max_player_health - gs.max_player_health / 10)
if (p->GetActor()->s->extra <= gs.max_player_health - gs.max_player_health / 10)
{
p->GetActor()->s.extra += 2;
p->last_extra = p->GetActor()->s.extra;
p->GetActor()->s->extra += 2;
p->last_extra = p->GetActor()->s->extra;
p->resurrected = true;
}
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
else if (p->GetActor()->s->extra < gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
}
}
}
@ -115,7 +115,7 @@ void hud_input(int plnum)
// Don't go on if paused or dead.
if (paused) return;
if (p->GetActor()->s.extra <= 0) return;
if (p->GetActor()->s->extra <= 0) return;
// Activate an inventory item. This just forwards to the other inventory bits. If the inventory selector was taken out of the playsim this could be removed.
if (PlayerInput(plnum, SB_INVUSE) && p->newOwner == nullptr)
@ -289,8 +289,8 @@ void hud_input(int plnum)
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, nullptr, 10);
pactor->temp_data[3] = pactor->temp_data[4] = 0;
p->holoduke_on = pactor;
pactor->s.yvel = plnum;
pactor->s.extra = 0;
pactor->s->yvel = plnum;
pactor->s->extra = 0;
FTA(QUOTE_HOLODUKE_ON, p);
S_PlayActorSound(TELEPORTER, p->holoduke_on);
}
@ -306,12 +306,12 @@ void hud_input(int plnum)
}
else // In RR this means drinking whiskey.
{
if (p->holoduke_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
if (p->holoduke_amount > 0 && p->GetActor()->s->extra < gs.max_player_health)
{
p->holoduke_amount -= 400;
p->GetActor()->s.extra += 5;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->GetActor()->s->extra += 5;
if (p->GetActor()->s->extra > gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
p->drink_amt += 5;
p->inven_icon = 3;
@ -339,18 +339,18 @@ void hud_input(int plnum)
madenoise(plnum);
if (sector[p->cursectnum].lotag == 857)
{
if (p->GetActor()->s.extra <= gs.max_player_health)
if (p->GetActor()->s->extra <= gs.max_player_health)
{
p->GetActor()->s.extra += 10;
if (p->GetActor()->s.extra >= gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->GetActor()->s->extra += 10;
if (p->GetActor()->s->extra >= gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
}
}
else
{
if (p->GetActor()->s.extra + 1 <= gs.max_player_health)
if (p->GetActor()->s->extra + 1 <= gs.max_player_health)
{
p->GetActor()->s.extra++;
p->GetActor()->s->extra++;
}
}
}
@ -363,21 +363,21 @@ void hud_input(int plnum)
OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1);
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
{
if (p->firstaid_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
if (p->firstaid_amount > 0 && p->GetActor()->s->extra < gs.max_player_health)
{
if (!isRR())
{
int j = gs.max_player_health - p->GetActor()->s.extra;
int j = gs.max_player_health - p->GetActor()->s->extra;
if ((unsigned int)p->firstaid_amount > j)
{
p->firstaid_amount -= j;
p->GetActor()->s.extra = gs.max_player_health;
p->GetActor()->s->extra = gs.max_player_health;
p->inven_icon = 1;
}
else
{
p->GetActor()->s.extra += p->firstaid_amount;
p->GetActor()->s->extra += p->firstaid_amount;
p->firstaid_amount = 0;
checkavailinven(p);
}
@ -389,19 +389,19 @@ void hud_input(int plnum)
if (p->firstaid_amount > j)
{
p->firstaid_amount -= j;
p->GetActor()->s.extra += j;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
p->GetActor()->s->extra += j;
if (p->GetActor()->s->extra > gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
p->inven_icon = 1;
}
else
{
p->GetActor()->s.extra += p->firstaid_amount;
p->GetActor()->s->extra += p->firstaid_amount;
p->firstaid_amount = 0;
checkavailinven(p);
}
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
if (p->GetActor()->s->extra > gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
p->drink_amt += 10;
if (p->drink_amt <= 100 && !S_CheckActorSoundPlaying(pact, DUKE_USEMEDKIT))
S_PlayActorSound(DUKE_USEMEDKIT, pact);
@ -444,7 +444,7 @@ void hud_input(int plnum)
else
{
// eat cow pie
if (p->jetpack_amount > 0 && p->GetActor()->s.extra < gs.max_player_health)
if (p->jetpack_amount > 0 && p->GetActor()->s->extra < gs.max_player_health)
{
if (!S_CheckActorSoundPlaying(pact, 429))
S_PlayActorSound(429, pact);
@ -464,12 +464,12 @@ void hud_input(int plnum)
p->eat = 100;
}
p->GetActor()->s.extra += 5;
p->GetActor()->s->extra += 5;
p->inven_icon = 4;
if (p->GetActor()->s.extra > gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
if (p->GetActor()->s->extra > gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
if (p->jetpack_amount <= 0)
checkavailinven(p);
@ -755,7 +755,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
input.avel = boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust);
}
input.fvel = xs_CRoundToInt(p->MotoSpeed);
input.fvel = clamp(xs_CRoundToInt(p->MotoSpeed), -(MAXVELMOTO >> 3), MAXVELMOTO);
input.avel *= BAngToDegree;
loc.avel += input.avel;
}
@ -766,9 +766,9 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
//
//---------------------------------------------------------------------------
static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle)
static void FinalizeInput(player_struct *p, InputPacket& input)
{
if (movementBlocked(p) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god && !p->resurrected))
if (movementBlocked(p) || p->GetActor()->s->extra <= 0 || (p->dead_flag && !ud.god && !p->resurrected))
{
// neutralize all movement when blocked or in automap follow mode
loc.fvel = loc.svel = 0;
@ -777,14 +777,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle)
}
else
{
if (p->on_crane == nullptr)
{
if (vehicle)
{
loc.fvel = clamp(input.fvel, -(MAXVELMOTO >> 3), MAXVELMOTO);
}
}
else
if (p->on_crane != nullptr)
{
loc.fvel = input.fvel = 0;
loc.svel = input.svel = 0;
@ -833,11 +826,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt);
}
FinalizeInput(p, input, rrraVehicle);
FinalizeInput(p, input);
if (!SyncInput())
{
if (p->GetActor()->s.extra > 0)
if (p->GetActor()->s->extra > 0)
{
// Do these in the same order as the old code.
doslopetilting(p, scaleAdjust);
@ -848,7 +841,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
p->angle.processhelpers(scaleAdjust);
p->horizon.processhelpers(scaleAdjust);
p->GetActor()->s.ang = p->angle.ang.asbuild();
p->GetActor()->s->ang = p->angle.ang.asbuild();
}
if (packet)

View file

@ -45,7 +45,7 @@ int wakeup(DDukeActor* ac, int snum)
player_struct *p;
int radius;
p = &ps[snum];
auto spr = &ac->s;
auto spr = ac->s;
if (!p->donoise)
return 0;
if (spr->pal == 30 || spr->pal == 32 || spr->pal == 33 || (isRRRA() && spr->pal == 8))

View file

@ -67,8 +67,8 @@ void PlayerColorChanged(void)
{
pp.palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
}
if (pp.GetActor()->s.picnum == TILE_APLAYER && pp.GetActor()->s.pal != 1)
pp.GetActor()->s.pal = ud.user_pals[myconnectindex];
if (pp.GetActor()->s->picnum == TILE_APLAYER && pp.GetActor()->s->pal != 1)
pp.GetActor()->s->pal = ud.user_pals[myconnectindex];
}
//---------------------------------------------------------------------------
@ -100,8 +100,8 @@ void quickkill(struct player_struct* p)
SetPlayerPal(p, PalEntry(48, 48, 48, 48));
auto pa = p->GetActor();
pa->s.extra = 0;
pa->s.cstat |= 32768;
pa->s->extra = 0;
pa->s->cstat |= 32768;
if (ud.god == 0) fi.guts(pa, TILE_JIBS6, 8, myconnectindex);
return;
}
@ -167,7 +167,7 @@ void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
int hits(DDukeActor* actor)
{
auto sp = &actor->s;
auto sp = actor->s;
int sx, sy, sz;
short sect;
short hw;
@ -190,7 +190,7 @@ int hits(DDukeActor* actor)
int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
{
auto sp = &actor->s;
auto sp = actor->s;
int sx, sy, sz, zoff;
short sect, hw;
@ -240,7 +240,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR };
int dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist;
int xv, yv;
auto s = &actor->s;
auto s = actor->s;
a = s->ang;
@ -309,7 +309,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
DukeStatIterator it(aimstats[k]);
while (auto act = it.Next())
{
auto sp = &act->s;
auto sp = act->s;
if (sp->xrepeat > 0 && sp->extra >= 0 && (sp->cstat & (257 + 32768)) == 257)
if (badguy(sp) || k < 2)
{
@ -381,18 +381,18 @@ void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
fi.guts(p->actorsqu, TILE_JIBS6, 7, myconnectindex);
spawn(p->actorsqu, TILE_BLOODPOOL);
S_PlayActorSound(SQUISHED, p->actorsqu);
if (isIn(p->actorsqu->s.picnum, respawnlist))
if (isIn(p->actorsqu->s->picnum, respawnlist))
{
if (p->actorsqu->s.yvel)
fi.operaterespawns(p->actorsqu->s.yvel);
if (p->actorsqu->s->yvel)
fi.operaterespawns(p->actorsqu->s->yvel);
}
if (p->actorsqu->s.picnum == TILE_APLAYER)
if (p->actorsqu->s->picnum == TILE_APLAYER)
{
quickkill(&ps[p->actorsqu->s.yvel]);
ps[p->actorsqu->s.yvel].frag_ps = snum;
quickkill(&ps[p->actorsqu->s->yvel]);
ps[p->actorsqu->s->yvel].frag_ps = snum;
}
else if (badguy(&p->actorsqu->s))
else if (badguy(p->actorsqu->s))
{
deletesprite(p->actorsqu);
p->actors_killed++;
@ -415,7 +415,7 @@ int makepainsounds(int snum, int type)
{
auto p = &ps[snum];
auto actor = p->GetActor();
auto s = &actor->s;
auto s = actor->s;
int k = 0;
switch (type)
@ -489,7 +489,7 @@ void footprints(int snum)
{
auto p = &ps[snum];
auto actor = p->GetActor();
auto s = &actor->s;
auto s = actor->s;
auto psect = s->sectnum;
if (p->footprintcount > 0 && p->on_ground)
@ -499,9 +499,9 @@ void footprints(int snum)
DukeSectIterator it(psect);
while (auto act = it.Next())
{
if (act->s.picnum == TILE_FOOTPRINTS || act->s.picnum == TILE_FOOTPRINTS2 || act->s.picnum == TILE_FOOTPRINTS3 || act->s.picnum == TILE_FOOTPRINTS4)
if (abs(act->s.x - p->posx) < 384)
if (abs(act->s.y - p->posy) < 384)
if (act->s->picnum == TILE_FOOTPRINTS || act->s->picnum == TILE_FOOTPRINTS2 || act->s->picnum == TILE_FOOTPRINTS3 || act->s->picnum == TILE_FOOTPRINTS4)
if (abs(act->s->x - p->posx) < 384)
if (abs(act->s->y - p->posy) < 384)
{
j = 1;
break;
@ -520,8 +520,8 @@ void footprints(int snum)
case 2: fprint = spawn(actor, TILE_FOOTPRINTS3); break;
default: fprint = spawn(actor, TILE_FOOTPRINTS4); break;
}
fprint->s.pal = p->footprintpal;
fprint->s.shade = p->footprintshade;
fprint->s->pal = p->footprintpal;
fprint->s->shade = p->footprintshade;
}
}
}
@ -544,7 +544,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
{
auto p = &ps[snum];
auto actor = p->GetActor();
auto s = &actor->s;
auto s = actor->s;
if (p->dead_flag == 0)
{
@ -1002,7 +1002,7 @@ int haskey(int sect, int snum)
void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall;
@ -1037,7 +1037,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
DukeSectIterator it(wall[hitwall].nextsector);
while (auto act2 = it.Next())
{
if (act2->s.statnum == STAT_EFFECTOR && act2->s.lotag == SE_13_EXPLOSIVE)
if (act2->s->statnum == STAT_EFFECTOR && act2->s->lotag == SE_13_EXPLOSIVE)
return;
}
}
@ -1049,16 +1049,16 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
if (wall[hitwall].hitag == 0)
{
auto spawned = spawn(actor, atwith);
spawned->s.xvel = -12;
spawned->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
spawned->s.x = hitx;
spawned->s.y = hity;
spawned->s.z = hitz;
spawned->s.cstat |= (krand() & 4);
spawned->s->xvel = -12;
spawned->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
spawned->s->x = hitx;
spawned->s->y = hity;
spawned->s->z = hitz;
spawned->s->cstat |= (krand() & 4);
ssp(spawned, CLIPMASK0);
setsprite(spawned, spawned->s.pos);
setsprite(spawned, spawned->s->pos);
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
spawned->s.pal = 6;
spawned->s->pal = 6;
}
}
}

View file

@ -54,9 +54,9 @@ void incur_damage_d(struct player_struct* p)
{
int damage = 0L, shield_damage = 0L;
p->GetActor()->s.extra -= p->extra_extra8 >> 8;
p->GetActor()->s->extra -= p->extra_extra8 >> 8;
damage = p->GetActor()->s.extra - p->last_extra;
damage = p->GetActor()->s->extra - p->last_extra;
if (damage < 0)
{
@ -76,7 +76,7 @@ void incur_damage_d(struct player_struct* p)
}
}
p->GetActor()->s.extra = p->last_extra + damage;
p->GetActor()->s->extra = p->last_extra + damage;
}
}
@ -89,7 +89,7 @@ void incur_damage_d(struct player_struct* p)
static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int sa)
{
auto s = &actor->s;
auto s = actor->s;
int vel, zvel;
if (s->extra >= 0)
@ -127,7 +127,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int
}
auto spawned = EGS(s->sectnum, sx, sy, sz, FIREBALL, -127, sizx, sizy, sa, vel, zvel, actor, (short)4);
auto spr = &spawned->s;
auto spr = spawned->s;
spr->extra += (krand() & 7);
if (s->picnum == BOSS5 || p >= 0)
{
@ -147,7 +147,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int
static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
auto s = &actor->s;
auto s = actor->s;
int vel, zvel;
if (s->extra >= 0)
@ -182,10 +182,10 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
else
{
zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (ps[p].GetActor()->s.xvel != 0)
if (ps[p].GetActor()->s->xvel != 0)
vel = (int)((((512 - (1024
- abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024)))
* 0.001953125f) * ps[p].GetActor()->s.xvel) + 400);
* 0.001953125f) * ps[p].GetActor()->s->xvel) + 400);
if (sector[s->sectnum].lotag == 2 && (krand() % 5) == 0)
spawned = spawn(actor, WATERBUBBLE);
}
@ -193,30 +193,30 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
if (spawned == nullptr)
{
spawned = spawn(actor, FLAMETHROWERFLAME);
spawned->s.xvel = (short)vel;
spawned->s.zvel = (short)zvel;
spawned->s->xvel = (short)vel;
spawned->s->zvel = (short)zvel;
}
spawned->s.x = sx + bsin(sa + 630) / 448;
spawned->s.y = sy + bsin(sa + 112) / 448;
spawned->s.z = sz - 256;
spawned->s.sectnum = s->sectnum;
spawned->s.cstat = 0x80;
spawned->s.ang = sa;
spawned->s.xrepeat = 2;
spawned->s.yrepeat = 2;
spawned->s.clipdist = 40;
spawned->s.yvel = p;
spawned->s->x = sx + bsin(sa + 630) / 448;
spawned->s->y = sy + bsin(sa + 112) / 448;
spawned->s->z = sz - 256;
spawned->s->sectnum = s->sectnum;
spawned->s->cstat = 0x80;
spawned->s->ang = sa;
spawned->s->xrepeat = 2;
spawned->s->yrepeat = 2;
spawned->s->clipdist = 40;
spawned->s->yvel = p;
spawned->SetOwner(actor);
if (p == -1)
{
if (s->picnum == BOSS5)
{
spawned->s.x -= bsin(sa) / 56;
spawned->s.y += bcos(sa) / 56;
spawned->s.xrepeat = 10;
spawned->s.yrepeat = 10;
spawned->s->x -= bsin(sa) / 56;
spawned->s->y += bcos(sa) / 56;
spawned->s->xrepeat = 10;
spawned->s->yrepeat = 10;
}
}
}
@ -229,7 +229,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int
static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall;
@ -246,8 +246,8 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
int x;
auto pactor = ps[findplayer(actor, &x)].GetActor();
zvel = ((pactor->s.z - sz) << 8) / (x + 1);
sa = getangle(pactor->s.x - sx, pactor->s.y - sy);
zvel = ((pactor->s->z - sz) << 8) / (x + 1);
sa = getangle(pactor->s->x - sx, pactor->s->y - sy);
}
hitscan(sx, sy, sz, sect,
@ -263,18 +263,18 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
if (hitwall >= 0 || hitsprt)
{
auto knee = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4);
knee->s.extra += (krand() & 7);
knee->s->extra += (krand() & 7);
if (p >= 0)
{
auto k = spawn(knee, SMALLSMOKE);
k->s.z -= (8 << 8);
k->s->z -= (8 << 8);
S_PlayActorSound(KICK_HIT, knee);
}
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
knee->s.extra += (gs.max_player_health >> 2);
knee->s->extra += (gs.max_player_health >> 2);
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
if (hitsprt && hitsprt->s->picnum != ACCESSSWITCH && hitsprt->s->picnum != ACCESSSWITCH2)
{
fi.checkhitsprite(hitsprt, knee);
if (p >= 0) fi.checkhitswitch(p, -1, hitsprt);
@ -297,12 +297,12 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1)
{
auto splash = spawn(ps[p].GetActor(), WATERSPLASH2);
splash->s.x = hitx;
splash->s.y = hity;
splash->s.ang = ps[p].angle.ang.asbuild(); // Total tweek
splash->s.xvel = 32;
splash->s->x = hitx;
splash->s->y = hity;
splash->s->ang = ps[p].angle.ang.asbuild(); // Total tweek
splash->s->xvel = 32;
ssp(actor, CLIPMASK0);
splash->s.xvel = 0;
splash->s->xvel = 0;
}
}
@ -316,7 +316,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall;
@ -338,8 +338,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
switch (aimed->s.picnum)
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8);
switch (aimed->s->picnum)
{
case GREENSLIME:
case GREENSLIME + 1:
@ -353,8 +353,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
dal -= (8 << 8);
break;
}
zvel = ((aimed->s.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
zvel = ((aimed->s->z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
if (isWW2GI())
@ -419,8 +419,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (p >= 0)
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s.extra += (krand() % 6);
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s->extra += (krand() % 6);
if (hitwall == -1 && hitact == nullptr)
{
@ -428,8 +428,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
{
if (sector[hitsect].ceilingstat & 1)
{
spark->s.xrepeat = 0;
spark->s.yrepeat = 0;
spark->s->xrepeat = 0;
spark->s->yrepeat = 0;
return;
}
else
@ -441,26 +441,26 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
if (hitact)
{
fi.checkhitsprite(hitact, spark);
if (hitact->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
if (hitact->s->picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
{
auto jib = spawn(spark, JIBS6);
spark->s.xrepeat = spark->s.yrepeat = 0;
jib->s.z += (4 << 8);
jib->s.xvel = 16;
jib->s.xrepeat = jib->s.yrepeat = 24;
jib->s.ang += 64 - (krand() & 127);
spark->s->xrepeat = spark->s->yrepeat = 0;
jib->s->z += (4 << 8);
jib->s->xvel = 16;
jib->s->xrepeat = jib->s->yrepeat = 24;
jib->s->ang += 64 - (krand() & 127);
}
else spawn(spark, SMALLSMOKE);
if (p >= 0 && (
hitact->s.picnum == DIPSWITCH ||
hitact->s.picnum == DIPSWITCH + 1 ||
hitact->s.picnum == DIPSWITCH2 ||
hitact->s.picnum == DIPSWITCH2 + 1 ||
hitact->s.picnum == DIPSWITCH3 ||
hitact->s.picnum == DIPSWITCH3 + 1 ||
hitact->s.picnum == HANDSWITCH ||
hitact->s.picnum == HANDSWITCH + 1))
hitact->s->picnum == DIPSWITCH ||
hitact->s->picnum == DIPSWITCH + 1 ||
hitact->s->picnum == DIPSWITCH2 ||
hitact->s->picnum == DIPSWITCH2 + 1 ||
hitact->s->picnum == DIPSWITCH3 ||
hitact->s->picnum == DIPSWITCH3 + 1 ||
hitact->s->picnum == HANDSWITCH ||
hitact->s->picnum == HANDSWITCH + 1))
{
fi.checkhitswitch(p, -1, hitact);
return;
@ -500,7 +500,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
DukeSectIterator it(wall[hitwall].nextsector);
while (auto l = it.Next())
{
if (l->s.statnum == 3 && l->s.lotag == 13)
if (l->s->statnum == 3 && l->s->lotag == 13)
goto SKIPBULLETHOLE;
}
}
@ -508,13 +508,13 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
DukeStatIterator it(STAT_MISC);
while (auto l = it.Next())
{
if (l->s.picnum == BULLETHOLE)
if (l->s->picnum == BULLETHOLE)
if (dist(l, spark) < (12 + (krand() & 7)))
goto SKIPBULLETHOLE;
}
auto hole = spawn(spark, BULLETHOLE);
hole->s.xvel = -1;
hole->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
hole->s->xvel = -1;
hole->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
ssp(hole, CLIPMASK0);
}
@ -532,14 +532,14 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
else
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
if (hitact)
{
fi.checkhitsprite(hitact, spark);
if (hitact->s.picnum != TILE_APLAYER)
if (hitact->s->picnum != TILE_APLAYER)
spawn(spark, SMALLSMOKE);
else spark->s.xrepeat = spark->s.yrepeat = 0;
else spark->s->xrepeat = spark->s->yrepeat = 0;
}
else if (hitwall >= 0)
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
@ -560,7 +560,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa
static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
int sect = s->sectnum;
int vel, zvel;
short l, scount;
@ -590,9 +590,9 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8);
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
@ -638,23 +638,23 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
while (scount > 0)
{
auto spawned = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
spawned->s.extra += (krand() & 7);
spawned->s->extra += (krand() & 7);
if (atwith == COOLEXPLOSION1)
{
spawned->s.shade = 0;
spawned->s->shade = 0;
if (s->picnum == BOSS2)
{
l = spawned->s.xvel;
spawned->s.xvel = 1024;
l = spawned->s->xvel;
spawned->s->xvel = 1024;
ssp(spawned, CLIPMASK0);
spawned->s.xvel = l;
spawned->s.ang += 128 - (krand() & 255);
spawned->s->xvel = l;
spawned->s->ang += 128 - (krand() & 255);
}
}
spawned->s.cstat = 128;
spawned->s.clipdist = 4;
spawned->s->cstat = 128;
spawned->s->clipdist = 4;
sa = s->ang + 32 - (krand() & 63);
zvel = oldzvel + 512 - (krand() & 1023);
@ -671,7 +671,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int vel, zvel;
short l, scount;
@ -688,10 +688,10 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
aimed = aim(actor, 48);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (8 << 8);
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s->picnum != RECON)
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (atwith == RPG)
@ -707,7 +707,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
{
int zoffs = (32 << 8);
if (isWorldTour()) // Twentieth Anniversary World Tour
zoffs = (int)((actor->s.yrepeat / 80.0f) * zoffs);
zoffs = (int)((actor->s->yrepeat / 80.0f) * zoffs);
sz -= zoffs;
}
else if (s->picnum == BOSS2)
@ -715,7 +715,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
vel += 128;
int zoffs = 24 << 8;
if (isWorldTour()) // Twentieth Anniversary World Tour
zoffs = (int)((actor->s.yrepeat / 80.0f) * zoffs);
zoffs = (int)((actor->s->yrepeat / 80.0f) * zoffs);
sz += zoffs;
}
@ -732,7 +732,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
sy + (bsin(sa + 348) / 448),
sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, actor, 4);
auto spj = &spawned->s;
auto spj = spawned->s;
spj->extra += (krand() & 7);
if (atwith != FREEZEBLAST)
spawned->temp_actor = aimed;
@ -761,7 +761,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
if (isWorldTour()) // Twentieth Anniversary World Tour
{
float siz = actor->s.yrepeat / 80.0f;
float siz = actor->s->yrepeat / 80.0f;
xoffs *= siz;
yoffs *= siz;
aoffs *= siz;
@ -781,7 +781,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
int aoffs = 8 + (krand() & 255) - 128;
if (isWorldTour()) { // Twentieth Anniversary World Tour
int siz = actor->s.yrepeat;
int siz = actor->s->yrepeat;
xoffs = Scale(xoffs, siz, 80);
yoffs = Scale(yoffs, siz, 80);
aoffs = Scale(aoffs, siz, 80);
@ -842,7 +842,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i
static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall, j;
@ -884,7 +884,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
int lLifetime = GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, p);
int lLifetimeVar = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, p);
// set timer. blows up when at zero....
bomb->s.extra = lLifetime
bomb->s->extra = lLifetime
+ MulScale(krand(), lLifetimeVar, 14)
- lLifetimeVar;
}
@ -893,12 +893,12 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
// this originally used the sprite index as tag to link the laser segments.
// This value is never used again to reference an actor by index. Decouple this for robustness.
ud.bomb_tag = (ud.bomb_tag + 1) & 32767;
bomb->s.hitag = ud.bomb_tag;
bomb->s->hitag = ud.bomb_tag;
S_PlayActorSound(LASERTRIP_ONWALL, bomb);
bomb->s.xvel = -20;
bomb->s->xvel = -20;
ssp(bomb, CLIPMASK0);
bomb->s.cstat = 16;
bomb->temp_data[5] = bomb->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512;
bomb->s->cstat = 16;
bomb->temp_data[5] = bomb->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512;
if (p >= 0)
ps[p].ammo_amount[TRIPBOMB_WEAPON]--;
@ -913,7 +913,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall, k;
@ -925,8 +925,8 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
auto aimed = aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
switch (aimed->s.picnum)
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8);
switch (aimed->s->picnum)
{
case GREENSLIME:
case GREENSLIME + 1:
@ -940,8 +940,8 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
dal -= (8 << 8);
break;
}
zvel = ((aimed->s.z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
zvel = ((aimed->s->z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else
{
@ -974,9 +974,9 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
auto spark = EGS(sect, hitx, hity, hitz, GROWSPARK, -16, 28, 28, sa, 0, 0, actor, 1);
spark->s.pal = 2;
spark->s.cstat |= 130;
spark->s.xrepeat = spark->s.yrepeat = 1;
spark->s->pal = 2;
spark->s->cstat |= 130;
spark->s->xrepeat = spark->s->yrepeat = 1;
if (hitwall == -1 && hitsprt == nullptr && hitsect >= 0)
{
@ -998,7 +998,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
void shoot_d(DDukeActor* actor, int atwith)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
short sect, l, j;
int sx, sy, sz, sa, p, vel, zvel, x, dal;
@ -1065,13 +1065,13 @@ void shoot_d(DDukeActor* actor, int atwith)
case FIREFLY: // BOSS5 shot
{
auto k = spawn(actor, atwith);
k->s.sectnum = sect;
k->s.x = sx;
k->s.y = sy;
k->s.z = sz;
k->s.ang = sa;
k->s.xvel = 500;
k->s.zvel = 0;
k->s->sectnum = sect;
k->s->x = sx;
k->s->y = sy;
k->s->z = sz;
k->s->ang = sa;
k->s->xvel = 500;
k->s->zvel = 0;
return;
}
}
@ -1145,9 +1145,9 @@ void shoot_d(DDukeActor* actor, int atwith)
auto aimed = isNamWW2GI() ? nullptr : aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1);
zvel = ((aimed->s.z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1);
zvel = ((aimed->s->z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed));
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
}
@ -1164,8 +1164,8 @@ void shoot_d(DDukeActor* actor, int atwith)
sy + bcos(sa, -12),
sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, actor, 4);
j->s.cstat = 128;
j->s.clipdist = 32;
j->s->cstat = 128;
j->s->clipdist = 32;
return;
@ -1184,7 +1184,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
{
int i, j, k;
auto p = &ps[snum];
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s.xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0)
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s->xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0)
{
if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9)))
{
@ -1313,7 +1313,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{
p->gotweapon.Set(HANDBOMB_WEAPON);
j = HANDREMOTE_WEAPON;
@ -1435,7 +1435,7 @@ int doincrements_d(struct player_struct* p)
int snum;
auto pact = p->GetActor();
snum = pact->s.yvel;
snum = pact->s->yvel;
p->player_par++;
@ -1517,7 +1517,7 @@ int doincrements_d(struct player_struct* p)
}
}
if (p->quick_kick > 0 && p->GetActor()->s.pal != 1)
if (p->quick_kick > 0 && p->GetActor()->s->pal != 1)
{
p->last_quick_kick = p->quick_kick + 1;
p->quick_kick--;
@ -1527,17 +1527,17 @@ int doincrements_d(struct player_struct* p)
else if (p->last_quick_kick > 0)
p->last_quick_kick--;
if (p->access_incs && p->GetActor()->s.pal != 1)
if (p->access_incs && p->GetActor()->s->pal != 1)
{
p->access_incs++;
if (p->GetActor()->s.extra <= 0)
if (p->GetActor()->s->extra <= 0)
p->access_incs = 12;
if (p->access_incs == 12)
{
if (p->access_spritenum != nullptr)
{
fi.checkhitswitch(snum, -1, p->access_spritenum);
switch (p->access_spritenum->s.pal)
switch (p->access_spritenum->s->pal)
{
case 0:p->got_access &= (0xffff - 0x1); break;
case 21:p->got_access &= (0xffff - 0x2); break;
@ -1634,7 +1634,7 @@ void checkweapons_d(struct player_struct* p)
if (isWW2GI())
{
int snum = p->GetActor()->s.yvel;
int snum = p->GetActor()->s->yvel;
cw = aplWeaponWorksLike[p->curr_weapon][snum];
}
else
@ -1809,8 +1809,8 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
else if (p->falling_counter > 9)
{
j = p->falling_counter;
pact->s.extra -= j - (krand() & 3);
if (pact->s.extra <= 0)
pact->s->extra -= j - (krand() & 3);
if (pact->s->extra <= 0)
{
S_PlayActorSound(SQUISHED, pact);
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
@ -1987,11 +1987,11 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
if (p->scuba_on && (krand() & 255) < 8)
{
auto j = spawn(pact, WATERBUBBLE);
j->s.x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128), -6);
j->s.y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6);
j->s.xrepeat = 3;
j->s.yrepeat = 2;
j->s.z = p->posz + (8 << 8);
j->s->x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128), -6);
j->s->y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6);
j->s->xrepeat = 3;
j->s->yrepeat = 2;
j->s->z = p->posz + (8 << 8);
}
}
@ -2028,7 +2028,7 @@ int operateTripbomb(int snum)
DukeSectIterator it(sect);
while (j = it.Next())
{
auto sj = &j->s;
auto sj = j->s;
if (sj->picnum == TRIPBOMB &&
abs(sj->z - sz) < (12 << 8) && ((sj->x - sx) * (sj->x - sx) + (sj->y - sy) * (sj->y - sy)) < (290 * 290))
return 0;
@ -2210,21 +2210,21 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (isNam())
{
spawned->s.extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14);
spawned->s->extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14);
}
if (k == 15)
{
spawned->s.yvel = 3;
spawned->s.z += (8 << 8);
spawned->s->yvel = 3;
spawned->s->z += (8 << 8);
}
k = hits(pact);
if (k < 512)
{
spawned->s.ang += 1024;
spawned->s.zvel /= 3;
spawned->s.xvel /= 3;
spawned->s->ang += 1024;
spawned->s->zvel /= 3;
spawned->s->xvel /= 3;
}
p->hbomb_on = 1;
@ -2348,9 +2348,9 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
case 24:
{
auto j = spawn(pact, SHOTGUNSHELL);
j->s.ang += 1024;
j->s->ang += 1024;
ssp(j, CLIPMASK0);
j->s.ang += 1024;
j->s->ang += 1024;
p->kickback_pic++;
break;
}
@ -2374,10 +2374,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{
auto j = spawn(pact, SHELL);
j->s.ang += 1024;
j->s.ang &= 2047;
j->s.xvel += 32;
j->s.z += (3 << 8);
j->s->ang += 1024;
j->s->ang &= 2047;
j->s->xvel += 32;
j->s->z += (3 << 8);
ssp(j, CLIPMASK0);
}
@ -2527,7 +2527,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
fi.shoot(pact, FREEZEBLAST);
checkavailweapon(p);
}
if (pact->s.xrepeat < 32)
if (pact->s->xrepeat < 32)
{
p->okickback_pic = p->kickback_pic = 0; break;
}
@ -2627,7 +2627,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
auto pact = p->GetActor();
auto s = &pact->s;
auto s = pact->s;
int shrunk = (s->yrepeat < 32);
// Set maximum for pistol slightly higher if playing with `cl_showmagamount 1`.
@ -2736,7 +2736,7 @@ void processinput_d(int snum)
p = &ps[snum];
auto pact = p->GetActor();
s = &pact->s;
s = pact->s;
p->horizon.resetadjustment();
p->angle.resetadjustment();
@ -2784,7 +2784,7 @@ void processinput_d(int snum)
if (chz.type == kHitSprite)
{
if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0)
if (chz.actor->s->statnum == 1 && chz.actor->s->extra >= 0)
{
chz.type = kHitNone;
chz.actor = nullptr;
@ -2794,15 +2794,15 @@ void processinput_d(int snum)
if (clz.type == kHitSprite)
{
if ((clz.actor->s.cstat & 33) == 33)
if ((clz.actor->s->cstat & 33) == 33)
{
psectlotag = 0;
p->footprintcount = 0;
p->spritebridge = 1;
}
else if (badguy(clz.actor) && clz.actor->s.xrepeat > 24 && abs(s->z - clz.actor->s.z) < (84 << 8))
else if (badguy(clz.actor) && clz.actor->s->xrepeat > 24 && abs(s->z - clz.actor->s->z) < (84 << 8))
{
j = getangle(clz.actor->s.x - p->posx, clz.actor->s.y - p->posy);
j = getangle(clz.actor->s->x - p->posx, clz.actor->s->y - p->posy);
p->posxv -= bcos(j, 4);
p->posyv -= bsin(j, 4);
}
@ -2869,7 +2869,7 @@ void processinput_d(int snum)
p->playerweaponsway(s->xvel);
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
@ -2963,7 +2963,7 @@ void processinput_d(int snum)
case 0:
if (clz.type == kHitSprite)
j = clz.actor->s.picnum;
j = clz.actor->s->picnum;
else
j = sector[psect].floorpicnum;
@ -3079,7 +3079,7 @@ HORIZONLY:
if (ud.clipping == 0 && sector[psect].lotag == 31)
{
auto secact = ScriptIndexToActor(sector[psect].hitag);
if (secact && secact->s.xvel && secact->temp_data[0] == 0)
if (secact && secact->s->xvel && secact->temp_data[0] == 0)
{
quickkill(p);
return;

View file

@ -46,9 +46,9 @@ void incur_damage_r(struct player_struct* p)
int damage = 0, unk = 0, shield_damage = 0;
short gut = 0;
p->GetActor()->s.extra -= p->extra_extra8 >> 8;
p->GetActor()->s->extra -= p->extra_extra8 >> 8;
damage = p->GetActor()->s.extra - p->last_extra;
damage = p->GetActor()->s->extra - p->last_extra;
if (damage < 0)
{
p->extra_extra8 = 0;
@ -78,7 +78,7 @@ void incur_damage_r(struct player_struct* p)
break;
}
p->GetActor()->s.extra = p->last_extra + damage;
p->GetActor()->s->extra = p->last_extra + damage;
}
}
@ -90,7 +90,7 @@ void incur_damage_r(struct player_struct* p)
static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall;
@ -107,8 +107,8 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
{
int x;
auto pspr = ps[findplayer(actor, &x)].GetActor();
zvel = ((pspr->s.z - sz) << 8) / (x + 1);
sa = getangle(pspr->s.x - sx, pspr->s.y - sy);
zvel = ((pspr->s->z - sz) << 8) / (x + 1);
sa = getangle(pspr->s->x - sx, pspr->s->y - sy);
}
hitscan(sx, sy, sz, sect,
@ -123,21 +123,21 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
while (auto effector = its.Next())
{
// shouldn't this only check STAT_EFFECTOR?
if (effector->s.sectnum == hitsect && effector->s.picnum == SECTOREFFECTOR && effector->GetOwner()
&& effector->s.lotag == 7)
if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner()
&& effector->s->lotag == 7)
{
int nx, ny, nz;
nx = hitx + (effector->GetOwner()->s.x - effector->s.x);
ny = hity + (effector->GetOwner()->s.y - effector->s.y);
nx = hitx + (effector->GetOwner()->s->x - effector->s->x);
ny = hity + (effector->GetOwner()->s->y - effector->s->y);
if (sector[hitsect].lotag == 161)
{
nz = sector[effector->GetOwner()->s.sectnum].floorz;
nz = sector[effector->GetOwner()->s->sectnum].floorz;
}
else
{
nz = sector[effector->GetOwner()->s.sectnum].ceilingz;
nz = sector[effector->GetOwner()->s->sectnum].ceilingz;
}
hitscan(nx, ny, nz, effector->GetOwner()->s.sectnum, bcos(sa), bsin(sa), zvel << 6,
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
break;
}
@ -154,25 +154,25 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
if (isRRRA() && atwith == SLINGBLADE)
{
wpn = EGS(hitsect, hitx, hity, hitz, SLINGBLADE, -15, 0, 0, sa, 32, 0, actor, 4);
wpn->s.extra += 50;
wpn->s->extra += 50;
}
else
{
wpn = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4);
wpn->s.extra += (krand() & 7);
wpn->s->extra += (krand() & 7);
}
if (p >= 0)
{
auto k = spawn(wpn, SMALLSMOKE);
k->s.z -= (8 << 8);
k->s->z -= (8 << 8);
if (atwith == KNEE) S_PlayActorSound(KICK_HIT, wpn);
else if (isRRRA() && atwith == SLINGBLADE) S_PlayActorSound(260, wpn);
}
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
wpn->s.extra += (gs.max_player_health >> 2);
wpn->s->extra += (gs.max_player_health >> 2);
if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2)
if (hitsprt && hitsprt->s->picnum != ACCESSSWITCH && hitsprt->s->picnum != ACCESSSWITCH2)
{
fi.checkhitsprite(hitsprt, wpn);
if (p >= 0) fi.checkhitswitch(p, -1, hitsprt);
@ -194,12 +194,12 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1)
{
auto splash = spawn(ps[p].GetActor(), WATERSPLASH2);
splash->s.x = hitx;
splash->s.y = hity;
splash->s.ang = ps[p].angle.ang.asbuild(); // Total tweek
splash->s.xvel = 32;
splash->s->x = hitx;
splash->s->y = hity;
splash->s->ang = ps[p].angle.ang.asbuild(); // Total tweek
splash->s->xvel = 32;
ssp(actor, 0);
splash->s.xvel = 0;
splash->s->xvel = 0;
}
}
}
@ -212,7 +212,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa,
static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int zvel;
short hitsect, hitwall;
@ -226,9 +226,9 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
auto aimed = aim(actor, AUTO_AIM_ANGLE);
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8);
zvel = ((aimed->s.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8);
zvel = ((aimed->s->z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
if (atwith == SHOTSPARK1)
@ -280,21 +280,21 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
while (auto effector = its.Next())
{
// shouldn't this only check STAT_EFFECTOR?
if (effector->s.sectnum == hitsect && effector->s.picnum == SECTOREFFECTOR && effector->GetOwner()
&& effector->s.lotag == 7)
if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner()
&& effector->s->lotag == 7)
{
int nx, ny, nz;
nx = hitx + (effector->GetOwner()->s.x - effector->s.x);
ny = hity + (effector->GetOwner()->s.y - effector->s.y);
nx = hitx + (effector->GetOwner()->s->x - effector->s->x);
ny = hity + (effector->GetOwner()->s->y - effector->s->y);
if (sector[hitsect].lotag == 161)
{
nz = sector[effector->GetOwner()->s.sectnum].floorz;
nz = sector[effector->GetOwner()->s->sectnum].floorz;
}
else
{
nz = sector[effector->GetOwner()->s.sectnum].ceilingz;
nz = sector[effector->GetOwner()->s->sectnum].ceilingz;
}
hitscan(nx, ny, nz, effector->GetOwner()->s.sectnum, bcos(sa), bsin(sa), zvel << 6,
hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6,
&hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
break;
}
@ -317,8 +317,8 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (p >= 0)
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s.extra += (krand() % 6);
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s->extra += (krand() % 6);
if (hitwall == -1 && hitsprt == nullptr)
{
@ -326,8 +326,8 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
{
if (sector[hitsect].ceilingstat & 1)
{
spark->s.xrepeat = 0;
spark->s.yrepeat = 0;
spark->s->xrepeat = 0;
spark->s->yrepeat = 0;
return;
}
else
@ -339,30 +339,30 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
if (hitsprt)
{
if (hitsprt->s.picnum == 1930)
if (hitsprt->s->picnum == 1930)
return;
fi.checkhitsprite(hitsprt, spark);
if (hitsprt->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
if (hitsprt->s->picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
{
auto l = spawn(spark, JIBS6);
spark->s.xrepeat = spark->s.yrepeat = 0;
l->s.z += (4 << 8);
l->s.xvel = 16;
l->s.xrepeat = l->s.yrepeat = 24;
l->s.ang += 64 - (krand() & 127);
spark->s->xrepeat = spark->s->yrepeat = 0;
l->s->z += (4 << 8);
l->s->xvel = 16;
l->s->xrepeat = l->s->yrepeat = 24;
l->s->ang += 64 - (krand() & 127);
}
else spawn(spark, SMALLSMOKE);
if (p >= 0 && (
hitsprt->s.picnum == DIPSWITCH ||
hitsprt->s.picnum == DIPSWITCH + 1 ||
hitsprt->s.picnum == DIPSWITCH2 ||
hitsprt->s.picnum == DIPSWITCH2 + 1 ||
hitsprt->s.picnum == DIPSWITCH3 ||
hitsprt->s.picnum == DIPSWITCH3 + 1 ||
(isRRRA() && hitsprt->s.picnum == RRTILE8660) ||
hitsprt->s.picnum == HANDSWITCH ||
hitsprt->s.picnum == HANDSWITCH + 1))
hitsprt->s->picnum == DIPSWITCH ||
hitsprt->s->picnum == DIPSWITCH + 1 ||
hitsprt->s->picnum == DIPSWITCH2 ||
hitsprt->s->picnum == DIPSWITCH2 + 1 ||
hitsprt->s->picnum == DIPSWITCH3 ||
hitsprt->s->picnum == DIPSWITCH3 + 1 ||
(isRRRA() && hitsprt->s->picnum == RRTILE8660) ||
hitsprt->s->picnum == HANDSWITCH ||
hitsprt->s->picnum == HANDSWITCH + 1))
{
fi.checkhitswitch(p, -1, hitsprt);
return;
@ -405,7 +405,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
DukeSectIterator it(wall[hitwall].nextsector);
while (auto l = it.Next())
{
if (l->s.statnum == 3 && l->s.lotag == 13)
if (l->s->statnum == 3 && l->s->lotag == 13)
goto SKIPBULLETHOLE;
}
}
@ -413,13 +413,13 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
DukeStatIterator it(STAT_MISC);
while (auto l = it.Next())
{
if (l->s.picnum == BULLETHOLE)
if (l->s->picnum == BULLETHOLE)
if (dist(l, spark) < (12 + (krand() & 7)))
goto SKIPBULLETHOLE;
}
auto l = spawn(spark, BULLETHOLE);
l->s.xvel = -1;
l->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
l->s->xvel = -1;
l->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
ssp(l, CLIPMASK0);
}
@ -437,14 +437,14 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
else
{
spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4);
spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress];
if (hitsprt)
{
fi.checkhitsprite(hitsprt, spark);
if (hitsprt->s.picnum != TILE_APLAYER)
if (hitsprt->s->picnum != TILE_APLAYER)
spawn(spark, SMALLSMOKE);
else spark->s.xrepeat = spark->s.yrepeat = 0;
else spark->s->xrepeat = spark->s->yrepeat = 0;
}
else if (hitwall >= 0)
fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1);
@ -465,7 +465,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa
static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int vel, zvel;
short scount;
@ -515,9 +515,9 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8);
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else
{
@ -580,17 +580,17 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
while (scount > 0)
{
auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
j->s.extra += (krand() & 7);
j->s.cstat = 128;
j->s.clipdist = 4;
j->s->extra += (krand() & 7);
j->s->cstat = 128;
j->s->clipdist = 4;
sa = s->ang + 32 - (krand() & 63);
zvel = oldzvel + 512 - (krand() & 1023);
if (atwith == FIRELASER)
{
j->s.xrepeat = 8;
j->s.yrepeat = 8;
j->s->xrepeat = 8;
j->s->yrepeat = 8;
}
scount--;
@ -605,7 +605,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int vel, zvel;
short l, scount;
@ -625,15 +625,15 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
{
if (isRRRA() && atwith == RPG2)
{
if (aimed->s.picnum == HEN || aimed->s.picnum == HENSTAYPUT)
if (aimed->s->picnum == HEN || aimed->s->picnum == HENSTAYPUT)
act90 = ps[screenpeek].GetActor();
else
act90 = aimed;
}
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s.picnum != RECON)
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (8 << 8);
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
if (aimed->s->picnum != RECON)
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16);
if (atwith == RPG)
@ -684,67 +684,67 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
{
if (atwith == RRTILE1790)
{
spawned->s.extra = 10;
spawned->s.zvel = -(10 << 8);
spawned->s->extra = 10;
spawned->s->zvel = -(10 << 8);
}
else if (atwith == RPG2)
{
spawned->seek_actor = act90;
spawned->s.hitag = 0;
spawned->s->hitag = 0;
fi.lotsofmoney(spawned, (krand() & 3) + 1);
}
}
spawned->s.extra += (krand() & 7);
spawned->s->extra += (krand() & 7);
if (atwith != FREEZEBLAST)
spawned->temp_actor = aimed;
else
{
spawned->s.yvel = gs.numfreezebounces;
spawned->s.xrepeat >>= 1;
spawned->s.yrepeat >>= 1;
spawned->s.zvel -= (2 << 4);
spawned->s->yvel = gs.numfreezebounces;
spawned->s->xrepeat >>= 1;
spawned->s->yrepeat >>= 1;
spawned->s->zvel -= (2 << 4);
}
if (p == -1)
{
if (s->picnum == HULK)
{
spawned->s.xrepeat = 8;
spawned->s.yrepeat = 8;
spawned->s->xrepeat = 8;
spawned->s->yrepeat = 8;
}
else if (atwith != FREEZEBLAST)
{
spawned->s.xrepeat = 30;
spawned->s.yrepeat = 30;
spawned->s.extra >>= 2;
spawned->s->xrepeat = 30;
spawned->s->yrepeat = 30;
spawned->s->extra >>= 2;
}
}
else if (ps[p].curr_weapon == TIT_WEAPON)
{
spawned->s.extra >>= 2;
spawned->s.ang += 16 - (krand() & 31);
spawned->s.zvel += 256 - (krand() & 511);
spawned->s->extra >>= 2;
spawned->s->ang += 16 - (krand() & 31);
spawned->s->zvel += 256 - (krand() & 511);
if (ps[p].hbomb_hold_delay)
{
spawned->s.x -= bsin(sa) / 644;
spawned->s.y += bcos(sa) / 644;
spawned->s->x -= bsin(sa) / 644;
spawned->s->y += bcos(sa) / 644;
}
else
{
spawned->s.x += bsin(sa, -8);
spawned->s.y -= bcos(sa, -8);
spawned->s->x += bsin(sa, -8);
spawned->s->y -= bcos(sa, -8);
}
spawned->s.xrepeat >>= 1;
spawned->s.yrepeat >>= 1;
spawned->s->xrepeat >>= 1;
spawned->s->yrepeat >>= 1;
}
spawned->s.cstat = 128;
spawned->s->cstat = 128;
if (atwith == RPG || (atwith == RPG2 && isRRRA()))
spawned->s.clipdist = 4;
spawned->s->clipdist = 4;
else
spawned->s.clipdist = 40;
spawned->s->clipdist = 40;
}
@ -757,7 +757,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i
static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith)
{
auto s = &actor->s;
auto s = actor->s;
int sect = s->sectnum;
int vel, zvel;
short scount;
@ -784,9 +784,9 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
if (aimed)
{
int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8);
zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s.x - sx, aimed->s.y - sy);
int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8);
zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed);
sa = getangle(aimed->s->x - sx, aimed->s->y - sy);
}
else
zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16);
@ -813,9 +813,9 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
while (scount > 0)
{
auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4);
j->s.extra += (krand() & 7);
j->s.cstat = 128;
j->s.clipdist = 4;
j->s->extra += (krand() & 7);
j->s->cstat = 128;
j->s->clipdist = 4;
sa = s->ang + 32 - (krand() & 63);
zvel = oldzvel + 512 - (krand() & 1023);
@ -832,7 +832,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa,
void shoot_r(DDukeActor* actor, int atwith)
{
spritetype* const s = &actor->s;
spritetype* const s = actor->s;
short sect, sa, p;
int sx, sy, sz, vel, zvel, x;
@ -900,17 +900,17 @@ void shoot_r(DDukeActor* actor, int atwith)
case TRIPBOMBSPRITE:
{
auto j = spawn(actor, atwith);
j->s.xvel = 32;
j->s.ang = s->ang;
j->s.z -= (5 << 8);
j->s->xvel = 32;
j->s->ang = s->ang;
j->s->z -= (5 << 8);
break;
}
case BOWLINGBALL:
{
auto j = spawn(actor, atwith);
j->s.xvel = 250;
j->s.ang = s->ang;
j->s.z -= (15 << 8);
j->s->xvel = 250;
j->s->ang = s->ang;
j->s->z -= (15 << 8);
break;
}
case OWHIP:
@ -978,7 +978,7 @@ void selectweapon_r(int snum, int weap)
{
int i, j, k;
auto p = &ps[snum];
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s.xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0)
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s->xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0)
{
if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9)))
{
@ -1085,7 +1085,7 @@ void selectweapon_r(int snum, int weap)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor())
{
p->gotweapon.Set(DYNAMITE_WEAPON);
j = THROWINGDYNAMITE_WEAPON;
@ -1250,7 +1250,7 @@ int doincrements_r(struct player_struct* p)
{
BellTime--;
if (BellTime == 0 && BellSprite)
BellSprite->s.picnum++;
BellSprite->s->picnum++;
}
if (chickenphase > 0)
chickenphase--;
@ -1262,7 +1262,7 @@ int doincrements_r(struct player_struct* p)
}
}
snum = p->GetActor()->s.yvel;
snum = p->GetActor()->s->yvel;
p->player_par++;
if (p->yehaa_timer)
@ -1389,17 +1389,17 @@ int doincrements_r(struct player_struct* p)
S_PlayActorSound(DUKE_TAKEPILLS, pact);
}
if (p->access_incs && p->GetActor()->s.pal != 1)
if (p->access_incs && p->GetActor()->s->pal != 1)
{
p->access_incs++;
if (p->GetActor()->s.extra <= 0)
if (p->GetActor()->s->extra <= 0)
p->access_incs = 12;
if (p->access_incs == 12)
{
if (p->access_spritenum != nullptr)
{
fi.checkhitswitch(snum, -1, p->access_spritenum);
switch (p->access_spritenum->s.pal)
switch (p->access_spritenum->s->pal)
{
case 0:p->keys[1] = 1; break;
case 21:p->keys[2] = 1; break;
@ -1519,7 +1519,7 @@ void checkweapons_r(struct player_struct* p)
if (p->OnMotorcycle && numplayers > 1)
{
auto j = spawn(p->GetActor(), 7220);
j->s.ang = p->angle.ang.asbuild();
j->s->ang = p->angle.ang.asbuild();
j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON);
@ -1535,7 +1535,7 @@ void checkweapons_r(struct player_struct* p)
else if (p->OnBoat && numplayers > 1)
{
auto j = spawn(p->GetActor(), 7233);
j->s.ang = p->angle.ang.asbuild();
j->s->ang = p->angle.ang.asbuild();
j->saved_ammo = p->ammo_amount[BOAT_WEAPON];
p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON);
@ -1573,16 +1573,16 @@ void checkweapons_r(struct player_struct* p)
switch (i)
{
case 1:
j->s.lotag = 100;
j->s->lotag = 100;
break;
case 2:
j->s.lotag = 101;
j->s->lotag = 101;
break;
case 3:
j->s.lotag = 102;
j->s->lotag = 102;
break;
case 4:
j->s.lotag = 103;
j->s->lotag = 103;
break;
}
}
@ -2073,7 +2073,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
{
auto p = &ps[snum];
auto pact = p->GetActor();
auto s = &pact->s;
auto s = pact->s;
if (p->airleft != 15 * 26)
p->airleft = 15 * 26; //Aprox twenty seconds.
@ -2358,12 +2358,12 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
if (p->scuba_on && (krand() & 255) < 8)
{
auto j = spawn(pact, WATERBUBBLE);
j->s.x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
j->s.y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
j->s.xrepeat = 3;
j->s.yrepeat = 2;
j->s.z = p->posz + (8 << 8);
j->s.cstat = 514;
j->s->x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
j->s->y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6);
j->s->xrepeat = 3;
j->s->yrepeat = 2;
j->s->z = p->posz + (8 << 8);
j->s->cstat = 514;
}
}
@ -2377,7 +2377,7 @@ void onMotorcycleMove(int snum, int psect, int j)
{
auto p = &ps[snum];
auto pact = p->GetActor();
auto s = &pact->s;
auto s = pact->s;
int psectlotag = sector[psect].lotag;
short angleDelta = abs(p->angle.ang.asbuild() - getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y));
short damageAmount;
@ -2474,7 +2474,7 @@ void onBoatMove(int snum, int psect, int j)
void onMotorcycleHit(int snum, DDukeActor* victim)
{
auto p = &ps[snum];
auto s = &victim->s;
auto s = victim->s;
if (badguy(s) || s->picnum == APLAYER)
{
if (s->picnum != APLAYER)
@ -2504,7 +2504,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim)
DukeSpriteIterator it;
while (auto act2 = it.Next())
{
auto sprj = &act2->s;
auto sprj = act2->s;
if ((sprj->picnum == RRTILE2431 || sprj->picnum == RRTILE2451) && sprj->pal == 4)
{
if (s->lotag == sprj->lotag)
@ -2535,7 +2535,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim)
void onBoatHit(int snum, DDukeActor* victim)
{
auto p = &ps[snum];
auto s = &victim->s;
auto s = victim->s;
if (badguy(s) || s->picnum == APLAYER)
{
@ -2765,16 +2765,16 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (k == 15)
{
spawned->s.yvel = 3;
spawned->s.z += (8 << 8);
spawned->s->yvel = 3;
spawned->s->z += (8 << 8);
}
k = hits(p->GetActor());
if (k < 512)
{
spawned->s.ang += 1024;
spawned->s.zvel /= 3;
spawned->s.xvel /= 3;
spawned->s->ang += 1024;
spawned->s->zvel /= 3;
spawned->s->xvel /= 3;
}
p->hbomb_on = 1;
@ -2985,10 +2985,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
{
auto j = spawn(pact, SHELL);
j->s.ang += 1024;
j->s.ang &= 2047;
j->s.xvel += 32;
j->s.z += (3 << 8);
j->s->ang += 1024;
j->s->ang &= 2047;
j->s->xvel += 32;
j->s->z += (3 << 8);
ssp(j, CLIPMASK0);
}
@ -3291,7 +3291,7 @@ static void processweapon(int snum, ESyncBits actions, int psect)
{
auto p = &ps[snum];
auto pact = p->GetActor();
auto s = &pact->s;
auto s = pact->s;
int shrunk = (s->yrepeat < 8);
if (actions & SB_FIRE)
@ -3358,7 +3358,7 @@ void processinput_r(int snum)
auto p = &ps[snum];
auto pact = p->GetActor();
auto s = &pact->s;
auto s = pact->s;
p->horizon.resetadjustment();
p->angle.resetadjustment();
@ -3395,8 +3395,8 @@ void processinput_r(int snum)
DukeSectIterator it(psect);
while (auto act2 = it.Next())
{
if (act2->s.picnum == RRTILE380)
if (act2->s.z - (8 << 8) < p->posz)
if (act2->s->picnum == RRTILE380)
if (act2->s->z - (8 << 8) < p->posz)
psectlotag = 2;
}
}
@ -3445,13 +3445,13 @@ void processinput_r(int snum)
if (chz.type == kHitSprite)
{
if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0)
if (chz.actor->s->statnum == 1 && chz.actor->s->extra >= 0)
{
chz.type = kHitNone;
chz.actor = nullptr;
cz = p->truecz;
}
else if (chz.actor->s.picnum == RRTILE3587)
else if (chz.actor->s->picnum == RRTILE3587)
{
if (!p->stairs)
{
@ -3470,7 +3470,7 @@ void processinput_r(int snum)
if (clz.type == kHitSprite)
{
if ((clz.actor->s.cstat & 33) == 33)
if ((clz.actor->s->cstat & 33) == 33)
{
psectlotag = 0;
p->footprintcount = 0;
@ -3492,29 +3492,29 @@ void processinput_r(int snum)
p->MotoSpeed -= p->MotoSpeed / 16.;
}
}
else if (badguy(clz.actor) && clz.actor->s.xrepeat > 24 && abs(s->z - clz.actor->s.z) < (84 << 8))
else if (badguy(clz.actor) && clz.actor->s->xrepeat > 24 && abs(s->z - clz.actor->s->z) < (84 << 8))
{
int j = getangle(clz.actor->s.x - p->posx, clz.actor->s.y - p->posy);
int j = getangle(clz.actor->s->x - p->posx, clz.actor->s->y - p->posy);
p->posxv -= bcos(j, 4);
p->posyv -= bsin(j, 4);
}
if (clz.actor->s.picnum == RRTILE3587)
if (clz.actor->s->picnum == RRTILE3587)
{
if (!p->stairs)
{
p->stairs = 10;
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
{
cz = clz.actor->s.z;
cz = clz.actor->s->z;
chz.type = kHitNone;
chz.actor = nullptr;
fz = clz.actor->s.z + (4 << 8);
fz = clz.actor->s->z + (4 << 8);
}
}
else
p->stairs--;
}
else if (clz.actor->s.picnum == TOILET || clz.actor->s.picnum == RRTILE2121)
else if (clz.actor->s->picnum == TOILET || clz.actor->s->picnum == RRTILE2121)
{
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
//if (Sound[436].num == 0)
@ -3586,7 +3586,7 @@ void processinput_r(int snum)
p->playerweaponsway(s->xvel);
s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512);
if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1;
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
@ -3694,7 +3694,7 @@ void processinput_r(int snum)
case 0:
if (clz.type == kHitSprite)
j = clz.actor->s.picnum;
j = clz.actor->s->picnum;
else j = sector[psect].floorpicnum;
break;
case 1:
@ -3858,33 +3858,33 @@ HORIZONLY:
}
else if (badguy(clip.actor))
{
if (clip.actor->s.statnum != 1)
if (clip.actor->s->statnum != 1)
{
clip.actor->timetosleep = 0;
if (clip.actor->s.picnum == BILLYRAY)
if (clip.actor->s->picnum == BILLYRAY)
S_PlayActorSound(404, clip.actor);
else
check_fta_sounds_r(clip.actor);
changespritestat(clip.actor, 1);
}
}
else if (!isRRRA() && clip.actor->s.picnum == RRTILE3410)
else if (!isRRRA() && clip.actor->s->picnum == RRTILE3410)
{
quickkill(p);
S_PlayActorSound(446, pact);
}
if (isRRRA())
{
if (clip.actor->s.picnum == RRTILE3410)
if (clip.actor->s->picnum == RRTILE3410)
{
quickkill(p);
S_PlayActorSound(446, pact);
}
else if (clip.actor->s.picnum == RRTILE2443 && clip.actor->s.pal == 19)
else if (clip.actor->s->picnum == RRTILE2443 && clip.actor->s->pal == 19)
{
clip.actor->s.pal = 0;
clip.actor->s->pal = 0;
p->DrugMode = 5;
ps[snum].GetActor()->s.extra = gs.max_player_health;
ps[snum].GetActor()->s->extra = gs.max_player_health;
}
}
}
@ -3921,7 +3921,7 @@ HORIZONLY:
if (ud.clipping == 0 && sector[psect].lotag == ST_31_TWO_WAY_TRAIN)
{
auto act = ScriptIndexToActor(sector[psect].hitag);
if (act && act->s.xvel && act->temp_data[0] == 0)
if (act && act->s->xvel && act->temp_data[0] == 0)
{
quickkill(p);
return;
@ -4072,9 +4072,9 @@ void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
{
if (motosprite)
{
p->posx = motosprite->s.x;
p->posy = motosprite->s.y;
p->angle.ang = buildang(motosprite->s.ang);
p->posx = motosprite->s->x;
p->posy = motosprite->s->y;
p->angle.ang = buildang(motosprite->s->ang);
p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo;
deletesprite(motosprite);
}
@ -4130,9 +4130,9 @@ void OffMotorcycle(struct player_struct *p)
p->posyv -= p->angle.ang.bsin(7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBIKE);
spawned->s.ang = p->angle.ang.asbuild();
spawned->s.xvel += p->angle.ang.bcos(7);
spawned->s.yvel += p->angle.ang.bsin(7);
spawned->s->ang = p->angle.ang.asbuild();
spawned->s->xvel += p->angle.ang.bcos(7);
spawned->s->yvel += p->angle.ang.bsin(7);
spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
}
}
@ -4149,9 +4149,9 @@ void OnBoat(struct player_struct *p, DDukeActor* boat)
{
if (boat)
{
p->posx = boat->s.x;
p->posy = boat->s.y;
p->angle.ang = buildang(boat->s.ang);
p->posx = boat->s->x;
p->posy = boat->s->y;
p->angle.ang = buildang(boat->s->ang);
p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo;
deletesprite(boat);
}
@ -4194,9 +4194,9 @@ void OffBoat(struct player_struct *p)
p->posyv -= p->angle.ang.bsin(7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBOAT);
spawned->s.ang = p->angle.ang.asbuild();
spawned->s.xvel += p->angle.ang.bcos(7);
spawned->s.yvel += p->angle.ang.bsin(7);
spawned->s->ang = p->angle.ang.asbuild();
spawned->s->xvel += p->angle.ang.bcos(7);
spawned->s->yvel += p->angle.ang.bsin(7);
spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON];
}
}

View file

@ -116,18 +116,18 @@ void DoSpawn(struct player_struct *p, short snum)
if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE2 ) )
{
// like shotgun shells
j->s.ang += 1024;
j->s->ang += 1024;
ssp(j,CLIPMASK0);
j->s.ang += 1024;
j->s->ang += 1024;
// p->kickback_pic++;
}
else if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) )
{
// like chaingun shells
j->s.ang += 1024;
j->s.ang &= 2047;
j->s.xvel += 32;
j->s.z += (3<<8);
j->s->ang += 1024;
j->s->ang &= 2047;
j->s->xvel += 32;
j->s->z += (3<<8);
ssp(j,CLIPMASK0);
}
@ -351,23 +351,23 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum);
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum);
// set timer. blows up when at zero....
j->s.extra = lGrenadeLifetime
j->s->extra = lGrenadeLifetime
+ MulScale(krand(), lGrenadeLifetimeVar, 14)
- lGrenadeLifetimeVar;
}
if (k == 15)
{
j->s.yvel = 3;
j->s.z += (8 << 8);
j->s->yvel = 3;
j->s->z += (8 << 8);
}
k = hits(p->GetActor());
if (k < 512)
{
j->s.ang += 1024;
j->s.zvel /= 3;
j->s.xvel /= 3;
j->s->ang += 1024;
j->s->zvel /= 3;
j->s->xvel /= 3;
}
p->hbomb_on = 1;

View file

@ -571,7 +571,7 @@ void resetpspritevars(int g)
DukeStatIterator it(STAT_PLAYER);
while (auto act = it.Next())
{
s = &act->s;
s = act->s;
if (numplayersprites == MAXPLAYERS)
I_Error("Too many player sprites (max 16.)");
@ -865,7 +865,7 @@ static void SpawnPortals()
DukeStatIterator it(STAT_RAROR);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (spr->picnum == SECTOREFFECTOR && spr->lotag == tag)
{
if (processedTags.Find(spr->hitag) == processedTags.Size())
@ -873,7 +873,7 @@ static void SpawnPortals()
DukeStatIterator it2(STAT_RAROR);
while (auto act2 = it2.Next())
{
auto spr2 = &act2->s;
auto spr2 = act2->s;
if (spr2->picnum == SECTOREFFECTOR && spr2->lotag == tag + 1 && spr2->hitag == spr->hitag)
{
if (processedTags.Find(spr->hitag) == processedTags.Size())
@ -1068,7 +1068,7 @@ void enterlevel(MapRecord *mi, int gamemode)
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
int pn = sector[ps[i].GetActor()->s.sectnum].floorpicnum;
int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum;
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
{
resetweapons(i);

View file

@ -256,8 +256,8 @@ void cacheit_d(void)
DukeSectIterator it(i);
while (auto j = it.Next())
{
if (j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat & 32768) == 0)
cachespritenum(&j->s);
if (j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat & 32768) == 0)
cachespritenum(j->s);
}
}
@ -280,7 +280,7 @@ void prelevel_d(int g)
DukeStatIterator it(STAT_DEFAULT);
while (auto ac = it.Next())
{
auto si = &ac->s;
auto si = ac->s;
LoadActor(ac, -1, -1);
if (si->lotag == -1 && (si->cstat & 16))
@ -366,7 +366,7 @@ void prelevel_d(int g)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto ac = it1.Next())
{
if (ac->s.lotag == 12 && ac->s.hitag == spr->lotag)
if (ac->s->lotag == 12 && ac->s->hitag == spr->lotag)
ac->temp_data[0] = 1;
}
}

View file

@ -431,8 +431,8 @@ void cacheit_r(void)
DukeSectIterator it(i);
while (auto j = it.Next())
{
if(j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat&32768) == 0)
cachespritenum(&j->s);
if(j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat&32768) == 0)
cachespritenum(j->s);
}
}
precacheMarkedTiles();
@ -499,7 +499,7 @@ void prelevel_r(int g)
DukeSectIterator it(i);
while (auto act = it.Next())
{
auto spr = &act->s;
auto spr = act->s;
if (spr->picnum == RRTILE11)
{
dist = spr->lotag << 4;
@ -530,7 +530,7 @@ void prelevel_r(int g)
DukeSectIterator it(i);
while (auto act = it.Next())
{
auto sj = &act->s;
auto sj = act->s;
if (sj->picnum == RRTILE64)
{
dist = sj->lotag << 4;
@ -562,7 +562,7 @@ void prelevel_r(int g)
DukeStatIterator it(STAT_DEFAULT);
while (auto ac = it.Next())
{
auto si = &ac->s;
auto si = ac->s;
LoadActor(ac, -1, -1);
if (si->lotag == -1 && (si->cstat & 16))
@ -698,7 +698,7 @@ void prelevel_r(int g)
it.Reset(STAT_DEFAULT);
while (auto ac = it.Next())
{
auto spr = &ac->s;
auto spr = ac->s;
switch (spr->picnum)
{
case RRTILE8464 + 1:
@ -733,7 +733,7 @@ void prelevel_r(int g)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto j = it1.Next())
{
if (j->s.lotag == 12 && j->s.hitag == spr->lotag)
if (j->s->lotag == 12 && j->s->hitag == spr->lotag)
j->temp_data[0] = 1;
}
}

View file

@ -101,7 +101,7 @@ void GameInterface::UpdateCameras(double smoothratio)
return;
auto p = &ps[screenpeek];
auto sp = &camsprite->s;
auto sp = camsprite->s;
if (p->newOwner != nullptr) camsprite->SetOwner(p->newOwner);
@ -115,7 +115,7 @@ void GameInterface::UpdateCameras(double smoothratio)
screen->RenderTextureView(canvas, [=](IntRect& rect)
{
auto camera = &camsprite->GetOwner()->s;
auto camera = camsprite->GetOwner()->s;
auto ang = buildang(camera->interpolatedang(smoothratio));
display_mirror = 1; // should really be 'display external view'.
if (!testnewrenderer)
@ -291,9 +291,7 @@ void displayrooms(int snum, double smoothratio)
if (ud.cameraactor)
{
spritetype* s;
s = &ud.cameraactor->s;
spritetype* s = ud.cameraactor->s;
if (s->yvel < 0) s->yvel = -100;
else if (s->yvel > 199) s->yvel = 300;
@ -306,7 +304,7 @@ void displayrooms(int snum, double smoothratio)
else
{
// Fixme: This should get the aspect ratio from the backend, not the current viewport size.
int i = DivScale(1, isRR() ? 64 : p->GetActor()->s.yrepeat + 28, 22);
int i = DivScale(1, isRR() ? 64 : p->GetActor()->s->yrepeat + 28, 22);
int viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i);
renderSetAspect(MulScale(viewingaspect, viewingrange, 16), yxaspect);
@ -356,7 +354,7 @@ void displayrooms(int snum, double smoothratio)
spritetype* viewer;
if (p->newOwner != nullptr)
{
auto spr = &p->newOwner->s;
auto spr = p->newOwner->s;
cang = buildang(spr->interpolatedang(smoothratio));
choriz = buildhoriz(spr->shade);
cposx = spr->pos.x;
@ -370,18 +368,18 @@ void displayrooms(int snum, double smoothratio)
else if (p->over_shoulder_on == 0)
{
if (cl_viewbob) cposz += interpolatedvalue(p->opyoff, p->pyoff, smoothratio);
viewer = &p->GetActor()->s;
viewer = p->GetActor()->s;
}
else
{
cposz -= isRR() ? 3840 : 3072;
if (!calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, &sect, cang, choriz, smoothratio))
if (!calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, &sect, cang, choriz, smoothratio))
{
cposz += isRR() ? 3840 : 3072;
calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, &sect, cang, choriz, smoothratio);
calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, &sect, cang, choriz, smoothratio);
}
viewer = &p->GetActor()->s;
viewer = p->GetActor()->s;
}
cz = p->GetActor()->ceilingz;
@ -393,7 +391,7 @@ void displayrooms(int snum, double smoothratio)
cang += buildang((2 - ((earthquaketime) & 2)) << 2);
}
if (p->GetActor()->s.pal == 1) cposz -= (18 << 8);
if (p->GetActor()->s->pal == 1) cposz -= (18 << 8);
else if (p->spritebridge == 0 && p->newOwner == nullptr)
{

View file

@ -158,7 +158,7 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health)
@ -261,7 +261,7 @@ public:
// health
//
DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health);
SBar_DrawString(this, digiFont, format, 20, -digiFont->mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
@ -437,7 +437,7 @@ public:
}
DrawWeaponAmounts(p, 96, top + 15.5);
int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num);
SBar_DrawString(this, digiFont, format, 31, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
format.Format("%d", GetMoraleOrShield(p, snum));

View file

@ -110,7 +110,7 @@ public:
imgScale = baseScale / img->GetDisplayHeight();
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2))
{
int s = -8;
if (althud_flashing && p->last_extra > gs.max_player_health)
@ -230,7 +230,7 @@ public:
// health
//
DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
FStringf format("%d", health);
SBar_DrawString(this, digiFont, format, 21.5, -digiFont->mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
@ -379,7 +379,7 @@ public:
if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0));
}
int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
format.Format("%d", num);
SBar_DrawString(this, digiFont, format, 66.5, top + 16, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);

View file

@ -64,7 +64,7 @@ int callsound(int sn, DDukeActor* whatsprite)
DukeSectIterator it(sn);
while (auto act = it.Next())
{
auto si = &act->s;
auto si = act->s;
if (si->picnum == MUSICANDSFX && si->lotag < 1000)
{
if (whatsprite == nullptr) whatsprite = act;
@ -122,17 +122,17 @@ int check_activator_motion(int lotag)
DukeStatIterator it(STAT_ACTIVATOR);
while (auto act = it.Next())
{
if (act->s.lotag == lotag)
if (act->s->lotag == lotag)
{
for (int j = animatecnt - 1; j >= 0; j--)
if (act->s.sectnum == animatesect[j])
if (act->s->sectnum == animatesect[j])
return(1);
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act2 = it1.Next())
{
if (act->s.sectnum == act2->s.sectnum)
switch (act2->s.lotag)
if (act->s->sectnum == act2->s->sectnum)
switch (act2->s->lotag)
{
case SE_11_SWINGING_DOOR:
case SE_30_TWO_WAY_TRAIN:
@ -218,7 +218,7 @@ int findplayer(const DDukeActor* actor, int* d)
{
short j, closest_player;
int x, closest;
auto s = &actor->s.pos;
auto s = &actor->s->pos;
if (ud.multimode < 2)
{
@ -232,7 +232,7 @@ int findplayer(const DDukeActor* actor, int* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
{
x = abs(ps[j].oposx - s->x) + abs(ps[j].oposy - s->y) + ((abs(ps[j].oposz - s->z + (28 << 8))) >> 4);
if (x < closest && ps[j].GetActor()->s.extra > 0)
if (x < closest && ps[j].GetActor()->s->extra > 0)
{
closest_player = j;
closest = x;
@ -258,7 +258,7 @@ int findotherplayer(int p, int* d)
closest_player = p;
for (j = connecthead; j >= 0; j = connectpoint2[j])
if (p != j && ps[j].GetActor()->s.extra > 0)
if (p != j && ps[j].GetActor()->s->extra > 0)
{
x = abs(ps[j].oposx - ps[p].posx) + abs(ps[j].oposy - ps[p].posy) + (abs(ps[j].oposz - ps[p].posz) >> 4);
@ -356,10 +356,10 @@ void doanimations(void)
DukeSectIterator it(dasect);
while (auto act = it.Next())
{
if (act->s.statnum != STAT_EFFECTOR)
if (act->s->statnum != STAT_EFFECTOR)
{
act->s.backupz();
act->s.z += v;
act->s->backupz();
act->s->z += v;
act->floorz = sector[dasect].floorz + v;
}
}
@ -435,7 +435,7 @@ int setanimation(short animsect, int animtype, int animtarget, int thegoal, int
bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum
{
int sn = actor->s.sectnum;
int sn = actor->s->sectnum;
// See if the sector exists
@ -443,10 +443,10 @@ bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum
DDukeActor *act2;
while ((act2 = it.Next()))
{
if (act2->s.lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL))
if (act2->s.hitag == actor->s.hitag)
if ((abs(sector[sn].floorz - actor->temp_data[2]) > act2->s.yvel) ||
(sector[act2->s.sectnum].hitag == (sector[sn].hitag - d)))
if (act2->s->lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL))
if (act2->s->hitag == actor->s->hitag)
if ((abs(sector[sn].floorz - actor->temp_data[2]) > act2->s->yvel) ||
(sector[act2->s->sectnum].hitag == (sector[sn].hitag - d)))
break;
}
@ -466,8 +466,8 @@ bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum
it.Reset(STAT_EFFECTOR);
while ((act2 = it.Next()))
{
if (act2->s.lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL))
if (act2->s.hitag == actor->s.hitag)
if (act2->s->lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL))
if (act2->s->hitag == actor->s->hitag)
{
act2->temp_data[0] = d;
act2->temp_data[1] = d; //Make all check warp
@ -575,18 +575,18 @@ static void handle_st09(int sn, DDukeActor* actor)
static void handle_st15(int sn, DDukeActor* actor)
{
if (actor->s.picnum != TILE_APLAYER) return;
if (actor->s->picnum != TILE_APLAYER) return;
sectortype* sptr = &sector[sn];
DukeSectIterator it(sn);
DDukeActor* a2;
while ((a2 = it.Next()))
{
if (a2->s.picnum == SECTOREFFECTOR && a2->s.lotag == ST_17_PLATFORM_UP) break;
if (a2->s->picnum == SECTOREFFECTOR && a2->s->lotag == ST_17_PLATFORM_UP) break;
}
if (!a2) return;
if (actor->s.sectnum == sn)
if (actor->s->sectnum == sn)
{
if (activatewarpelevators(a2, -1))
activatewarpelevators(a2, 1);
@ -596,7 +596,7 @@ static void handle_st15(int sn, DDukeActor* actor)
}
else
{
if (sptr->floorz > a2->s.z)
if (sptr->floorz > a2->s->z)
activatewarpelevators(a2, -1);
else
activatewarpelevators(a2, 1);
@ -678,10 +678,10 @@ static void handle_st29(int sn, DDukeActor* actor)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act2 = it.Next())
{
if ((act2->s.lotag == 22) &&
(act2->s.hitag == sptr->hitag))
if ((act2->s->lotag == 22) &&
(act2->s->hitag == sptr->hitag))
{
sector[act2->s.sectnum].extra = -sector[act2->s.sectnum].extra;
sector[act2->s->sectnum].extra = -sector[act2->s->sectnum].extra;
act2->temp_data[0] = sn;
act2->temp_data[1] = 1;
@ -713,9 +713,9 @@ REDODOOR:
DukeSectIterator it(sn);
while ((a2 = it.Next()))
{
if (a2->s.statnum == 3 && a2->s.lotag == 9)
if (a2->s->statnum == 3 && a2->s->lotag == 9)
{
j = a2->s.z;
j = a2->s->z;
break;
}
}
@ -815,14 +815,14 @@ static void handle_st23(int sn, DDukeActor* actor)
DDukeActor* act2;
while ((act2 = it.Next()))
{
if (act2->s.lotag == SE_11_SWINGING_DOOR && act2->s.sectnum == sn && !act2->temp_data[4])
if (act2->s->lotag == SE_11_SWINGING_DOOR && act2->s->sectnum == sn && !act2->temp_data[4])
{
break;
}
}
if (!act2) return;
int l = sector[act2->s.sectnum].lotag & 0x8000;
int l = sector[act2->s->sectnum].lotag & 0x8000;
if (act2)
{
@ -830,7 +830,7 @@ static void handle_st23(int sn, DDukeActor* actor)
while (auto act3 = it.Next())
{
if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag && act3->temp_data[4])
if (l == (sector[act3->s->sectnum].lotag & 0x8000) && act3->s->lotag == SE_11_SWINGING_DOOR && act2->s->hitag == act3->s->hitag && act3->temp_data[4])
{
return;
}
@ -839,10 +839,10 @@ static void handle_st23(int sn, DDukeActor* actor)
it.Reset(STAT_EFFECTOR);
while (auto act3 = it.Next())
{
if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag)
if (l == (sector[act3->s->sectnum].lotag & 0x8000) && act3->s->lotag == SE_11_SWINGING_DOOR && act2->s->hitag == act3->s->hitag)
{
if (sector[act3->s.sectnum].lotag & 0x8000) sector[act3->s.sectnum].lotag &= 0x7fff;
else sector[act3->s.sectnum].lotag |= 0x8000;
if (sector[act3->s->sectnum].lotag & 0x8000) sector[act3->s->sectnum].lotag &= 0x7fff;
else sector[act3->s->sectnum].lotag |= 0x8000;
act3->temp_data[4] = 1;
act3->temp_data[3] = -act3->temp_data[3];
if (q == 0)
@ -867,7 +867,7 @@ static void handle_st25(int sn, DDukeActor* actor)
DDukeActor* act2;
while ((act2 = it.Next()))
{
if (act2->s.lotag == 15 && act2->s.sectnum == sn)
if (act2->s->lotag == 15 && act2->s->sectnum == sn)
{
break;
}
@ -879,15 +879,15 @@ static void handle_st25(int sn, DDukeActor* actor)
it.Reset(STAT_EFFECTOR);
while (auto act3 = it.Next())
{
if (act3->s.hitag == act2->s.hitag)
if (act3->s->hitag == act2->s->hitag)
{
if (act3->s.lotag == 15)
if (act3->s->lotag == 15)
{
sector[act3->s.sectnum].lotag ^= 0x8000; // Toggle the open or close
act3->s.ang += 1024;
if (act3->temp_data[4]) callsound(act3->s.sectnum, act3);
callsound(act3->s.sectnum, act3);
if (sector[act3->s.sectnum].lotag & 0x8000) act3->temp_data[4] = 1;
sector[act3->s->sectnum].lotag ^= 0x8000; // Toggle the open or close
act3->s->ang += 1024;
if (act3->temp_data[4]) callsound(act3->s->sectnum, act3);
callsound(act3->s->sectnum, act3);
if (sector[act3->s->sectnum].lotag & 0x8000) act3->temp_data[4] = 1;
else act3->temp_data[4] = 2;
}
}
@ -905,7 +905,7 @@ static void handle_st27(int sn, DDukeActor* actor)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act2 = it.Next())
{
if ((act2->s.lotag & 0xff) == 20 && act2->s.sectnum == sn) //Bridge
if ((act2->s->lotag & 0xff) == 20 && act2->s->sectnum == sn) //Bridge
{
sector[sn].lotag ^= 0x8000;
@ -931,9 +931,9 @@ static void handle_st28(int sn, DDukeActor* actor)
DukeSectIterator it(sn);
while (auto a2 = it.Next())
{
if (a2->s.statnum == 3 && (a2->s.lotag & 0xff) == 21)
if (a2->s->statnum == 3 && (a2->s->lotag & 0xff) == 21)
{
j = a2->s.hitag;
j = a2->s->hitag;
break; //Found it
}
}
@ -942,8 +942,8 @@ static void handle_st28(int sn, DDukeActor* actor)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act3 = it.Next())
{
if ((act3->s.lotag & 0xff) == 21 && !act3->temp_data[0] &&
(act3->s.hitag) == j)
if ((act3->s->lotag & 0xff) == 21 && !act3->temp_data[0] &&
(act3->s->hitag) == j)
act3->temp_data[0] = 1;
}
callsound(sn, actor);
@ -986,8 +986,8 @@ void operatesectors(int sn, DDukeActor *actor)
auto act = ScriptIndexToActor(sector[sn].hitag);
if (!act) break;
if (act->tempang == 0 || act->tempang == 256) callsound(sn, actor);
if (act->s.extra == 1) act->s.extra = 3;
else act->s.extra = 1;
if (act->s->extra == 1) act->s->extra = 3;
else act->s->extra = 1;
break;
}
@ -1101,45 +1101,45 @@ void operateactivators(int low, int plnum)
DukeStatIterator it(STAT_ACTIVATOR);
while (auto act = it.Next())
{
if (act->s.lotag == low)
if (act->s->lotag == low)
{
if (act->s.picnum == ACTIVATORLOCKED)
if (act->s->picnum == ACTIVATORLOCKED)
{
sector[act->s.sectnum].lotag ^= 16384;
sector[act->s->sectnum].lotag ^= 16384;
if (plnum >= 0)
{
if (sector[act->s.sectnum].lotag & 16384)
if (sector[act->s->sectnum].lotag & 16384)
FTA(4, &ps[plnum]);
else FTA(8, &ps[plnum]);
}
}
else
{
switch (act->s.hitag)
switch (act->s->hitag)
{
case 0:
break;
case 1:
if (sector[act->s.sectnum].floorz != sector[act->s.sectnum].ceilingz)
if (sector[act->s->sectnum].floorz != sector[act->s->sectnum].ceilingz)
{
continue;
}
break;
case 2:
if (sector[act->s.sectnum].floorz == sector[act->s.sectnum].ceilingz)
if (sector[act->s->sectnum].floorz == sector[act->s->sectnum].ceilingz)
{
continue;
}
break;
}
if (sector[act->s.sectnum].lotag < 3)
if (sector[act->s->sectnum].lotag < 3)
{
DukeSectIterator it(act->s.sectnum);
DukeSectIterator it(act->s->sectnum);
while (auto a2 = it.Next())
{
if (a2->s.statnum == 3) switch (a2->s.lotag)
if (a2->s->statnum == 3) switch (a2->s->lotag)
{
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
if (isRRRA()) break;
@ -1147,16 +1147,16 @@ void operateactivators(int low, int plnum)
case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL:
a2->temp_data[0] = 1 - a2->temp_data[0];
callsound(act->s.sectnum, a2);
callsound(act->s->sectnum, a2);
break;
}
}
}
if (k == -1 && (sector[act->s.sectnum].lotag & 0xff) == 22)
k = callsound(act->s.sectnum, act);
if (k == -1 && (sector[act->s->sectnum].lotag & 0xff) == 22)
k = callsound(act->s->sectnum, act);
operatesectors(act->s.sectnum, act);
operatesectors(act->s->sectnum, act);
}
}
}
@ -1175,8 +1175,8 @@ void operatemasterswitches(int low)
DukeStatIterator it(STAT_STANDABLE);
while (auto act2 = it.Next())
{
if (act2->s.picnum == MASTERSWITCH && act2->s.lotag == low && act2->s.yvel == 0)
act2->s.yvel = 1;
if (act2->s->picnum == MASTERSWITCH && act2->s->lotag == low && act2->s->yvel == 0)
act2->s->yvel = 1;
}
}
@ -1203,7 +1203,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial
{
wall[i].cstat = 0;
if (effector && effector->s.picnum == SECTOREFFECTOR && effector->s.lotag == 30)
if (effector && effector->s->picnum == SECTOREFFECTOR && effector->s->lotag == 30)
wall[i].lotag = 0;
}
else
@ -1237,15 +1237,15 @@ void allignwarpelevators(void)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (act->s.lotag == SE_17_WARP_ELEVATOR && act->s.shade > 16)
if (act->s->lotag == SE_17_WARP_ELEVATOR && act->s->shade > 16)
{
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act2 = it1.Next())
{
if ((act2->s.lotag) == SE_17_WARP_ELEVATOR && act != act2 && act->s.hitag == act2->s.hitag)
if ((act2->s->lotag) == SE_17_WARP_ELEVATOR && act != act2 && act->s->hitag == act2->s->hitag)
{
sector[act2->s.sectnum].floorz = sector[act->s.sectnum].floorz;
sector[act2->s.sectnum].ceilingz = sector[act->s.sectnum].ceilingz;
sector[act2->s->sectnum].floorz = sector[act->s->sectnum].floorz;
sector[act2->s->sectnum].ceilingz = sector[act->s->sectnum].ceilingz;
}
}
}

View file

@ -191,15 +191,15 @@ void operaterespawns_d(int low)
DukeStatIterator it(STAT_FX);
while (auto act = it.Next())
{
if (act->s.lotag == low) switch (act->s.picnum)
if (act->s->lotag == low) switch (act->s->picnum)
{
case RESPAWN:
if (badguypic(act->s.hitag) && ud.monsters_off) break;
if (badguypic(act->s->hitag) && ud.monsters_off) break;
auto star = spawn(act, TRANSPORTERSTAR);
star->s.z -= (32 << 8);
star->s->z -= (32 << 8);
act->s.extra = 66 - 12; // Just a way to killit
act->s->extra = 66 - 12; // Just a way to killit
break;
}
}
@ -234,13 +234,13 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
if (act)
{
lotag = act->s.lotag;
lotag = act->s->lotag;
if (lotag == 0) return 0;
hitag = act->s.hitag;
sx = act->s.x;
sy = act->s.y;
picnum = act->s.picnum;
switchpal = act->s.pal;
hitag = act->s->hitag;
sx = act->s->x;
sy = act->s->y;
picnum = act->s->picnum;
switchpal = act->s->pal;
}
else
{
@ -267,7 +267,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
if (act)
{
StopCommentary();
act->s.picnum = DEVELOPERCOMMENTARY;
act->s->picnum = DEVELOPERCOMMENTARY;
return true;
}
return false;
@ -275,7 +275,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
if (act)
{
if (StartCommentary(lotag, act))
act->s.picnum = DEVELOPERCOMMENTARY+1;
act->s->picnum = DEVELOPERCOMMENTARY+1;
return true;
}
return false;
@ -354,7 +354,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
DukeStatIterator it(STAT_DEFAULT);
while (auto other = it.Next())
{
auto si = &other->s;
auto si = other->s;
if (lotag == si->lotag) switch (si->picnum)
{
case DIPSWITCH:
@ -551,12 +551,12 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act)
DukeStatIterator it(STAT_EFFECTOR);
while (auto other = it.Next())
{
if (other->s.hitag == lotag)
if (other->s->hitag == lotag)
{
switch (other->s.lotag)
switch (other->s->lotag)
{
case SE_12_LIGHT_SWITCH:
sector[other->s.sectnum].floorpal = 0;
sector[other->s->sectnum].floorpal = 0;
other->temp_data[0]++;
if (other->temp_data[0] == 2)
other->temp_data[0]++;
@ -621,9 +621,9 @@ void activatebysector_d(int sect, DDukeActor* activator)
DukeSectIterator it(sect);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR)
if (act->s->picnum == ACTIVATOR)
{
operateactivators(act->s.lotag, -1);
operateactivators(act->s->lotag, -1);
didit = 1;
// return;
}
@ -685,12 +685,12 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
else
{
if (atwith == CHAINGUN)
spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 16 + spr->s.xrepeat, 16 + spr->s.yrepeat, 0, 0, 0, spr, 5);
spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 16 + spr->s->xrepeat, 16 + spr->s->yrepeat, 0, 0, 0, spr, 5);
else spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 32, 32, 0, 0, 0, spr, 5);
}
spawned->s.cstat |= 18 + 128;
spawned->s.ang = getangle(wal->x - wall[wal->point2].x, wal->y - wall[wal->point2].y) - 512;
spawned->s->cstat |= 18 + 128;
spawned->s->ang = getangle(wal->x - wall[wal->point2].x, wal->y - wall[wal->point2].y) - 512;
S_PlayActorSound(SOMETHINGHITFORCE, spawned);
@ -719,7 +719,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
wall[wal->nextwall].cstat = 0;
auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
spawned->s.lotag = 128;
spawned->s->lotag = 128;
spawned->temp_data[1] = 5;
spawned->temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, spawned);
@ -870,7 +870,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
DukeStatIterator it(STAT_EFFECTOR);
while (auto effector = it.Next())
{
if (effector->s.hitag == wall[dawallnum].lotag && effector->s.lotag == 3)
if (effector->s->hitag == wall[dawallnum].lotag && effector->s->lotag == 3)
{
effector->temp_data[2] = j;
effector->temp_data[3] = darkestwall;
@ -891,12 +891,12 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
{
if (coll.type == kHitSprite)
{
switch (coll.actor->s.picnum)
switch (coll.actor->s->picnum)
{
case CACTUS:
if (p->hurt_delay < 8)
{
p->GetActor()->s.extra -= 5;
p->GetActor()->s->extra -= 5;
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
@ -915,7 +915,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
case W_FORCEFIELD:
case W_FORCEFIELD + 1:
case W_FORCEFIELD + 2:
p->GetActor()->s.extra -= 5;
p->GetActor()->s->extra -= 5;
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
@ -988,12 +988,12 @@ bool checkhitceiling_d(int sn)
DukeSectIterator it(sn);
while (auto act = it.Next())
{
if (act->s.picnum == SECTOREFFECTOR && act->s.lotag == 12)
if (act->s->picnum == SECTOREFFECTOR && act->s->lotag == 12)
{
DukeStatIterator it1(STAT_EFFECTOR);
while (auto act2 = it1.Next())
{
if (act2->s.hitag == act->s.hitag)
if (act2->s->hitag == act->s->hitag)
act2->temp_data[3] = 1;
}
break;
@ -1005,7 +1005,7 @@ bool checkhitceiling_d(int sn)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (act->s.hitag == (sector[sn].hitag) && act->s.lotag == 3)
if (act->s->hitag == (sector[sn].hitag) && act->s->lotag == 3)
{
act->temp_data[2] = j;
act->temp_data[4] = 1;
@ -1027,8 +1027,8 @@ bool checkhitceiling_d(int sn)
void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{
int j, k, p;
spritetype* s = &targ->s;
auto pspr = &proj->s;
spritetype* s = targ->s;
auto pspr = proj->s;
switch (s->picnum)
{
@ -1106,7 +1106,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
for (k = 0; k < 64; k++)
{
auto j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), targ, 5);
j->s.pal = 8;
j->s->pal = 8;
}
if (s->picnum == CACTUS)
@ -1305,7 +1305,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
}
{
auto j = spawn(targ, STEAM);
j->s.z = sector[s->sectnum].floorz - (32 << 8);
j->s->z = sector[s->sectnum].floorz - (32 << 8);
}
break;
@ -1367,7 +1367,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
case PLAYERONWATER:
targ = targ->GetOwner();
if (!targ) break;
s = &targ->s;
s = targ->s;
default:
if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0)
break;
@ -1387,16 +1387,16 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
{
auto spawned = spawn(proj, JIBS6);
if (pspr->pal == 6)
spawned->s.pal = 6;
spawned->s.z += (4 << 8);
spawned->s.xvel = 16;
spawned->s.xrepeat = spawned->s.yrepeat = 24;
spawned->s.ang += 32 - (krand() & 63);
spawned->s->pal = 6;
spawned->s->z += (4 << 8);
spawned->s->xvel = 16;
spawned->s->xrepeat = spawned->s->yrepeat = 24;
spawned->s->ang += 32 - (krand() & 63);
}
auto Owner = proj->GetOwner();
if (Owner && Owner->s.picnum == APLAYER && s->picnum != ROTATEGUN && s->picnum != DRONE)
if (Owner && Owner->s->picnum == APLAYER && s->picnum != ROTATEGUN && s->picnum != DRONE)
if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON)
{
fi.shoot(targ, BLOODSPLAT3);
@ -1432,13 +1432,13 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
int hitpic = pspr->picnum;
auto Owner = proj->GetOwner();
if (Owner && Owner->s.picnum == APLAYER)
if (Owner && Owner->s->picnum == APLAYER)
{
if (s->picnum == APLAYER && ud.coop != 0 && ud.ffire == 0)
return;
auto tOwner = targ->GetOwner();
if (isWorldTour() && hitpic == FIREBALL && tOwner && tOwner->s.picnum != FIREBALL)
if (isWorldTour() && hitpic == FIREBALL && tOwner && tOwner->s->picnum != FIREBALL)
hitpic = FLAMETHROWERFLAME;
}
@ -1464,7 +1464,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
DukeStatIterator it(STAT_ACTOR);
while (auto j = it.Next())
{
if (j->s.picnum == CAMERA1) j->s.yvel = 0;
if (j->s->picnum == CAMERA1) j->s->yvel = 0;
}
}
@ -1472,7 +1472,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj)
return;
auto hitowner = targ->GetHitOwner();
if (!hitowner || hitowner->s.picnum != APLAYER)
if (!hitowner || hitowner->s->picnum != APLAYER)
if (ud.player_skill >= 3)
pspr->extra += (pspr->extra >> 1);
}
@ -1531,7 +1531,7 @@ void checksectors_d(int snum)
//After this point the the player effects the map with space
if (chatmodeon || p->GetActor()->s.extra <= 0) return;
if (chatmodeon || p->GetActor()->s->extra <= 0) return;
if (ud.cashman && PlayerInput(snum, SB_OPEN))
fi.lotsofmoney(p->GetActor(), 2);
@ -1579,20 +1579,20 @@ void checksectors_d(int snum)
return;
if (p->newOwner != nullptr)
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
{
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite != nullptr)
{
switch (neartagsprite->s.picnum)
switch (neartagsprite->s->picnum)
{
case FEM1:
case FEM2:
@ -1619,8 +1619,8 @@ void checksectors_d(int snum)
}
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
neartagsector = p->GetActor()->s.sectnum;
if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag))
neartagsector = p->GetActor()->s->sectnum;
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384))
return;
@ -1639,7 +1639,7 @@ void checksectors_d(int snum)
{
if (fi.checkhitswitch(snum, -1, neartagsprite)) return;
switch (neartagsprite->s.picnum)
switch (neartagsprite->s->picnum)
{
case TOILET:
case STALL:
@ -1654,13 +1654,13 @@ void checksectors_d(int snum)
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10)))
if (p->GetActor()->s->extra <= (gs.max_player_health - (gs.max_player_health / 10)))
{
p->GetActor()->s.extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s.extra;
p->GetActor()->s->extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s->extra;
}
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
else if (p->GetActor()->s->extra < gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
}
else if (S_CheckActorSoundPlaying(neartagsprite, FLUSH_TOILET) == 0)
S_PlayActorSound(FLUSH_TOILET, neartagsprite);
@ -1674,9 +1674,9 @@ void checksectors_d(int snum)
{
neartagsprite->temp_data[0] = 1;
neartagsprite->SetOwner(p->GetActor());
p->buttonpalette = neartagsprite->s.pal;
p->buttonpalette = neartagsprite->s->pal;
if (p->buttonpalette)
ud.secretlevel = neartagsprite->s.lotag;
ud.secretlevel = neartagsprite->s->lotag;
else ud.secretlevel = 0;
}
return;
@ -1686,16 +1686,16 @@ void checksectors_d(int snum)
neartagsprite->temp_data[0] = 1;
neartagsprite->SetOwner(p->GetActor());
if (p->GetActor()->s.extra < gs.max_player_health)
if (p->GetActor()->s->extra < gs.max_player_health)
{
p->GetActor()->s.extra++;
p->GetActor()->s->extra++;
S_PlayActorSound(DUKE_DRINKING, p->GetActor());
}
}
return;
case PLUG:
S_PlayActorSound(SHORT_CIRCUIT, pact);
p->GetActor()->s.extra -= 2 + (krand() & 3);
p->GetActor()->s->extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break;
case VIEWSCREEN:
@ -1704,14 +1704,14 @@ void checksectors_d(int snum)
DukeStatIterator it(STAT_ACTOR);
while (auto acti = it.Next())
{
auto spr = &acti->s;
if (spr->picnum == CAMERA1 && spr->yvel == 0 && neartagsprite->s.hitag == spr->lotag)
auto spr = acti->s;
if (spr->picnum == CAMERA1 && spr->yvel == 0 && neartagsprite->s->hitag == spr->lotag)
{
spr->yvel = 1; //Using this camera
if (snum == screenpeek) S_PlaySound(MONITOR_ACTIVE);
neartagsprite->SetOwner(acti);
neartagsprite->s.yvel = 1;
neartagsprite->s->yvel = 1;
camsprite = neartagsprite;
@ -1741,7 +1741,7 @@ void checksectors_d(int snum)
DukeStatIterator it(STAT_ACTOR);
while (auto act = it.Next())
{
if (act->s.picnum == CAMERA1) act->s.yvel = 0;
if (act->s->picnum == CAMERA1) act->s->yvel = 0;
}
}
else if (p->newOwner != nullptr)
@ -1783,21 +1783,21 @@ void checksectors_d(int snum)
DukeSectIterator it(neartagsector);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
operatesectors(neartagsector, p->GetActor());
}
else if ((sector[p->GetActor()->s.sectnum].lotag & 16384) == 0)
else if ((sector[p->GetActor()->s->sectnum].lotag & 16384) == 0)
{
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag))
{
DukeSectIterator it(p->GetActor()->s.sectnum);
DukeSectIterator it(p->GetActor()->s->sectnum);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH) return;
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return;
}
operatesectors(p->GetActor()->s.sectnum, p->GetActor());
operatesectors(p->GetActor()->s->sectnum, p->GetActor());
}
else fi.checkhitswitch(snum, neartagwall, nullptr);
}

View file

@ -306,16 +306,16 @@ void operaterespawns_r(int low)
DukeStatIterator it(STAT_FX);
while (auto act = it.Next())
{
if (act->s.lotag == low) switch (act->s.picnum)
if (act->s->lotag == low) switch (act->s->picnum)
{
case RESPAWN:
{
if (badguypic(act->s.hitag) && ud.monsters_off) break;
if (badguypic(act->s->hitag) && ud.monsters_off) break;
auto star = spawn(act, TRANSPORTERSTAR);
star->s.z -= (32 << 8);
star->s->z -= (32 << 8);
act->s.extra = 66 - 12; // Just a way to killit
act->s->extra = 66 - 12; // Just a way to killit
break;
}
case RRTILE7424:
@ -356,13 +356,13 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
if (act)
{
lotag = act->s.lotag;
lotag = act->s->lotag;
if (lotag == 0) return 0;
hitag = act->s.hitag;
sx = act->s.x;
sy = act->s.y;
picnum = act->s.picnum;
switchpal = act->s.pal;
hitag = act->s->hitag;
sx = act->s->x;
sy = act->s->y;
picnum = act->s->picnum;
switchpal = act->s->pal;
}
else
{
@ -489,7 +489,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
DukeStatIterator it(STAT_DEFAULT);
while (auto other = it.Next())
{
auto si = &other->s;
auto si = other->s;
if (lotag == si->lotag) switch (si->picnum)
{
case DIPSWITCH:
@ -554,14 +554,14 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
DukeStatIterator it1(107);
while (auto other2 = it1.Next())
{
if (other2->s.picnum == RRTILE3410)
if (other2->s->picnum == RRTILE3410)
{
other2->s.picnum++;
other2->s.hitag = 100;
other2->s.extra = 0;
other2->s->picnum++;
other2->s->hitag = 100;
other2->s->extra = 0;
S_PlayActorSound(474, other2);
}
else if (other2->s.picnum == RRTILE295)
else if (other2->s->picnum == RRTILE295)
deletesprite(other2);
}
si->picnum++;
@ -762,11 +762,11 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
{
BellTime = 132;
BellSprite = act;
act->s.picnum++;
act->s->picnum++;
}
else if (picnum == RRTILE8464)
{
act->s.picnum = act->s.picnum + 1;
act->s->picnum = act->s->picnum + 1;
if (hitag == 10001)
{
if (ps[snum].SeaSick == 0)
@ -790,8 +790,8 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
DukeLinearSpriteIterator it;
while (auto actt = it.Next())
{
int jpn = actt->s.picnum;
int jht = actt->s.hitag;
int jpn = actt->s->picnum;
int jht = actt->s->hitag;
if ((jpn == MULTISWITCH || jpn == MULTISWITCH2) && jht == 10000)
{
if (switchcount < 3)
@ -806,11 +806,11 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
S_PlaySound3D(78, act, &v);
for (j = 0; j < switchcount; j++)
{
switches[j]->s.hitag = 0;
switches[j]->s->hitag = 0;
if (picnum >= MULTISWITCH2)
switches[j]->s.picnum = MULTISWITCH2 + 3;
switches[j]->s->picnum = MULTISWITCH2 + 3;
else
switches[j]->s.picnum = MULTISWITCH + 3;
switches[j]->s->picnum = MULTISWITCH + 3;
checkhitswitch_r(snum, -1, switches[j]);
}
}
@ -831,16 +831,16 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
DukeStatIterator it(STAT_EFFECTOR);
while (auto other = it.Next())
{
if (other->s.hitag == lotag)
if (other->s->hitag == lotag)
{
switch (other->s.lotag)
switch (other->s->lotag)
{
case 46:
case SE_47_LIGHT_SWITCH:
case SE_48_LIGHT_SWITCH:
if (!isRRRA()) break;
case SE_12_LIGHT_SWITCH:
sector[other->s.sectnum].floorpal = 0;
sector[other->s->sectnum].floorpal = 0;
other->temp_data[0]++;
if (other->temp_data[0] == 2)
other->temp_data[0]++;
@ -901,9 +901,9 @@ void activatebysector_r(int sect, DDukeActor* activator)
DukeSectIterator it(sect);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR)
if (act->s->picnum == ACTIVATOR)
{
operateactivators(act->s.lotag, -1);
operateactivators(act->s->lotag, -1);
// return;
}
}
@ -925,7 +925,7 @@ static void lotsofpopcorn(DDukeActor *actor, short wallnum, short n)
short sect, a;
sect = -1;
auto sp = &actor->s;
auto sp = actor->s;
if (wallnum < 0)
{
@ -1032,7 +1032,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
wall[wal->nextwall].cstat = 0;
auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
spawned->s.lotag = 128;
spawned->s->lotag = 128;
spawned->temp_data[1] = 2;
spawned->temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, spawned);
@ -1049,7 +1049,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
wall[wal->nextwall].cstat = 0;
auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
spawned->s.lotag = 128;
spawned->s->lotag = 128;
spawned->temp_data[1] = 2;
spawned->temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, spawned);
@ -1083,7 +1083,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
DukeSectIterator it(sect);
while (auto act = it.Next())
{
s = &act->s;
s = act->s;
if (s->lotag == 6)
{
//for (j = 0; j < 16; j++) RANDOMSCRAP(s, -1); This never spawned anything due to the -1.
@ -1095,7 +1095,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
for (i = startwall; i < endwall; i++)
sector[wall[i].nextsector].lotag = 0;
sector[s->sectnum].lotag = 0;
S_StopSound(act->s.lotag);
S_StopSound(act->s->lotag);
S_PlayActorSound(400, act);
deletesprite(act);
}
@ -1356,7 +1356,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (act->s.hitag == wall[dawallnum].lotag && act->s.lotag == 3)
if (act->s->hitag == wall[dawallnum].lotag && act->s->lotag == 3)
{
act->temp_data[2] = j;
act->temp_data[3] = darkestwall;
@ -1377,7 +1377,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
{
if (coll.type == kHitSprite)
{
switch (coll.actor->s.picnum)
switch (coll.actor->s->picnum)
{
case RRTILE2430:
case RRTILE2431:
@ -1388,7 +1388,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
case RRTILE2455:
if (isRRRA() && p->hurt_delay2 < 8)
{
p->GetActor()->s.extra -= 2;
p->GetActor()->s->extra -= 2;
p->hurt_delay2 = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
@ -1397,7 +1397,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll)
case CACTUS:
if (!isRRRA() && p->hurt_delay < 8)
{
p->GetActor()->s.extra -= 5;
p->GetActor()->s->extra -= 5;
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
@ -1495,13 +1495,13 @@ bool checkhitceiling_r(int sn)
DukeSectIterator it(sn);
while (auto act1 = it.Next())
{
auto spr1 = &act1->s;
auto spr1 = act1->s;
if (spr1->picnum == SECTOREFFECTOR && (spr1->lotag == 12 || (isRRRA() && (spr1->lotag == 47 || spr1->lotag == 48))))
{
DukeStatIterator it(STAT_EFFECTOR);
while (auto act2 = it.Next())
{
if (act2->s.hitag == spr1->hitag)
if (act2->s->hitag == spr1->hitag)
act2->temp_data[3] = 1;
}
break;
@ -1513,7 +1513,7 @@ bool checkhitceiling_r(int sn)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act1 = it.Next())
{
auto spr1 = &act1->s;
auto spr1 = act1->s;
if (spr1->hitag == (sector[sn].hitag) && spr1->lotag == 3)
{
act1->temp_data[2] = j;
@ -1536,8 +1536,8 @@ bool checkhitceiling_r(int sn)
void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{
int j, k, p;
spritetype* s = &targ->s;
auto pspr = &proj->s;
spritetype* s = targ->s;
auto pspr = proj->s;
if (isRRRA()) switch (s->picnum)
{
@ -1919,10 +1919,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
DukeSpriteIterator it;
while (auto act = it.Next())
{
if (act->s.picnum == RRTILE8679 && act->s.pal == 4)
if (act->s->picnum == RRTILE8679 && act->s->pal == 4)
{
if (act->s.lotag == s->lotag)
act->s.picnum = RRTILE8680;
if (act->s->lotag == s->lotag)
act->s->picnum = RRTILE8680;
}
}
}
@ -1945,8 +1945,8 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
DukeSpriteIterator it;
while (auto act = it.Next())
{
if (act->s.picnum == RRTILE8094)
act->s.picnum = RRTILE5088;
if (act->s->picnum == RRTILE8094)
act->s->picnum = RRTILE5088;
}
}
break;
@ -1959,10 +1959,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
DukeSpriteIterator it;
while (auto act = it.Next())
{
if (act->s.picnum == RRTILE2431 && act->s.pal == 4)
if (act->s->picnum == RRTILE2431 && act->s->pal == 4)
{
if (s->lotag == act->s.lotag)
act->s.picnum = RRTILE2451;
if (s->lotag == act->s->lotag)
act->s->picnum = RRTILE2451;
}
}
}
@ -1986,14 +1986,14 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
DukeSpriteIterator it;
while (auto act = it.Next())
{
if (act->s.picnum == RRTILE2451 && act->s.pal == 4)
if (act->s->picnum == RRTILE2451 && act->s->pal == 4)
{
if (s->lotag == act->s.lotag)
if (s->lotag == act->s->lotag)
{
fi.guts(targ, RRTILE2460, 12, myconnectindex);
fi.guts(targ, RRTILE2465, 3, myconnectindex);
act->s.xrepeat = 0;
act->s.yrepeat = 0;
act->s->xrepeat = 0;
act->s->yrepeat = 0;
s->xrepeat = 0;
s->yrepeat = 0;
}
@ -2161,7 +2161,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
for (k = 0; k < 64; k++)
{
auto j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), targ, 5);
j->s.pal = 8;
j->s->pal = 8;
}
if (s->picnum == CACTUS)
@ -2317,7 +2317,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
}
{
auto j = spawn(targ, STEAM);
j->s.z = sector[s->sectnum].floorz - (32 << 8);
j->s->z = sector[s->sectnum].floorz - (32 << 8);
}
break;
@ -2342,7 +2342,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
case PLAYERONWATER:
targ = targ->GetOwner();
if (!targ) break;
s = &targ->s;
s = targ->s;
default:
if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0)
break;
@ -2360,16 +2360,16 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
{
auto spawned = spawn(proj, JIBS6);
if (pspr->pal == 6)
spawned->s.pal = 6;
spawned->s.z += (4 << 8);
spawned->s.xvel = 16;
spawned->s.xrepeat = spawned->s.yrepeat = 24;
spawned->s.ang += 32 - (krand() & 63);
spawned->s->pal = 6;
spawned->s->z += (4 << 8);
spawned->s->xvel = 16;
spawned->s->xrepeat = spawned->s->yrepeat = 24;
spawned->s->ang += 32 - (krand() & 63);
}
auto Owner = proj->GetOwner();
if (Owner && Owner->s.picnum == APLAYER && s->picnum != DRONE)
if (Owner && Owner->s->picnum == APLAYER && s->picnum != DRONE)
if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON)
{
fi.shoot(targ, BLOODSPLAT3);
@ -2412,11 +2412,11 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
DukeStatIterator it(STAT_EFFECTOR);
while (auto act = it.Next())
{
if (act->s.picnum == CAMERA1) act->s.yvel = 0;
if (act->s->picnum == CAMERA1) act->s->yvel = 0;
}
}
auto Owner = targ->GetHitOwner();
if (!Owner || Owner->s.picnum != APLAYER)
if (!Owner || Owner->s->picnum != APLAYER)
if (ud.player_skill >= 3)
pspr->extra += (pspr->extra >> 1);
}
@ -2479,7 +2479,7 @@ void checksectors_r(int snum)
//After this point the the player effects the map with space
if (chatmodeon || p->GetActor()->s.extra <= 0) return;
if (chatmodeon || p->GetActor()->s->extra <= 0) return;
if (ud.cashman && PlayerInput(snum, SB_OPEN))
fi.lotsofmoney(p->GetActor(), 2);
@ -2553,24 +2553,24 @@ void checksectors_r(int snum)
}
return;
}
neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
}
if (p->newOwner != nullptr)
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1)
{
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite != nullptr)
{
switch (neartagsprite->s.picnum)
switch (neartagsprite->s->picnum)
{
case FEM10:
case NAKED1:
@ -2590,8 +2590,8 @@ void checksectors_r(int snum)
}
if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
neartagsector = p->GetActor()->s.sectnum;
if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag))
neartagsector = p->GetActor()->s->sectnum;
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384))
return;
@ -2609,7 +2609,7 @@ void checksectors_r(int snum)
{
if (fi.checkhitswitch(snum, -1,neartagsprite)) return;
switch (neartagsprite->s.picnum)
switch (neartagsprite->s->picnum)
{
case RRTILE8448:
if (!isRRRA()) return;
@ -2658,7 +2658,7 @@ void checksectors_r(int snum)
case RRTILE8594:
case RRTILE8595:
if (!isRRRA()) return;
neartagsprite->s.extra = 60;
neartagsprite->s->extra = 60;
S_PlayActorSound(235, neartagsprite);
return;
@ -2677,13 +2677,13 @@ void checksectors_r(int snum)
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10)))
if (p->GetActor()->s->extra <= (gs.max_player_health - (gs.max_player_health / 10)))
{
p->GetActor()->s.extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s.extra;
p->GetActor()->s->extra += gs.max_player_health / 10;
p->last_extra = p->GetActor()->s->extra;
}
else if (p->GetActor()->s.extra < gs.max_player_health)
p->GetActor()->s.extra = gs.max_player_health;
else if (p->GetActor()->s->extra < gs.max_player_health)
p->GetActor()->s->extra = gs.max_player_health;
}
else if (S_CheckActorSoundPlaying(pact, DUKE_GRUNT) == 0)
S_PlayActorSound(DUKE_GRUNT, pact);
@ -2694,16 +2694,16 @@ void checksectors_r(int snum)
neartagsprite->temp_data[0] = 1;
neartagsprite->SetOwner(p->GetActor());
if (p->GetActor()->s.extra < gs.max_player_health)
if (p->GetActor()->s->extra < gs.max_player_health)
{
p->GetActor()->s.extra++;
p->GetActor()->s->extra++;
S_PlayActorSound(DUKE_DRINKING, pact);
}
}
return;
case PLUG:
S_PlayActorSound(SHORT_CIRCUIT, pact);
p->GetActor()->s.extra -= 2 + (krand() & 3);
p->GetActor()->s->extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break;
}
@ -2736,7 +2736,7 @@ void checksectors_r(int snum)
DukeSectIterator it(neartagsector);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(neartagsector, snum))
@ -2750,18 +2750,18 @@ void checksectors_r(int snum)
FTA(41, p);
}
}
else if ((sector[p->GetActor()->s.sectnum].lotag & 16384) == 0)
else if ((sector[p->GetActor()->s->sectnum].lotag & 16384) == 0)
{
if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag))
if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag))
{
DukeSectIterator it(p->GetActor()->s.sectnum);
DukeSectIterator it(p->GetActor()->s->sectnum);
while (auto act = it.Next())
{
if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(neartagsector, snum))
operatesectors(p->GetActor()->s.sectnum, p->GetActor());
operatesectors(p->GetActor()->s->sectnum, p->GetActor());
else
{
if (neartagsprite && neartagsprite->spriteextra > 3)
@ -2905,7 +2905,7 @@ void tearitup(int sect)
DukeSectIterator it(sect);
while (auto act = it.Next())
{
if (act->s.picnum == DESTRUCTO)
if (act->s->picnum == DESTRUCTO)
{
act->picnum = SHOTSPARK1;
act->extra = 1;

View file

@ -56,7 +56,7 @@ BEGIN_DUKE_NS
// These are needed until real objects can be used for actors.
inline void* sndActor(DDukeActor* actor)
{
return actor ? &actor->s : nullptr;
return actor ? actor->s : nullptr;
}
inline DDukeActor* getSndActor(const void* source)
@ -124,7 +124,7 @@ public:
{
UnloadSound(schan->SoundID);
currentCommentarySound = 0;
currentCommentarySprite->s.picnum = DEVELOPERCOMMENTARY;
currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY;
I_SetRelativeVolume(1.0f);
UnmuteSounds();
}
@ -257,7 +257,7 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit
inline bool S_IsAmbientSFX(DDukeActor* actor)
{
return (actor->s.picnum == MUSICANDSFX && actor->s.lotag < 999);
return (actor->s->picnum == MUSICANDSFX && actor->s->lotag < 999);
}
//==========================================================================
@ -272,7 +272,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum,
// There's a lot of hackery going on here that could be mapped to rolloff and attenuation parameters.
// However, ultimately rolloff would also just reposition the sound source so this can remain as it is.
auto sp = &actor->s;
auto sp = actor->s;
int orgsndist = 0, sndang = 0, sndist = 0, explosion = 0;
auto const* snd = soundEngine->GetUserData(soundNum + 1);
int userflags = snd ? snd[kFlags] : 0;
@ -337,9 +337,9 @@ void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
}
else
{
if (c) *c = &ud.cameraactor->s.pos;
if (cs) *cs = ud.cameraactor->s.sectnum;
if (ca) *ca = ud.cameraactor->s.ang;
if (c) *c = &ud.cameraactor->s->pos;
if (cs) *cs = ud.cameraactor->s->sectnum;
if (ca) *ca = ud.cameraactor->s->ang;
}
}
@ -370,11 +370,11 @@ void DukeSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
else if (type == SOURCE_Actor)
{
auto aactor = getSndActor(source);
auto actor = aactor ? &aactor->s : nullptr;
assert(actor != nullptr);
if (actor != nullptr)
auto aspr = aactor ? aactor->s : nullptr;
assert(aspr != nullptr);
if (aspr != nullptr)
{
GetPositionInfo(aactor, chanSound - 1, camsect, campos, &actor->pos, nullptr, pos);
GetPositionInfo(aactor, chanSound - 1, camsect, campos, &aspr->pos, nullptr, pos);
/*
if (vel) // DN3D does not properly maintain this.
{
@ -431,7 +431,7 @@ void GameInterface::UpdateSounds(void)
listener.Environment = nullptr;
listener.valid = false;
}
listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : &ud.cameraactor->s;
listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : ud.cameraactor->s;
soundEngine->SetListener(listener);
}
@ -459,7 +459,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel,
if (userflags & SF_TALK)
{
if (snd_speech == 0 || (ud.multimode > 1 && actor->s.picnum == TILE_APLAYER && actor->s.yvel != screenpeek && ud.coop != 1)) return -1;
if (snd_speech == 0 || (ud.multimode > 1 && actor->s->picnum == TILE_APLAYER && actor->s->yvel != screenpeek && ud.coop != 1)) return -1;
bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan)
{
auto sid = chan->OrgID;
@ -497,7 +497,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel,
}
else
{
if (sndist > 32767 && actor->s.picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0)
if (sndist > 32767 && actor->s->picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0)
return -1;
if (underwater && (userflags & SF_TALK) == 0)
@ -505,7 +505,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel,
}
bool is_playing = soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, sndnum+1);
if (is_playing && actor->s.picnum != MUSICANDSFX)
if (is_playing && actor->s->picnum != MUSICANDSFX)
S_StopSound(sndnum, actor);
int const repeatp = (userflags & SF_LOOP);
@ -564,12 +564,12 @@ int S_PlaySound(int sndnum, int channel, EChanFlags flags, float vol)
int S_PlayActorSound(int soundNum, DDukeActor* actor, int channel, EChanFlags flags)
{
return (actor == nullptr ? S_PlaySound(soundNum, channel, flags) :
S_PlaySound3D(soundNum, actor, &actor->s.pos, channel, flags));
S_PlaySound3D(soundNum, actor, &actor->s->pos, channel, flags));
}
void S_RelinkActorSound(DDukeActor* from, DDukeActor* to)
{
FVector3 pos = GetSoundPos(&from->s.pos);
FVector3 pos = GetSoundPos(&from->s->pos);
soundEngine->RelinkSound(SOURCE_Actor, sndActor(from), sndActor(to), &pos);
}
@ -584,7 +584,7 @@ void S_StopSound(int sndNum, DDukeActor* actor, int channel)
else soundEngine->StopSound(SOURCE_Actor, actor, channel, -1);
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
if (S_IsAmbientSFX(actor) && sector[actor->s.sectnum].lotag < 3) // ST_2_UNDERWATER
if (S_IsAmbientSFX(actor) && sector[actor->s->sectnum].lotag < 3) // ST_2_UNDERWATER
actor->temp_data[0] = 0;
}
}

View file

@ -57,7 +57,7 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
I_Error(" Too many sprites spawned.");
auto act = &hittype[i];
auto s = &act->s;
auto s = act->s;
s->x = s_x;
s->y = s_y;
@ -95,7 +95,7 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch
if (s_ow)
{
act->picnum = s_ow->s.picnum;
act->picnum = s_ow->s->picnum;
act->floorz = s_ow->floorz;
act->ceilingz = s_ow->ceilingz;
}
@ -143,9 +143,9 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
if (actj)
{
auto spawned = EGS(actj->s.sectnum, actj->s.x, actj->s.y, actj->s.z, pn, 0, 0, 0, 0, 0, 0, actj, 0);
spawned->picnum = actj->s.picnum;
sp = &spawned->s;
auto spawned = EGS(actj->s->sectnum, actj->s->x, actj->s->y, actj->s->z, pn, 0, 0, 0, 0, 0, 0, actj, 0);
spawned->picnum = actj->s->picnum;
sp = spawned->s;
t = spawned->temp_data;
i = spawned->GetIndex();
}
@ -153,7 +153,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
{
i = pn;
auto act = &hittype[i];
sp = &act->s;
sp = act->s;
t = act->temp_data;
act->picnum = sp->picnum;
@ -234,7 +234,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int
void spawninitdefault(DDukeActor* actj, DDukeActor *act)
{
auto sp = &act->s;
auto sp = act->s;
auto sect = sp->sectnum;
if (gs.actorinfo[sp->picnum].scriptaddress)
@ -271,8 +271,8 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
sp->clipdist = 80;
if (actj)
{
if (actj->s.picnum == RESPAWN)
act->tempang = sp->pal = actj->s.pal;
if (actj->s->picnum == RESPAWN)
act->tempang = sp->pal = actj->s->pal;
changespritestat(act, STAT_ACTOR);
}
else changespritestat(act, STAT_ZOMBIEACTOR);
@ -287,7 +287,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
act->timetosleep = 0;
if (actj)
sp->ang = actj->s.ang;
sp->ang = actj->s->ang;
}
}
@ -300,8 +300,8 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act)
void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
{
if (actj == nullptr) return;
auto sp = &acti->s;
auto spj = &actj->s;
auto sp = acti->s;
auto spj = actj->s;
if (beam)
{
sp->xrepeat = 31;
@ -342,7 +342,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
{
auto sp = &acti->s;
auto sp = acti->s;
short s1 = sp->sectnum;
updatesector(sp->x + 108, sp->y + 108, &s1);
@ -382,7 +382,7 @@ int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
void initfootprint(DDukeActor* actj, DDukeActor* acti)
{
auto sp = &acti->s;
auto sp = acti->s;
int sect = sp->sectnum;
if (actj)
{
@ -410,8 +410,8 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
}
else { sp->xrepeat = sp->yrepeat = 0; return; }
sp->cstat = 32 + ((ps[actj->s.yvel].footprintcount & 1) << 2);
sp->ang = actj->s.ang;
sp->cstat = 32 + ((ps[actj->s->yvel].footprintcount & 1) << 2);
sp->ang = actj->s->ang;
}
sp->z = sector[sect].floorz;
@ -430,12 +430,12 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
{
auto sp = &acti->s;
auto sp = acti->s;
int sect = sp->sectnum;
auto t = acti->temp_data;
if (actj)
{
auto spj = &actj->s;
auto spj = actj->s;
short snum, a;
if (spj->picnum == TILE_APLAYER)
@ -484,7 +484,7 @@ void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
{
auto sp = &acti->s;
auto sp = acti->s;
int sect = sp->sectnum;
auto t = acti->temp_data;
sp->cstat |= 64 | 257;
@ -500,7 +500,7 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
DukeStatIterator it(STAT_DEFAULT);
while (auto act = it.Next())
{
auto ss = &act->s;
auto ss = act->s;
if (ss->picnum == CRANEPOLE && sp->hitag == (ss->hitag))
{
msy[tempwallptr + 2] = ActorToScriptIndex(act);
@ -537,13 +537,13 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
{
auto sp = &actor->s;
auto sp = actor->s;
int sect = sp->sectnum;
auto t = actor->temp_data;
if (actj && (actj->s.statnum == 10 || actj->s.statnum == 1))
if (actj && (actj->s->statnum == 10 || actj->s->statnum == 1))
{
sp->shade = 32;
if (actj->s.pal != 1)
if (actj->s->pal != 1)
{
sp->pal = 2;
sp->z -= (18 << 8);
@ -573,7 +573,7 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
{
auto sp = &actor->s;
auto sp = actor->s;
int sect = sp->sectnum;
auto t = actor->temp_data;
if (isrecon)
@ -621,7 +621,7 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
void spawneffector(DDukeActor* actor)
{
auto sp = &actor->s;
auto sp = actor->s;
int sect = sp->sectnum;
auto t = actor->temp_data;
int startwall, endwall, x, y, d, s, clostest;
@ -642,8 +642,8 @@ void spawneffector(DDukeActor* actor)
DukeLinearSpriteIterator it;
while (auto act2 = it.Next())
{
if (act2->s.statnum < MAXSTATUS && act2->s.picnum == SECTOREFFECTOR && (act2->s.lotag == SE_7_TELEPORT || act2->s.lotag == SE_23_ONE_WAY_TELEPORT) &&
actor != act2 && act2->s.hitag == sp->hitag)
if (act2->s->statnum < MAXSTATUS && act2->s->picnum == SECTOREFFECTOR && (act2->s->lotag == SE_7_TELEPORT || act2->s->lotag == SE_23_ONE_WAY_TELEPORT) &&
actor != act2 && act2->s->hitag == sp->hitag)
{
actor->SetOwner(act2);
break;
@ -976,7 +976,7 @@ void spawneffector(DDukeActor* actor)
bool found = false;
while (auto act2 = it.Next())
{
auto spr = &act2->s;
auto spr = act2->s;
if (spr->statnum < MAXSTATUS)
if (spr->picnum == SECTOREFFECTOR &&
spr->lotag == SE_1_PIVOT &&
@ -1094,17 +1094,17 @@ void spawneffector(DDukeActor* actor)
case SE_15_SLIDING_DOOR:
case SE_16_REACTOR:
case SE_26:
setsectinterpolate(actor->s.sectnum);
setsectinterpolate(actor->s->sectnum);
break;
case SE_29_WAVES:
StartInterpolation(actor->s.sectnum, Interp_Sect_Floorheinum);
StartInterpolation(actor->s.sectnum, Interp_Sect_Floorz);
StartInterpolation(actor->s->sectnum, Interp_Sect_Floorheinum);
StartInterpolation(actor->s->sectnum, Interp_Sect_Floorz);
break;
}
if ((!isRR() && actor->s.lotag >= 40 && actor->s.lotag <= 45) ||
(isRRRA() && actor->s.lotag >= 150 && actor->s.lotag <= 155))
if ((!isRR() && actor->s->lotag >= 40 && actor->s->lotag <= 45) ||
(isRRRA() && actor->s->lotag >= 150 && actor->s->lotag <= 155))
changespritestat(actor, STAT_RAROR);
else
changespritestat(actor, STAT_EFFECTOR);
@ -1121,7 +1121,7 @@ void lotsofglass(DDukeActor *actor, int wallnum, int n)
{
int j, xv, yv, z, x1, y1, a;
short sect;
auto sp = &actor->s;
auto sp = actor->s;
sect = -1;
@ -1174,14 +1174,14 @@ void lotsofglass(DDukeActor *actor, int wallnum, int n)
void spriteglass(DDukeActor* actor, int n)
{
auto sp = &actor->s;
auto sp = actor->s;
for (int j = n; j > 0; j--)
{
int a = krand() & 2047;
int z = sp->z - ((krand() & 16) << 8);
auto k = EGS(sp->sectnum, sp->x, sp->y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5);
k->s.pal = sp->pal;
k->s->pal = sp->pal;
}
}
@ -1195,7 +1195,7 @@ void ceilingglass(DDukeActor* actor, int sectnum, int n)
{
int j, xv, yv, z, x1, y1;
int a, s, startwall, endwall;
auto sp = &actor->s;
auto sp = actor->s;
startwall = sector[sectnum].wallptr;
endwall = startwall + sector[sectnum].wallnum;
@ -1230,7 +1230,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n)
int j, xv, yv, z, x1, y1;
short sect = -1;
int a;;
auto sp = &actor->s;
auto sp = actor->s;
if (wallnum < 0)
{
@ -1238,7 +1238,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n)
{
a = krand() & 2047;
auto k = EGS(sp->sectnum, sp->x, sp->y, sp->z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5);
k->s.pal = krand() & 15;
k->s->pal = krand() & 15;
}
return;
}
@ -1261,7 +1261,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n)
z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = sp->ang - 1024;
auto k = EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), actor, 5);
k->s.pal = krand() & 7;
k->s->pal = krand() & 7;
}
}

View file

@ -50,8 +50,8 @@ int spawn_d(int j, int pn)
if (!(i & 0x1000000)) return i;
i &= 0xffffff;
auto act = &hittype[i];
auto sp = &act->s;
auto spj = j < 0 ? nullptr : &actj->s;
auto sp = act->s;
auto spj = j < 0 ? nullptr : actj->s;
auto t = act->temp_data;
int sect = sp->sectnum;

View file

@ -45,8 +45,8 @@ int spawn_r(int j, int pn)
if (!(i & 0x1000000)) return i;
i &= 0xffffff;
auto act = &hittype[i];
auto sp = &act->s;
auto spj = j < 0? nullptr : &actj->s;
auto sp = act->s;
auto spj = j < 0? nullptr : actj->s;
auto t = act->temp_data;
int sect = sp->sectnum;

View file

@ -36,11 +36,11 @@ struct weaponhit
};
int temp_data[6];
weaponhit* temp_actor, *seek_actor;
spritetype& s; // direct reference to the corresponding sprite.
spritetype* s; // direct reference to the corresponding sprite.
static weaponhit* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself.
weaponhit() : s(sprite_s[this - array()]) {} // little trick to initialize the reference automatically. ;)
weaponhit() : s(&sprite_s[this - array()]) {} // little trick to initialize the reference automatically. ;)
weaponhit(const weaponhit& other) = delete; // we also do not want to allow copies.
weaponhit& operator=(const weaponhit& other) = delete;
void clear()
@ -55,12 +55,12 @@ struct weaponhit
// Wrapper around some ugliness. The 'owner' field gets abused by some actors, so better wrap its real use in access functions to keep things in order.
inline weaponhit* GetOwner()
{
return s.owner < 0 ? nullptr : &array()[s.owner];
return s->owner < 0 ? nullptr : &array()[s->owner];
}
inline void SetOwner(weaponhit* a)
{
s.owner = a? a->GetIndex() : -1;
s->owner = a? a->GetIndex() : -1;
}
// same for the 'hittype' owner - which is normally the shooter in an attack.
@ -77,18 +77,18 @@ struct weaponhit
// This used the Owner field - better move this to something more safe.
inline bool IsActiveCrane()
{
return s.owner == -2;
return s->owner == -2;
}
inline void SetActiveCrane(bool yes)
{
s.owner = yes ? -2 : -1;
s->owner = yes ? -2 : -1;
}
int PlayerIndex() const
{
// only valid for real players - just here to abstract yvel.
return s.yvel;
return s->yvel;
}

View file

@ -243,7 +243,7 @@ struct GameInterface : ::GameInterface
void GetInput(InputPacket* packet, ControlInfo* const hidInput) override;
void Startup() override;
const char* GenericCheat(int player, int cheat) override;
void NewGame(MapRecord *map, int skill) override;
void NewGame(MapRecord *map, int skill, bool) override;
void LevelCompleted(MapRecord *map, int skill) override;
void NextLevel(MapRecord *map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override;

View file

@ -212,12 +212,13 @@ void GameInterface::NextLevel(MapRecord *map, int skill)
}
void GameInterface::NewGame(MapRecord *map, int skill)
void GameInterface::NewGame(MapRecord *map, int skill, bool frommenu)
{
// start a new game on the given level
InitNewGame();
if (map->levelNumber == 1) STAT_StartNewGame("Exhumed", 1);
Intermission(nullptr, map);
if (frommenu) Intermission(nullptr, map);
else NextLevel(map, skill);
}
void GameInterface::LevelCompleted(MapRecord *map, int skill)

View file

@ -610,7 +610,7 @@ void GameInterface::NextLevel(MapRecord *map, int skill)
//
//---------------------------------------------------------------------------
void GameInterface::NewGame(MapRecord *map, int skill)
void GameInterface::NewGame(MapRecord *map, int skill, bool)
{
if (skill != -1) Skill = skill;
ShadowWarrior::NewGame = true;

View file

@ -2233,7 +2233,7 @@ struct GameInterface : ::GameInterface
const char* GenericCheat(int player, int cheat) override;
void LevelCompleted(MapRecord *map, int skill) override;
void NextLevel(MapRecord *map, int skill) override;
void NewGame(MapRecord *map, int skill) override;
void NewGame(MapRecord *map, int skill, bool) override;
bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override;
int playerKeyMove() override { return 35; }
void WarpToCoords(int x, int y, int z, int a, int h) override;