mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
— New utilities for better abstraction added.
This commit is contained in:
parent
d115d90961
commit
323b5441d5
3 changed files with 63 additions and 35 deletions
|
@ -194,39 +194,6 @@ inline bool validWallIndex(int wallnum)
|
|||
return wallnum >= 0 && wallnum < numwalls;
|
||||
}
|
||||
|
||||
inline sectortype* spritetype::sector() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
return !validSectorIndex(sectnum) ? nullptr : &::sector[sectnum];
|
||||
#else
|
||||
return &::sector[sectnum];
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool spritetype::insector() const
|
||||
{
|
||||
return validSectorIndex(sectnum);
|
||||
}
|
||||
|
||||
inline sectortype* walltype::nextSector() const
|
||||
{
|
||||
return &::sector[nextsector];
|
||||
}
|
||||
|
||||
inline walltype* walltype::nextWall() const
|
||||
{
|
||||
return &::wall[nextwall];
|
||||
}
|
||||
|
||||
inline walltype* walltype::point2Wall() const
|
||||
{
|
||||
return &::wall[point2];
|
||||
}
|
||||
|
||||
inline walltype* sectortype::firstWall() const
|
||||
{
|
||||
return &wall[wallptr];
|
||||
}
|
||||
|
||||
EXTERN int32_t randomseed;
|
||||
|
||||
|
@ -745,12 +712,42 @@ inline bool testgotpic(int32_t tilenume, bool reset = false)
|
|||
return res;
|
||||
}
|
||||
|
||||
inline sectortype* spritetype::sector() const
|
||||
{
|
||||
return !validSectorIndex(sectnum)? nullptr : &::sector[sectnum];
|
||||
}
|
||||
|
||||
inline bool spritetype::insector() const
|
||||
{
|
||||
return validSectorIndex(sectnum);
|
||||
return validSectorIndex(sectnum);
|
||||
}
|
||||
|
||||
inline sectortype* walltype::nextSector() const
|
||||
{
|
||||
return !validSectorIndex(nextsector)? nullptr : &::sector[nextsector];
|
||||
}
|
||||
|
||||
inline walltype* walltype::nextWall() const
|
||||
{
|
||||
return !validWallIndex(nextwall)? nullptr : &::wall[nextwall];
|
||||
}
|
||||
|
||||
inline sectortype* walltype::sectorp() const
|
||||
{
|
||||
return &::sector[sector]; // cannot be -1 in a proper map.
|
||||
}
|
||||
|
||||
inline walltype* walltype::point2Wall() const
|
||||
{
|
||||
return &::wall[point2]; // cannot be -1 in a proper map.
|
||||
}
|
||||
|
||||
inline walltype* sectortype::firstWall() const
|
||||
{
|
||||
return &wall[wallptr]; // cannot be -1 in a proper map
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "iterators.h"
|
||||
|
||||
|
|
|
@ -208,7 +208,8 @@ struct walltype
|
|||
void addxpan(float add) { xpan_ = fmodf(xpan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
void addypan(float add) { ypan_ = fmodf(ypan_ + add + 512, 256); } // +512 is for handling negative offsets
|
||||
sectortype* nextSector() const;
|
||||
walltype* nextWall() const;
|
||||
sectortype* sectorp() const;
|
||||
walltype* nextWall() const;
|
||||
walltype* point2Wall() const;
|
||||
vec2_t delta() const { return point2Wall()->pos - pos; }
|
||||
vec2_t center() const { return(point2Wall()->pos + pos) / 2; }
|
||||
|
|
|
@ -82,6 +82,36 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class BFSSectorSearch : public BFSSearch
|
||||
{
|
||||
public:
|
||||
|
||||
BFSSectorSearch(sectortype* startnode) : BFSSearch(numsectors, sector.IndexOf(startnode))
|
||||
{
|
||||
}
|
||||
|
||||
bool Check(sectortype* index) const
|
||||
{
|
||||
return BFSSearch::Check(sector.IndexOf(index));
|
||||
}
|
||||
|
||||
void Set(sectortype* index)
|
||||
{
|
||||
BFSSearch::Set(sector.IndexOf(index));
|
||||
}
|
||||
|
||||
sectortype* GetNext()
|
||||
{
|
||||
unsigned ret = BFSSearch::GetNext();
|
||||
return ret == EOL? nullptr : §or[ret];
|
||||
}
|
||||
|
||||
void Add(sectortype* elem)
|
||||
{
|
||||
BFSSearch::Add(sector.IndexOf(elem));
|
||||
}
|
||||
};
|
||||
|
||||
extern int cameradist, cameraclock;
|
||||
|
||||
void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false);
|
||||
|
|
Loading…
Reference in a new issue