mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- use texture IDs in the spawn records.
This commit is contained in:
parent
4692cc55f7
commit
1bace1d508
15 changed files with 35 additions and 35 deletions
|
@ -266,8 +266,8 @@ void FMapInfoParser::ParseSpawnClasses()
|
|||
int clipdist = -1;
|
||||
int num = -1;
|
||||
int base = -1;
|
||||
int basetex = -1;
|
||||
int brokentex = -1;
|
||||
FTextureID basetex = FNullTextureID();
|
||||
FTextureID brokentex = FNullTextureID();
|
||||
int fullbright = 0;
|
||||
int flags = 0;
|
||||
FSoundID sound = NO_SOUND;
|
||||
|
@ -305,8 +305,8 @@ void FMapInfoParser::ParseSpawnClasses()
|
|||
}
|
||||
const char* p = sc.String;
|
||||
if (*p == '*') { fullbright |= 1; p++; }
|
||||
basetex = tileForName(p);
|
||||
if (basetex < 0) sc.ScriptMessage("Unknown texture '%s' in definition for spawn ID # %d", sc.String, num);
|
||||
basetex = TexMan.CheckForTexture(p, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
if (!basetex.isValid()) sc.ScriptMessage("Unknown texture '%s' in definition for spawn ID # %d", sc.String, num);
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
sc.MustGetString();
|
||||
|
@ -314,8 +314,8 @@ void FMapInfoParser::ParseSpawnClasses()
|
|||
if (*p)
|
||||
{
|
||||
if (*p == '*') { fullbright |= 2; p++; }
|
||||
brokentex = tileForName(p);
|
||||
if (brokentex < 0) sc.ScriptMessage("Unknown texture '%s' in definition for spawn ID # %d", sc.String, num);
|
||||
brokentex = TexMan.CheckForTexture(p, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
|
||||
if (!brokentex.isValid()) sc.ScriptMessage("Unknown texture '%s' in definition for spawn ID # %d", sc.String, num);
|
||||
}
|
||||
if (sc.CheckString(","))
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
struct SpawnRec
|
||||
{
|
||||
PClassActor* cls;
|
||||
int basetex, brokentex;
|
||||
FTextureID basetex, brokentex;
|
||||
FSoundID breaksound;
|
||||
int8_t fullbright, clipdist;
|
||||
int16_t flags;
|
||||
|
|
|
@ -385,7 +385,7 @@ struct sectortype
|
|||
{
|
||||
struct // DukeRR
|
||||
{
|
||||
uint8_t keyinfo; // This was originally the repurposed filler byte.
|
||||
uint8_t lockinfo; // This was originally the repurposed filler byte.
|
||||
uint8_t shadedsector;
|
||||
TObjPtr<DCoreActor*> hitagactor; // we need this because Duke stores an actor in the hitag field. Is really a DDukeActor, but cannot be declared here safely.
|
||||
};
|
||||
|
|
|
@ -479,7 +479,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
// Save the extensions only when playing their respective games.
|
||||
if (isDukeEngine())
|
||||
{
|
||||
arc("keyinfo", c.keyinfo, def->keyinfo)
|
||||
arc("keyinfo", c.lockinfo, def->lockinfo)
|
||||
("shadedsector", c.shadedsector, def->shadedsector)
|
||||
("hitagactor", c.hitagactor, def->hitagactor);
|
||||
|
||||
|
|
|
@ -920,7 +920,7 @@ void destroyit(DDukeActor *actor)
|
|||
destsect->floorxpan_ = srcsect->floorxpan_;
|
||||
destsect->floorypan_ = srcsect->floorypan_;
|
||||
destsect->visibility = srcsect->visibility;
|
||||
destsect->keyinfo = srcsect->keyinfo;
|
||||
destsect->lockinfo = srcsect->lockinfo;
|
||||
destsect->lotag = srcsect->lotag;
|
||||
destsect->hitag = srcsect->hitag;
|
||||
destsect->extra = srcsect->extra;
|
||||
|
|
|
@ -129,3 +129,4 @@ xx(RedneckShotgun)
|
|||
xx(RedneckRipsaw)
|
||||
xx(RedneckBlaster)
|
||||
xx(RedneckPowderKeg)
|
||||
xx(RedneckCow)
|
||||
|
|
|
@ -119,7 +119,7 @@ int findotherplayer(int p, double* d);
|
|||
void quickkill(player_struct* p);
|
||||
int setpal(player_struct* p);
|
||||
int madenoise(int playerNum);
|
||||
int haskey(sectortype* sect, int snum);
|
||||
int haslock(sectortype* sect, int snum);
|
||||
void purplelavacheck(player_struct* p);
|
||||
void addphealth(player_struct* p, int amount, bool bigitem);
|
||||
int playereat(player_struct* p, int amount, bool bigitem);
|
||||
|
|
|
@ -438,16 +438,16 @@ void GameInterface::FinalizeSetup()
|
|||
auto info = spawnMap.CheckKey(i);
|
||||
PClassActor* cls = nullptr;
|
||||
|
||||
if (info != nullptr && info->basetex <= 0)
|
||||
if (info != nullptr && !info->basetex.isValid())
|
||||
{
|
||||
cls = info->cls;
|
||||
}
|
||||
else if (info == nullptr || info->basetex <= 0)
|
||||
else if (info == nullptr || !info->basetex.isValid())
|
||||
{
|
||||
// No unique actor exists here. Since we need one, create a new class here, directly derived from DDukeActor.
|
||||
auto newcls = (PClassActor*)RUNTIME_CLASS(DDukeActor)->CreateDerivedClass(FStringf("NewConActor%d", i), RUNTIME_CLASS(DDukeActor)->Size);
|
||||
newcls->InitializeDefaults();
|
||||
spawnMap.Insert(i, { newcls, -1, -1, NO_SOUND, int8_t(0), int8_t(0), int16_t(0x8000) });
|
||||
spawnMap.Insert(i, { newcls, FNullTextureID(), FNullTextureID(), NO_SOUND, int8_t(0), int8_t(0), int16_t(0x8000) });
|
||||
cls = newcls;
|
||||
GetDefaultByType(newcls)->spr.picnum = i; // make it show the right pic.
|
||||
}
|
||||
|
|
|
@ -1756,7 +1756,7 @@ int ParseState::parse(void)
|
|||
ps[g_p].tipincs = 26;
|
||||
break;
|
||||
case concmd_iftipcow:
|
||||
case concmd_ifhittruck: // both have the same code.
|
||||
case concmd_ifhittruck: // both have the same code. Note that 'iftipcpw' ONLY works when used on the cow!
|
||||
if (g_ac->spriteextra == 1) //
|
||||
{
|
||||
j = 1;
|
||||
|
|
|
@ -988,22 +988,22 @@ bool movementBlocked(player_struct *p)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int haskey(sectortype* sectp, int snum)
|
||||
int haslock(sectortype* sectp, int snum)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
if (!sectp)
|
||||
return 0;
|
||||
if (!sectp->keyinfo)
|
||||
if (!sectp->lockinfo)
|
||||
return 1;
|
||||
if (sectp->keyinfo > 6)
|
||||
if (sectp->lockinfo > 6)
|
||||
return 1;
|
||||
int wk = sectp->keyinfo;
|
||||
int wk = sectp->lockinfo;
|
||||
if (wk > 3)
|
||||
wk -= 3;
|
||||
|
||||
if (p->keys[wk] == 1)
|
||||
{
|
||||
sectp->keyinfo = 0;
|
||||
sectp->lockinfo = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
actor->Destroy();
|
||||
if (actor->GetClass() == RedneckKeyinfoSetterClass)
|
||||
{
|
||||
actor->sector()->keyinfo = uint8_t(actor->spr.lotag);
|
||||
actor->sector()->lockinfo = uint8_t(actor->spr.lotag);
|
||||
actor->Destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -412,7 +412,7 @@ void checksectors_d(int snum)
|
|||
return;
|
||||
|
||||
if (near.actor() == nullptr && near.hitWall == nullptr)
|
||||
if (p->cursector->lotag == 2)
|
||||
if (p->cursector->lotag == ST_2_UNDERWATER)
|
||||
{
|
||||
DDukeActor* hit;
|
||||
dist = hitasprite(p->GetActor(), &hit);
|
||||
|
|
|
@ -388,9 +388,8 @@ void checksectors_r(int snum)
|
|||
if (near.actor()->flags2 & SFLAG2_TRIGGERRESPAWN)
|
||||
return;
|
||||
|
||||
switch (near.actor()->spr.picnum)
|
||||
if (near.actor()->IsKindOf(RedneckCowClass)) // This is for a VERY poorly implemented CON hack. See 'iftipcow'.
|
||||
{
|
||||
case RTILE_COW:
|
||||
near.actor()->spriteextra = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -408,7 +407,7 @@ void checksectors_r(int snum)
|
|||
return;
|
||||
|
||||
if (near.actor() == nullptr && near.hitWall == nullptr)
|
||||
if (p->cursector->lotag == 2)
|
||||
if (p->cursector->lotag == ST_2_UNDERWATER)
|
||||
{
|
||||
DDukeActor* hit;
|
||||
double dist = hitasprite(p->GetActor(), &hit);
|
||||
|
@ -457,7 +456,7 @@ void checksectors_r(int snum)
|
|||
if (isactivator(act) || ismasterswitch(act))
|
||||
return;
|
||||
}
|
||||
if (haskey(near.hitSector, snum))
|
||||
if (haslock(near.hitSector, snum))
|
||||
operatesectors(near.hitSector, p->GetActor());
|
||||
else
|
||||
{
|
||||
|
@ -478,7 +477,7 @@ void checksectors_r(int snum)
|
|||
if (isactivator(act) || ismasterswitch(act))
|
||||
return;
|
||||
}
|
||||
if (haskey(near.hitSector, snum))
|
||||
if (haslock(near.hitSector, snum))
|
||||
operatesectors(p->GetActor()->sector(), p->GetActor());
|
||||
else
|
||||
{
|
||||
|
|
|
@ -50,11 +50,11 @@ void setFromSpawnRec(DDukeActor* act, SpawnRec* info)
|
|||
act->curAction = &actions[0];
|
||||
if (info)
|
||||
{
|
||||
if (info->basetex > 0 && act->IsKindOf(DukeGenericDestructibleClass))
|
||||
if (info->basetex.isValid() && act->IsKindOf(DukeGenericDestructibleClass))
|
||||
{
|
||||
// allow defining simple destructibles without actual actor definitions.
|
||||
act->IntVar(NAME_spawnstate) = info->basetex;
|
||||
act->IntVar(NAME_brokenstate) = info->brokentex;
|
||||
act->IntVar(NAME_spawnstate) = info->basetex.GetIndex();
|
||||
act->IntVar(NAME_brokenstate) = info->brokentex.GetIndex();
|
||||
act->IntVar(NAME_breaksound) = info->breaksound.index();
|
||||
act->IntVar(NAME_fullbright) = info->fullbright;
|
||||
act->spr.inittype = info->flags;
|
||||
|
@ -63,7 +63,7 @@ void setFromSpawnRec(DDukeActor* act, SpawnRec* info)
|
|||
else
|
||||
{
|
||||
// same for simple sprite replacements with existing implementations.
|
||||
if (info->basetex >= 0 && info->basetex < MAXTILES) act->spr.picnum = info->basetex;
|
||||
if (info->basetex.isValid()) act->spr.setspritetexture(info->basetex);
|
||||
if (info->fullbright & 1) act->spr.cstat2 |= CSTAT2_SPRITE_FULLBRIGHT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1838,14 +1838,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, copyfloorpal, copyfloorpal)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// this must still work around the lack of proper texture support on the script side.
|
||||
// this must still work around the lack of proper texture support on the script side and should go away once sprites have proper texture support
|
||||
DEFINE_ACTION_FUNCTION(DDukeGenericDestructible, SetBroken)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(DDukeActor);
|
||||
PARAM_INT(bust);
|
||||
int tilenum = self->IntVar(bust ? NAME_brokenstate : NAME_spawnstate);
|
||||
if (tilenum >= 0) self->spr.picnum = tilenum;
|
||||
ACTION_RETURN_BOOL(tilenum < 0);
|
||||
FSetTextureID tilenum(self->IntVar(bust ? NAME_brokenstate : NAME_spawnstate));
|
||||
if (tilenum.isValid()) self->spr.setspritetexture(tilenum);
|
||||
ACTION_RETURN_BOOL(!tilenum.isValid());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue