Example #1
0
void ShapeArchive::cache(uint32 shapenum)
{
	if (shapenum >= count) return;
	if (shapes.empty()) shapes.resize(count);

	if (shapes[shapenum]) return;

	uint32 shpsize;
	uint8 *data = getRawObject(shapenum, &shpsize);

	if (!data || shpsize == 0) return;

	// Auto detect format
	if (!format) {
		format = Shape::DetectShapeFormat(data,shpsize);
		if (format) pout << "Detected Shape Format: " << format->name << std::endl;
	}
	
	if (!format)
	{
		delete [] data;
		perr << "Error: Unable to detect shape format for flex." << std::endl;
		return;
	}

	Shape* shape = new Shape(data, shpsize, format, id, shapenum);
	if (palette) shape->setPalette(palette);

	shapes[shapenum] = shape;
}
Example #2
0
HOT_FUNC
ArrayIter::~ArrayIter() {
    if (hasArrayData()) {
        const ArrayData* ad = getArrayData();
        if (ad) decRefArr(const_cast<ArrayData*>(ad));
        return;
    }
    ObjectData* obj = getRawObject();
    assert(obj);
    decRefObj(obj);
}
Example #3
0
void ArrayIter::reset() {
    if (hasArrayData()) {
        const ArrayData* ad = getArrayData();
        m_data = NULL;
        if (ad) decRefArr(const_cast<ArrayData*>(ad));
        return;
    }
    ObjectData* obj = getRawObject();
    m_data = NULL;
    assert(obj);
    decRefObj(obj);
}
Example #4
0
HOT_FUNC
ArrayIter::~ArrayIter() {
  if (hasArrayData()) {
    const ArrayData* ad = getArrayData();
    if (ad) decRefArr(const_cast<ArrayData*>(ad));
    return;
  }
  ObjectData* obj = getRawObject();
  ASSERT(obj);
  if (obj->decRefCount() == 0) {
    const_cast<ObjectData*>(obj)->release();
  }
}
class BOOST_PP_CAT(derived_dispatch_helper, N)
:   public script_dispatch_helper<Method_type, Return_type, ScriptableClass_type>
{
public:

    virtual
    boost::any dispatch(Method_type _function, I_ObjectReference* _pObject, std::vector<boost::any> _parms)
    {
        typename ScriptableClass_type::ScriptObjectReference_type* pObject = dynamic_cast<typename ScriptableClass_type::ScriptObjectReference_type*>(_pObject);

#define BOOST_PP_ITERATION_PARAMS_2 \
    (3, (0, M, <Zen/Core/Scripting/script_arity_conversion.hpp>))

// Only expand if M != 0
#if BOOST_PP_IF(N, 1, 0)
#include BOOST_PP_ITERATE()
#endif

        return // need this? (script_convert_argument<typename Return_type>::type)
            (getRawObject(pObject)->*_function)(BOOST_PP_ENUM_PARAMS_Z(1, N, parm));
    }