diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-14 00:50:34 +0100 |
commit | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (patch) | |
tree | eaf6e857382eef16c2dd940eb4125536fbe068bd /src/T2DLL/T2SubPlugin.cpp | |
download | t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.tar.gz t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.zip |
initial commit
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2SubPlugin.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/T2DLL/T2SubPlugin.cpp b/src/T2DLL/T2SubPlugin.cpp new file mode 100644 index 0000000..fbdbe01 --- /dev/null +++ b/src/T2DLL/T2SubPlugin.cpp @@ -0,0 +1,68 @@ +#include "CResFile.h" +#include "T2BitImage.h" +#include "T2ImageObj.h" +#include "T2SubPlugin.h" + +T2SubPlugin::T2SubPlugin(DWORD type, T2PluginSpecifier& specifier) + : CResourcePlugin(type, specifier) +{ + mDupCustomerTableDefRes = false; + mTieup = 0; + mTitle[0] = 0; + mTieup = NULL; + mOpenTime = 0; + mCloseTime = 0; + mBitImage = NULL; + mImageObj = NULL; +} + +/*virtual*/ T2SubPlugin::~T2SubPlugin() { + if (mTieup) + delete mTieup; + if (mBitImage) + delete mBitImage; + if (mImageObj) + delete mImageObj; +} + +int T2SubPlugin::IsTieupFinish() { + int result = false; + + if (mTieup) { + CTime now = CTime::GetTickCount(); + if (*mTieup < now) + result = true; + } + + return result; +} + +/*virtual*/ void T2SubPlugin::GetTitle(CString& outStr) { + outStr = mTitle; +} + +/*virtual*/ void T2SubPlugin::LoadRsrcFromStream(CResFile& resFile) { + resFile >> mTitle; + + unsigned int t; + resFile >> t; + if (t != 0) { + int year = (t >> 28) & 0xF; + year *= 10; + year += (t >> 24) & 0xF; + year *= 10; + year += (t >> 20) & 0xF; + year *= 10; + year += (t >> 16) & 0xF; + + int month = (t >> 12) & 0xF; + month *= 10; + month += (t >> 8) & 0xF; + + int day = (t >> 4) & 0xF; + day *= 10; + day += (t & 0xF) + 1; + + mTieup = new CTime(year, month, day, 0, 0, 0); + } +} |