forked from OpenEnroth/OpenEnroth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved out SoundList, dropped mapSounds global.
- Loading branch information
1 parent
debe437
commit 5617f65
Showing
7 changed files
with
94 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "SoundList.h" | ||
|
||
#include "Engine/Snapshots/EntitySnapshots.h" | ||
|
||
#include "Library/Snapshots/SnapshotSerialization.h" | ||
|
||
#include "Utility/MapAccess.h" | ||
|
||
#include "SoundInfo.h" | ||
|
||
SoundList *pSoundList; | ||
|
||
void SoundList::FromFile(const Blob &data_mm6, const Blob &data_mm7, const Blob &data_mm8) { | ||
std::vector<SoundInfo> sounds; | ||
|
||
if (data_mm6) | ||
deserialize(data_mm6, &sounds, tags::append, tags::via<SoundInfo_MM6>); | ||
if (data_mm7) | ||
deserialize(data_mm7, &sounds, tags::append, tags::via<SoundInfo_MM7>); | ||
if (data_mm8) | ||
deserialize(data_mm8, &sounds, tags::append, tags::via<SoundInfo_MM7>); | ||
|
||
assert(!sounds.empty()); | ||
|
||
for (const SoundInfo &sound : sounds) | ||
_mapSounds[sound.uSoundID] = sound; | ||
} | ||
|
||
SoundInfo *SoundList::soundInfo(int soundId) { | ||
return valuePtr(_mapSounds, soundId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <unordered_map> | ||
|
||
#include "Utility/Memory/Blob.h" | ||
|
||
#include "SoundInfo.h" | ||
|
||
class SoundList { | ||
public: | ||
void FromFile(const Blob &data_mm6, const Blob &data_mm7, const Blob &data_mm8); | ||
|
||
// TODO(captainurist): should be const | ||
SoundInfo *soundInfo(int soundId); | ||
|
||
private: | ||
std::unordered_map<int, SoundInfo> _mapSounds; | ||
}; | ||
|
||
extern SoundList *pSoundList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters