- some leftover shorts plus utilities that ended up unused but may be useful later.

This commit is contained in:
Christoph Oelckers 2021-11-07 16:46:23 +01:00
parent 35b9318580
commit ae08ae1d8d
12 changed files with 68 additions and 27 deletions

View file

@ -168,6 +168,11 @@ inline walltype* walltype::nextWall() const
return &::wall[nextwall];
}
inline walltype* walltype::point2Wall() const
{
return &::wall[point2];
}
inline walltype* sectortype::firstWall() const
{
return &wall[wallptr];

View file

@ -138,6 +138,7 @@ struct walltype
void addypan(float add) { ypan_ = fmodf(ypan_ + add + 512, 256); } // +512 is for handling negative offsets
sectortype* nextSector() const;
walltype* nextWall() const;
walltype* point2Wall() const;
bool twoSided() const { return nextsector >= 0; }
#if 0

View file

@ -152,3 +152,11 @@ inline int I_GetBuildTime()
{
return I_GetTime(120);
}
inline int32_t getangle(walltype* wal)
{
return getangle(
wall[wal->point2].x - wal->x,
wall[wal->point2].y - wal->y);
}

View file

@ -278,6 +278,19 @@ struct Collision
else { index = -1; actor = &bloodActors[value & kHitIndexMask]; }
return type;
}
walltype* wall()
{
assert(type == kHitWall);
return &::wall[index];
}
sectortype* sector()
{
assert(type == kHitSector);
return &::sector[index];
}
};
inline DBloodActor* getUpperLink(int sect)

View file

@ -40,7 +40,6 @@ BEGIN_DUKE_NS
void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int a, int smoothratio)
{
int i, j, k, p;
short sect;
int l, t1, t3, t4;
spritetype* s;
tspritetype* t;
@ -174,7 +173,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t->pos = s->interpolatedvec3(smoothratio);
}
sect = s->sectnum;
//sect = s->sectnum;
auto sectp = s->sector();
t1 = h->temp_data[1];
t3 = h->temp_data[3];
t4 = h->temp_data[4];
@ -485,8 +485,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
PALONLY:
if (sector[sect].floorpal)
copyfloorpal(t, &sector[sect]);
if (sectp->floorpal)
copyfloorpal(t, sectp);
if (!h->GetOwner()) continue;
@ -617,8 +617,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
t->picnum = s->yvel;
else t->picnum += h->temp_data[0];
if (sector[sect].floorpal)
copyfloorpal(t, &sector[sect]);
if (sectp->floorpal)
copyfloorpal(t, sectp);
break;
case WATERBUBBLE:
@ -630,8 +630,8 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
default:
default_case:
if (sector[sect].floorpal)
copyfloorpal(t, &sector[sect]);
if (sectp->floorpal)
copyfloorpal(t, sectp);
break;
}
@ -740,9 +740,9 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
{
int daz;
if (isRRRA() && sector[sect].lotag == 160) continue;
if ((sector[sect].lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE)
daz = sector[sect].floorz;
if (isRRRA() && sectp->lotag == 160) continue;
if ((sectp->lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE)
daz = sectp->floorz;
else
daz = h->floorz;

View file

@ -19,6 +19,7 @@
#include "soundefs.h"
#include "gamestruct.h"
#include "v_draw.h"
#include "gamefuncs.h"
BEGIN_DUKE_NS

View file

@ -136,7 +136,7 @@ int madenoise(int playerNum);
int haskey(int sect, int snum);
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
void breakwall(short newpn, DDukeActor* spr, short dawallnum);
void breakwall(int newpn, DDukeActor* spr, int dawallnum);
int callsound(int sectnum,DDukeActor* snum);
int hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
int findplayer(const DDukeActor* s, int* dist);

View file

@ -3330,8 +3330,8 @@ void processinput_r(int snum)
{
int i, k, doubvel, fz, cz, truefdist;
Collision chz, clz;
char shrunk;
short psect, psectlotag;
bool shrunk;
int psect, psectlotag;
auto p = &ps[snum];
auto pact = p->GetActor();

View file

@ -418,15 +418,15 @@ void cacheit_r(void)
void prelevel_r(int g)
{
struct player_struct* p;
short i;
short j;
short startwall;
short endwall;
short lotaglist;
int i;
int j;
int startwall;
int endwall;
int lotaglist;
short lotags[65];
int speed;
int dist;
short sound;
int sound;
sound = 0;
prelevel_common(g);

View file

@ -981,7 +981,7 @@ void operatesectors(int sn, DDukeActor *actor)
case ST_30_ROTATE_RISE_BRIDGE:
{
auto act = ScriptIndexToActor(sector[sn].hitag);
auto act = ScriptIndexToActor(sptr->hitag);
if (!act) break;
if (act->tempang == 0 || act->tempang == 256) callsound(sn, actor);
if (act->s->extra == 1) act->s->extra = 3;
@ -991,7 +991,7 @@ void operatesectors(int sn, DDukeActor *actor)
case ST_31_TWO_WAY_TRAIN:
{
auto act = ScriptIndexToActor(sector[sn].hitag);
auto act = ScriptIndexToActor(sptr->hitag);
if (!act) break;
if (act->temp_data[4] == 0)
act->temp_data[4] = 1;
@ -1218,7 +1218,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial
//
//---------------------------------------------------------------------------
void breakwall(short newpn, DDukeActor* spr, short dawallnum)
void breakwall(int newpn, DDukeActor* spr, int dawallnum)
{
wall[dawallnum].picnum = newpn;
S_PlayActorSound(VENT_BUST, spr);

View file

@ -199,7 +199,7 @@ struct player_struct
int aim_mode, ftt;
int cursectnum, one_parallax_sectnum; // sector references. Make them pointers later?
int cursectnum, one_parallax_sectnum, access_wallnum; // wall + sector references. Make them pointers later?
short last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
@ -207,7 +207,7 @@ struct player_struct
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum;
short ftq;
short got_access, weapon_ang, firstaid_amount;
short i;
short over_shoulder_on, fist_incs;
@ -374,6 +374,19 @@ struct Collision
else { index = -1; actor = &hittype[value & kHitIndexMask]; }
return type;
}
walltype* wall() const
{
assert(type == kHitWall);
return &::wall[index];
}
sectortype* sector() const
{
assert(type == kHitSector);
return &::sector[index];
}
};

View file

@ -159,7 +159,7 @@ struct DukePlayer
native int randomflamex, crack_time;
native int aim_mode, ftt;
native int cursectnum, one_parallax_sectnum;
native int cursectnum, one_parallax_sectnum, access_wallnum;
native int16 last_extra, subweapon;
native int16 ammo_amount[DukeWpn.MAX_WEAPONS], frag, fraggedself;
@ -167,7 +167,7 @@ struct DukePlayer
native int16 curr_weapon, last_weapon, tipincs, wantweaponfire;
native int16 holoduke_amount, hurt_delay, hbomb_hold_delay;
native int16 jumping_counter, airleft, knee_incs, access_incs;
native int16 ftq, access_wallnum;
native int16 ftq;
native int16 got_access, weapon_ang, firstaid_amount;
native int16 i;
native int16 over_shoulder_on, fist_incs;