//-----------------------------------------------------------------------------------------
void OgitorsRoot::GetObjectListByName(unsigned int type, const Ogre::String& nameregexp, bool inverse, ObjectVector& list)
{
    list.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        NameObjectPairList::iterator list_st, list_ed;

        if(type == 0)
        {
            list_st = mNameList.begin();
            list_ed = mNameList.end();
        }
        else
        {
            list_st = mNamesByType[type].begin();
            list_ed = mNamesByType[type].end();
        }

        while(list_st != list_ed)
        {
            if(regex_match(list_st->first.c_str(), e) != inverse)
            {
                list.push_back(list_st->second);
            }
            list_st++;
        }
    }
    catch(...)
    {
        list.clear();
    }
}
//-----------------------------------------------------------------------------------------
void OgitorsRoot::RegExpByProperty(const Ogre::String& nameregexp, bool inverse, const ObjectVector& list_in, ObjectVector& list_out)
{
    list_out.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        OgitorsPropertyVector pvec;

        for(unsigned int i = 0;i < list_in.size();i++)   
        {
            pvec = list_in[i]->getProperties()->getPropertyVector();

            bool add_list = false;
            
            for(unsigned int k = 0;k < pvec.size();k++)
            {
                if(regex_match(pvec[k]->getName().c_str(), e))
                {
                    add_list = true;
                    break;
                }
            }
            
            if(add_list != inverse)
                list_out.push_back(list_in[i]);
        }
    }
    catch(...)
    {
        list_out.clear();
    }
}    
示例#3
0
AABBTreeUnpacked::AABBTreeUnpacked(ObjectVector& objects)
{
    m_numNodes = 0;
    m_maxDepth = 0;
    m_twoChildNodes = 0;
    m_leafNodes = 0;

    // Find the total AABB of all the objects
    root = new(_mm_malloc(sizeof(Node),16)) Node();
    root->aabb = Surround(objects,0,objects.size());
    if(objects.size() == 1)
    {
        m_maxDepth = 0;
        m_numNodes = 1;
        m_leafNodes = 1;
        root->obj = objects[0].obj;
        root->children[0] = NULL;
        root->children[1] = NULL;
    }
    else
    {
        root->obj = NULL;
        ++m_numNodes;
        ++m_twoChildNodes;
        BuildTreeRecursive(
            objects,
            root,
            0,
            (uint32_t)objects.size(),
            1);
    }

    //assert(m_numNodes == m_leafNodes + m_twoChildNodes);
}
示例#4
0
//--------------------------------------------------------------------------------
void CMultiSelEditor::getSelection(ObjectVector& list)
{
    list.clear();

    NameObjectPairList::const_iterator it = mSelectedObjects.begin();
    while(it != mSelectedObjects.end())
    {
        list.push_back(it->second);
        it++;
    }
}
示例#5
0
文件: STM.cpp 项目: naderman/spoac
ObjectVector STM::vectorFromIds(const std::vector<std::string>& ids)
{
    ObjectVector vector;
    std::vector<std::string>::const_iterator id;

    for (id = ids.begin(); id != ids.end(); ++id)
    {
        vector.push_back(get(*id));
    }

    return vector;
}
//-----------------------------------------------------------------------------------------
void OgitorsRoot::GetObjectListByCustomProperty(unsigned int type, const Ogre::String& nameregexp, bool inverse, ObjectVector& list)
{
    list.clear();

    try
    {
        const boost::regex e(nameregexp.c_str());

        NameObjectPairList::iterator list_st, list_ed;

        if(type == 0)
        {
            list_st = mNameList.begin();
            list_ed = mNameList.end();
        }
        else
        {
            list_st = mNamesByType[type].begin();
            list_ed = mNamesByType[type].end();
        }

        OgitorsPropertyVector pvec;

        while(list_st != list_ed)
        {
            pvec = list_st->second->getCustomProperties()->getPropertyVector();
            bool add_list = false;
            for(unsigned int k = 0;k < pvec.size();k++)
            {
                if(regex_match(pvec[k]->getName().c_str(), e))
                {
                    add_list = true;
                    break;
                }
            }
            
            if(add_list != inverse)
                list.push_back(list_st->second);
            
            list_st++;
        }
    }
    catch(...)
    {
        list.clear();
    }
}
示例#7
0
//-----------------------------------------------------------------------------
int COFSSceneSerializer::_writeFile(Ogre::String exportfile, const bool forceSave)
{
    if (exportfile.empty())
        return SCF_ERRUNKNOWN;

    OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr();
    // Open a stream to output our XML Content and write the general headercopyFile
    std::stringstream outfile;

    outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    outfile << "<OGITORSCENE version=\"" << Globals::OGSCENE_FORMAT_VERSION << "\">\n";

    PROJECTOPTIONS *pOpt = ogRoot->GetProjectOptions();
    pOpt->CameraSpeed = ogRoot->GetViewport()->GetCameraSpeed();

    ogRoot->WriteProjectOptions(outfile, pOpt);

    ObjectVector ObjectList;
    OgitorsPropertyValueMap theList;
    OgitorsPropertyValueMap::iterator ni;

    // Start from 1, since 0 means all objects
    for(unsigned int i = 1; i < LAST_EDITOR; i++)
    {
        ogRoot->GetObjectList(i, ObjectList);
        for(unsigned int ob = 0; ob < ObjectList.size(); ob++)
        {
            /// If Object does not have a parent, then it is not part of the scene
            if(ObjectList[ob]->getParent())
            {
                ObjectList[ob]->onSave(forceSave);
                if(ObjectList[ob]->isSerializable())
                {
                    outfile << OgitorsUtils::GetObjectSaveStringV2(ObjectList[ob], 2, true, true).c_str();
                    outfile << "\n";
                }
            }
        }
    }
    outfile << "</OGITORSCENE>\n";

    if (OgitorsUtils::SaveStreamOfs(outfile, exportfile)) {
        return SCF_OK;
    }

    return SCF_ERRFILE;
}
示例#8
0
//--------------------------------------------------------------------------------
void CMultiSelEditor::add(const ObjectVector& newselection)
{
    if(mDeletionInProgress)
        return;

    if(newselection.size() == 0)
        return;

    for(unsigned int i = 0;i < newselection.size();i++)
    {
        if(newselection[i] && (newselection[i] != this) && (mSelectedObjects.find(newselection[i]->getName()) == mSelectedObjects.end()))
        {
            mSelectedObjects.insert(NameObjectPairList::value_type(newselection[i]->getName(), newselection[i]));

            newselection[i]->setSelected(true);
        }
    }

    _createModifyList();
}
//-----------------------------------------------------------------------------------------
void OgitorsRoot::RegExpByName(const Ogre::String& nameregexp, bool inverse, const ObjectVector& list_in, ObjectVector& list_out)
{
    list_out.clear();
    
    try
    {
        const boost::regex e(nameregexp.c_str());

        for(unsigned int i = 0;i < list_in.size();i++)   
        {
            if(regex_match(list_in[i]->getName().c_str(), e) != inverse)
            {
                list_out.push_back(list_in[i]);
            }
        }
    }
    catch(...)
    {
        list_out.clear();
    }
}
示例#10
0
void AABBTreeUnpacked::Partition(
    ObjectVector& objects,
    uint32_t beginIndex,
    uint32_t endIndex,
    uint32_t axis,
    float val,
    uint32_t& finalRightIdx)
{
    assert(endIndex > beginIndex);
    assert(endIndex <= objects.size());
    assert(axis < 3);

    ObjectVector sos(endIndex-beginIndex);

    // Indices which we use to track the number of aabbs in the left and right lists.
    uint32_t rightIdxObj = endIndex;

    uint32_t leftIdxSOS = 0;
    uint32_t rightIdxSOS = endIndex - beginIndex - 1;

    for(uint32_t i = beginIndex; i < endIndex; ++i)
    {
        Vector3 centroid = objects[i].aabb.GetCentroid();

        if(centroid.GetComponent(axis) >= val)
        {
            sos[rightIdxSOS--] = objects[i];
            --rightIdxObj;
        }
        else
        {
            sos[leftIdxSOS++] = objects[i];
        }
    }

    // Make sure we have actually found a place for all the AABBs
    assert(leftIdxSOS == rightIdxSOS+1);

    // Copy the partitioned list back to the correct part of the object vector.

    uint32_t it = 0;
    for(uint32_t i = beginIndex; i < endIndex; ++i)
    {
        objects[i] = sos[it++];
    }

    finalRightIdx = rightIdxObj;

    // Make sure we always have at least one object in each list. This prevents dangling
    // leaf nodes from being created, as well as solving certain infinite recursion situations.
    if(finalRightIdx == beginIndex) finalRightIdx = beginIndex + 1;
    if(finalRightIdx == endIndex) finalRightIdx = endIndex - 1;
}
示例#11
0
//--------------------------------------------------------------------------------
void CMultiSelEditor::remove(const ObjectVector& newselection)
{
    if(mDeletionInProgress)
        return;

    if(newselection.size() == 0)
        return;

    NameObjectPairList::iterator it;

    for(unsigned int i = 0;i < newselection.size();i++)
    {
        if(newselection[i] && ((it = mSelectedObjects.find(newselection[i]->getName())) != mSelectedObjects.end()))
        {
            mSelectedObjects.erase(it);

            newselection[i]->setSelected(false);
        }
    }

    _createModifyList();
}
示例#12
0
AABBTreeUnpacked::AABB AABBTreeUnpacked::Surround(ObjectVector& ov, size_t beginIdx, size_t endIdx)
{
    assert(endIdx >= beginIdx);
    assert(endIdx <= ov.size());

    if(endIdx == beginIdx)
    {
        return AABB(Vector3(0.0f),Vector3(0.0f));
    }

    AABB aabb = ov[beginIdx].aabb;
    if(beginIdx == endIdx - 1) return aabb;
    for(size_t i = beginIdx + 1; i < endIdx; ++i)
    {
        aabb = Union(aabb,ov[i].aabb);
    }
    return aabb;
}
示例#13
0
//--------------------------------------------------------------------------------
void CMultiSelEditor::setSelection(const ObjectVector& list)
{
    if(mDeletionInProgress)
        return;

    _clearSelection();

    for(unsigned int i = 0;i < list.size();i++)
    {
        if(list[i])
        {
            list[i]->setSelected(true);
            mSelectedObjects.insert(NameObjectPairList::value_type(list[i]->getName(), list[i]));
        }
    }

    _createModifyList();

    SelectionChangeEvent evt(this);
    EventManager::getSingletonPtr()->sendEvent(this, 0, &evt);
}
示例#14
0
//
// BinaryTokenPPACS::make_tokens
//
void BinaryTokenPPACS::make_tokens
(ObjectVector const &objects, std::vector<BinaryTokenPPACS> *instructions)
{
   static ObjectExpression::Pointer const fracbits =
      ObjectExpression::CreateValueINT(16, SourcePosition::builtin());

   static std::vector<std::string> const nolabels;

   std::vector<ObjectExpression::Pointer> args;

   ObjectVector::const_iterator object;
   for (object = objects.begin(); object != objects.end(); ++object)
   {
   SourcePosition const &pos = object->pos;

   std::vector<std::string> const *labels = &object->labels;

   switch (object->code)
   {
   BINTOKACS_TOKENS_MAP_ALL();
   BINTOKACS_TOKENS_TRAN_ALL();

   //
   // Operators
   //
   CASE_REMAP(ADD_AUTO_I,   ADD_AUTO);
   CASE_REMAP(ADD_AUTO_U,   ADD_AUTO);
   CASE_REMAP(ADD_AUTO_X,   ADD_AUTO);
   CASE_REMAP(ADD_PTR_I,    ADD_PTR);
   CASE_REMAP(ADD_PTR_U,    ADD_PTR);
   CASE_REMAP(ADD_PTR_X,    ADD_PTR);
   CASE_REMAP(ADD_STATIC_I, ADD_STATIC);
   CASE_REMAP(ADD_STATIC_U, ADD_STATIC);
   CASE_REMAP(ADD_STATIC_X, ADD_STATIC);

   CASE_REMAP(AND_AUTO_I,   AND_AUTO);
   CASE_REMAP(AND_AUTO_U,   AND_AUTO);
   CASE_REMAP(AND_AUTO_X,   AND_AUTO);
   CASE_REMAP(AND_PTR_I,    AND_PTR);
   CASE_REMAP(AND_PTR_U,    AND_PTR);
   CASE_REMAP(AND_PTR_X,    AND_PTR);
   CASE_REMAP(AND_STATIC_I, AND_STATIC);
   CASE_REMAP(AND_STATIC_U, AND_STATIC);
   CASE_REMAP(AND_STATIC_X, AND_STATIC);

   CASE_REMAP(DEC_AUTO_I,   DEC_AUTO);
   CASE_REMAP(DEC_AUTO_U,   DEC_AUTO);
   CASE_REMAP(DEC_PTR_I,    DEC_PTR);
   CASE_REMAP(DEC_PTR_U,    DEC_PTR);
   CASE_REMAP(DEC_STATIC_I, DEC_STATIC);
   CASE_REMAP(DEC_STATIC_U, DEC_STATIC);

   CASE_REMAP(DIV_STK_X,    DIV_STK_X);
   CASE_REMAP(DIV_AUTO_I,   DIV_AUTO);
   CASE_REMAP(DIV_PTR_I,    DIV_PTR);
   CASE_REMAP(DIV_STATIC_I, DIV_STATIC);

   CASE_REMAP(INC_AUTO_I,   INC_AUTO);
   CASE_REMAP(INC_AUTO_U,   INC_AUTO);
   CASE_REMAP(INC_PTR_I,    INC_PTR);
   CASE_REMAP(INC_PTR_U,    INC_PTR);
   CASE_REMAP(INC_STATIC_I, INC_STATIC);
   CASE_REMAP(INC_STATIC_U, INC_STATIC);

   CASE_REMAP(IOR_AUTO_I,   IOR_AUTO);
   CASE_REMAP(IOR_AUTO_U,   IOR_AUTO);
   CASE_REMAP(IOR_AUTO_X,   IOR_AUTO);
   CASE_REMAP(IOR_PTR_I,    IOR_PTR);
   CASE_REMAP(IOR_PTR_U,    IOR_PTR);
   CASE_REMAP(IOR_PTR_X,    IOR_PTR);
   CASE_REMAP(IOR_STATIC_I, IOR_STATIC);
   CASE_REMAP(IOR_STATIC_U, IOR_STATIC);
   CASE_REMAP(IOR_STATIC_X, IOR_STATIC);

   CASE_REMAP(LSH_AUTO_I,   LSH_AUTO);
   CASE_REMAP(LSH_AUTO_U,   LSH_AUTO);
   CASE_REMAP(LSH_AUTO_X,   LSH_AUTO);
   CASE_REMAP(LSH_PTR_I,    LSH_PTR);
   CASE_REMAP(LSH_PTR_U,    LSH_PTR);
   CASE_REMAP(LSH_PTR_X,    LSH_PTR);
   CASE_REMAP(LSH_STATIC_I, LSH_STATIC);
   CASE_REMAP(LSH_STATIC_U, LSH_STATIC);
   CASE_REMAP(LSH_STATIC_X, LSH_STATIC);

   CASE_REMAP(MOD_AUTO_I,   MOD_AUTO);
   CASE_REMAP(MOD_AUTO_X,   MOD_AUTO);
   CASE_REMAP(MOD_PTR_I,    MOD_PTR);
   CASE_REMAP(MOD_PTR_X,    MOD_PTR);
   CASE_REMAP(MOD_STATIC_I, MOD_STATIC);
   CASE_REMAP(MOD_STATIC_X, MOD_STATIC);

   CASE_REMAP(MUL_STK_X,    MUL_STK_X);
   CASE_REMAP(MUL_AUTO_I,   MUL_AUTO);
   CASE_REMAP(MUL_AUTO_U,   MUL_AUTO);
   CASE_REMAP(MUL_PTR_I,    MUL_PTR);
   CASE_REMAP(MUL_PTR_U,    MUL_PTR);
   CASE_REMAP(MUL_STATIC_I, MUL_STATIC);
   CASE_REMAP(MUL_STATIC_U, MUL_STATIC);

   CASE_REMAP(RSH_AUTO_I,   RSH_AUTO);
   CASE_REMAP(RSH_AUTO_X,   RSH_AUTO);
   CASE_REMAP(RSH_PTR_I,    RSH_PTR);
   CASE_REMAP(RSH_PTR_X,    RSH_PTR);
   CASE_REMAP(RSH_STATIC_I, RSH_STATIC);
   CASE_REMAP(RSH_STATIC_X, RSH_STATIC);

   CASE_REMAP(SUB_AUTO_I,   SUB_AUTO);
   CASE_REMAP(SUB_AUTO_U,   SUB_AUTO);
   CASE_REMAP(SUB_AUTO_X,   SUB_AUTO);
   CASE_REMAP(SUB_PTR_I,    SUB_PTR);
   CASE_REMAP(SUB_PTR_U,    SUB_PTR);
   CASE_REMAP(SUB_PTR_X,    SUB_PTR);
   CASE_REMAP(SUB_STATIC_I, SUB_STATIC);
   CASE_REMAP(SUB_STATIC_U, SUB_STATIC);
   CASE_REMAP(SUB_STATIC_X, SUB_STATIC);

   CASE_REMAP(XOR_AUTO_I,   XOR_AUTO);
   CASE_REMAP(XOR_AUTO_U,   XOR_AUTO);
   CASE_REMAP(XOR_AUTO_X,   XOR_AUTO);
   CASE_REMAP(XOR_PTR_I,    XOR_PTR);
   CASE_REMAP(XOR_PTR_U,    XOR_PTR);
   CASE_REMAP(XOR_PTR_X,    XOR_PTR);
   CASE_REMAP(XOR_STATIC_I, XOR_STATIC);
   CASE_REMAP(XOR_STATIC_U, XOR_STATIC);
   CASE_REMAP(XOR_STATIC_X, XOR_STATIC);

   //
   // Jumps
   //
   CASE_REMAP(JMP, JMP);

   //
   // Variable Address
   //
   CASE_REMAP(GET_AUTPTR_IMM, GET_AUTPTR_IMM);

   CASE_REMAP(ADD_AUTPTR, ADD_AUTPTR);
   case OCODE_ADD_AUTPTR_IMM:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
      PUSH_TOKEN(BCODE_ADD_AUTPTR);
      break;

   CASE_REMAP(SUB_AUTPTR, SUB_AUTPTR);
   case OCODE_SUB_AUTPTR_IMM:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
      PUSH_TOKEN(BCODE_SUB_AUTPTR);
      break;

   //
   // Variable Get
   //
   CASE_REMAP(GET_STATIC, GET_STATIC);
   CASE_REMAP(GET_AUTO,   GET_AUTO);
   CASE_REMAP(GET_PTR,    GET_PTR);
   CASE_REMAP(GET_TEMP,   GET_AUTO);

   //
   // Variable Set
   //
   CASE_REMAP(SET_STATIC, SET_STATIC);
   CASE_REMAP(SET_AUTO,   SET_AUTO);
   CASE_REMAP(SET_PTR,    SET_PTR);
   CASE_REMAP(SET_TEMP,   SET_AUTO);

   //
   // ACS Extensions
   //
   CASE_MAP_ACSE(MID_GET);
   CASE_MAP_ACSE(MID_SET);

   //
   // ACS Printing
   //
   CASE_MAP_ACSP(END_ERROR);
   CASE_MAP_ACSP(END_LOG);
   CASE_REMAP_ACSP(NUM_DEC_X, NUM_DEC_X);

   case OCODE_NONE:
   default:
      Error_P("unknown OCODE: %s", make_string(object->code));
   }
   }
}
示例#15
0
//
// BinaryTokenZDACS::make_tokens
//
void BinaryTokenZDACS::make_tokens
(ObjectVector const &objects, std::vector<BinaryTokenZDACS> *instructions)
{
   static ObjectExpression::Pointer const fracbits =
      ObjectExpression::CreateValueINT(16, SourcePosition::builtin());

   static ObjectExpression::Pointer const indexAddr =
      ObjectExpression::CreateValueINT(option_addr_array, SourcePosition::builtin());

   static ObjectExpression::Reference const indexAuto =
      ObjectExpression::CreateValueINT(option_auto_array, SourcePosition::builtin());

   static ObjectExpression::Reference const indexRet1 =
      ObjectExpression::CreateValueINT(-1, SourcePosition::builtin());

   static ObjectExpression::Pointer const indexStack =
      ObjectExpression::CreateValueINT(option_addr_stack, SourcePosition::builtin());

   static ObjectExpression::Reference const func_GetChar =
      ObjectExpression::CreateValueUNS(15, SourcePosition::builtin());
   static ObjectExpression::Reference const func_GetCharArgs =
      ObjectExpression::CreateValueUNS(2, SourcePosition::builtin());

   static ObjectExpression::Reference const func_Getptr =
      ObjectExpression::CreateValueSymbol("__Getptr", SourcePosition::builtin());
   static ObjectExpression::Reference const func_Setptr =
      ObjectExpression::CreateValueSymbol("__Setptr", SourcePosition::builtin());

   static ObjectExpression::Reference const func_Udiv =
      ObjectExpression::CreateValueSymbol("__Udiv", SourcePosition::builtin());
   static ObjectExpression::Reference const func_Ursh =
      ObjectExpression::CreateValueSymbol("__Ursh", SourcePosition::builtin());

   static std::vector<std::string> const nolabels;

   std::vector<ObjectExpression::Pointer> args;

   ObjectVector::const_iterator object;
   for (object = objects.begin(); object != objects.end(); ++object)
   {
   SourcePosition const &pos = object->pos;

   std::vector<std::string> const *labels = &object->labels;

   switch (object->code)
   {
   BINTOKACS_TOKENS_MAP_ALL();
   BINTOKACS_TOKENS_TRAN_ALL();

   // Operators
   CASE_ADDR_BINOP(ADD, _I,);
   CASE_ADDR_BINOP(ADD, _U,);
   CASE_ADDR_BINOP(ADD, _X,);
   CASE_REMAP_REGS(ADD, _I,);
   CASE_REMAP_REGS(ADD, _U,);
   CASE_REMAP_REGS(ADD, _X,);

   CASE_ADDR_BINOP(AND, _I,);
   CASE_ADDR_BINOP(AND, _U,);
   CASE_ADDR_BINOP(AND, _X,);
   CASE_REMAP_REG2(AND, _I,);
   CASE_REMAP_REG2(AND, _U,);
   CASE_REMAP_REG2(AND, _X,);

   CASE_ADDR_UNAOP(DEC, _I,);
   CASE_ADDR_UNAOP(DEC, _U,);
   CASE_REMAP_REGS(DEC, _I,);
   CASE_REMAP_REGS(DEC, _U,);

   CASE_REMAP(DIV_STK_X, DIV_STK_X);
   CASE_ADDR_BINOP(DIV, _I,);
   CASE_REMAP_REGS(DIV, _I,);

   case OCODE_DIV_STK_U:
      args.push_back(func_Udiv);
      PUSH_TOKEN(BCODE_JMP_CAL_IMM);
      break;

   CASE_ADDR_UNAOP(INC, _I,);
   CASE_ADDR_UNAOP(INC, _U,);
   CASE_REMAP_REGS(INC, _I,);
   CASE_REMAP_REGS(INC, _U,);

   CASE_ADDR_BINOP(IOR, _I,);
   CASE_ADDR_BINOP(IOR, _U,);
   CASE_ADDR_BINOP(IOR, _X,);
   CASE_REMAP_REG2(IOR, _I,);
   CASE_REMAP_REG2(IOR, _U,);
   CASE_REMAP_REG2(IOR, _X,);

   CASE_ADDR_BINOP(LSH, _I,);
   CASE_ADDR_BINOP(LSH, _U,);
   CASE_ADDR_BINOP(LSH, _X,);
   CASE_REMAP_REG2(LSH, _I,);
   CASE_REMAP_REG2(LSH, _U,);
   CASE_REMAP_REG2(LSH, _X,);

   CASE_ADDR_BINOP(MOD, _I,);
   CASE_ADDR_BINOP(MOD, _X,);
   CASE_REMAP_REGS(MOD, _I,);
   CASE_REMAP_REGS(MOD, _X,);

   case OCODE_MOD_STK_U:
      args.push_back(func_Udiv);
      PUSH_TOKEN(BCODE_JMP_CAL_NIL_IMM);
      args.push_back(indexRet1);
      PUSH_TOKEN(BCODE_GET_IMM);
      args.push_back(indexAuto);
      PUSH_TOKEN(BCODE_GET_WLDARR);
      break;

   CASE_REMAP(MUL_STK_X, MUL_STK_X);
   CASE_ADDR_BINOP(MUL, _I,);
   CASE_ADDR_BINOP(MUL, _U,);
   CASE_REMAP_REGS(MUL, _I,);
   CASE_REMAP_REGS(MUL, _U,);

   CASE_ADDR_BINOP(RSH, _I,);
   CASE_ADDR_BINOP(RSH, _X,);
   CASE_REMAP_REG2(RSH, _I,);
   CASE_REMAP_REG2(RSH, _X,);

   case OCODE_RSH_STK_U:
      args.push_back(func_Ursh);
      PUSH_TOKEN(BCODE_JMP_CAL_IMM);
      break;

   CASE_ADDR_BINOP(SUB, _I,);
   CASE_ADDR_BINOP(SUB, _U,);
   CASE_ADDR_BINOP(SUB, _X,);
   CASE_REMAP_REGS(SUB, _I,);
   CASE_REMAP_REGS(SUB, _U,);
   CASE_REMAP_REGS(SUB, _X,);

   CASE_ADDR_BINOP(XOR, _I,);
   CASE_ADDR_BINOP(XOR, _U,);
   CASE_ADDR_BINOP(XOR, _X,);
   CASE_REMAP_REG2(XOR, _I,);
   CASE_REMAP_REG2(XOR, _U,);
   CASE_REMAP_REG2(XOR, _X,);

   CASE_REMAP(INV_STK_I, INV_STK);
   CASE_REMAP(INV_STK_U, INV_STK);
   CASE_REMAP(INV_STK_X, INV_STK);

   // Jumps
   CASE_REMAP(JMP,             JMP);
   case OCODE_JMP_TAB:
      if((args = object->args).size() % 2)
         Error_P("uneven OCODE_JMP_TAB");
      PUSH_TOKEN(BCODE_JMP_TAB);
      break;
   CASE_REMAP(JMP_CAL,         JMP_CAL);
   CASE_REMAP(JMP_CAL_IMM,     JMP_CAL_IMM);
   case OCODE_JMP_CAL_NIL:
      PUSH_TOKEN(BCODE_JMP_CAL);
      PUSH_TOKEN(BCODE_STK_DROP);
      break;
   CASE_REMAP(JMP_CAL_NIL_IMM, JMP_CAL_NIL_IMM);
   CASE_REMAP(JMP_RET,         JMP_RET);
   CASE_REMAP(JMP_RET_NIL,     JMP_RET_NIL);

   // Stack-ops.
   CASE_REMAP(STK_COPY, STK_COPY);
   CASE_REMAP(STK_SWAP, STK_SWAP);

   // Trigonometry
   CASE_REMAP(TRIG_COS_X, TRIG_COS);
   CASE_REMAP(TRIG_SIN_X, TRIG_SIN);

   // Variable Address
   case OCODE_GET_AUTPTR:
      args.push_back(indexStack);
      PUSH_TOKEN(BCODE_GET_WLDREG);
      break;

   case OCODE_GET_AUTPTR_IMM:
      args.push_back(indexStack);
      PUSH_TOKEN(BCODE_GET_WLDREG);
      PUSH_TOKEN_ADD_ARG0();
      break;

   case OCODE_SET_AUTPTR_IMM:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
   case OCODE_SET_AUTPTR:
      args.push_back(indexStack);
      PUSH_TOKEN(BCODE_SET_WLDREG);
      break;

   case OCODE_ADD_AUTPTR_IMM:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
   case OCODE_ADD_AUTPTR:
      args.push_back(indexStack);
      PUSH_TOKEN(BCODE_ADD_WLDREG);
      break;

   case OCODE_SUB_AUTPTR_IMM:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
   case OCODE_SUB_AUTPTR:
      args.push_back(indexStack);
      PUSH_TOKEN(BCODE_SUB_WLDREG);
      break;

   // Variable Get
   case OCODE_GET_FUNCP:
      // Don't tag nullptr.
      if(object->getArg(0)->resolveUNS())
      {
         PUSH_TOKEN_ARGS1(BCODE_GET_FUNCP, 1);
      }
      else
      {
         PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
      }
      break;

   case OCODE_GET_STRING:
      PUSH_TOKEN_ARGS1(BCODE_GET_IMM, 1);
      // Don't tag nullptr.
      if(option_string_tag && object->getArg(0)->resolveUNS())
         PUSH_TOKEN(BCODE_STRING_TAG);
      break;

   case OCODE_GET_FARPTR:
      PUSH_TOKEN_ADD_ARG0();
      args.push_back(func_Getptr);
      PUSH_TOKEN(BCODE_JMP_CAL_IMM);
      break;

   case OCODE_GET_STRPTR:
      PUSH_TOKEN_ADD_ARG0();
      args.push_back(func_GetCharArgs);
      args.push_back(func_GetChar);
      PUSH_TOKEN(BCODE_NATIVE);
      break;

   CASE_ADDR_UNAOP(GET,,);
   CASE_REMAP_REGS(GET,,);

   // Variable Set
   case OCODE_SET_FARPTR:
      PUSH_TOKEN_ADD_ARG0();
      args.push_back(func_Setptr);
      PUSH_TOKEN(BCODE_JMP_CAL_NIL_IMM);
      break;

   CASE_ADDR_BINOP(SET,,);
   CASE_REMAP_REGS(SET,,);
   CASE_REMAP(SET_SCRRET, SET_SCRRET);

   // Miscellaneous
   CASE_REMAP(NATIVE, NATIVE);

   // ACS

   // ACS Common Extensions

   // ACS Extensions
   CASE_MAP_ACSE(GAME_EXEC);
   CASE_MAP_ACSE(GAME_EXEC_IMM);
   CASE_MAP_ACSE(GAME_GET_CVAR);
   CASE_MAP_ACSE(GAME_GET_INVASIONSTATE);
   CASE_MAP_ACSE(GAME_GET_INVASIONWAVE);
   CASE_MAP_ACSE(GAME_GET_LEVELINFO);
   CASE_MAP_ACSE(GAME_GET_TEAMINFO_PLAYERCOUNT_BLUE);
   CASE_MAP_ACSE(GAME_GET_TEAMINFO_PLAYERCOUNT_RED);
   CASE_MAP_ACSE(GAME_GET_TEAMINFO_SCORE_BLUE);
   CASE_MAP_ACSE(GAME_GET_TEAMINFO_SCORE_RED);
   CASE_MAP_ACSE(GAME_GET_THINGCOUNT_STR);
   CASE_MAP_ACSE(GAME_GET_TYPE_ONEFLAGCTF);
   CASE_MAP_ACSE(GAME_GET_TYPE_SINGLEPLAYER);
   CASE_MAP_ACSE(GAME_REPLACETEXTURES);
   CASE_MAP_ACSE(GAME_SET_AIRCONTROL);
   CASE_MAP_ACSE(GAME_SET_AIRCONTROL_IMM);
   CASE_MAP_ACSE(GAME_SET_GRAVITY);
   CASE_MAP_ACSE(GAME_SET_GRAVITY_IMM);
   CASE_MAP_ACSE(GAME_SET_LEVEL);
   CASE_MAP_ACSE(GAME_SET_MUSIC);
   CASE_MAP_ACSE(GAME_SET_MUSIC_IMM);
   CASE_MAP_ACSE(GAME_SET_MUSICLOCAL);
   CASE_MAP_ACSE(GAME_SET_MUSICLOCAL_IMM);
   CASE_MAP_ACSE(GAME_SET_MUSICST);
   CASE_MAP_ACSE(GAME_SET_SKY);
   CASE_MAP_ACSE(LINE_GET_OFFSETY);
   CASE_MAP_ACSE(LTAG_SET_BLOCKMONSTER);
   CASE_MAP_ACSE(MISC_PLAYMOVIE);
   CASE_MAP_ACSE(MTAG_ADD_INVENTORY);
   CASE_MAP_ACSE(MTAG_CHK_TEXTURE_CEILING);
   CASE_MAP_ACSE(MTAG_CHK_TEXTURE_FLOOR);
   CASE_MAP_ACSE(MTAG_CLR_INVENTORY);
   CASE_MAP_ACSE(MTAG_DAMAGE);
   CASE_MAP_ACSE(MTAG_GET);
   CASE_MAP_ACSE(MTAG_GET_ANGLE);
   CASE_MAP_ACSE(MTAG_GET_CEILINGZ);
   CASE_MAP_ACSE(MTAG_GET_CLASSIFICATION);
   CASE_MAP_ACSE(MTAG_GET_FLOORZ);
   CASE_MAP_ACSE(MTAG_GET_INVENTORY);
   CASE_MAP_ACSE(MTAG_GET_LIGHTLEVEL);
   CASE_MAP_ACSE(MTAG_GET_PITCH);
   CASE_MAP_ACSE(MTAG_GET_X);
   CASE_MAP_ACSE(MTAG_GET_Y);
   CASE_MAP_ACSE(MTAG_GET_Z);
   CASE_MAP_ACSE(MTAG_MORPH);
   CASE_MAP_ACSE(MTAG_SET);
   CASE_MAP_ACSE(MTAG_SET_ANGLE);
   CASE_MAP_ACSE(MTAG_SET_CAMERATEXTURE);
   CASE_MAP_ACSE(MTAG_SET_MARINESPRITE);
   CASE_MAP_ACSE(MTAG_SET_MARINEWEAPON);
   CASE_MAP_ACSE(MTAG_SET_PITCH);
   CASE_MAP_ACSE(MTAG_SET_SPECIAL);
   CASE_MAP_ACSE(MTAG_SET_STATE);
   CASE_MAP_ACSE(MTAG_SET_XYZ);
   CASE_MAP_ACSE(MTAG_SUB_INVENTORY);
   CASE_MAP_ACSE(MTAG_UNMORPH);
   CASE_MAP_ACSE(MTAG_USEINVENTORY);
   CASE_MAP_ACSE(PLAYER_GET_CAMERA);
   CASE_MAP_ACSE(PLAYER_GET_CLASS);
   CASE_MAP_ACSE(PLAYER_GET_INFO);
   CASE_MAP_ACSE(PLAYER_GET_INGAME);
   CASE_MAP_ACSE(PLAYER_GET_INPUT);
   CASE_MAP_ACSE(PLAYER_GET_ISBOT);
   CASE_MAP_ACSE(SCREEN_FADE_RANGE);
   CASE_MAP_ACSE(SCREEN_FADE_START);
   CASE_MAP_ACSE(SCREEN_FADE_STOP);
   CASE_MAP_ACSE(SCREEN_GET_HEIGHT);
   CASE_MAP_ACSE(SCREEN_GET_WIDTH);
   CASE_MAP_ACSE(SCREEN_SET_HUDSIZE);
   CASE_MAP_ACSE(SOUND_AMBIENTLOCAL);
   CASE_MAP_ACSE(SOUND_THING);
   CASE_MAP_ACSE(SPAWN_POINT);
   CASE_MAP_ACSE(SPAWN_POINT_IMM);
   CASE_MAP_ACSE(SPAWN_PROJECTILE_SID);
   CASE_MAP_ACSE(SPAWN_PROJECTILE_STR);
   CASE_MAP_ACSE(SPAWN_SPOT_ANGLE);
   CASE_MAP_ACSE(SPAWN_SPOT_ANGLE_IMM);
   CASE_MAP_ACSE(SPAWN_SPOT);
   CASE_MAP_ACSE(SPECIAL_EXEC5_RETN1);
   CASE_MAP_ACSE(STAG_DAMAGE);
   CASE_MAP_ACSE(STAG_GET_LIGHTLEVEL);
   CASE_MAP_ACSE(STAG_GET_THINGCOUNT_SID);
   CASE_MAP_ACSE(STAG_GET_THINGCOUNT_STR);
   CASE_MAP_ACSE(STAG_GET_Z_CEILING);
   CASE_MAP_ACSE(STAG_GET_Z_FLOOR);
   CASE_MAP_ACSE(STAG_SET_TRIGGER_CEILING);
   CASE_MAP_ACSE(STAG_SET_TRIGGER_FLOOR);
   CASE_MAP_ACSE(STRING_COPY_GLOBALRANGE);
   CASE_MAP_ACSE(STRING_COPY_MAPRANGE);
   CASE_MAP_ACSE(STRING_COPY_WORLDRANGE);
   CASE_MAP_ACSE(STRING_GET_LENGTH);
   CASE_MAP_ACSE(THING_ADD_INVENTORY);
   CASE_MAP_ACSE(THING_ADD_INVENTORY_IMM);
   CASE_MAP_ACSE(THING_CHK_WEAPON);
   CASE_MAP_ACSE(THING_CLR_INVENTORY);
   CASE_MAP_ACSE(THING_GET_AMMOCAP);
   CASE_MAP_ACSE(THING_GET_ARMOR);
   CASE_MAP_ACSE(THING_GET_FRAGS);
   CASE_MAP_ACSE(THING_GET_HEALTH);
   CASE_MAP_ACSE(THING_GET_INVENTORY);
   CASE_MAP_ACSE(THING_GET_INVENTORY_IMM);
   CASE_MAP_ACSE(THING_GET_MTAG);
   CASE_MAP_ACSE(THING_GET_PLAYERNUMBER);
   CASE_MAP_ACSE(THING_GET_SIGIL);
   CASE_MAP_ACSE(THING_GET_TEAM);
   CASE_MAP_ACSE(THING_SET_AMMOCAP);
   CASE_MAP_ACSE(THING_SET_MUGSHOT);
   CASE_MAP_ACSE(THING_SET_WEAPON);
   CASE_MAP_ACSE(THING_SUB_INVENTORY);
   CASE_MAP_ACSE(THING_SUB_INVENTORY_IMM);
   CASE_MAP_ACSE(THING_USEINVENTORY);
   CASE_MAP_ACSE(TRANSLATION_DESAT);
   CASE_MAP_ACSE(TRANSLATION_END);
   CASE_MAP_ACSE(TRANSLATION_PALETTE);
   CASE_MAP_ACSE(TRANSLATION_RGB);
   CASE_MAP_ACSE(TRANSLATION_START);
   CASE_MAP_ACSE(TRIG_VECTORANGLE);
   CASE_MAP_ACSE(WAIT_SNAM);

   // ACS Printing
   CASE_MAP_ACSP(END_HUD);
   CASE_MAP_ACSP(END_HUD_BOLD);
   CASE_MAP_ACSP(END_LOG);
   CASE_MAP_ACSP(END_OPT);
   CASE_MAP_ACSP(END_STR);
   CASE_MAP_ACSP(KEYBIND);
   CASE_REMAP_ACSP(NUM_BIN_U, NUM_BIN);
   CASE_REMAP_ACSP(NUM_DEC_X, NUM_DEC_X);
   CASE_REMAP_ACSP(NUM_HEX_U, NUM_HEX);
   CASE_MAP_ACSP(PLAYER_NAME);
   CASE_MAP_ACSP(SET_FONT);
   CASE_MAP_ACSP(SET_FONT_IMM);
   CASE_MAP_ACSP(START_OPT);
   CASE_MAP_ACSP(STR_GBLARR);
   CASE_MAP_ACSP(STR_GBLRNG);
   CASE_MAP_ACSP(STR_LOCALIZED);
   CASE_MAP_ACSP(STR_MAPARR);
   CASE_MAP_ACSP(STR_MAPRNG);
   CASE_MAP_ACSP(STR_WLDARR);
   CASE_MAP_ACSP(STR_WLDRNG);

   case OCODE_NONE:
   default:
      Error_P("unknown OCODE: %s", make_string(object->code));
   }
   }
}