Ejemplo n.º 1
0
void psOperProfileSet::Dump(const csStringFast<50> & unitName, csStringFast<50> & header, csStringFast<50> & list)
{
    double totalCons=0;
    psOperProfile **sortedProfs;
    float time;
    size_t i;
    
    for (i=0; i < profs.GetSize(); i++)
        totalCons += profs[i]->GetConsumption();
    time = csGetTicks() - profStart;

    header += csString().Format("Total time: %i seconds\n", int(time/1000));
    header += csString().Format("Total %s: %i \n", unitName.GetData(), int(totalCons));
    // NOTE: totalcons might NOT be in kilo units as assumed here
    //header += csString().Format("Average consumption: %f %s/sec\n", totalCons*8/1024/time*1000, unitName.GetData());
    
    // sort the profiles by bandwidth and dump them out
    sortedProfs = new psOperProfile*[profs.GetSize()];
    for (i=0; i < profs.GetSize(); i++)
        sortedProfs[i] = profs[i];
    qsort(sortedProfs, profs.GetSize(), sizeof(psOperProfile*), psOperProfile::cmpProfs);
    for (i=0; i < profs.GetSize(); i++)
        list += sortedProfs[i]->Dump(totalCons, unitName);
    delete [] sortedProfs;
}
Ejemplo n.º 2
0
FrankieScene::FrankieScene (AvatarTest* avatarTest)
  : avatarTest (avatarTest), debugBones (false), debugBBoxes (false), targetReached (false),
    lookAtListener (this), decalsEnabled (false), decal (nullptr), decalPosition (0.0f)
{
  // Setup the parameters of the camera manager
  avatarTest->cameraManager->SetStartPosition (csVector3 (0.0f, 0.25f, -1.25f));
  avatarTest->cameraManager->SetCameraMinimumDistance (0.75f);

  // Define the available keys
  avatarTest->hudManager->GetKeyDescriptions ()->Empty ();
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("arrow keys: move camera");
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("SHIFT-up/down keys: camera closer/farther");
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("+/-: walk faster/slower");
  avatarTest->hudManager->GetKeyDescriptions ()->Push (csString().Format ("t: toggle %s target mode",
					      CS::Quote::Single ("LookAt")));
  avatarTest->hudManager->GetKeyDescriptions ()->Push (csString().Format ("y: toggle %s mode",
					      CS::Quote::Single ("LookAt: always rotate")));
  avatarTest->hudManager->GetKeyDescriptions ()->Push (csString().Format ("u: toggle %s",
					      CS::Quote::Single ("LookAt: rotation speed")));
  if (avatarTest->physicsEnabled)
  {
    avatarTest->hudManager->GetKeyDescriptions ()->Push ("f: toggle physical tail");
    avatarTest->hudManager->GetKeyDescriptions ()->Push ("left mouse: kill Frankie");
    avatarTest->hudManager->GetKeyDescriptions ()->Push ("d: display active colliders");
  }
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("a: display bone positions");
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("b: display bounding boxes");
  if (avatarTest->decalManager)
    avatarTest->hudManager->GetKeyDescriptions ()->Push ("c: toggle decals under the mouse");
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("r: reset scene");
  avatarTest->hudManager->GetKeyDescriptions ()->Push ("n: switch to next scene");
}
Ejemplo n.º 3
0
void csGraphics2D::Alert (int type, const wchar_t* title, const wchar_t* okMsg, 
			  const wchar_t* msg, ...)
{
  va_list arg;
  va_start (arg, msg);
  AlertV (type, csString (title), csString (okMsg), csString (msg), arg);
  va_end (arg);
}
Ejemplo n.º 4
0
SoundFile::SoundFile (const char *newname, const char *newfilename)
{
    name      = csString(newname);
    filename  = csString(newfilename);
    loaded    = false;
    snddata   = NULL;
    lasttouch = csGetTicks();
}
Ejemplo n.º 5
0
SoundFile::SoundFile (SoundFile* const &copythat)
{
    name      = csString(copythat->name);
    filename  = csString(copythat->filename);
    loaded    = false;
    snddata   = NULL;
    lasttouch = csGetTicks();
}
Ejemplo n.º 6
0
bool GMEventManager::Initialise(void)
{
    GMEvent* ongoingGMEvent;

    // load any existing gm events from database
    Result events(db->Select("SELECT * from gm_events order by id"));
    if (events.IsValid())
    {
        for (unsigned long e=0; e<events.Count(); e++)
        {
            ongoingGMEvent = new GMEvent;
            ongoingGMEvent->id = events[e].GetInt("id");
            ongoingGMEvent->status = static_cast<GMEventStatus>(events[e].GetInt("status"));
            ongoingGMEvent->gmID = events[e].GetInt("gm_id");
            ongoingGMEvent->EndTime = 0;
            ongoingGMEvent->eventName = csString(events[e]["name"]);
            ongoingGMEvent->eventDescription = csString(events[e]["description"]);
            gmEvents.Push(ongoingGMEvent);

            // setup next available id
            if (ongoingGMEvent->id >= nextEventID)
                nextEventID = ongoingGMEvent->id + 1;
        }

        // load registered players from database
        Result registeredPlayers(db->Select("SELECT * from character_events order by event_id"));
        if (registeredPlayers.IsValid())
        {
            PlayerData eventPlayer;
            int eventID;
            for (unsigned long rp=0; rp<registeredPlayers.Count(); rp++)
            {
                eventID = registeredPlayers[rp].GetInt("event_id");
                eventPlayer.PlayerID = registeredPlayers[rp].GetInt("player_id");
                eventPlayer.CanEvaluate = (registeredPlayers[rp]["vote"] == NULL);
                if ((ongoingGMEvent = GetGMEventByID(eventID)) != NULL)
                    ongoingGMEvent->Player.Push(eventPlayer);
                else
                {
                    Error1("GMEventManager: gm_events / character_events table mismatch.");
                    return false;        // ermm.. somethings gone wrong with the DB!!!
                }
            }
        }
        else
        {
            Error1("GMEventManager: character_events table is not valid.");
            return false;
        }

        return true;
    }

    Error1("GMEventManager: gm_events table is not valid.");
    return false;
}
Ejemplo n.º 7
0
bool SoundHandle::Init(const char* resname, bool loop, float volume_preset,
                       int type, SoundControl* &ctrl, bool doppler)
{
    csRef<iSndSysData> snddata;

    if(!SoundSystemManager::GetSingleton().GetSoundData()->LoadSoundFile(resname, snddata))
    {
        return false;
    }

    if(!SoundSystemManager::GetSingleton().GetSoundSystem()->CreateStream(snddata, loop, type, sndstream))
    {
        SoundSystemManager::GetSingleton().GetSoundData()->UnloadSoundFile(resname);
        return false;
    }

    SoundSystemManager::GetSingleton().GetSoundSystem()->CreateSource(sndstream, sndsource);
    preset_volume = volume_preset;
    sndCtrl = ctrl;
    name = csString(resname);

    dopplerEffect = doppler;

    return true;
}
Ejemplo n.º 8
0
csString csMatrix3::Description () const
{
    return csString().Format ("(%s), (%s), (%s)",
                              Row1().Description().GetData(),
                              Row2().Description().GetData(),
                              Row3().Description().GetData());
}
Ejemplo n.º 9
0
bool pawsRadioButtonGroup::OnButtonPressed(int mouseButton, int keyModifier, pawsWidget* widget)
{
    for(size_t x=0; x<children.GetSize(); x++)
    {
        csString factory = csString(children[x]->GetType());

        if(factory == "pawsRadioButton")
        {
            pawsRadioButton* radButton = (pawsRadioButton*)children[x];

            if(radButton == widget)
                radButton->SetState(true);
            else
                radButton->SetState(false);
        }
    }

    if(parent)
        parent->OnChange(this);

    if(parent)
        return parent->OnButtonPressed(mouseButton, keyModifier, widget);

    return false;
}
Ejemplo n.º 10
0
bool pawsStyles::LoadStyles(const csString &fileName)
{
    csRef<iVFS> vfs =  csQueryRegistry<iVFS > (objectReg);
    assert(vfs);
    csRef<iDataBuffer> buff = vfs->ReadFile(fileName);
    if(buff == NULL)
    {
        Error2("Could not find file: %s", fileName.GetData());
        return false;
    }
    csRef<iDocumentSystem> xml;
    xml.AttachNew(new csTinyDocumentSystem);
    assert(xml);
    csRef<iDocument> doc = xml->CreateDocument();
    assert(doc);
    const char* error = doc->Parse(buff);
    if(error)
    {
        Error3("Parse error in %s: %s", fileName.GetData(), error);
        return false;
    }
    csRef<iDocumentNode> root = doc->GetRoot();
    if(root == NULL) return false;
    csRef<iDocumentNode> topNode = root->GetNode("styles");
    if(topNode == NULL)
    {
        Error2("Missing <styles> tag in %s", fileName.GetData());
        return false;
    }

    csRef<iDocumentNodeIterator> iter = topNode->GetNodes("style");
    while(iter->HasNext())
    {
        csRef<iDocumentNode> styleNode = iter->Next();
        csString name = styleNode->GetAttributeValue("name");
        if(styles.In(csString(name)))
        {
            // This is not an error anymore.  Custom skins can and should supercede standard styles.
            //Error2("Warning: PAWS style '%s' defined more than once", name.GetData());
        }
        else
            styles.Put(csString(name), styleNode);
    }

    InheritStyles();
    return true;
}
Ejemplo n.º 11
0
void EntityManager::LoadFamiliarAffinityAttributes()
{
    csString sql = "SELECT * FROM char_create_affinity";
    
    Result result( db->Select( sql ) );

    if (!result.IsValid())
        return;

    for ( unsigned long row = 0; row < result.Count(); row++)
    {
        psAffinityAttribute* newAttribute = new psAffinityAttribute();
        newAttribute->Attribute = csString( result[row]["attribute"] ).Downcase();
        newAttribute->Category  = csString( result[row]["category"]  ).Downcase();
        affinityAttributeList.Put( csHashCompute( newAttribute->Attribute + newAttribute->Category ), newAttribute );
    }
}
Ejemplo n.º 12
0
void pawsNpcDialogWindow::OnListAction( pawsListBox* widget, int status )
{
    if (status == LISTBOX_HIGHLIGHTED)
    {
		pawsTextBox *fld = dynamic_cast<pawsTextBox *>(widget->GetSelectedRow()->FindWidgetXMLBinding("text"));
		Debug2(LOG_QUESTS, 0, "Pressed: %s\n",fld->GetText() );
    }
	else if (status == LISTBOX_SELECTED)
	{
        //if no row is selected
        if(!widget->GetSelectedRow())
            return;

		pawsTextBox *fld  = dynamic_cast<pawsTextBox *>(widget->GetSelectedRow()->FindWidgetXMLBinding("text"));
		Debug2(LOG_QUESTS, 0,"Player chose '%s'.\n", fld->GetText() );
		pawsTextBox *trig = dynamic_cast<pawsTextBox *>(widget->GetSelectedRow()->FindWidgetXMLBinding("trig"));
		Debug2(LOG_QUESTS, 0,"Player says '%s'.\n", trig->GetText() );

        csString trigger(trig->GetText());

        // Send the server the original trigger
    	csString cmd;
        if (trigger.GetAt(0) == '=') // prompt window signal
		{
			pawsStringPromptWindow::Create(csString(trigger.GetData()+1),
				                           csString(""),
				                           false, 320, 30, this, trigger.GetData()+1 );
		}
		else
		{
			if (trigger.GetAt(0) != '<')
			{
	    		cmd.Format("/tellnpc %s", trigger.GetData() );
				psengine->GetCmdHandler()->Publish(cmd);
			}
			else
			{
				psSimpleStringMessage gift(0,MSGTYPE_EXCHANGE_AUTOGIVE,trigger);
				gift.SendMessage();
			}
			DisplayTextBubbles(fld->GetText());
		}
		Hide();
	}
}
Ejemplo n.º 13
0
void psServerStatusRunEvent::Trigger ()
{
    struct tm currentTime;
    time_t now;
            
    csString reportString;
    csString timeString;
    
    csRef<iDocumentSystem> docSystem = csPtr<iDocumentSystem> (new csTinyDocumentSystem ());
    csRef<iDocument> doc = docSystem->CreateDocument();
    csRef<iDocumentNode> rootNode = doc->CreateRoot();

    // create ClientStatusLogger object to log info under node
    ClientStatusLogger clientLogger(rootNode);

    time( &now );
    currentTime = *gmtime( &now );
    timeString = asctime( &currentTime );
    timeString.Trim();
    EconomyManager::Economy& economy = psserver->GetEconomyManager()->economy;
    
    unsigned int moneyIn = economy.lootValue + economy.sellingValue + economy.pickupsValue;
    unsigned int moneyOut = economy.buyingValue + economy.droppedValue;
    
    ClientConnectionSet * clients = EntityManager::GetSingleton().GetClients();
    reportString.Format("<server_report time=\"%s\" now=\"%ld\" number=\"%u\" client_count=\"%zu\" mob_births=\"%u\" mob_deaths=\"%u\" player_deaths=\"%u\" sold_items=\"%u\" sold_value=\"%u\" totalMoneyIn=\"%u\" totalMoneyOut=\"%u\">\n",
        timeString.GetData(), now, ServerStatus::count, clients->Count(), ServerStatus::mob_birthcount, ServerStatus::mob_deathcount, ServerStatus::player_deathcount, ServerStatus::sold_items, ServerStatus::sold_value, moneyIn, moneyOut );
    ClientIterator i(*clients);
    while(i.HasNext())
    {
        Client *curr = i.Next();
        ReportClient(curr, clientLogger, reportString);
    }
    // Record npc data
    csHash<gemObject*, EID> & gems = EntityManager::GetSingleton().GetGEM()->GetAllGEMS();
    csHash<gemObject*, EID>::GlobalIterator gemi(gems.GetIterator());
    gemObject* obj;
    
    while ( gemi.HasNext() )
    {
        obj = gemi.Next();       
        if(!obj->GetClient() && obj->GetCharacterData())
            ReportNPC(obj->GetCharacterData(), reportString);
    }
    reportString.Append( "</server_report>" );
    
    csRef<iFile> logFile = psserver->vfs->Open( ServerStatus::reportFile, VFS_FILE_WRITE );            
    logFile->Write( reportString, reportString.Length() );                         
    logFile->Flush();

    // write XML log to file
    csRef<iFile> logFileTest = psserver->vfs->Open(csString("/this/testlog.xml"), VFS_FILE_WRITE);
    doc->Write(logFileTest);

    ServerStatus::count++;
    ServerStatus::ScheduleNextRun();
}
Ejemplo n.º 14
0
bool psEntityTypes::SaveConfigToFile()
{
    csString xml;
    xml = "<EntityInteraction>\n";
    for (size_t i=0; i < types.GetSize(); i++)
        xml += csString().Format("\t<%s value='%i'/>\n", types[i]->id.GetData(), types[i]->usedCommand);
    xml += "</EntityInteraction>";
    return vfs->WriteFile(CONFIG_FILE_NAME, xml.GetData(), xml.Length());
}
Ejemplo n.º 15
0
void psEntityLabels::RefreshGuildLabels()
{
    const csPDelArray<GEMClientObject>& entities = celClient->GetEntities();
    for (size_t i=0; i < entities.GetSize(); i++)
    {
        GEMClientActor* actor = dynamic_cast<GEMClientActor*>(entities.Get(i));
        if ( actor && csString(actor->GetGuildName()).Length() )
            OnObjectArrived(actor);
    }
}
Ejemplo n.º 16
0
csString psOperProfile::Dump(double totalConsumption, const csString & unitName)
{
    double perc = consumption/totalConsumption*100;
    if (perc > 0)
        return csString().Format(
                "count=%-5u perc=%.1lf %s=%-2i avg-%s=%.3f max=%.3f Name=%s\n",
                unsigned(count), perc, unitName.GetData(), int(consumption),
                unitName.GetData(), consumption/count, maxCons, desc.GetData());
    else
        return "";
}
Ejemplo n.º 17
0
 csString TUI::FormatByteSize (uint64 size)
 {
   static const char* const units[] = {"KB", "MB", "GB"};
   const int numUnits = sizeof(units)/sizeof(const char*);
   const uint64 unitThreshold = CONST_UINT64(2048);
   
   if (size <= unitThreshold)
   {
     return csString().Format ("%" CS_PRIu64 "B", size);
   }
   
   int unit = 0;
   while ((size > unitThreshold * CONST_UINT64(1024)) && (unit < numUnits))
   {
     size /= CONST_UINT64(1024);
     unit++;
   }
   return csString().Format ("%.1f%s",
     double (size) / 1024.0, units[unit]);
 }
Ejemplo n.º 18
0
psEmitter::psEmitter (psEmitter* const &emitter)
{
    // FIXME, this copy constructor is incomplete
    resource = csString(emitter->resource);
    maxvol = emitter->maxvol;
    minvol = emitter->minvol;
    minrange = emitter->minrange;
    maxrange = emitter->maxrange;
    timeofday = emitter->timeofday;
    timeofdayrange = emitter->timeofdayrange;
}
Ejemplo n.º 19
0
void pawsRadioButtonGroup::TurnAllOff()
{
    for(size_t x=0; x<children.GetSize(); x++)
    {
        csString factory = csString(children[x]->GetType());
        if(factory == "pawsRadioButton")
        {
            pawsRadioButton* radButton = (pawsRadioButton*)children[x];
            radButton->SetState(false);
        }
    }
}
Ejemplo n.º 20
0
bool psMainWidget::SaveConfigToFile()
{
    csString xml;
    csHash<mesgOption, int>::GlobalIterator iter = mesgOptions.GetIterator();
    xml = "<ScreenMessages>\n";
    while(iter.HasNext())
    {
        struct mesgOption &opt  = iter.Next();
        xml += csString().Format("\t<message id='%i' value='%i'/>\n", opt.type, opt.value);
    }
    xml += "</ScreenMessages>";
    return psengine->GetVFS()->WriteFile(MSGCONFIG_FILE_NAME, xml.GetData(), xml.Length());
}
Ejemplo n.º 21
0
int pawsRadioButtonGroup::GetActiveID()
{
    for(size_t x=0; x<children.GetSize(); x++)
    {
        csString factory = csString(children[x]->GetType());
        if(factory == "pawsRadioButton")
        {
            pawsRadioButton* radButton = (pawsRadioButton*)children[x];
            if(radButton->GetState())
                return radButton->GetID();
        }
    }
    return -1;
}
Ejemplo n.º 22
0
bool GMEventManager::CompleteGMEvent (Client* client, PID gmID, bool byTheControllerGM)
{
    int zero = 0;

    // if this GM does not have an active event, he/she can't end it.
    GMEvent* theEvent;
    int clientnum = client->GetClientNum();

    if ((theEvent = GetGMEventByGM(gmID, RUNNING, zero)) == NULL)
    {
        psserver->SendSystemInfo(clientnum, "You are not running an event.");
        return false;
    }

    // inform players
    ClientConnectionSet* clientConnections = psserver->GetConnections();
    Client* target;
    for (size_t p = 0; p < theEvent->Player.GetSize(); p++)
    {
        if ((target = clientConnections->FindPlayer(theEvent->Player[p].PlayerID)))
        {
            // psCharacter
            target->GetActor()->GetCharacterData()->CompleteGMEvent(false);

            psserver->SendSystemInfo(target->GetClientNum(),
                                     "Event '%s' complete.",
                                     theEvent->eventName.GetDataSafe());
        }
    }

    // GMs psCharacter
    if (byTheControllerGM)
        client->GetActor()->GetCharacterData()->CompleteGMEvent(true);

    // Update description & flag the event complete
    if (theEvent->gmID == UNDEFINED_GMID)
        theEvent->eventDescription += " (No GM)";
    else
        theEvent->eventDescription += " (" + csString(client->GetName()) + ")";
    csString EscEventDescription;
    db->Escape(EscEventDescription, theEvent->eventDescription);
    db->Command("UPDATE gm_events SET status = %d, description = '%s' WHERE id = %d",
                COMPLETED, EscEventDescription.GetDataSafe(), theEvent->id);
    theEvent->status = COMPLETED;
    theEvent->EndTime = csGetTicks();
    psserver->SendSystemInfo(clientnum, "Event '%s' complete.", theEvent->eventName.GetDataSafe());

    return true;
}
Ejemplo n.º 23
0
csPtr<iString> AssetManager::FindAsset (iStringArray* assets,
    const char* filepath, const char* filename,
    bool use_first_if_not_found)
{
  csString path;
  if (csString (filepath).StartsWith ("$#"))
  {
    filepath += 2;

    // Trick: we go to == assets size in order to make sure we pick
    // the first location when we cannot find the file.
    for (size_t i = 0 ; i <= assets->GetSize () ; i++)
    {
      if (i == assets->GetSize () && !use_first_if_not_found) return 0;
      path = assets->Get (i % assets->GetSize ());	// Make sure to wrap around
      if (path[path.Length ()-1] != '\\' && path[path.Length ()-1] != '/')
	path += CS_PATH_SEPARATOR;
      path += filepath;
      //path += filename;
      if (CS_PATH_SEPARATOR != '/')
      {
	csString sep;
	sep = CS_PATH_SEPARATOR;
	path.ReplaceAll ("/", sep);
      }
      if (i == assets->GetSize () && use_first_if_not_found) break;
      struct stat buf;
      csString sp;
      if (path[path.Length ()-1] == '\\' || path[path.Length ()-1] == '/')
	//sp = path.Slice (0, path.Length ()-1);
	sp = path + filename;
      else
	sp = path;
      if (CS::Platform::Stat (sp, &buf) == 0)
      {
        if (CS::Platform::IsRegularFile (&buf) || CS::Platform::IsDirectory (&buf))
	  break;
      }
    }
  }
  else
    path = filepath;
  path.ReplaceAll ("/", "$/");
  return new scfString (path);
}
Ejemplo n.º 24
0
bool Tribe::LoadNPCMemoryBuffer(const char* name, csArray<NPC*> npcs)
{
    // Check just to be sure
    if(npcs.GetSize() == 0) return false;

    Memory* newLocation = FindMemory(csString(name));

    if(!newLocation)
    {
        return false;
    }

    for(size_t i=0; i<npcs.GetSize(); i++)
    {
        npcs[i]->SetBufferMemory(newLocation);
    }
    return true;
}
bool ProgressionManager::Initialize()
{
    Subscribe(&ProgressionManager::HandleSkill, MSGTYPE_GUISKILL, REQUIRE_READY_CLIENT);
    Subscribe(&ProgressionManager::HandleDeathEvent, MSGTYPE_DEATH_EVENT, NO_VALIDATION);
    Subscribe(&ProgressionManager::HandleZPointEvent, MSGTYPE_ZPOINT_EVENT, REQUIRE_READY_CLIENT);

    Result result_affinitycategories(db->Select("SELECT * from char_create_affinity"));

    if ( result_affinitycategories.IsValid() )
    {
        for ( unsigned int x = 0; x < result_affinitycategories.Count(); x++ )
        {
            affinitycategories.Put( csString( result_affinitycategories[(unsigned long)x]["category"]).Downcase() , csString( result_affinitycategories[(unsigned long)x]["attribute"]).Downcase() );
        }
    }

    return true;
}
void pawsSpellBookWindow::OnListAction( pawsListBox* widget, int status )
{
    if (status==LISTBOX_HIGHLIGHTED)
    {
        spellDescription->Clear();
        pawsListBoxRow* row = widget->GetSelectedRow();

        pawsTextBox* spellName = (pawsTextBox*)(row->GetColumn(0));

        selectedSpell.Replace( spellName->GetText() );
        spellDescription->AddMessage(descriptions_Hash.Get(spellName->GetText(), "Unknown"));
        spellDescription->ResetScroll();
        //spellImage->SetBackground(images_Hash.Get(spellName->GetText(), ""));
        spellImage->PlaceItem(images_Hash.Get(spellName->GetText(),""), "", "", 1);
        csString action = "/cast " + csString(spellName->GetText());
        spellImage->SetBartenderAction(action);
        spellImage->SetToolTip(spellName->GetText());
    }
}
Ejemplo n.º 27
0
bool psEffectObjSimpMesh::Load(iDocumentNode *node, iLoaderContext* ldr_context)
{

    // get the attributes
    name.Clear();
    materialName.Clear();
    fileName.Clear();
    csRef<iDocumentAttributeIterator> attribIter = node->GetAttributes();
    while (attribIter->HasNext())
    {
        csRef<iDocumentAttribute> attr = attribIter->Next();
        csString attrName = attr->GetName();
        attrName.Downcase();
        if (attrName == "name")
            name = attr->GetValue();
        else if (attrName == "material")
            materialName = attr->GetValue();
        else if (attrName == "file")
            fileName = csString("/this/art/effects/") + attr->GetValue();
        else if (attrName == "mesh")
            meshName = attr->GetValue();
    }
    if (name.IsEmpty())
    {
        csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj with no name.\n");
        return false;
    }
    
    csRef<iVFS> vfs =  csQueryRegistry<iVFS> (psCSSetup::object_reg);
    assert(vfs);
    
    if (!vfs->Exists(fileName))
    {
        csReport(psCSSetup::object_reg, CS_REPORTER_SEVERITY_ERROR, "Eulora_effects", "Attempting to create an effect obj without specifying an existing mesh file.\n");
        return false;
    }
    
    if (!psEffectObj::Load(node, ldr_context))
        return false;

    return PostSetup();
}
void EEditShortcutsToolbox::SaveShortcuts()
{
    shortcuts.DeleteAll();
    
    for (size_t a=0; a<(size_t)shortcutsList->GetRowCount(); ++a)
    {
        pawsListBoxRow * row = shortcutsList->GetRow(a);
        if (!row)
            return;

        pawsTextBox * col = (pawsTextBox *)row->GetColumn(0);
        if (!col)
            return;

        pawsKeySelectBox * key = (pawsKeySelectBox *)row->GetColumn(1);
        if (!key)
            return;

        shortcuts.Push(EEditShortcutKey(col->GetText(), key->GetKey(), key->GetModifiers()));
        editApp->SetConfigString(csString("EEdit.Shortcut.") + col->GetText(), key->GetText());
    }
}
Ejemplo n.º 29
0
bool StartMe::OnClick (const CEGUI::EventArgs& e)
{
  // TODO: don't relaunch if it was multi clicked
  if (rotationStatus != ROTATE_SELECTING)
    return true;

  const CEGUI::WindowEventArgs& args = static_cast<const CEGUI::WindowEventArgs&>(e);

  for (size_t i = 0 ; i < demos.GetSize () ; i++)
    if (demos[i].window == args.window)
    {
      csRef<iCommandLineParser> cmdline = csQueryRegistry<iCommandLineParser> (GetObjectRegistry());
      csString appdir = cmdline->GetAppDir ();
      if (system (csString("\"") << appdir << CS_PATH_SEPARATOR <<
		  csInstallationPathsHelper::GetAppFilename (
		    demos[i].exec) << "\" " << 
		  demos[i].args))
	break;
      else break;
    }
  return true;
}
Ejemplo n.º 30
0
void pawsBuddyWindow::OnListAction( pawsListBox* widget, int status )
{
    if (status==LISTBOX_HIGHLIGHTED)
    {
        pawsListBoxRow* row =  widget->GetSelectedRow();
        if ( row )
        {
            currentBuddy = ((pawsTextBox*)row->GetColumn(0))->GetText();
        }
    }

    else if (status == LISTBOX_SELECTED)
    {
        if (currentBuddy.IsEmpty())
            return;

        csString title(PawsManager::GetSingleton().Translate("Tell"));
        csString name = GetRealName(currentBuddy);
        title.Append(" " + name);
        pawsStringPromptWindow::Create(title, csString(""),
                                       false, 220, 20, this, name);
    }
}