- added some 'overrides' and block 'forcelookup' for script access to textures.

This commit is contained in:
Christoph Oelckers 2020-09-27 10:45:45 +02:00
parent 528e4e46b3
commit 31628a70c8
2 changed files with 20 additions and 19 deletions

View file

@ -270,10 +270,10 @@ public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
virtual void SetValue(void *addr, int val); virtual void SetValue(void *addr, int val) override;
virtual void SetValue(void *addr, double val); virtual void SetValue(void *addr, double val) override;
virtual int GetValueInt(void *addr) const; virtual int GetValueInt(void *addr) const override;
virtual double GetValueFloat(void *addr) const; virtual double GetValueFloat(void *addr) const override;
virtual bool isNumeric() override { return IntCompatible; } virtual bool isNumeric() override { return IntCompatible; }
bool Unsigned; bool Unsigned;
@ -300,10 +300,10 @@ public:
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
virtual void SetValue(void *addr, int val); virtual void SetValue(void *addr, int val) override;
virtual void SetValue(void *addr, double val); virtual void SetValue(void *addr, double val) override;
virtual int GetValueInt(void *addr) const; virtual int GetValueInt(void *addr) const override;
virtual double GetValueFloat(void *addr) const; virtual double GetValueFloat(void *addr) const override;
virtual bool isNumeric() override { return true; } virtual bool isNumeric() override { return true; }
protected: protected:
void SetOps(); void SetOps();
@ -411,8 +411,8 @@ public:
reader = r; reader = r;
} }
virtual bool IsMatch(intptr_t id1, intptr_t id2) const; bool IsMatch(intptr_t id1, intptr_t id2) const override;
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override;
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
@ -455,8 +455,8 @@ public:
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) override; void SetPointer(void *base, unsigned offset, TArray<size_t> *special = NULL) override;
virtual bool IsMatch(intptr_t id1, intptr_t id2) const; bool IsMatch(intptr_t id1, intptr_t id2) const override;
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override;
}; };
// Compound types ----------------------------------------------------------- // Compound types -----------------------------------------------------------
@ -479,8 +479,8 @@ public:
unsigned int ElementCount; unsigned int ElementCount;
unsigned int ElementSize; unsigned int ElementSize;
virtual bool IsMatch(intptr_t id1, intptr_t id2) const; bool IsMatch(intptr_t id1, intptr_t id2) const override;
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override;
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
@ -507,8 +507,8 @@ public:
PType *ElementType; PType *ElementType;
PStruct *BackingType; PStruct *BackingType;
virtual bool IsMatch(intptr_t id1, intptr_t id2) const; bool IsMatch(intptr_t id1, intptr_t id2) const override;
virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; void GetTypeIDs(intptr_t &id1, intptr_t &id2) const override;
void WriteValue(FSerializer &ar, const char *key, const void *addr) const override; void WriteValue(FSerializer &ar, const char *key, const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
@ -540,8 +540,8 @@ public:
VMFunction *mConstructor = nullptr; VMFunction *mConstructor = nullptr;
VMFunction *mDestructor = nullptr; VMFunction *mDestructor = nullptr;
virtual PField *AddField(FName name, PType *type, uint32_t flags=0); PField *AddField(FName name, PType *type, uint32_t flags=0) override;
virtual PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0); PField *AddNativeField(FName name, PType *type, size_t address, uint32_t flags = 0, int bitvalue = 0) override;
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;

View file

@ -78,7 +78,8 @@ DEFINE_ACTION_FUNCTION(_TexMan, GetName)
static int CheckForTexture(const FString& name, int type, int flags) static int CheckForTexture(const FString& name, int type, int flags)
{ {
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), flags).GetIndex(); // ForceLookup is intentionally blocked here, this flag is for internal use only.
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), (flags & ~FTextureManager::TEXMAN_ForceLookup)).GetIndex();
} }
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture) DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)