summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2OuterObjDef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2OuterObjDef.cpp')
-rw-r--r--src/T2DLL/T2OuterObjDef.cpp95
1 files changed, 89 insertions, 6 deletions
diff --git a/src/T2DLL/T2OuterObjDef.cpp b/src/T2DLL/T2OuterObjDef.cpp
index cefb374..5c8ec2a 100644
--- a/src/T2DLL/T2OuterObjDef.cpp
+++ b/src/T2DLL/T2OuterObjDef.cpp
@@ -1,28 +1,111 @@
+#include "T2FloorInfo.h"
+#include "T2ImageObj.h"
+#include "T2InfoDialog.h"
+#include "T2Message.h"
+#include "T2OutObj.h"
#include "T2OuterObjDef.h"
+#include "T2OuterObjList.h"
+#include "T2TowerDoc.h"
+#include "T2WorldDef.h"
+#include "UT2Coordinate.h"
-T2OuterObjDef::T2OuterObjDef(unsigned long, T2PluginSpecifier&, CResFile*, T2WorldDef*, T2ToolPlugin*) {
+T2OuterObjDef::T2OuterObjDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile, T2WorldDef* worldDef, T2ToolPlugin* plugin)
+ : T2ToolDef(type, specifier, resFile, worldDef, plugin)
+{
+ mValiationCount = 1;
}
/*virtual*/ T2OuterObjDef::~T2OuterObjDef() {
}
-/*virtual*/ CURSORTYPE T2OuterObjDef::QueryCursor(T2TowerDoc*, POINT, CString&, RECT&, POINT&, int, unsigned int, int) {
+/*virtual*/ CURSORTYPE T2OuterObjDef::QueryCursor(T2TowerDoc*, POINT inPt, CString& outStr, RECT& outRect, POINT& outPt, int factor, unsigned int, int) {
+ outStr = "Csr";
+
+ inPt.x -= ((mWidth * UT2Coordinate::UnitHSize(factor)) / 2 - UT2Coordinate::UnitHSize(factor) / 2);
+ inPt.y -= ((mHeight * UT2Coordinate::UnitVSize(factor)) / 2 - UT2Coordinate::UnitVSize(factor) / 2);
+
+ UT2Coordinate::QDToUnit(inPt, factor);
+
+ SetRect(&outRect, inPt.x, inPt.y, inPt.x + mWidth, inPt.y + mHeight);
+ outPt.x = outRect.left;
+ outPt.y = outRect.top;
+ UT2Coordinate::UnitToQD(outRect, factor, true);
+
+ return CursorType_0;
}
-/*virtual*/ void T2OuterObjDef::DrawProc(T2HaveOutViewObject*, const RECT&, T2TowerDoc*) const {
+/*virtual*/ void T2OuterObjDef::DrawProc(T2HaveOutViewObject* obj, const RECT& inRect, T2TowerDoc* inDoc) const {
+ RECT rect = ((T2OutObj *) obj)->_3C;
+ UT2Coordinate::UnitToQD(rect, inDoc->towerDoc_vf108(), true);
+
+ int objectID = mImageObj->FindObject("View");
+ mImageObj->DrawObject(inDoc->towerDoc_vf10C(), objectID, rect, inDoc->towerDoc_vf108());
}
-/*virtual*/ AREACHECKCODE T2OuterObjDef::AreaCheck(T2TowerDoc*, RECT&, unsigned int, int) {
+/*virtual*/ AREACHECKCODE T2OuterObjDef::AreaCheck(T2TowerDoc* inDoc, RECT& rect, unsigned int arg1, int arg2) {
+ LArrayIterator iterator(*inDoc->mOuterObjList);
+ T2OutObj *theOutObj;
+
+ while (iterator.Next(&theOutObj)) {
+ RECT intersect;
+ if (IntersectRect(&intersect, &theOutObj->_3C, &rect)) {
+ if (arg2) {
+ // "重ねて設置できません" - cannot be placed on top of each other
+ CString str = "\x8F\x64\x82\xCB\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x81\xF1";
+ (new T2Message)->ShowMessage(str);
+ }
+ return AreaCheckCode_0;
+ }
+ }
+
+ for (int x = rect.left; x < rect.right; x++) {
+ for (int y = rect.top; y < rect.bottom; y++) {
+ if (!inDoc->mFloorInfo->GetTenant(y, x)) {
+ if (arg2) {
+ // "はみだして設置できません" - it cannot be installed as it protrudes
+ CString str = "\x82\xCD\x82\xDD\x82\xBE\x82\xB5\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1";
+ (new T2Message)->ShowMessage(str);
+ }
+ return AreaCheckCode_0;
+ }
+ }
+ }
+
+ if (rect.bottom > (inDoc->mWorldDef->mGroundLine - inDoc->mWorldDef->mLobbyHeight)) {
+ if (arg2) {
+ // "ここには設置できません" - cannot be installed here
+ CString str = "\x82\xB1\x82\xB1\x82\xC9\x82\xCD\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1";
+ (new T2Message)->ShowMessage(str);
+ }
+ return AreaCheckCode_0;
+ }
+
+ return AreaCheckCode_1;
}
-/*virtual*/ T2InfoDialog* T2OuterObjDef::ShowInfoDialog(T2TowerDoc*, T2OutObj*) {
+/*virtual*/ T2InfoDialog* T2OuterObjDef::ShowInfoDialog(T2TowerDoc* inDoc, T2OutObj* inOutObj) {
+ CRect windowRect;
+ AfxGetMainWnd()->GetWindowRect(windowRect);
+
+ T2DLGTEMPLATE tmpl;
+ tmpl.pt = windowRect.CenterPoint();
+ tmpl.moduleHandle = mModuleHandle;
+ tmpl.resID = GetInfoDialogID(inDoc, inOutObj);
+
+ T2InfoDialog *theDialog = ConstructInfoDialog(inOutObj);
+ theDialog->Realize(this, &tmpl, inDoc, mImageObj, NULL, true, NULL, 0, true);
+ return theDialog;
}
/*virtual*/ int T2OuterObjDef::GetInfoDialogID(T2TowerDoc*, const T2OutObj*) const {
+ return 1000;
}
/*virtual*/ T2InfoDialog* T2OuterObjDef::ConstructInfoDialog(T2OutObj*) {
+ return NULL;
}
-/*virtual*/ PROCCODE T2OuterObjDef::DoDestructProc(T2TowerDoc*, T2HaveOutViewObject*, POINT, RECT&) {
+/*virtual*/ PROCCODE T2OuterObjDef::DoDestructProc(T2TowerDoc* inDoc, T2HaveOutViewObject* inObj, POINT, RECT& outRect) {
+ outRect = ((T2OutObj *) inObj)->_3C;
+ return ((T2OutObj *) inObj)->Destruct(inDoc, outRect);
}