complete workover of nnextsif to adapt to Raze's organization and to get rid of the global work state.

This commit is contained in:
Christoph Oelckers 2023-10-14 17:53:50 +02:00
parent e889f16803
commit f0131a9fb5
6 changed files with 2106 additions and 2206 deletions

View file

@ -126,10 +126,7 @@ static void markgcroots()
GC::MarkArray(gSightSpritesList, gSightSpritesCount);
GC::MarkArray(gPhysSpritesList, gPhysSpritesCount);
GC::MarkArray(gImpactSpritesList, gImpactSpritesCount);
for (auto& cond : gConditions)
{
for (auto& obj : cond.objects) obj.obj.Mark();
}
//MarkModernConditions();
MarkSprInSect();
#endif
for (auto& evobj : rxBucket)

View file

@ -28,12 +28,6 @@ BEGIN_BLD_NS
// Object storage helper that packs the value into 8 bytes. This depends on pointer alignment being a multiple of 8 bytes for actors
class EventObject
{
enum EType
{
Actor = 0,
Sector = 1,
Wall = 2
};
union
{
DBloodActor* ActorP;
@ -41,6 +35,14 @@ class EventObject
};
public:
enum EType
{
Actor = 0,
Sector = 1,
Wall = 2,
Invalid = 7
};
EventObject() = default;
explicit EventObject(std::nullptr_t) { index = -1; }
explicit EventObject(DBloodActor* actor_) { ActorP = actor_; assert(isActor()); }
@ -50,10 +52,12 @@ public:
bool isActor() const { return (index & 7) == Actor; }
bool isSector() const { return (index & 7) == Sector; }
bool isWall() const { return (index & 7) == Wall; }
int type() const { return index & 7; }
DBloodActor* actor() const { assert(isActor()); return ActorP; }
DBloodActor* actor() { assert(isActor()); return GC::ReadBarrier(ActorP); }
sectortype* sector() { assert(isSector()); return &::sector[index >> 8]; }
walltype* wall() { assert(isWall()); return &::wall[index >> 8]; }
sectortype* sector() const { assert(isSector()); return &::sector[index >> 8]; }
walltype* wall() const { assert(isWall()); return &::wall[index >> 8]; }
int rawindex() { return int(index >> 8); }
bool operator==(const EventObject& other) const { return index == other.index; }

View file

@ -424,6 +424,8 @@ inline bool rngok(int val, int min, int max)
return (val > min && val < max);
}
inline int EVTIME2TICKS(int x) { return ((x * 120) / 10); }
////////////////////////////////////////////////////////////////////////
// This file provides modern features for mappers.
// For full documentation please visit http://cruo.bloodgame.ru/xxsystem

File diff suppressed because it is too large Load diff

View file

@ -39,7 +39,6 @@ BEGIN_BLD_NS
void conditionsInit(bool bSaveLoad);
void conditionsError(DBloodActor* actor, const char* pFormat, ...);
void conditionsTrackingAlloc(bool bSaveLoad);
void conditionsTrackingClear();
void conditionsTrackingProcess();

View file

@ -83,7 +83,7 @@ int enumStr(int nOffs, const char* str, char* key, char* val)
if (isarray(str))
{
t = strlen(str);
t = (int)strlen(str);
strcpy(string, str);
pStr = &string[(string[0] == '(')];
@ -117,7 +117,9 @@ int enumStr(int nOffs, const char* str, char* key, char* val)
{
if ((nOffs = enumStr(nOffs, str, tval)) != 0)
{
t = strlen(tval); strcat(val, ","); strcat(val, tval);
t = (int)strlen(tval);
strcat(val, ",");
strcat(val, tval);
if (tval[t - 1] != ')')
continue;
}
@ -151,7 +153,7 @@ int enumStr(int nOffs, const char* str, char* val)
char string[256];
int t;
t = strlen(str);
t = (int)strlen(str);
strcpy(string, str);
string[t] = '\0';
@ -170,7 +172,7 @@ void removeSpaces(char* str)
{
if (str)
{
int t = strlen(str);
int t = (int)strlen(str);
for (int i = t - 1; i >= 0; i--)
{
if (!isspace(str[i]))
@ -206,7 +208,7 @@ char isarray(const char* str, int* nLen)
if (str)
{
int l = strlen(str);
int l = (int)strlen(str);
if (l && str[0] == '(' && str[l - 1] == ')')
{
if (nLen)
@ -228,7 +230,7 @@ char isperc(const char* str)
{
if (str)
{
int l = strlen(str);
int l = (int)strlen(str);
if (--l > 0 && str[l] == '%')
{
while (--l > 0)
@ -249,7 +251,7 @@ char isfix(const char* str, char flags)
{
if (str)
{
int l = strlen(str);
int l = (int)strlen(str);
if (l > 0)
{
if (!isdigit(str[0]))