void BoxObject::load ( trObjectParserBlock &parserBlock ) { depthWrites = true; // scan elements tvStringPairList::iterator itr = parserBlock.elements.begin(); std::string grimeTexture; float grimeZ = 1; while ( itr != parserBlock.elements.end() ) { if ( !basicElement(*itr) ) { std::string tag = string_util::toupper(itr->first); if ( tag == "COLOR" ) color.parseColor(itr->second); if ( tag == "DEPTHWRITE" ) depthWrites = atoi(itr->second.c_str()) != 0; if ( tag == "NOTOP" ) noTop = atoi(itr->second.c_str()) != 0; if ( tag == "GRIMETEXTURE" ) grimeTexture = itr->second.c_str(); if ( tag == "GRIMEZ" ) grimeZ = (float)atof(itr->second.c_str()); } itr++; } glList = DisplayListManager::instance().newList(this); if ( grimeTexture.size() ) { // we need to make a child grim object // we copy the elements so it gets all the same stuff // but we DON'T do the sub blocks trObjectParserBlock miniBlock; miniBlock.name = parserBlock.name; miniBlock.elements.push_back(tpStringPair(std::string("SIZE"),string_util::format("%f,%f,%f",size.X(),size.Y(),grimeZ*0.5f))); float localCenter = -(size.Z()-grimeZ/2.0f); miniBlock.elements.push_back(tpStringPair(std::string("POSITION"),string_util::format("%f,%f,%f",0.0f,0.0f,localCenter))); miniBlock.elements.push_back(tpStringPair(std::string("DEPTHWRITE"),std::string("0"))); miniBlock.elements.push_back(tpStringPair(std::string("NOTOP"),std::string("1"))); miniBlock.elements.push_back(tpStringPair(std::string("TEXTURE"),grimeTexture)); C3DVertex uvScale(1,1,1); if ((int)uvScales.size()) uvScale = uvScales[(int)uvScales.size()-1]; miniBlock.elements.push_back(tpStringPair(std::string("UVSCALE"),string_util::format("%f,%f,%f",uvScale.X(),uvScale.Y(),uvScale.Z()*(grimeZ/size.Z())))); world->AddObject("BOX",miniBlock,this); } MapBaseObject::load(parserBlock); }