mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 15:11:46 +00:00
- moved all 'sectorptr - &level.sectors[0]' constructs into a subfunction.
This commit is contained in:
parent
c02281a439
commit
91981e25a8
13 changed files with 23 additions and 30 deletions
|
@ -764,7 +764,7 @@ void ProcessEDSectors()
|
|||
{
|
||||
if (lines[i].special == Static_Init && lines[i].args[1] == Init_EDSector)
|
||||
{
|
||||
sectorrecord[lines[i].frontsector - &level.sectors[0]] = lines[i].args[0];
|
||||
sectorrecord[lines[i].frontsector->Index()] = lines[i].args[0];
|
||||
lines[i].special = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -448,7 +448,6 @@ struct FLevelLocals
|
|||
bool IsFreelookAllowed() const;
|
||||
};
|
||||
|
||||
|
||||
struct cluster_info_t
|
||||
{
|
||||
int cluster;
|
||||
|
|
|
@ -381,7 +381,7 @@ static void PrepareTransparentDoors(sector_t * sector)
|
|||
|
||||
static void AddToVertex(const sector_t * sec, TArray<int> & list)
|
||||
{
|
||||
int secno = int(sec-&level.sectors[0]);
|
||||
int secno = sec->Index();
|
||||
|
||||
for(unsigned i=0;i<list.Size();i++)
|
||||
{
|
||||
|
|
|
@ -350,7 +350,7 @@ void P_RunEffects ()
|
|||
{
|
||||
if (players[consoleplayer].camera == NULL) return;
|
||||
|
||||
int pnum = int(players[consoleplayer].camera->Sector - &level.sectors[0]) * level.sectors.Size();
|
||||
int pnum = players[consoleplayer].camera->Sector->Index() * level.sectors.Size();
|
||||
|
||||
AActor *actor;
|
||||
TThinkerIterator<AActor> iterator;
|
||||
|
@ -360,7 +360,7 @@ void P_RunEffects ()
|
|||
if (actor->effects)
|
||||
{
|
||||
// Only run the effect if the actor is potentially visible
|
||||
int rnum = pnum + int(actor->Sector - &level.sectors[0]);
|
||||
int rnum = pnum + actor->Sector->Index();
|
||||
if (rejectmatrix == NULL || !(rejectmatrix[rnum>>3] & (1 << (rnum & 7))))
|
||||
P_RunEffect (actor, actor->effects);
|
||||
}
|
||||
|
|
|
@ -3961,9 +3961,9 @@ void AActor::Tick ()
|
|||
sector_t *sec = node->m_sector;
|
||||
DVector2 scrollv;
|
||||
|
||||
if (level.Scrolls.Size() > unsigned(sec-&level.sectors[0]))
|
||||
if (level.Scrolls.Size() > unsigned(sec->Index()))
|
||||
{
|
||||
scrollv = level.Scrolls[sec - &level.sectors[0]];
|
||||
scrollv = level.Scrolls[sec->Index()];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -406,8 +406,7 @@ void P_SpawnPushers ()
|
|||
if (thing->GetClass()->TypeName == NAME_PointPusher ||
|
||||
thing->GetClass()->TypeName == NAME_PointPuller)
|
||||
{
|
||||
new DPusher (DPusher::p_push, l->args[3] ? l : NULL, l->args[2],
|
||||
0, thing, int(thing->Sector - &level.sectors[0]));
|
||||
new DPusher (DPusher::p_push, l->args[3] ? l : NULL, l->args[2], 0, thing, thing->Sector->Index());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -441,7 +441,7 @@ void P_SpawnScrollers(void)
|
|||
{
|
||||
// if 1, then displacement
|
||||
// if 2, then accelerative (also if 3)
|
||||
control = int(l->sidedef[0]->sector - &level.sectors[0]);
|
||||
control = l->sidedef[0]->sector->Index();
|
||||
if (l->args[1] & 2)
|
||||
accel = 1;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ void P_SpawnScrollers(void)
|
|||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 1))
|
||||
{
|
||||
new DScroller(EScroll::sc_ceiling, -dx, dy, control, int(line->frontsector - &level.sectors[0]), accel);
|
||||
new DScroller(EScroll::sc_ceiling, -dx, dy, control, line->frontsector->Index(), accel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -498,7 +498,7 @@ void P_SpawnScrollers(void)
|
|||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 2))
|
||||
{
|
||||
new DScroller(EScroll::sc_floor, -dx, dy, control, int(line->frontsector - &level.sectors[0]), accel);
|
||||
new DScroller(EScroll::sc_floor, -dx, dy, control, line->frontsector->Index(), accel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ void P_SpawnScrollers(void)
|
|||
|
||||
if (line->args[0] == l->args[0] && (line->args[1] & 4))
|
||||
{
|
||||
new DScroller (EScroll::sc_carry, dx, dy, control, int(line->frontsector-&level.sectors[0]), accel);
|
||||
new DScroller (EScroll::sc_carry, dx, dy, control, line->frontsector->Index(), accel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3179,11 +3179,11 @@ static void P_GroupLines (bool buildmap)
|
|||
auto li = &lines[i];
|
||||
if (li->frontsector != NULL)
|
||||
{
|
||||
li->frontsector->Lines[linesDoneInEachSector[li->frontsector - &level.sectors[0]]++] = li;
|
||||
li->frontsector->Lines[linesDoneInEachSector[li->frontsector->Index()]++] = li;
|
||||
}
|
||||
if (li->backsector != NULL && li->backsector != li->frontsector)
|
||||
{
|
||||
li->backsector->Lines[linesDoneInEachSector[li->backsector - &level.sectors[0]]++] = li;
|
||||
li->backsector->Lines[linesDoneInEachSector[li->backsector->Index()]++] = li;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -821,7 +821,7 @@ bool P_CheckSight (AActor *t1, AActor *t2, int flags)
|
|||
|
||||
const sector_t *s1 = t1->Sector;
|
||||
const sector_t *s2 = t2->Sector;
|
||||
int pnum = int(s1 - &level.sectors[0]) * level.sectors.Size() + int(s2 - &level.sectors[0]);
|
||||
int pnum = int(s1->Index()) * level.sectors.Size() + int(s2->Index());
|
||||
|
||||
//
|
||||
// check for trivial rejection
|
||||
|
|
|
@ -433,7 +433,7 @@ void P_PlayerInSpecialSector (player_t *player, sector_t * sector)
|
|||
if (sector->isSecret())
|
||||
{
|
||||
sector->ClearSecret();
|
||||
P_GiveSecret(player->mo, true, true, int(sector - &level.sectors[0]));
|
||||
P_GiveSecret(player->mo, true, true, sector->Index());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
|
||||
case dScroll_EastLavaDamage:
|
||||
P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX);
|
||||
P_CreateScroller(EScroll::sc_floor, -4., 0, -1, int(sector - &level.sectors[0]), 0);
|
||||
P_CreateScroller(EScroll::sc_floor, -4., 0, -1, sector->Index(), 0);
|
||||
keepspecial = true;
|
||||
break;
|
||||
|
||||
|
@ -1215,14 +1215,14 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
int i = sector->special - Scroll_North_Slow;
|
||||
double dx = hexenScrollies[i][0] / 2.;
|
||||
double dy = hexenScrollies[i][1] / 2.;
|
||||
P_CreateScroller(EScroll::sc_floor, dx, dy, -1, int(sector-&level.sectors[0]), 0);
|
||||
P_CreateScroller(EScroll::sc_floor, dx, dy, -1, sector->Index(), 0);
|
||||
}
|
||||
else if (sector->special >= Carry_East5 &&
|
||||
sector->special <= Carry_East35)
|
||||
{ // Heretic scroll special
|
||||
// Only east scrollers also scroll the texture
|
||||
P_CreateScroller(EScroll::sc_floor,
|
||||
-0.5 * (1 << ((sector->special & 0xff) - Carry_East5)), 0, -1, int(sector-&level.sectors[0]), 0);
|
||||
-0.5 * (1 << ((sector->special & 0xff) - Carry_East5)), 0, -1, sector->Index(), 0);
|
||||
}
|
||||
keepspecial = true;
|
||||
break;
|
||||
|
|
|
@ -45,11 +45,6 @@ FTagManager tagManager;
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static inline int sectindex(const sector_t *sector)
|
||||
{
|
||||
return (int)(intptr_t)(sector - &level.sectors[0]);
|
||||
}
|
||||
|
||||
static inline int lineindex(const line_t *line)
|
||||
{
|
||||
return (int)(intptr_t)(line - lines);
|
||||
|
@ -194,7 +189,7 @@ void FTagManager::HashTags()
|
|||
|
||||
bool FTagManager::SectorHasTags(const sector_t *sector) const
|
||||
{
|
||||
int i = sectindex(sector);
|
||||
int i = sector->Index();
|
||||
return SectorHasTags(i);
|
||||
}
|
||||
|
||||
|
@ -206,7 +201,7 @@ bool FTagManager::SectorHasTags(const sector_t *sector) const
|
|||
|
||||
int FTagManager::GetFirstSectorTag(const sector_t *sect) const
|
||||
{
|
||||
int i = sectindex(sect);
|
||||
int i = sect->Index();
|
||||
return SectorHasTags(i) ? allTags[startForSector[i]].tag : 0;
|
||||
}
|
||||
|
||||
|
@ -238,7 +233,7 @@ bool FTagManager::SectorHasTag(int i, int tag) const
|
|||
|
||||
bool FTagManager::SectorHasTag(const sector_t *sector, int tag) const
|
||||
{
|
||||
return SectorHasTag(sectindex(sector), tag);
|
||||
return SectorHasTag(sector->Index(), tag);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
if (tag == 0)
|
||||
{
|
||||
searchtag = INT_MIN;
|
||||
start = (line == NULL || line->backsector == NULL)? -1 : (int)(line->backsector - &level.sectors[0]);
|
||||
start = (line == NULL || line->backsector == NULL)? -1 : line->backsector->Index();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef __R_DEFS_H__
|
||||
#define __R_DEFS_H__
|
||||
|
||||
#include <forward_list>
|
||||
#include "doomdef.h"
|
||||
#include "templates.h"
|
||||
#include "memarena.h"
|
||||
|
@ -660,6 +659,7 @@ public:
|
|||
double FindLowestCeilingPoint(vertex_t **v) const;
|
||||
double FindHighestFloorPoint(vertex_t **v) const;
|
||||
void RemoveForceField();
|
||||
int Index() const { return int(this - &level.sectors[0]); }
|
||||
|
||||
void AdjustFloorClip () const;
|
||||
void SetColor(int r, int g, int b, int desat);
|
||||
|
|
Loading…
Reference in a new issue