summaryrefslogtreecommitdiff
path: root/src/T2DLL/CFilePlugin.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-14 00:50:34 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-14 00:50:34 +0100
commit37e364b2c6cc7487a1c888d256a73e5337bb7189 (patch)
treeeaf6e857382eef16c2dd940eb4125536fbe068bd /src/T2DLL/CFilePlugin.cpp
downloadt2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.tar.gz
t2win-37e364b2c6cc7487a1c888d256a73e5337bb7189.zip
initial commit
Diffstat (limited to 'src/T2DLL/CFilePlugin.cpp')
-rw-r--r--src/T2DLL/CFilePlugin.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/T2DLL/CFilePlugin.cpp b/src/T2DLL/CFilePlugin.cpp
new file mode 100644
index 0000000..aac286d
--- /dev/null
+++ b/src/T2DLL/CFilePlugin.cpp
@@ -0,0 +1,52 @@
+#include "CFilePlugin.h"
+#include "CPluginInfo.h"
+#include "CResFile.h"
+
+CFilePlugin::CFilePlugin(DWORD type, T2PluginSpecifier& specifier)
+ : CPlugin(type, specifier)
+{
+ mAttrib = 0;
+ mGameLevel = 0;
+
+ CResFile file;
+ int success = false;
+ if (specifier.mIsSubPlugin) {
+ success = file.OpenResource(specifier.mPath, 128, 'ATTR');
+ specifier.mIsLoaded = true;
+ } else {
+ success = file.OpenResource(specifier.mInstance, 128, "ATTR");
+ }
+
+ if (success) {
+ file >> mID;
+ file >> mAttrib;
+ file >> mDependID;
+ file >> mGameLevel;
+ file >> mSecretItem;
+ file >> mItemType;
+ file >> mMustItem;
+ file >> mPluginName;
+ }
+}
+
+/*virtual*/ CFilePlugin::~CFilePlugin() {
+ Unload();
+}
+
+/*virtual*/ void CFilePlugin::GetName(CString& outStr) {
+ outStr = mPluginName;
+}
+
+/*virtual*/ BOOL CFilePlugin::Load() {
+ return true;
+}
+
+/*virtual*/ BOOL CFilePlugin::Unload() {
+ return true;
+}
+
+CPluginInfo* CFilePlugin::GetPluginInfo() {
+ char buf[500];
+ GetModuleFileName(mModuleHandle, buf, sizeof(buf));
+ return new CPluginInfo(mType, mID, mItemType, mMustItem, mPluginName, buf);
+}