diff --git a/source/core/actorinfo.cpp b/source/core/actorinfo.cpp index 2bc53f78b..1c8da9dc0 100644 --- a/source/core/actorinfo.cpp +++ b/source/core/actorinfo.cpp @@ -249,14 +249,14 @@ void FActorInfo::ResolveTextures(const char* clsname, DCoreActor* defaults) SpriteSet.Resize(SpriteSetNames.Size()); for (unsigned i = 0; i < SpriteSet.Size(); i++) { - SpriteSet[i] = tileForName(SpriteSetNames[i]); + SpriteSet[i] = TexMan.CheckForTexture(SpriteSetNames[i], ETextureType::Any); // This should later be enabled to user content. //if (SpriteSet[i] == -1) Printf(TEXTCOLOR_RED "Unknown texture '%s' in sprite set for class %s\n", SpriteSetNames[i].GetChars(), clsname); } if (SpriteSet.Size() > 0) { if (defaults->spritesetindex < 0 || defaults->spritesetindex >= (int)SpriteSet.Size()) defaults->spritesetindex = 0; - defaults->spr.picnum = SpriteSet[defaults->spritesetindex]; // Unless picnum is specified it will be set to the given image of the sprite set. + defaults->spr.setspritetexture(SpriteSet[defaults->spritesetindex]); // Unless picnum is specified it will be set to the given image of the sprite set. } SpriteSetNames.Reset(); } diff --git a/source/core/actorinfo.h b/source/core/actorinfo.h index 2d7192719..df4384739 100644 --- a/source/core/actorinfo.h +++ b/source/core/actorinfo.h @@ -21,7 +21,7 @@ enum EDefaultFlags struct FActorInfo { TArray LightAssociations; - TArray SpriteSet; + TArray SpriteSet; PClassActor *Replacement = nullptr; PClassActor *Replacee = nullptr; DVector2 DefaultScale = { 0, 0 }; diff --git a/source/core/vmexports.cpp b/source/core/vmexports.cpp index 6f3382f86..bc6562e6d 100644 --- a/source/core/vmexports.cpp +++ b/source/core/vmexports.cpp @@ -797,7 +797,7 @@ void tspritetype_setSpritePic(tspritetype* targ, DCoreActor* self, unsigned z) auto& spriteset = static_cast(self->GetClass())->ActorInfo()->SpriteSet; if (z < spriteset.Size()) { - targ->picnum = spriteset[z]; + targ->setspritetexture(spriteset[z]); } else if (z == ~0) { diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index 530e23b09..52ae6199a 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -311,7 +311,7 @@ void setSpritesetImage(DDukeActor* self, unsigned int index) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Bad sprite set index %d (max. allowed is %d", index, spriteset.Size() - 1); } self->spritesetindex = index; - self->spr.picnum = spriteset[index]; + self->spr.setspritetexture(spriteset[index]); } DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetSpritesetImage, setSpritesetImage)