2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-15 10:54:18 +00:00

Compare commits

..

9 Commits

15 changed files with 62 additions and 151 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_Internal|Win32">
@ -121,8 +121,6 @@
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MapExports>true</MapExports>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<HeapReserveSize>0x140000</HeapReserveSize>
<StackReserveSize>0x140000</StackReserveSize>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -179,8 +177,6 @@
<MapFileName>$(OutDir)$(TargetName).map</MapFileName>
<MapExports>true</MapExports>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<HeapReserveSize>0x140000</HeapReserveSize>
<StackReserveSize>0x140000</StackReserveSize>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -241,8 +237,6 @@
<TargetMachine>MachineX86</TargetMachine>
<MapExports>true</MapExports>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<HeapReserveSize>0x140000</HeapReserveSize>
<StackReserveSize>0x140000</StackReserveSize>
</Link>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -304,8 +298,6 @@
<TargetMachine>MachineX86</TargetMachine>
<MapExports>true</MapExports>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<HeapReserveSize>0x140000</HeapReserveSize>
<StackReserveSize>0x140000</StackReserveSize>
</Link>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -810,4 +802,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -2313,7 +2313,7 @@ void plClient::IDetectAudioVideoSettings()
WriteInt(stream, "Audio.SetChannelVolume Ambience", 1);
WriteInt(stream, "Audio.SetChannelVolume NPCVoice", 1);
WriteInt(stream, "Audio.EnableVoiceRecording", 1);
WriteInt(stream, "Audio.EnableSubtitles", true);
WriteInt(stream, "Audio.EnableSubtitles", false);
WriteString(stream, "Audio.SetDeviceName", deviceName );
stream->Close();
delete stream;

View File

@ -165,8 +165,6 @@ class pfKIMsg : public plMessage
kUNUSED1 = 0x00000008,
kStatusMsg = 0x00000010,
kNeighborMsg = 0x00000020, // sending to all the neighbors
kSubtitleMsg = 0x00000040,
kLocKeyMsg = 0x00000080,
kChannelMask = 0x0000ff00
};

View File

@ -474,12 +474,6 @@ void plPythonSDLModifier::IPythonVarToSDL(plStateDataRecord* state, const char*
int count = PyTuple_Size(pyVar);
plSimpleVarDescriptor::Type type = var->GetSimpleVarDescriptor()->GetType();
// Ensure that variable length arrays match.
if (var->GetSimpleVarDescriptor()->IsVariableLength()) {
if (var->GetCount() != count)
var->Alloc(count);
}
for (int i = 0; i < count; i++)
{
PyObject* pyVarItem = PyTuple_GetItem(pyVar, i);

View File

@ -587,17 +587,16 @@ std::wstring pyGUIControlListBox::GetElementW( UInt16 idx )
{
// if its a text element type then it should be safe to cast it to a pfGUIListText
pfGUIListText* letext = (pfGUIListText*)le;
return (letext->GetText() != nullptr) ? letext->GetText() : L"";
return letext->GetText();
}
else if ( le->GetType() == pfGUIListElement::kTreeRoot )
{
pfGUIListTreeRoot* elroot = (pfGUIListTreeRoot*)le;
return (elroot->GetTitle() != nullptr) ? elroot->GetTitle() : L"";
return elroot->GetTitle();
}
}
}
}
return L"";
}

View File

@ -994,7 +994,7 @@ hsBool plgAudioSys::fInit = false;
hsBool plgAudioSys::fActive = false;
hsBool plgAudioSys::fUseHardware = false;
hsBool plgAudioSys::fMuted = true;
bool plgAudioSys::fEnableSubtitles = true;
bool plgAudioSys::fEnableSubtitles = false;
hsBool plgAudioSys::fDelayedActivate = false;
hsBool plgAudioSys::fEnableEAX = false;
hsWindowHndl plgAudioSys::fWnd = nil;

View File

@ -111,18 +111,14 @@ void plWin32Sound::IFreeBuffers( void )
void plWin32Sound::Update()
{
plSoundBuffer* buf = GetDataBuffer();
if (buf != nullptr) {
if (plgAudioSys::AreSubtitlesEnabled() && buf != nullptr) {
plSrtFileReader* srtReader = buf->GetSrtReader();
if (srtReader != nullptr) {
uint32_t currentTimeMs = (uint32_t)(GetActualTimeSec() * 1000.0f);
if (currentTimeMs <= srtReader->GetLastEntryEndTime()) {
while (plSrtEntry* nextEntry = srtReader->GetNextEntryStartingBeforeTime(currentTimeMs)) {
if (plgAudioSys::AreSubtitlesEnabled()) {
// add a plSubtitleMsg to go... to whoever is listening (probably the KI)
plSubtitleMsg* msg = new plSubtitleMsg(nextEntry->GetSubtitleText(), nextEntry->GetSpeakerName());
msg->Send();
}
}
while (plSrtEntry* nextEntry = srtReader->GetNextEntryStartingBeforeTime(currentTimeMs)) {
// add a plSubtitleMsg to go... to whoever is listening (probably the KI)
plSubtitleMsg* msg = new plSubtitleMsg(nextEntry->GetSubtitleText(), nextEntry->GetSpeakerName());
msg->Send();
}
}
}

View File

@ -184,13 +184,4 @@ plSrtEntry* plSrtFileReader::GetNextEntryEndingBeforeTime(uint32_t timeMs)
}
return nullptr;
}
uint32_t plSrtFileReader::GetLastEntryEndTime()
{
if (!fEntries.empty()) {
return fEntries.back().GetEndTimeMs();
}
return 0;
}

View File

@ -95,7 +95,6 @@ public:
void AdvanceToTime(uint32_t timeMs);
plSrtEntry* GetNextEntryStartingBeforeTime(uint32_t timeMs);
plSrtEntry* GetNextEntryEndingBeforeTime(uint32_t timeMs);
uint32_t GetLastEntryEndTime();
protected:

View File

@ -326,7 +326,7 @@ bool plAvBrainClimb::IProcessExitStage(double time, float elapsed)
float curBlend = ai->GetBlend();
if(fCurStage && curBlend > .99) // reached peak strength
if(curBlend > .99) // reached peak strength
{
fCurStage->Detach(fAvMod); // remove the (now completely masked) underlying anim
fCurStage = nil;

View File

@ -176,19 +176,16 @@ void plKeyboardDevice::HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDo
if (key == KEY_SHIFT)
{
fShiftKeyDown = bKeyDown;
// return;
}
if (key == KEY_CTRL)
{
fCtrlKeyDown = bKeyDown;
// return;
}
if (key == KEY_CAPSLOCK)
{
// Keyboards toggle the light on key-down, so I'm going with that.
if (bKeyDown && !bKeyRepeat)
if (!bKeyRepeat)
{
fCapsLockLock = !fCapsLockLock;
fCapsLockLock = (GetKeyState(KEY_CAPSLOCK) & 1) == 1;
plAvatarInputInterface::GetInstance()->ForceAlwaysRun(fCapsLockLock);
}
}
@ -208,7 +205,8 @@ void plKeyboardDevice::HandleWindowActivate(bool bActive, HWND hWnd)
{
if (bActive)
{
fCtrlKeyDown = false;
// Refresh the caps lock state
HandleKeyEvent(KEYDOWN, KEY_CAPSLOCK, nil, false);
}
else
{
@ -481,8 +479,8 @@ void plMouseDevice::SetCursorY(hsScalar y)
void plMouseDevice::HideCursor(hsBool override)
{
if (fInstance && fInstance->fCursor)
fInstance->fCursor->SetVisible(false);
if( fInstance->fCursor != nil )
fInstance->fCursor->SetVisible( false );
plMouseDevice::bCursorOverride = (override != 0);
plMouseDevice::bCursorHidden = true;
@ -499,11 +497,9 @@ void plMouseDevice::ShowCursor(hsBool override)
plMouseDevice::bCursorHidden = false;
plMouseDevice::bCursorOverride = false;
if (fInstance) {
if (!fInstance->fCursor)
fInstance->CreateCursor(fInstance->fCursorID);
fInstance->fCursor->SetVisible(true);
}
if( fInstance->fCursor == nil )
fInstance->CreateCursor( fInstance->fCursorID );
fInstance->fCursor->SetVisible( true );
}
void plMouseDevice::NewCursor(char* cursor)

View File

@ -504,56 +504,25 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg)
return false;
}
if (cVaultLink != nil) {
// Verify that if the Age vault already exists that it matches the requested
// deferred link. If it doesn't exist, well, I hope you're happy with the result.
if (cVaultLink != nil)
{
// This is something that Cyan does... >.<
// It's very useful though...
VaultAgeLinkNode accLink(cVaultLink);
if (RelVaultNode* rvnInfo = cVaultLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
plAgeInfoStruct dest;
accLink.CopyTo(cur);
if (RelVaultNode* rvnInfo = cVaultLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1))
{
VaultAgeInfoNode accInfo(rvnInfo);
accInfo.CopyTo(&dest);
if (!dest.IsEqualTo(fDeferredLink->GetAgeLink()->GetAgeInfo())) {
hsLogEntry(
plNetClientMgr::GetInstance()->DebugMsg(
"Waiting for a deferred link to '%s' but got AgeInfo for '%s' instead.",
fDeferredLink->GetAgeLink()->AsStdString().c_str(),
dest.AsStdString().c_str()
);
);
rvnInfo->DecRef();
return false;
}
accInfo.CopyTo(cur->GetAgeInfo());
rvnInfo->DecRef();
}
// If we're still here, that means the links match. Set the vault copy as our current
// AgeLink and AgeInfo. Note this mainly copies the AgeInfo.
accLink.CopyTo(cur);
hsLogEntry(
plNetClientMgr::GetInstance()->DebugMsg(
"Performing deferred link to '%s'",
cur->AsStdString().c_str()
);
);
// Steals fDeferredLink
IDoLink(fDeferredLink);
fDeferredLink = nil;
return true;
cVaultLink->DecRef();
return true;
} else {
hsLogEntry(
plNetClientMgr::GetInstance()->ErrorMsg(
"Waiting for a deferred link to '%s' but got a garbage link?",
fDeferredLink->GetAgeLink()->AsStdString().c_str()
)
);
}
}
return false;
}

View File

@ -1328,9 +1328,9 @@ void plPXPhysical::GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsV
void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV)
{
bool isLoading = plNetClientApp::GetInstance()->IsLoadingInitialAgeState();
bool isFirstIn = plNetClientApp::GetInstance()->GetJoinOrder() == 0;
bool initialSync = isLoading && isFirstIn;
bool initialSync = plNetClientApp::GetInstance()->IsLoadingInitialAgeState() &&
plNetClientApp::GetInstance()->GetJoinOrder() == 0;
// If the physical has fallen out of the sim, and this is initial age state, and we're
// the first person in, reset it to the original position. (ie, prop the default state
// we've got right now)
@ -1350,13 +1350,6 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV
SetLinearVelocitySim(*linV);
if (angV)
SetAngularVelocitySim(*angV);
// If we're loading the age, then we should ensure the objects stay asleep if they're supposed to be asleep.
// NOTE: We should only do this if the objects are not at their initial locations. Otherwise, they might
// sleep inside each other and explode or float randomly in midair
if (isLoading && GetProperty(plSimulationInterface::kStartInactive) && !fActor->readBodyFlag(NX_BF_KINEMATIC)) {
if (!pos && !rot)
fActor->putToSleep();
}
SendNewLocation(false, true);
}

View File

@ -1299,7 +1299,7 @@ void plResManager::PageInAge(const char *age)
hsBool plResManager::VerifyPages()
{
PageSet invalidPages, newerPages;
hsTArray<plRegistryPageNode*> invalidPages, newerPages;
// Step 1: verify major/minor version changes
if (plResMgrSettings::Get().GetFilterNewerPageVersions() ||
@ -1313,7 +1313,7 @@ hsBool plResManager::VerifyPages()
if (page->GetPageCondition() == kPageTooNew && plResMgrSettings::Get().GetFilterNewerPageVersions())
{
newerPages.insert(page);
newerPages.Append(page);
fAllPages.erase(page);
}
else if (
@ -1321,21 +1321,21 @@ hsBool plResManager::VerifyPages()
page->GetPageCondition() == kPageOutOfDate)
&& plResMgrSettings::Get().GetFilterOlderPageVersions())
{
invalidPages.insert(page);
invalidPages.Append(page);
fAllPages.erase(page);
}
}
}
// Handle all our invalid pages now
if (!invalidPages.empty())
if (invalidPages.GetCount() > 0)
{
if (!IDeleteBadPages(invalidPages, false))
return false;
}
// Warn about newer pages
if (!newerPages.empty())
if (newerPages.GetCount() > 0)
{
if (!IWarnNewerPages(newerPages))
return false;
@ -1343,35 +1343,22 @@ hsBool plResManager::VerifyPages()
// Step 2 of verification: make sure no sequence numbers conflict
PageSet::iterator it = fAllPages.begin();
for (; it != fAllPages.end();)
for (; it != fAllPages.end(); it++)
{
plRegistryPageNode* page = *it;
PageSet::iterator itUp = it;
itUp++;
bool amValid = true;
for (; itUp != fAllPages.end();)
for (; itUp != fAllPages.end(); itUp++)
{
plRegistryPageNode* upPage = *itUp;
if (page->GetPageInfo().GetLocation() == upPage->GetPageInfo().GetLocation()) {
invalidPages.insert(upPage);
itUp = fAllPages.erase(itUp);
amValid = false;
} else {
itUp++;
if (page->GetPageInfo().GetLocation() == upPage->GetPageInfo().GetLocation())
{
invalidPages.Append(upPage);
fAllPages.erase(itUp);
break;
}
}
// Delete *all* conflicting pages, not just conflicting - 1.
// If we leave in a single conflicting page, a new conflict can trivially
// be introduced if the page we leave behind is defunct and a new version
// is later downloaded from the FileSrv.
if (!amValid) {
invalidPages.insert(page);
it = fAllPages.erase(it);
} else {
it++;
}
}
// Redo our loaded pages list, since Verify() might force the page's keys to load or unload
@ -1387,7 +1374,7 @@ hsBool plResManager::VerifyPages()
}
// Handle all our conflicting pages now
if (!invalidPages.empty())
if (invalidPages.GetCount() > 0)
return IDeleteBadPages(invalidPages, true);
return true;
@ -1397,10 +1384,9 @@ hsBool plResManager::VerifyPages()
// Given an array of pages that are invalid (major version out-of-date or
// whatnot), asks the user what we should do about them.
static void ICatPageNames(const std::set<plRegistryPageNode*>& pages, char* buf, int bufSize)
static void ICatPageNames(hsTArray<plRegistryPageNode*>& pages, char* buf, int bufSize)
{
int i = 0;
for (auto it = pages.cbegin(); it != pages.cend(); ++it, ++i)
for (int i = 0; i < pages.GetCount(); i++)
{
if (i >= 25)
{
@ -1408,7 +1394,7 @@ static void ICatPageNames(const std::set<plRegistryPageNode*>& pages, char* buf,
break;
}
const char* pagePath = (*it)->GetPagePath();
const char* pagePath = pages[i]->GetPagePath();
const char* pageFile = plFileUtils::GetFileName(pagePath);
if (strlen(buf) + strlen(pageFile) > bufSize - 5)
@ -1422,7 +1408,7 @@ static void ICatPageNames(const std::set<plRegistryPageNode*>& pages, char* buf,
}
}
hsBool plResManager::IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSeqNums)
hsBool plResManager::IDeleteBadPages(hsTArray<plRegistryPageNode*>& invalidPages, hsBool conflictingSeqNums)
{
#ifndef PLASMA_EXTERNAL_RELEASE
if (!hsMessageBox_SuppressPrompts)
@ -1444,12 +1430,12 @@ hsBool plResManager::IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSe
#endif // PLASMA_EXTERNAL_RELEASE
// Delete 'em
for (PageSet::iterator it = invalidPages.begin(); it != invalidPages.end(); ++it)
for (int i = 0; i < invalidPages.GetCount(); i++)
{
(*it)->DeleteSource();
delete *it;
invalidPages[i]->DeleteSource();
delete invalidPages[i];
}
invalidPages.clear();
invalidPages.Reset();
fLastFoundPage = nil;
@ -1461,7 +1447,7 @@ hsBool plResManager::IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSe
// than the "current" one), warns the user about them but does nothing to
// them.
hsBool plResManager::IWarnNewerPages(PageSet &newerPages)
hsBool plResManager::IWarnNewerPages(hsTArray<plRegistryPageNode*> &newerPages)
{
#ifndef PLASMA_EXTERNAL_RELEASE
if (!hsMessageBox_SuppressPrompts)
@ -1479,9 +1465,9 @@ hsBool plResManager::IWarnNewerPages(PageSet &newerPages)
// Not deleting the files, just delete them from memory
for (PageSet::iterator it = newerPages.begin(); it != newerPages.end(); ++it)
delete *it;
newerPages.clear();
for (int i = 0; i < newerPages.GetCount(); i++)
delete newerPages[i];
newerPages.Reset();
fLastFoundPage = nil;

View File

@ -61,9 +61,6 @@ typedef void(*plProgressProc)(plKey key);
class plResManager : public hsResMgr
{
protected:
typedef std::set<plRegistryPageNode*> PageSet;
public:
plResManager();
virtual ~plResManager();
@ -197,8 +194,8 @@ protected:
void IUnloadPageKeys(plRegistryPageNode* pageNode, hsBool dontClear = false);
hsBool IDeleteBadPages(PageSet& invalidPages, hsBool conflictingSeqNums);
hsBool IWarnNewerPages(PageSet& newerPages);
hsBool IDeleteBadPages(hsTArray<plRegistryPageNode*>& invalidPages, hsBool conflictingSeqNums);
hsBool IWarnNewerPages(hsTArray<plRegistryPageNode*>& newerPages);
void ILockPages();
void IUnlockPages();
@ -236,6 +233,7 @@ protected:
UInt8 fPageListLock; // Number of locks on the page lists. If it's greater than zero, they can't be modified
hsBool fPagesNeedCleanup; // True if something modified the page lists while they were locked.
typedef std::set<plRegistryPageNode*> PageSet;
PageSet fAllPages; // All the pages, loaded or not
PageSet fLoadedPages; // Just the loaded pages