-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore flashlight reflections on buildings throughout Silent Hill, a…
…nd introduce flashlight reflections to some special objects (#986)
- Loading branch information
1 parent
32cd222
commit 4c46e90
Showing
14 changed files
with
1,292 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// added by iOrange in 2024 | ||
|
||
#pragma once | ||
|
||
// simplified version of Microsoft::WRL::ComPtr | ||
|
||
template <typename T> | ||
class IUnknownPtr { | ||
public: | ||
IUnknownPtr() : mPtr(nullptr) {} | ||
|
||
~IUnknownPtr() { | ||
InternalRelease(); | ||
} | ||
|
||
IUnknownPtr& operator=(decltype(__nullptr)) { | ||
InternalRelease(); | ||
return *this; | ||
} | ||
|
||
IUnknownPtr& operator=(T* other) { | ||
if (mPtr != other) { | ||
InternalRelease(); | ||
mPtr = other; | ||
} | ||
return *this; | ||
} | ||
|
||
operator bool() const { | ||
return mPtr != nullptr; | ||
} | ||
|
||
T* GetPtr() const { | ||
return mPtr; | ||
} | ||
|
||
T* operator->() const { | ||
return mPtr; | ||
} | ||
|
||
T* const* GetAddressOf() const { | ||
return &mPtr; | ||
} | ||
|
||
T** GetAddressOf() { | ||
return &mPtr; | ||
} | ||
|
||
T** ReleaseAndGetAddressOf() { | ||
InternalRelease(); | ||
return &mPtr; | ||
} | ||
|
||
private: | ||
void InternalAddRef() const { | ||
if (mPtr) { | ||
mPtr->AddRef(); | ||
} | ||
} | ||
|
||
unsigned long InternalRelease() { | ||
unsigned long refs = 0ul; | ||
T* temp = mPtr; | ||
|
||
if (temp) { | ||
mPtr = nullptr; | ||
refs = temp->Release(); | ||
} | ||
|
||
return refs; | ||
} | ||
|
||
private: | ||
T* mPtr; | ||
}; |
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
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
Oops, something went wrong.