diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-11 17:52:00 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-11 17:52:00 +0100 |
commit | 024306ccab5f6d51f3fce269fb1984fd02f3bb02 (patch) | |
tree | 8d359495d72bf4e7295c7eab4cb220edc2d4b60c /src/Plugins/Lobby/Floor | |
parent | 0f3cba6fcea0ffd511dfe3275d57a5b9e69be5be (diff) | |
download | t2win-main.tar.gz t2win-main.zip |
add Floor, add DefaultToolPalettemain
Diffstat (limited to '')
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.clw | 16 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.cpp | 97 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.def | 10 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.dsp | 157 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.h | 45 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Floor.rc | 150 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/FloorDef.cpp | 811 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/FloorDef.h | 19 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/FloorPlugin.cpp | 6 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/FloorPlugin.h | 7 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/Resource.h | 16 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/StdAfx.cpp | 6 | ||||
-rw-r--r-- | src/Plugins/Lobby/Floor/StdAfx.h | 41 |
13 files changed, 1375 insertions, 6 deletions
diff --git a/src/Plugins/Lobby/Floor/Floor.clw b/src/Plugins/Lobby/Floor/Floor.clw new file mode 100644 index 0000000..363ad09 --- /dev/null +++ b/src/Plugins/Lobby/Floor/Floor.clw @@ -0,0 +1,16 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +ClassCount=1 +Class1=CFloorApp +LastClass=CFloorApp +NewFileInclude2=#include "Floor.h" +ResourceCount=0 +NewFileInclude1=#include "stdafx.h" + +[CLS:CFloorApp] +Type=0 +HeaderFile=Floor.h +ImplementationFile=Floor.cpp +Filter=N diff --git a/src/Plugins/Lobby/Floor/Floor.cpp b/src/Plugins/Lobby/Floor/Floor.cpp index e5fc2a5..ab788c8 100644 --- a/src/Plugins/Lobby/Floor/Floor.cpp +++ b/src/Plugins/Lobby/Floor/Floor.cpp @@ -1,7 +1,104 @@ +// Floor.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" #include "Floor.h" +#include "FloorDef.h" +#include "FloorPlugin.h" +#include "../../../T2DLL/T2PluginSpecifier.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +// +// Note! +// +// If this DLL is dynamically linked against the MFC +// DLLs, any functions exported from this DLL which +// call into MFC must have the AFX_MANAGE_STATE macro +// added at the very beginning of the function. +// +// For example: +// +// extern "C" BOOL PASCAL EXPORT ExportedFunction() +// { +// AFX_MANAGE_STATE(AfxGetStaticModuleState()); +// // normal function body here +// } +// +// It is very important that this macro appear in each +// function, prior to any calls into MFC. This means that +// it must appear as the first statement within the +// function, even before any object variable declarations +// as their constructors may generate calls into the MFC +// DLL. +// +// Please see MFC Technical Notes 33 and 58 for additional +// details. +// + +///////////////////////////////////////////////////////////////////////////// +// CFloorApp + +BEGIN_MESSAGE_MAP(CFloorApp, CWinApp) + //{{AFX_MSG_MAP(CFloorApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CFloorApp construction + +CFloorApp::CFloorApp() +{ +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CFloorApp object + +CFloorApp theApp; + +FloorPlugin *sFloorPlugin; +FloorDef *sFloorDef; + +void *CALLBACK ConstructProgramPlugin(T2PluginSpecifier *inSpecifier) { + if (!sFloorPlugin) { +#line 48 + sFloorPlugin = new FloorPlugin('TnPl', *inSpecifier); + } + + return sFloorPlugin; +} + +void *CALLBACK ConstructTemplatePlugin(T2PluginSpecifier *inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) { + if (!sFloorDef) { +#line 55 + sFloorDef = new FloorDef('TnDf', *inSpecifier, inResFile, inWorldDef, inPlugin); + } + + return sFloorDef; +} + +void *CALLBACK DestructProgramPlugin() { + delete sFloorPlugin; + sFloorPlugin = NULL; + + delete sFloorDef; + sFloorDef = NULL; + + return NULL; +} + +T2PluginSpecifier *CALLBACK GetAttr(T2PluginSpecifier *inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) { +#line 76 + T2PluginSpecifier *specifier = new T2PluginSpecifier; + specifier->mPluginName = "Burgar"; + specifier->mType = 'TnPl'; + specifier->mAttrib = 0xFFFFFFFF; + specifier->mGameLevel = 0; + return specifier; +} diff --git a/src/Plugins/Lobby/Floor/Floor.def b/src/Plugins/Lobby/Floor/Floor.def new file mode 100644 index 0000000..a24e3a1 --- /dev/null +++ b/src/Plugins/Lobby/Floor/Floor.def @@ -0,0 +1,10 @@ +; Floor.def : Declares the module parameters for the DLL. + +LIBRARY "Floor" +DESCRIPTION 'Floor Windows Dynamic Link Library' + +EXPORTS + ConstructProgramPlugin + ConstructTemplatePlugin + DestructProgramPlugin + GetAttr diff --git a/src/Plugins/Lobby/Floor/Floor.dsp b/src/Plugins/Lobby/Floor/Floor.dsp new file mode 100644 index 0000000..322c46a --- /dev/null +++ b/src/Plugins/Lobby/Floor/Floor.dsp @@ -0,0 +1,157 @@ +# Microsoft Developer Studio Project File - Name="Floor" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=Floor - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Floor.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Floor.mak" CFG="Floor - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Floor - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Floor - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Floor - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x809 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 + +!ELSEIF "$(CFG)" == "Floor - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "Z:\Users\ash\src\t2-res\dx5\cdrom\sdk\inc" /I "Z:\Users\ash\src\t2-res\dxmedia51\DX51\dxmdev\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ../../../T2DLL/Debug/T2DLL.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\Floor.t2p" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "Floor - Win32 Release" +# Name "Floor - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Floor.cpp +# End Source File +# Begin Source File + +SOURCE=.\FloorDef.cpp +# End Source File +# Begin Source File + +SOURCE=.\FloorPlugin.cpp +# End Source File +# Begin Source File + +SOURCE=.\Floor.def +# End Source File +# Begin Source File + +SOURCE=.\Floor.rc + +!IF "$(CFG)" == "Floor - Win32 Release" + +!ELSEIF "$(CFG)" == "Floor - Win32 Debug" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Floor.h +# End Source File +# Begin Source File + +SOURCE=.\FloorDef.h +# End Source File +# Begin Source File + +SOURCE=.\FloorPlugin.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\Floor.rc2 +# End Source File +# End Group +# End Target +# End Project diff --git a/src/Plugins/Lobby/Floor/Floor.h b/src/Plugins/Lobby/Floor/Floor.h index 1a6ec0f..ec27269 100644 --- a/src/Plugins/Lobby/Floor/Floor.h +++ b/src/Plugins/Lobby/Floor/Floor.h @@ -1,5 +1,46 @@ +// Floor.h : main header file for the FLOOR DLL +// + +#if !defined(AFX_FLOOR_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_) +#define AFX_FLOOR_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_ + +#if _MSC_VER >= 1000 #pragma once -#include "common.h" +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "../../../common.h" +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CFloorApp +// See Floor.cpp for the implementation of this class +// + +class CFloorApp : public CWinApp +{ +public: + CFloorApp(); -class Floor { +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CFloorApp) + //}}AFX_VIRTUAL + + //{{AFX_MSG(CFloorApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() }; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_FLOOR_H__81154B54_BBFC_4E61_A2BC_BB53B98894B3__INCLUDED_) diff --git a/src/Plugins/Lobby/Floor/Floor.rc b/src/Plugins/Lobby/Floor/Floor.rc new file mode 100644 index 0000000..1781a41 --- /dev/null +++ b/src/Plugins/Lobby/Floor/Floor.rc @@ -0,0 +1,150 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +128 ATTR "res\\ATTR128_1.bin" + +128 DESC "res\\DESC128_1.txt" + +100 OBJMAP "res\\OBJMAP100_1.txt" + +1000 OBJMAP "res\\OBJMAP1000_1.txt" + +1001 OBJMAP "res\\OBJMAP1001_1.txt" + +1002 OBJMAP "res\\OBJMAP1002_1.txt" + +1003 OBJMAP "res\\OBJMAP1003_1.txt" + +1 TNDF "res\\TNDF1_1.bin" + +100 BITMAP "res\\BITMAP100_1.bmp" + +1000 BITMAP "res\\BITMAP1000_1.bmp" + +1001 BITMAP "res\\BITMAP1001_1.bmp" + +1002 BITMAP "res\\BITMAP1002_1.bmp" + +1003 BITMAP "res\\BITMAP1003_1.bmp" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\Floor.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif" + "\0" +END + +///////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + + + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Floor DLL\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Floor\0" + VALUE "LegalCopyright", "Copyright (C) 1997\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename","Floor.DLL\0" + VALUE "ProductName", "Floor Dynamic Link Library\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\\Floor.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/Plugins/Lobby/Floor/FloorDef.cpp b/src/Plugins/Lobby/Floor/FloorDef.cpp index e537523..029485b 100644 --- a/src/Plugins/Lobby/Floor/FloorDef.cpp +++ b/src/Plugins/Lobby/Floor/FloorDef.cpp @@ -1,7 +1,818 @@ +#include "StdAfx.h" #include "FloorDef.h" +#include "../../../T2DLL/T2BitImage.h" +#include "../../../T2DLL/T2CrossEquipArray.h" +#include "../../../T2DLL/T2FInfoAreaIterator.h" +#include "../../../T2DLL/T2FInfoPtIterator.h" +#include "../../../T2DLL/T2FloorInfo.h" +#include "../../../T2DLL/T2ImageObj.h" +#include "../../../T2DLL/T2Mover.h" +#include "../../../T2DLL/T2PaletteAnime.h" +#include "../../../T2DLL/T2People.h" +#include "../../../T2DLL/T2Request.h" +#include "../../../T2DLL/T2RouteNavigator.h" +#include "../../../T2DLL/T2Tenant.h" +#include "../../../T2DLL/T2ToolWindow.h" +#include "../../../T2DLL/T2TowerMessage.h" +#include "../../../T2DLL/T2WorldDef.h" +#include "../../../T2DLL/UT2Coordinate.h" +#include "../../../T2TowerDoc.h" +#include "../../../T2TowerMainView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +static BOOL DoMerges(T2Tenant *&ioFloor, T2TowerDoc *inDoc); +static void MergeFloor(T2Tenant *inFloorA, T2Tenant *inFloorB, T2TowerDoc *inDoc); +static void ReplaceMoverIDForFloors(const RECT &inRect, unsigned int inOldID, unsigned int inNewID, T2FloorInfo *inFloorInfo); +static void ReplaceFloorIDForMovers(T2CrossEquipArray *inMoverIDArray, unsigned int inOldID, unsigned int inNewID, T2FloorInfo *inFloorInfo); + +/*virtual*/ unsigned int FloorDef::IdleProc(T2HaveOutViewObject *inObject, T2TowerDoc *inDoc) { + unsigned int result = 0; + + T2Tenant *floor = (T2Tenant *) inObject; + int status = floor->GetStatus(); + if (status == kTenantStatus1) { + T2Tenant *floorMerge = floor; + + CRect area; + floorMerge->GetEquipArea(area); + + if (DoMerges(floorMerge, inDoc)) { + inDoc->GetMainView()->InvalUnitRect(area); + } else { + floor->SetStatus(kTenantStatus10); + result = 2; + inDoc->GetRouteNavi()->FloorAdded(floorMerge, false); + } + + BuildFinish(inDoc, floor); + } + + return result; +} + +FloorDef::FloorDef(DWORD inType, T2PluginSpecifier &inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) + : T2TenantDef(inType, inSpecifier, inResFile, inWorldDef, inPlugin) +{ +} + +/*virtual*/ FloorDef::~FloorDef() { +} + +/*virtual*/ T2InfoDialog *FloorDef::ShowInfoDialog(T2TowerDoc *doc, T2Equip *equip) { + return NULL; +} + +/*virtual*/ void FloorDef::DrawProc(T2HaveOutViewObject *inObject, const RECT &inRect, T2TowerDoc *inDoc) const { +#pragma var_order(var14, width, var1C, var20, theTenant, theFloor, isExcludeRoofAndFloor, var30, floorArea, var44, var48, var4C, rect5, pattern, visibleRFloor, rect6, height, var88, id, var90, fInfoAreaIter) + T2Tenant *theFloor = (T2Tenant *) inObject; + + CRect visibleFloor = inRect; + visibleFloor = theFloor->mArea; + + T2FInfoAreaIterator fInfoAreaIter(*inDoc->GetFloorInfo(), theFloor->mArea); + T2Tenant *theTenant; + + while (fInfoAreaIter.NextTenant(theTenant)) { + if (theTenant->GetEquipID() == theFloor->GetEquipID()) { + RECT rect2 = theFloor->mArea; + fInfoAreaIter.GetTenantRect(rect2); + + RECT rect3; + if (IntersectRect(&rect3, &rect2, &inRect)) { + visibleFloor = rect2; + break; + } + } + } + + int height = theFloor->mArea.bottom - theFloor->mArea.top; + int width = visibleFloor.left - theFloor->mArea.left; + + CRect floorArea = theFloor->mArea; + int id; + int pattern; + BOOL isExcludeRoofAndFloor; + + if (inDoc->mViewMode != kOutView) { + id = 100; + if (theFloor->mValiation == 0) + pattern = 100; + else + pattern = height * 100 + 1000; + + isExcludeRoofAndFloor = false; + } else { + id = 101; + pattern = + (inDoc->GetWorldDef()->GetOutViewKind() + 1) * 10000 + + theFloor->mValiation * 1000 + + height * 100; + + if (theFloor->IsFire()) + pattern += 2; + else if (inDoc->GetPaletteAnime()->IsSnow()) + pattern += 1; + + isExcludeRoofAndFloor = true; + } + + CRect rect5, rect6; + + int var14; + int var44; + T2BitImage *var48; + + if (inDoc->mViewMode != kOutView) { + var44 = mImageObj->FindObject(id, pattern); + var48 = mImageObj->GetObjectImage(var44, rect5); + var14 = rect5.Width() / 8; + } else { + var14 = 0; + } + + int var4C = mImageObj->FindObject(id, pattern + 100000); + T2BitImage *var30 = mImageObj->GetObjectImage(var4C, rect6); + int var88 = rect6.Width() / 8; + + int var90; + if (inDoc->mViewMode != kOutView) { + var90 = var14 + ((floorArea.left + var14 - 7) % 8) - 7; + var90 = min(var90, visibleFloor.right - floorArea.left); + } else { + var90 = 0; + } + + int var20 = visibleFloor.right - floorArea.left - var90; + int var1C = floorArea.left + var90; + + if (var90 > width) { + CRect src = rect5; + src.right = src.left + var90 * 8; + src.left += width * 8; + + CRect dst = visibleFloor; + dst.right = min(dst.left + var90 - width, visibleFloor.right); + visibleFloor.left = dst.right; + + UT2Coordinate::UnitToQD(dst, inDoc->GetZoomLevel(), isExcludeRoofAndFloor); + var48->CopyImage(*inDoc->GetImage(), src, dst); + + width = 0; + } + + if (var20 > 0) { + if (width > 0) + width -= var90; + + width += var1C % var88; + width %= var88; + + CRect dstUnitRect, srcRect, dstRect; + if ((width + visibleFloor.Width()) <= var88) { + dstUnitRect = visibleFloor; + + srcRect = rect6; + srcRect.left += width * 8; + srcRect.right = srcRect.left + visibleFloor.Width() * 8; + + UT2Coordinate::UnitToQD(dstUnitRect, dstRect, inDoc->GetZoomLevel(), isExcludeRoofAndFloor); + var30->CopyImage(*inDoc->GetImage(), srcRect, dstRect); + } else { + if (width > 0) { + dstUnitRect = visibleFloor; + dstUnitRect.right = dstUnitRect.left + (var88 - width); + + srcRect = rect6; + srcRect.left += width * 8; + + UT2Coordinate::UnitToQD(dstUnitRect, dstRect, inDoc->GetZoomLevel(), isExcludeRoofAndFloor); + var30->CopyImage(*inDoc->GetImage(), srcRect, dstRect); + + visibleFloor.left = dstUnitRect.right; + } + + while ((visibleFloor.left + var88) <= visibleFloor.right) { + dstUnitRect = visibleFloor; + dstUnitRect.right = dstUnitRect.left + var88; + + srcRect = rect6; + + UT2Coordinate::UnitToQD(dstUnitRect, dstRect, inDoc->GetZoomLevel(), isExcludeRoofAndFloor); + var30->CopyImage(*inDoc->GetImage(), srcRect, dstRect); + + visibleFloor.left = dstUnitRect.right; + } + + if (visibleFloor.left < visibleFloor.right) { + dstUnitRect = visibleFloor; + + srcRect = rect6; + srcRect.right = srcRect.left + dstUnitRect.Width() * 8; + + UT2Coordinate::UnitToQD(dstUnitRect, dstRect, inDoc->GetZoomLevel(), isExcludeRoofAndFloor); + var30->CopyImage(*inDoc->GetImage(), srcRect, dstRect); + + visibleFloor.left = dstUnitRect.right; + } + } + } +} + +/*virtual*/ AREACHECKCODE FloorDef::AreaCheck(T2TowerDoc *inDoc, RECT &ioRect, unsigned int inInfo, BOOL inShowError) { + AREACHECKCODE result = AreaCheckCode_1; + + if (!(inInfo & kAreaCheckFlag10000)) { + if (GetCategory() != 100 && ioRect.top < inDoc->mWorldDef->mTopFloorLine) { + if (inShowError) { + // EN: Only Final item can be placed on the top floor of building. + inDoc->GetTowerMessage()->BuildErr(68, NULL); + } + result = AreaCheckCode_0; + } + + if (result == AreaCheckCode_1 && ioRect.bottom > inDoc->mWorldDef->mBottomFloorLine) { + if (inShowError) { + // EN: Can not place items beyond the edges of the floor below. + inDoc->GetTowerMessage()->BuildErr(2, NULL); + } + return AreaCheckCode_0; + } + } + + if (result == AreaCheckCode_1) { + inInfo &= 0xFF; + if (ioRect.bottom == inDoc->GetWorldDef()->mGroundLine) { + if (inInfo == 0) { + if (inShowError) { + // EN: Only the lobby item can be placed on the first floor. + inDoc->GetTowerMessage()->BuildErr(15, NULL); + } + return AreaCheckCode_0; + } + } else { + if (inInfo == 1) { + if (inShowError) { + // EN: The lobby item can be only placed on the first floor. + inDoc->GetTowerMessage()->BuildErr(16, NULL); + } + return AreaCheckCode_0; + } + } + + if (inInfo != 3) { +#line 289 + _ASSERT(inDoc != NULL && inDoc->GetWorldDef() != NULL); + if (ioRect.bottom < inDoc->GetWorldDef()->mTopFloorLine) { + if (inShowError) { + // EN: Can not place items here. + inDoc->GetTowerMessage()->BuildErr(8, NULL); + } + return AreaCheckCode_0; + } + } + + if (inInfo == 0) { + T2FloorInfo *theFloorInfo = inDoc->GetFloorInfo(); + if (ioRect.bottom <= theFloorInfo->GetGroundLine()) { + for (int h = ioRect.left; h < ioRect.right; h++) { + unsigned int theTenantID = theFloorInfo->GetTenantID(ioRect.bottom, h); + if (theTenantID == 0) { + if (inShowError) { + RECT area; + theFloorInfo->GetFloorArea(area); + area.top = ioRect.bottom; + area.bottom = ioRect.bottom + 1; + + T2FInfoAreaIterator iterator(*theFloorInfo, area); + T2Tenant *theTenant; + if (iterator.NextTenant(theTenant)) { + // EN: Can not place items beyond the edges of the floor below. + inDoc->GetTowerMessage()->BuildErr(2, NULL); + } else { + // EN: There is no floor below. + inDoc->GetTowerMessage()->BuildErr(4, NULL); + } + } + return AreaCheckCode_0; + } else { + T2Tenant *theTenant = theFloorInfo->GetTenant(theTenantID); + if (theTenant && T2EquipDef::IsSetAttribute(kTenantAttr40000)) { + if (inShowError) { + // EN: Can not place this item above the sky bridge. + inDoc->GetTowerMessage()->BuildErr(13, NULL); + } + return AreaCheckCode_0; + } + } + } + } else { + BOOL flag = false; + if (inDoc->GetWorldDef()->m17C == 1 || inDoc->GetWorldDef()->m17C == 2) { + for (int v = ioRect.top; v < ioRect.bottom; v++) { + if (theFloorInfo->GetTenantID(v, ioRect.left - 1) || theFloorInfo->GetTenantID(v, ioRect.right)) { + flag = true; + break; + } + } + + if (!flag) { + for (int h = ioRect.left; h < ioRect.right; h++) { + if (theFloorInfo->GetTenantID(ioRect.top - 1, h)) { + flag = true; + break; + } + } + } + } else { + flag = true; + for (int h = ioRect.left; h < ioRect.right; h++) { + if (!theFloorInfo->GetTenantID(ioRect.top - 1, h)) { + flag = false; + break; + } + } + } + + if (!flag) { + if (inShowError) { + // EN: Can not place items beyond the edges of the floor above. + inDoc->GetTowerMessage()->BuildErr(3, NULL); + } + return AreaCheckCode_0; + } + } + } + + RECT area; + inDoc->GetFloorInfo()->GetFloorArea(area); + + int minimumX = (inInfo != 1) ? (ioRect.left - 9) : area.left; + minimumX = max(minimumX, area.left); + + int maximumX = (inInfo != 1) ? (ioRect.right + 8) : (area.right - 1); + maximumX = min(maximumX, area.right - 1); + + int y = ioRect.bottom - 1; + int x; + + for (x = ioRect.left - 1; x >= minimumX; x--) { + if (inDoc->GetFloorInfo()->GetTenant(y, x)) + break; + } + + if (x >= minimumX) + ioRect.left = x + 1; + + for (x = ioRect.right; x <= maximumX; x++) { + if (inDoc->GetFloorInfo()->GetTenant(y, x)) + break; + } + + if (x <= maximumX) + ioRect.right = x; + + result = AreaCheckCode_1; + } + + return result; +} + +/*virtual*/ int FloorDef::RequierToolIcon(T2ToolWindow *window) { + window->AddIcon(mStr48, 0, 1, kToolOption1, NULL, 0, 1, NULL); + return 0; +} + +/*virtual*/ CURSORTYPE FloorDef::QueryCursor(T2TowerDoc *inDoc, POINT inPt, CString &outSpriteName, RECT &outRect, POINT &outPt, + int inZoomLevel, unsigned int inValiation, int i) { + int height; + + if (inValiation == 0) { + outSpriteName = "Csr"; + height = mHeight; + } else { + char buf[20]; + height = inDoc->GetWorldDef()->GetLobbyHeight(); + wsprintfA(buf, "LCsr%d%d", 1, height); + outSpriteName = buf; + } + + inPt.x -= ((UT2Coordinate::UnitHSize(inZoomLevel) * mWidth) / 2) - (UT2Coordinate::UnitHSize(inZoomLevel) / 2); + inPt.y -= ((UT2Coordinate::UnitVSize(inZoomLevel) * height) / 2) - (UT2Coordinate::UnitVSize(inZoomLevel) / 2); + + UT2Coordinate::QDToUnit(inPt, inZoomLevel); + SetRect(&outRect, inPt.x, inPt.y, inPt.x + mWidth, inPt.y + height); + + outPt.x = outRect.left; + outPt.y = outRect.top; + UT2Coordinate::UnitToQD(outRect, inZoomLevel); + + return CursorType_0; +} + +static BOOL DoMerges(T2Tenant *&ioFloor, T2TowerDoc *inDoc) { +#pragma var_order(leftFloor, rightFloor, flag10, floorInfo, area, pt, result) + BOOL result = false; + + BOOL flag10 = (ioFloor->GetEquipID() == 1000); + T2FloorInfo *floorInfo = inDoc->mFloorInfo; + + RECT area; + ioFloor->GetEquipArea(area); + + POINT pt; + pt.y = area.top; + pt.x = area.left - 1; + + T2Tenant *leftFloor = floorInfo->GetFloor(pt.y, pt.x); + if (leftFloor && leftFloor->IsBuildFinish()) { + if (!flag10) { + MergeFloor(ioFloor, leftFloor, inDoc); + ioFloor = leftFloor; + } else { + ioFloor->SetStatus(kTenantStatus10); + inDoc->GetRouteNavi()->FloorAdded(ioFloor, false); + MergeFloor(leftFloor, ioFloor, inDoc); + } + result = true; + } + + pt.x = area.right; + + T2Tenant *rightFloor = floorInfo->GetFloor(pt.y, pt.x); + if (rightFloor && rightFloor->IsBuildFinish()) { + if (!result) { + if (!flag10) { + MergeFloor(ioFloor, rightFloor, inDoc); + ioFloor = rightFloor; + } else { + ioFloor->SetStatus(kTenantStatus10); + inDoc->GetRouteNavi()->FloorAdded(ioFloor, false); + MergeFloor(rightFloor, ioFloor, inDoc); + } + } else { + if (ioFloor->IsMoverAvailable() || flag10) { + MergeFloor(rightFloor, ioFloor, inDoc); + } else { + MergeFloor(ioFloor, rightFloor, inDoc); + } + } + result = true; + } + + return result; +} + +static void MergeFloor(T2Tenant *inFloorA, T2Tenant *inFloorB, T2TowerDoc *inDoc) { +#pragma var_order(floorIDA, flagC, ceArrayB, floorInfo, ceArrayA, pt, areaA, isFloorB, areaB, isFinishA, floorIDB, isFloorA) + T2FloorInfo *floorInfo = inDoc->mFloorInfo; +#line 481 + _ASSERT(floorInfo != NULL); + + BOOL isFloorA = inFloorA->IsFloor(); + if (!isFloorA) { + unsigned int floorID = inFloorA->GetFloorID(-1); + if (floorID != 0) + inFloorA = floorInfo->GetTenant(floorID); + } + + BOOL isFloorB = inFloorB->IsFloor(); + if (!isFloorB) { + unsigned int floorID = inFloorB->GetFloorID(-1); + if (floorID != 0) + inFloorB = floorInfo->GetTenant(floorID); + } + + BOOL isFinishA = inFloorA->IsBuildFinish(); + BOOL flagC = isFinishA && inFloorA->IsMoverAvailable(); + + RECT areaA, areaB; + inFloorA->GetEquipArea(areaA); + inFloorB->GetEquipArea(areaB); + + unsigned int floorIDA = inFloorA->GetEquipID(); + unsigned int floorIDB = inFloorB->GetEquipID(); + + T2CrossEquipArray *ceArrayA = inFloorA->GetCEArray(); + T2CrossEquipArray *ceArrayB = inFloorB->GetCEArray(); + + ReplaceMoverIDForFloors(areaA, floorIDA, floorIDB, floorInfo); + ReplaceFloorIDForMovers(ceArrayA, floorIDA, floorIDB, floorInfo); + + inFloorB->UnionFloorPeople(inFloorA); + + POINT pt; + pt.x = (areaA.left < areaB.left) ? (areaB.left - 1) : (areaA.left - 1); + pt.y = areaA.bottom - 1; + + ceArrayB->Union(ceArrayA); + floorInfo->ReplaceFloorID(areaA, floorIDA, floorIDB); + + UnionRect(&areaB, &areaB, &areaA); + inFloorB->SetEquipArea(areaB); + + if (isFinishA) + inDoc->GetRouteNavi()->FloorRemoved(inFloorA, flagC); + + inFloorA->SetUsed(false); + floorInfo->UpdeteRequestByUnionFloor(inFloorB, pt); +} + +static void ReplaceMoverIDForFloors(const RECT &inRect, unsigned int inOldID, unsigned int inNewID, T2FloorInfo *inFloorInfo) { + T2FInfoAreaIterator iterator(*inFloorInfo, inRect); + T2Tenant *theTenant; + + while (iterator.NextTenant(theTenant)) { + if (theTenant && !theTenant->IsFloor()) { + T2CrossEquipArray *theFloorCEArray = theTenant->GetCEArray(); + if (theFloorCEArray) + theFloorCEArray->ReplaceID(inOldID, inNewID); + } + } +} + +static void ReplaceFloorIDForMovers(T2CrossEquipArray *inMoverIDArray, unsigned int inOldID, unsigned int inNewID, T2FloorInfo *inFloorInfo) { + LArrayIterator iterator(*inMoverIDArray); + unsigned int theMoverID; + + while (iterator.Next(&theMoverID)) { + T2Mover *theMover = inFloorInfo->GetMover(theMoverID); + if (theMover) { + T2CrossEquipArray *theMoverCEArray = theMover->GetCEArray(); + if (theMoverCEArray) + theMoverCEArray->ReplaceID(inOldID, inNewID); + } + } +} + +/*virtual*/ void FloorDef::BuildFinish(T2TowerDoc *inDoc, T2Equip *inEquip) { + T2EquipDef::BuildFinish(inDoc, inEquip); + + CRect floorArea; + inEquip->GetEquipArea(floorArea); + + CRect aboveArea(floorArea.left, floorArea.top - 1, floorArea.right, floorArea.top); + T2FInfoAreaIterator iter(*inDoc->GetFloorInfo(), aboveArea); + + T2Tenant *theTenant = NULL; + while (iter.NextTenant(theTenant)) { + if (theTenant->IsSetAttribute(kTenantAttr40000)) { + theTenant->GetEquipDef()->OptionProc(inDoc, theTenant, NULL); + break; + } + } +} + +static PROCCODE x154C0(T2TowerDoc *inDoc, T2HaveOutViewObject *inObject, POINT inPt, RECT &outRect); + +/*virtual*/ PROCCODE FloorDef::DoDestructProc(T2TowerDoc *inDoc, T2HaveOutViewObject *inObject, POINT inPt, RECT &outRect) { + T2Tenant *theFloor = (T2Tenant *) inObject; + + POINT unitPt = inPt; + UT2Coordinate::QDToUnit(unitPt, inDoc->GetZoomLevel()); + + if (unitPt.y < (inDoc->GetFloorInfo()->GetGroundLine() - 1)) { + if (!inDoc->GetFloorInfo()->GetTenant(unitPt.y + 1, unitPt.x)) + return x154C0(inDoc, theFloor, unitPt, outRect); + } + + PROCCODE result = ProcCode_1; + int buildErr = 0; + + CRect equipArea; + theFloor->GetEquipArea(equipArea); + + // bug??? + if (!theFloor->GetCEArray() && theFloor->GetCEArray()->GetCount()) { + result = ProcCode_2; + // EN: This floor can not be removed because transit systems are connected. + buildErr = 22; + } + + if (result == ProcCode_1) { + T2FInfoAreaIterator iter(*inDoc->GetFloorInfo(), equipArea); + T2Mover *theMover; + + while (result == ProcCode_1 && iter.NextMover(theMover)) { + CRect moverArea, intersect; + theMover->CalcBodyArea(moverArea); + if (intersect.IntersectRect(equipArea, moverArea)) { + result = ProcCode_2; + // EN: This floor can not be removed because transit systems are connected. + buildErr = 22; + } + } + } + + if (theFloor->GetFirstPeople()) { + result = ProcCode_2; + // EN: Can not remove the floor because there are people here. + buildErr = 73; + } + + if (result == ProcCode_1) { + T2FInfoAreaIterator iter(*inDoc->GetFloorInfo(), equipArea); + T2Tenant *tenant; + + while (iter.NextTenant(tenant) && tenant) { + if (!tenant->IsFloor()) { + result = ProcCode_2; + // EN: This floor can not be removed because there is already a tenant on it. + buildErr = 21; + break; + } + } + } + + if (result == ProcCode_1) { + BOOL isAbove = equipArea.bottom <= inDoc->GetFloorInfo()->GetGroundLine(); + if (isAbove) { + CRect aboveArea(equipArea.left, equipArea.top - 1, equipArea.right, equipArea.top); + T2FInfoAreaIterator iter(*inDoc->GetFloorInfo(), aboveArea); + T2Tenant *tenant = NULL; + + if (iter.NextTenant(tenant) && tenant) { + result = ProcCode_2; + // EN: Floor can only be removed if it is the top floor of the building. + buildErr = 19; + } + } + + BOOL isBelow = equipArea.bottom >= inDoc->GetFloorInfo()->GetGroundLine(); + if (isBelow) { + CRect undergroundArea(equipArea.left, equipArea.bottom, equipArea.right, equipArea.bottom + 1); + T2FInfoAreaIterator iter(*inDoc->GetFloorInfo(), undergroundArea); + T2Tenant *tenant = NULL; + + if (iter.NextTenant(tenant) && tenant) { + result = ProcCode_2; + // EN: Floor can only be removed if it is the lowest floor of the building. + buildErr = 20; + } + } + } + + if (buildErr != 0) + inDoc->GetTowerMessage()->BuildErr(buildErr, NULL); + + if (result == ProcCode_1) + result = ProcCode_0; + + return result; +} + +static PROCCODE x154C0(T2TowerDoc *inDoc, T2HaveOutViewObject *inObject, POINT inPt, RECT &outRect) { +#pragma var_order(crossEquipArrayIterator, lastID, theFloor, result, theMoverID, theIterR, theFloorID, theUpRequest, theFloorInfo, tenant, requestIterator, removedArea, iterator3, rightTenant, ceIterator, theFloorDef, rightArea, leftArea, leftTenant, floorArea, theRequest, theIterL, pt, theRightFloor, theRightFloorID, theCEArray, theDnRequest) + PROCCODE result = ProcCode_1; + + T2FloorInfo *theFloorInfo = inDoc->GetFloorInfo(); + T2Tenant *theFloor = (T2Tenant *) inObject; + FloorDef *theFloorDef = (FloorDef *) theFloor->GetEquipDef(); + unsigned int theFloorID = theFloor->GetEquipID(); + + CRect floorArea; + theFloor->GetEquipArea(floorArea); + outRect = floorArea; + + CRect removedArea(0, 0, 0, 0); + POINT pt; + pt.x = inPt.x; + pt.y = inPt.y + 1; + + T2FInfoPtIterator theIterL(*theFloorInfo, inPt); + T2FInfoPtIterator theIterR(*theFloorInfo, pt); + T2Tenant *leftTenant = NULL; + T2Tenant *rightTenant = NULL; + + if (theIterL.LeftTenant(leftTenant) && theIterR.RightTenant(rightTenant)) { + CRect theLeftArea, theRightArea; + leftTenant->GetEquipArea(theLeftArea); + rightTenant->GetEquipArea(theRightArea); + removedArea = CRect(theLeftArea.left, floorArea.top, theRightArea.right, floorArea.bottom); + } + + T2CrossEquipArray *theCEArray = theFloor->GetCEArray(); + LArrayIterator ceIterator(*theCEArray); + unsigned int theMoverID; + + while (ceIterator.Next(&theMoverID)) { + T2Mover *mover = theFloorInfo->GetMover(theMoverID); + if (mover) { + CRect moverArea, intersect; + mover->GetEquipArea(moverArea); +#line 634 + _ASSERT(!intersect.IntersectRect(&removedArea, &moverArea)); + } + } + + T2Request *theDnRequest = NULL; + T2Request *theUpRequest = NULL; + T2Request *theRequest; + T2FInfoAreaIterator requestIterator(*theFloorInfo, removedArea); + + while (requestIterator.NextRequest(theRequest)) { + POINT head = theRequest->GetHeadPosition(); +#line 646 + _ASSERT(!removedArea.PtInRect(head)); + + CRect requestArea; + theRequest->CalcArea(requestArea); + + if (theRequest->GetUpDown() == ERequestUpDown_1) + theDnRequest = theRequest; + else + theUpRequest = theRequest; + + theFloorInfo->RemoveRequestID(theRequest->GetUpDown(), requestArea); + } + + CRect leftArea(floorArea.left, floorArea.top, removedArea.left, floorArea.bottom); + CRect rightArea(removedArea.right, floorArea.top, floorArea.right, floorArea.bottom); +#line 659 + _ASSERT(!leftArea.IsRectEmpty() && !rightArea.IsRectEmpty()); + + T2Tenant *theRightFloor = theFloorInfo->FindUnusedTenant(); +#line 663 + _ASSERT(theRightFloor != NULL); + + theRightFloor->InitTenant(theFloorDef, rightArea, theFloor->GetValiation()); + theRightFloor->SetStatus(kTenantStatus10); + unsigned int theRightFloorID = theRightFloor->GetEquipID(); + + theFloor->SetEquipArea(leftArea); + + unsigned int lastID = 0; + LArrayIterator crossEquipArrayIterator(*theCEArray); + + while (crossEquipArrayIterator.Next(&theMoverID)) { + T2Mover *mover = theFloorInfo->GetMover(theMoverID); + if (mover) { + CRect moverArea, intersect; + mover->GetEquipArea(moverArea); + if (intersect.IntersectRect(rightArea, moverArea)) { + T2CrossEquipArray *moverCEArray = mover->GetCEArray(); + if (moverCEArray) { + moverCEArray->ReplaceID(theFloorID, theRightFloorID); + theFloor->RemoveCEID(theMoverID); + theRightFloor->InsertCEID(lastID, theMoverID); + lastID = theMoverID; + } + } + } + } + + T2FInfoAreaIterator iterator3(*theFloorInfo, rightArea); + T2Tenant *tenant; + + while (iterator3.NextTenant(tenant)) { + if (!tenant->IsFloor()) { + T2CrossEquipArray *tenantCEArray = tenant->GetCEArray(); + if (tenantCEArray) + tenantCEArray->ReplaceID(theFloorID, theRightFloorID); + } + } + + if (theFloor->IsTherePeople()) { + int centerH = (removedArea.left + removedArea.right) / 2; + + T2People *thePeople = theFloor->mFirstPeople; + T2People *theNextPeople = NULL; + for (; thePeople; thePeople = theNextPeople) { + theNextPeople = (T2People *) thePeople->mNext; + + POINT curPt = thePeople->GetCurPosition(); + if (curPt.x < centerH) { + if (curPt.x > (leftArea.right - 2)) + thePeople->MoveHTo(leftArea.right - 2); + } else { + theFloor->Leave(thePeople); + theRightFloor->Enter(thePeople); + } + + thePeople->SetStatus(kStatus2); + } + } + + theFloorInfo->FillTenantID(removedArea, 0); + theFloorInfo->ReplaceFloorID(rightArea, theFloorID, theRightFloorID); + + if (theDnRequest) + theDnRequest->SetDrawWidth(theFloorInfo->FillRequestID(theDnRequest->GetHeadPosition(), ERequestUpDown_1, theDnRequest->GetRequestID())); + if (theUpRequest) + theUpRequest->SetDrawWidth(theFloorInfo->FillRequestID(theUpRequest->GetHeadPosition(), ERequestUpDown_0, theUpRequest->GetRequestID())); + + inDoc->GetRouteNavi()->FloorAdded(theRightFloor, true); + return ProcCode_2; +} + +/*virtual*/ PROCCODE FloorDef::DrawHitMask(T2TowerDoc *doc, T2HaveOutViewObject *object) { + RECT rect; + ((T2Tenant *) object)->GetEquipArea(rect); + UT2Coordinate::UnitToQD(rect, doc->GetZoomLevel()); + doc->GetImage()->FillRect(rect, 1); + return ProcCode_1; +} diff --git a/src/Plugins/Lobby/Floor/FloorDef.h b/src/Plugins/Lobby/Floor/FloorDef.h index dca8270..fde0986 100644 --- a/src/Plugins/Lobby/Floor/FloorDef.h +++ b/src/Plugins/Lobby/Floor/FloorDef.h @@ -1,5 +1,20 @@ #pragma once -#include "common.h" +#include "../../../common.h" +#include "../../../T2DLL/T2TenantDef.h" -class FloorDef { +class FloorDef : public T2TenantDef { +public: + FloorDef(DWORD inType, T2PluginSpecifier &inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin); + virtual ~FloorDef(); + virtual void BuildFinish(T2TowerDoc *inDoc, T2Equip *inEquip); + virtual T2InfoDialog *ShowInfoDialog(T2TowerDoc *doc, T2Equip *equip); + virtual unsigned int IdleProc(T2HaveOutViewObject *inObject, T2TowerDoc *inDoc); + virtual void DrawProc(T2HaveOutViewObject *inObject, const RECT &inRect, T2TowerDoc *inDoc) const; + virtual AREACHECKCODE AreaCheck(T2TowerDoc *inDoc, RECT &ioRect, unsigned int inInfo, BOOL inShowError); + virtual int RequierToolIcon(T2ToolWindow *window); + virtual CURSORTYPE + QueryCursor(T2TowerDoc *inDoc, POINT inPt, CString &outSpriteName, RECT &outRect, POINT &outPt, int inZoomLevel, + unsigned int inValiation, int i); + virtual PROCCODE DoDestructProc(T2TowerDoc *inDoc, T2HaveOutViewObject *inObject, POINT inPt, RECT &outRect); + virtual PROCCODE DrawHitMask(T2TowerDoc *doc, T2HaveOutViewObject *object); }; diff --git a/src/Plugins/Lobby/Floor/FloorPlugin.cpp b/src/Plugins/Lobby/Floor/FloorPlugin.cpp index e43b2d3..b77c284 100644 --- a/src/Plugins/Lobby/Floor/FloorPlugin.cpp +++ b/src/Plugins/Lobby/Floor/FloorPlugin.cpp @@ -1,3 +1,4 @@ +#include "StdAfx.h" #include "FloorPlugin.h" #ifdef _DEBUG @@ -5,3 +6,8 @@ #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +FloorPlugin::FloorPlugin(DWORD inType, T2PluginSpecifier &inSpecifier) + : T2TenantPlugin(inType, inSpecifier) +{ +} diff --git a/src/Plugins/Lobby/Floor/FloorPlugin.h b/src/Plugins/Lobby/Floor/FloorPlugin.h index a57a05f..2a7d723 100644 --- a/src/Plugins/Lobby/Floor/FloorPlugin.h +++ b/src/Plugins/Lobby/Floor/FloorPlugin.h @@ -1,5 +1,8 @@ #pragma once -#include "common.h" +#include "../../../common.h" +#include "../../../T2DLL/T2TenantPlugin.h" -class FloorPlugin { +class FloorPlugin : public T2TenantPlugin { +public: + FloorPlugin(DWORD inType, T2PluginSpecifier &inSpecifier); }; diff --git a/src/Plugins/Lobby/Floor/Resource.h b/src/Plugins/Lobby/Floor/Resource.h new file mode 100644 index 0000000..8d2cbf7 --- /dev/null +++ b/src/Plugins/Lobby/Floor/Resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by FLOOR.RC +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/Plugins/Lobby/Floor/StdAfx.cpp b/src/Plugins/Lobby/Floor/StdAfx.cpp new file mode 100644 index 0000000..65ad23f --- /dev/null +++ b/src/Plugins/Lobby/Floor/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// Floor.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/src/Plugins/Lobby/Floor/StdAfx.h b/src/Plugins/Lobby/Floor/StdAfx.h new file mode 100644 index 0000000..9fc556e --- /dev/null +++ b/src/Plugins/Lobby/Floor/StdAfx.h @@ -0,0 +1,41 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_) +#define AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions + +#ifndef _AFX_NO_OLE_SUPPORT +#include <afxole.h> // MFC OLE classes +#include <afxodlgs.h> // MFC OLE dialog classes +#include <afxdisp.h> // MFC OLE automation classes +#endif // _AFX_NO_OLE_SUPPORT + + +#ifndef _AFX_NO_DB_SUPPORT +#include <afxdb.h> // MFC ODBC database classes +#endif // _AFX_NO_DB_SUPPORT + +#ifndef _AFX_NO_DAO_SUPPORT +#include <afxdao.h> // MFC DAO database classes +#endif // _AFX_NO_DAO_SUPPORT + +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__AF935A55_9E17_4611_818A_EF6A4343861E__INCLUDED_) |