Fix compilation under MSVC, bind some fucntions
This commit is contained in:
parent
9bd02ca8ba
commit
79be0eca73
|
@ -461,10 +461,69 @@ void Client::registerLuaFunctions()
|
|||
g_lua.bindClassMemberFunction<ItemType>("isWritable", &ItemType::isWritable);
|
||||
|
||||
g_lua.registerClass<ThingType>();
|
||||
g_lua.bindClassStaticFunction<ThingType>("create", []{ return ThingTypePtr(new ThingType); });
|
||||
g_lua.bindClassMemberFunction<ThingType>("getId", &ThingType::getId);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getClothSlot", &ThingType::getClothSlot);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getCategory", &ThingType::getCategory);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getSize", &ThingType::getSize);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getWidth", &ThingType::getWidth);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getHeight", &ThingType::getHeight);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getDisplacement", &ThingType::getDisplacement);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getDisplacementX", &ThingType::getDisplacementX);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getDisplacementY", &ThingType::getDisplacementY);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getExactSize", &ThingType::getExactSize);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getLayers", &ThingType::getLayers);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getNumPatternX", &ThingType::getNumPatternX);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getNumPatternY", &ThingType::getNumPatternY);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getNumPatternZ", &ThingType::getNumPatternZ);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getAnimationPhases", &ThingType::getAnimationPhases);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getGroundSpeed", &ThingType::getGroundSpeed);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getMaxTextLength", &ThingType::getMaxTextLength);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getLightIntensity", &ThingType::getLightIntensity);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getLightColor", &ThingType::getLightColor);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getMinimapColor", &ThingType::getMinimapColor);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getLensHelp", &ThingType::getLensHelp);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getClothSlot", &ThingType::getClothSlot);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getElevation", &ThingType::getElevation);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isGround", &ThingType::isGround);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isGroundBorder", &ThingType::isGroundBorder);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isOnBottom", &ThingType::isOnBottom);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isOnTop", &ThingType::isOnTop);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isContainer", &ThingType::isContainer);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isStackable", &ThingType::isStackable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isForceUse", &ThingType::isForceUse);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isMultiUse", &ThingType::isMultiUse);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isWritable", &ThingType::isWritable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isChargeable", &ThingType::isChargeable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isWritableOnce", &ThingType::isWritableOnce);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isFluidContainer", &ThingType::isFluidContainer);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isSplash", &ThingType::isSplash);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isNotWalkable", &ThingType::isNotWalkable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isNotMoveable", &ThingType::isNotMoveable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("blockProjectile", &ThingType::blockProjectile);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isNotPathable", &ThingType::isNotPathable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isPickupable", &ThingType::isPickupable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isHangable", &ThingType::isHangable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isHookSouth", &ThingType::isHookSouth);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isHookEast", &ThingType::isHookEast);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isRotateable", &ThingType::isRotateable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasLight", &ThingType::hasLight);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isDontHide", &ThingType::isDontHide);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isTranslucent", &ThingType::isTranslucent);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasDisplacement", &ThingType::hasDisplacement);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasElevation", &ThingType::hasElevation);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isLyingCorpse", &ThingType::isLyingCorpse);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isAnimateAlways", &ThingType::isAnimateAlways);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasMiniMapColor", &ThingType::hasMiniMapColor);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasLensHelp", &ThingType::hasLensHelp);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isFullGround", &ThingType::isFullGround);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isIgnoreLook", &ThingType::isIgnoreLook);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isCloth", &ThingType::isCloth);
|
||||
g_lua.bindClassMemberFunction<ThingType>("isMarketable", &ThingType::isMarketable);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
|
||||
g_lua.bindClassMemberFunction<ThingType>("getSprites", &ThingType::getSprites);
|
||||
g_lua.bindClassMemberFunction<ThingType>("hasAttribute", &ThingType::hasAttr);
|
||||
g_lua.bindClassMemberFunction<ThingType>("exportImage", &ThingType::exportImage);
|
||||
|
||||
g_lua.registerClass<Item, Thing>();
|
||||
|
|
|
@ -100,8 +100,8 @@ void SpriteManager::saveSpr(std::string fileName)
|
|||
fin->addU8(m_spritesFile->getU8());
|
||||
|
||||
uint16 dataSize = m_spritesFile->getU16();
|
||||
char spriteData[dataSize];
|
||||
fin->addU16(dataSize);
|
||||
char spriteData[SPRITE_DATA_SIZE];
|
||||
m_spritesFile->read(spriteData, dataSize);
|
||||
fin->write(spriteData, dataSize);
|
||||
|
||||
|
@ -127,10 +127,6 @@ void SpriteManager::unload()
|
|||
ImagePtr SpriteManager::getSpriteImage(int id)
|
||||
{
|
||||
try {
|
||||
enum {
|
||||
SPRITE_SIZE = 32,
|
||||
SPRITE_DATA_SIZE = SPRITE_SIZE*SPRITE_SIZE*4
|
||||
};
|
||||
|
||||
if(id == 0 || !m_spritesFile)
|
||||
return nullptr;
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
//@bindsingleton g_sprites
|
||||
class SpriteManager
|
||||
{
|
||||
enum {
|
||||
SPRITE_SIZE = 32,
|
||||
SPRITE_DATA_SIZE = SPRITE_SIZE*SPRITE_SIZE * 4
|
||||
};
|
||||
|
||||
public:
|
||||
SpriteManager();
|
||||
|
||||
|
|
|
@ -144,6 +144,8 @@ public:
|
|||
int getGroundSpeed() { return m_attribs.get<uint16>(ThingAttrGround); }
|
||||
int getMaxTextLength() { return m_attribs.has(ThingAttrWritableOnce) ? m_attribs.get<uint16>(ThingAttrWritableOnce) : m_attribs.get<uint16>(ThingAttrWritable); }
|
||||
Light getLight() { return m_attribs.get<Light>(ThingAttrLight); }
|
||||
int getLightIntensity() { return getLight().intensity; }
|
||||
int getLightColor() { return getLight().color; }
|
||||
int getMinimapColor() { return m_attribs.get<uint16>(ThingAttrMinimapColor); }
|
||||
int getLensHelp() { return m_attribs.get<uint16>(ThingAttrLensHelp); }
|
||||
int getClothSlot() { return m_attribs.get<uint16>(ThingAttrCloth); }
|
||||
|
@ -183,6 +185,7 @@ public:
|
|||
bool isIgnoreLook() { return m_attribs.has(ThingAttrLook); }
|
||||
bool isCloth() { return m_attribs.has(ThingAttrCloth); }
|
||||
bool isMarketable() { return m_attribs.has(ThingAttrMarket); }
|
||||
std::vector<int> getSprites() { return m_spritesIndex; }
|
||||
|
||||
// additional
|
||||
float getOpacity() { return m_opacity; }
|
||||
|
|
Loading…
Reference in New Issue