void visit( const char* key, const char* value ){ if ( strcmp( key, "classname" ) == 0 ) { m_entity->SetClassname( value ); } else{ m_entity->AddEPair( key, value ); } }
void operator()(scene::Instance& instance) const { if(!instance.isSelected()) { return; } ent.LoadFromEntity(instance.path().top()); DEPair* pEpair = ent.FindEPairByKey("origin"); if(!pEpair) { return; } vec3_t vec, out; sscanf( pEpair->value.GetBuffer(), "%f %f %f", &vec[0], &vec[1], &vec[2]); planter.FindDropPoint( vec, out ); char buffer[256]; sprintf( buffer, "%f %f %f", out[0], out[1], out[2] ); ent.AddEPair( "origin", buffer ); ent.RemoveFromRadiant(); ent.BuildInRadiant(false); }
bool DShape::BuildPit( vec3_t min, vec3_t max ){ if ( ( max[2] - min[2] ) < 196 ) { return FALSE; } srand( time( NULL ) ); vec3_t centre; VectorAdd( min, max, centre ); VectorScale( centre, 0.5f, centre ); char buffer[256]; int team = ( rand() % 10000 ) + 5000; // ************* SPEAKER *************** sprintf( buffer, "t%i_1", team ); // trigger for speaker vec3_t triggerVoiceBtm; VectorCopy( min, triggerVoiceBtm ); triggerVoiceBtm[2] = max[2] - 16; DEntity* triggerVoice = m_Container.AddEntity( "trigger_multiple" ); GetBoundingCube( triggerVoiceBtm, max, "textures/common/trigger", triggerVoice ); triggerVoice->AddEPair( "target", buffer ); //-------------------- // target for speaker vec3_t voiceOrigin; VectorCopy( centre, voiceOrigin ); voiceOrigin[2] = max[2] + 16; DEntity* targetVoice = m_Container.AddEntity( "target_speaker" ); targetVoice->AddEPair( "targetname", buffer ); sprintf( buffer, "%f %f %f", voiceOrigin[0], voiceOrigin[1], voiceOrigin[2] ); targetVoice->AddEPair( "origin", buffer ); targetVoice->AddEPair( "spawnflags", "8" ); targetVoice->AddEPair( "noise", "*falling1.wav" ); //-------------------- // *********** END SPEAKER ************* // ********* POWERUP REMOVAL *********** sprintf( buffer, "t%i_2", team ); // trigger for powerup removal vec3_t triggerPwrRmvTop, triggerPwrRmvBtm; VectorCopy( min, triggerPwrRmvBtm ); VectorCopy( max, triggerPwrRmvTop ); triggerPwrRmvTop[2] = triggerVoiceBtm[2] - 64; triggerPwrRmvBtm[2] = triggerPwrRmvTop[2] - 16; DEntity* triggerPwrRmv = m_Container.AddEntity( "trigger_multiple" ); GetBoundingCube( triggerPwrRmvBtm, triggerPwrRmvTop, "textures/common/trigger", triggerPwrRmv ); triggerPwrRmv->AddEPair( "target", buffer ); //-------------------- // target for powerup removal vec3_t pwrRmvOrigin; VectorCopy( centre, pwrRmvOrigin ); pwrRmvOrigin[2] = triggerPwrRmvTop[2] + 16; DEntity* targetPwrRmv = m_Container.AddEntity( "target_remove_powerups" ); targetPwrRmv->AddEPair( "targetname", buffer ); sprintf( buffer, "%f %f %f", pwrRmvOrigin[0], pwrRmvOrigin[1], pwrRmvOrigin[2] ); targetPwrRmv->AddEPair( "origin", buffer ); //-------------------- // ****** END POWERUP REMOVAL ******** // ********* DAMAGE *********** // trigger for damage vec3_t triggerDmgTop, triggerDmgBtm; VectorCopy( min, triggerDmgBtm ); VectorCopy( max, triggerDmgTop ); triggerDmgBtm[2] = min[2] + 64; triggerDmgTop[2] = triggerDmgBtm[2] + 16; DEntity* triggerDmg = m_Container.AddEntity( "trigger_hurt" ); GetBoundingCube( triggerDmgBtm, triggerDmgTop, "textures/common/trigger", triggerDmg ); triggerDmg->AddEPair( "dmg", "9999" ); triggerDmg->AddEPair( "spawnflags", "12" ); //-------------------- // ****** END DAMAGE ******** // ********* NODROP *********** vec3_t nodropTop; VectorCopy( max, nodropTop ); nodropTop[2] = min[2] + 64; GetBoundingCube( min, nodropTop, "textures/common/nodrop" ); // ****** END NODROP ******** return TRUE; }