Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add server-specific resource loading for objects, room textures, music, sounds and rooms. #117

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions Meridian59.Ogre.Client/OgreClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,6 @@ namespace Meridian59 { namespace Ogre
// 7. initialize caelum group
InitResourceGroup("Caelum", true, false, System::IO::SearchOption::TopDirectoryOnly, true, true);

// 10. load legacy resources
ResourceManager->Preload(
Config->PreloadObjects,
Config->PreloadRoomTextures,
Config->PreloadRooms,
Config->PreloadSound,
Config->PreloadMusic);

// .NET 4.5
// next gc run, defragment the largeobjectheap
::System::Runtime::GCSettings::LargeObjectHeapCompactionMode =
Expand Down Expand Up @@ -844,6 +836,27 @@ namespace Meridian59 { namespace Ogre
{
ConnectionInfo^ info = Config->SelectedConnectionInfo;
SendLoginMessage(info->Username, info->Password);

// Only show the bar if we preload at least one group.
if (Config->PreloadObjects || Config->PreloadRoomTextures || Config->PreloadRooms
|| Config->PreloadSound || Config->PreloadMusic)
{
// Legacy resources handled as one group.
const ushort groups = 1;

Data->UIMode = UIMode::LoadingBar;
ControllerUI::LoadingBar::Start(groups);

// Preload legacy resources.
ResourceManager->Preload(
Config->PreloadObjects,
Config->PreloadRoomTextures,
Config->PreloadRooms,
Config->PreloadSound,
Config->PreloadMusic);

ControllerUI::LoadingBar::Finish();
}
};

void OgreClient::HandleLookupNamesMessage(LookupNamesMessage^ Message)
Expand Down
2 changes: 1 addition & 1 deletion Meridian59.Ogre.Client/UILoadingBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace Meridian59 { namespace Ogre
items += OgreClient::Singleton->ResourceManager->Rooms->Count;

if (OgreClient::Singleton->Config->PreloadSound)
items += OgreClient::Singleton->ResourceManager->Wavs->Count;
items += OgreClient::Singleton->ResourceManager->Sounds->Count;

if (OgreClient::Singleton->Config->PreloadMusic)
items += OgreClient::Singleton->ResourceManager->Music->Count;
Expand Down
3 changes: 3 additions & 0 deletions Meridian59/Client/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public virtual void Connect()
Config.SelectedConnectionInfo.StringDictionary,
LanguageCode.English); // todo: from config

// Load server-specific resources if present
ResourceManager.SelectServerResources(Config.SelectedConnectionInfo.Name);

// fill ignore list in datacontroller with ignored
// playernames for this connectionentry.
Data.IgnoreList.Clear();
Expand Down
4 changes: 2 additions & 2 deletions Meridian59/Data/Models/PlaySound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ public void ResolveResources(ResourceManager M59ResourceManager, bool RaiseChang
{
if (RaiseChangedEvent)
{
Resource = M59ResourceManager.GetWavFile(ResourceName);
Resource = M59ResourceManager.GetSoundFile(ResourceName);
}
else
{
resource = M59ResourceManager.GetWavFile(ResourceName);
resource = M59ResourceManager.GetSoundFile(ResourceName);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Meridian59/Data/Models/StopSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ public void ResolveResources(ResourceManager M59ResourceManager, bool RaiseChang
{
if (RaiseChangedEvent)
{
Resource = M59ResourceManager.GetWavFile(ResourceName);
Resource = M59ResourceManager.GetSoundFile(ResourceName);
}
else
{
resource = M59ResourceManager.GetWavFile(ResourceName);
resource = M59ResourceManager.GetSoundFile(ResourceName);
}
}
}
Expand Down
Loading