• R/O
  • SSH
  • HTTPS

railsim2: Commit


Commit MetaInfo

Revision9 (tree)
Time2012-08-28 23:58:05
Authorokadu

Log Message

[okadu] Version 2.14
ニュートラル画面分割
ダイヤ停車位置の数値設定
レイアウト読み込みバグ一部修正

Change Summary

Incremental Difference

--- trunk/CDiaEditMode.h (revision 8)
+++ trunk/CDiaEditMode.h (revision 9)
@@ -25,6 +25,7 @@
2525 bool IsPausedCursorScenery(){
2626 return m_PointDialog.IsVisible() || m_DiaDialog.IsVisible();
2727 }
28+ //bool IsWindowDivisible(){ return true; }
2829 };
2930
3031 // 外部グローバル
--- trunk/Capture.cpp (revision 8)
+++ trunk/Capture.cpp (revision 9)
@@ -55,7 +55,6 @@
5555 CountPicture();
5656 CountVideoAVI();
5757 chdir(g_BaseDir);
58-
5958 }
6059 /*
6160 * 撮影解放
--- trunk/CScene.h (revision 8)
+++ trunk/CScene.h (revision 9)
@@ -38,6 +38,7 @@
3838 CStruct *m_Struct; // 施設
3939 CSurfacePlugin *m_SurfacePlugin; // 地形プラグイン
4040 CEnvPlugin *m_EnvPlugin; // 環境プラグイン
41+ bool m_IsDumpReady; // ダンプ完了
4142 CScene *m_Next; // 次
4243 public:
4344 CScene();
--- trunk/CSceneryMode.h (revision 8)
+++ trunk/CSceneryMode.h (revision 9)
@@ -14,9 +14,9 @@
1414 class CSceneryMode: public CGameMode{
1515 protected:
1616 static int ms_PhotoMode; // 撮影モード
17+ static bool ms_NeedResetViewport;
1718 public:
1819 static int GetPhotoMode(){ return ms_PhotoMode; }
19- static CCamera *GetCamera();
2020 CSceneryMode(){}
2121 virtual ~CSceneryMode(){}
2222 virtual bool CameraCtrlExp(){ return false; }
@@ -25,9 +25,11 @@
2525 virtual char *LoadScenerySetting(char *str){ return str; }
2626 void SaveSetting(FILE *file){ SaveScenerySetting(file); }
2727 virtual void SaveScenerySetting(FILE *){}
28+ CCamera *GetCamera();
2829 void EnterGame();
2930 virtual void EnterScenery() = 0;
3031 void SpinGame();
32+ void ResetViewport();
3133 virtual void ApplyCamera();
3234 virtual void ScanInputScenery() = 0;
3335 virtual void RenderScenery() = 0;
@@ -35,6 +37,7 @@
3537 virtual bool IsPausedScenery() = 0;
3638 bool ProcessShortcutKey();
3739 virtual bool IsArrowMode(){ return false; }
40+ virtual bool IsWindowDivisible(){ return false; }
3841 };
3942
4043 /*
--- trunk/CWindowDivInfo.h (nonexistent)
+++ trunk/CWindowDivInfo.h (revision 9)
@@ -0,0 +1,94 @@
1+#ifndef CWINDOWDIVINFO_H_INCLUDED
2+#define CWINDOWDIVINFO_H_INCLUDED
3+
4+#include "CCamera.h"
5+
6+class CScene;
7+class CWindowDivInfo;
8+class CSceneryMode;
9+
10+const int WIN_DIV_MAX = 2; // 画面分割単位
11+const int WIN_DIV_MARGIN = 5; // 画面分割余白
12+const int WIN_DIV_PADDING = 2; // 画面分割線幅
13+const int WIN_DIV_MOVE_MARGIN = 1; // 画面分割移動判定幅
14+const int WIN_DIV_MIN_SIZE = 50; // 画面分割最小サイズ
15+
16+class CWindowInfo {
17+ friend class CWindowDivInfo;
18+
19+private:
20+ CScene *m_Scene;
21+ CCamera m_Camera;
22+ CWindowDivInfo *m_Div;
23+ int m_PosX, m_PosY;
24+ int m_Width, m_Height;
25+
26+public:
27+ CWindowInfo();
28+ ~CWindowInfo();
29+
30+ CWindowDivInfo *GetDiv(){ return m_Div; }
31+ CWindowDivInfo **GetDivAdr(){ return &m_Div; }
32+ CScene *GetScene(){ return m_Scene; }
33+ CCamera *GetCamera(){ return &m_Camera; }
34+ void SetCamera(const CCamera& cam){ m_Camera = cam; }
35+ void SetScene(CScene *scene){ m_Scene = scene; }
36+ void Free();
37+ CWindowInfo *GetPointWindow(int x, int y, int w, int h, const POINT& pos);
38+ CWindowInfo *GetFirstLeaf();
39+ void ApplyViewportAndCamera();
40+ void RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt);
41+ void OnDeleteScene(CScene *scene);
42+ char *Read(char *);
43+ void Save(FILE *, string indent);
44+};
45+
46+class CWindowDivInfo {
47+ friend class CWindowInfo;
48+
49+private:
50+ enum {
51+ DRAG_STATE_NONE = 0,
52+ DRAG_STATE_HORZ = 1,
53+ DRAG_STATE_VERT = 2,
54+ DRAG_STATE_HORZVERT = DRAG_STATE_HORZ|DRAG_STATE_VERT,
55+ };
56+
57+public:
58+ static CWindowDivInfo **s_DragDivInfo;
59+ static CWindowDivInfo *s_MoveDivInfo;
60+ static CCamera *s_DragDivCamera;
61+ static CScene **s_DragDivScene;
62+ static int s_DragState;
63+ static int s_ShrinkState;
64+ static int s_ShrinkAnim;
65+ static int s_TargetPosX, s_TargetPosY;
66+ static int s_TargetWidth, s_TargetHeight;
67+
68+ float m_HorzRatio;
69+ float m_VertRatio;
70+ CWindowInfo m_ChildWindow[WIN_DIV_MAX][WIN_DIV_MAX];
71+ int m_ChildWidth[WIN_DIV_MAX];
72+ int m_ChildHeight[WIN_DIV_MAX];
73+ int m_DragState;
74+
75+public:
76+ static void InitState();
77+ void CalcChildSize(int w, int h);
78+ int ScanInputSelf(CWindowDivInfo** info, int x, int y, int w, int h);
79+ static int ScanInput(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene);
80+ static int ScanInputRecursive(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene);
81+ static void RenderInterface();
82+ void InitCamera(const CCamera& cam, CScene *scene);
83+ void RenderInterfaceRecursive(int x, int y, int w, int h);
84+ void RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt);
85+ CWindowInfo* GetPointWindow(int x, int y, int w, int h, const POINT& pos);
86+ void OnDeleteScene(CScene *scene);
87+
88+ CWindowDivInfo();
89+ ~CWindowDivInfo();
90+ char *Read(char *);
91+ void Save(FILE *, string indent);
92+};
93+
94+#endif
--- trunk/CSaveFile.cpp (revision 8)
+++ trunk/CSaveFile.cpp (revision 9)
@@ -75,6 +75,7 @@
7575 */
7676 CSaveFile::~CSaveFile(){
7777 g_Scene = NULL;
78+ if(g_ConfigMode) g_ConfigMode->FreeWindowDiv();
7879 DELETE_V(m_WarpList);
7980 DELETE_V(m_GroupList);
8081 DELETE_V(m_SceneList);
@@ -364,6 +365,7 @@
364365 }
365366 NumberScene();
366367 g_Scene->Enter(false);
368+ g_ConfigMode->GetRootWindow()->OnDeleteScene(sc);
367369 }
368370
369371 /*
@@ -406,6 +408,9 @@
406408 void CSaveFile::NextScene(
407409 bool prev // 逆方向
408410 ){
411+ CWindowInfo* active_wnd = g_ConfigMode->GetActiveWindow();
412+ CScene *origscene = g_Scene;
413+ if(active_wnd && active_wnd->GetScene()) g_Scene = active_wnd->GetScene();
409414 CScene *oldscene = g_Scene;
410415 if(prev){
411416 CScene *ptr = m_SceneList;
@@ -420,6 +425,10 @@
420425 g_Scene = g_Scene && g_Scene->Next() ? g_Scene->Next() : m_SceneList;
421426 }
422427 if(g_Scene!=oldscene) g_Scene->Enter(true);
428+ if(active_wnd){
429+ active_wnd->SetScene(g_Scene);
430+ g_Scene = origscene;
431+ }
423432 }
424433
425434 /*
@@ -646,6 +655,7 @@
646655 void ClearStaticSwitchTable();
647656 ClearStaticSwitchTable();
648657 g_Scene = NULL;
658+ g_ConfigMode->FreeWindowDiv();
649659 g_TrainGroup = NULL;
650660 g_AddressMap.clear();
651661 g_AddressMap[NULL] = NULL;
@@ -783,6 +793,11 @@
783793 g_Scene = NULL;
784794 if(!(str = EndBlock(eee = str))) throw CSynErr(eee, ERR_ENDBLOCK);
785795
796+ if(m_Version>=2.14f){
797+ if(!(str = BeginBlock(eee = str, "Window"))) throw CSynErr(eee);
798+ str = g_ConfigMode->GetRootWindow()->Read(str);
799+ if(!(str = EndBlock(eee = str))) throw CSynErr(eee, ERR_ENDBLOCK);
800+ }
786801 }
787802 catch(CSynErr err){
788803 err.Handle(FlashIn("%s <%s>", m_FileName.c_str(), "Layout"), buf);
@@ -942,6 +957,10 @@
942957 }
943958 fprintf(df, "}\n\n");
944959
960+ fprintf(df, "Window{\n");
961+ g_ConfigMode->GetRootWindow()->Save(df, "\t");
962+ fprintf(df, "}\n\n");
963+
945964 fclose(df);
946965 return 0;
947966 }
--- trunk/CDiaDialog.h (revision 8)
+++ trunk/CDiaDialog.h (revision 9)
@@ -83,16 +83,18 @@
8383 */
8484 class CDiaDialog: public CDiaDialogBase{
8585 private:
86- int m_OffsetSlide; // オフセットスライダ状態
87- CRadioButton m_Action[3]; // 動作ラジオ
88- CRadioButton m_TimeType[2]; // 時間ラジオ
89- CEditCtrl m_HourEdit; // 時ラベル
90- CStaticCtrl m_HourLabel; // 時エディット
91- CEditCtrl m_MinuteEdit; // 分エディット
92- CStaticCtrl m_MinuteLabel; // 分ラベル
93- CEditCtrl m_SecondEdit; // 秒エディット
94- CStaticCtrl m_SecondLabel; // 秒ラベル
95-// CCheckBox m_JointCheck; // 連結チェック
86+ int m_OffsetSlide; // オフセットスライダ状態
87+ CRadioButton m_Action[3]; // 動作ラジオ
88+ CRadioButton m_TimeType[2]; // 時間ラジオ
89+ CEditCtrl m_HourEdit; // 時ラベル
90+ CStaticCtrl m_HourLabel; // 時エディット
91+ CEditCtrl m_MinuteEdit; // 分エディット
92+ CStaticCtrl m_MinuteLabel; // 分ラベル
93+ CEditCtrl m_SecondEdit; // 秒エディット
94+ CStaticCtrl m_SecondLabel; // 秒ラベル
95+ CEditCtrl m_StopPosEdit; // 停車位置エディット
96+ CPushButton m_StopPosButton; // 停車位置反映ボタン
97+// CCheckBox m_JointCheck; // 連結チェック
9698 public:
9799 void Init(CInterface *);
98100 void ResizeDiaDialogBase(int, int);
--- trunk/Macro.h (revision 8)
+++ trunk/Macro.h (revision 9)
@@ -1,8 +1,8 @@
11 #ifndef MACRO_H_INCLUDED
22 #define MACRO_H_INCLUDED
33
4-#define DELETE_V(p) { if(p){ delete p; p = NULL; } } // NULL 確認付き変数開放
5-#define DELETE_A(p) { if(p){ delete [] p; p = NULL; } } // NULL 確認付き配列開放
4+#define DELETE_V(p) do{ if(p){ delete p; p = NULL; } } while(false) // NULL 確認付き変数開放
5+#define DELETE_A(p) do{ if(p){ delete [] p; p = NULL; } } while(false) // NULL 確認付き配列開放
66
77 #define V2Norm D3DXVec2Normalize // ベクトル正規化
88 #define V2Len D3DXVec2Length // ベクトル絶対値
--- trunk/CCursor.cpp (revision 8)
+++ trunk/CCursor.cpp (revision 9)
@@ -74,10 +74,24 @@
7474 void CCursor::Init(){
7575 m_Alpha = 1.0f;
7676 m_Resizing = -2;
77- Center();
77+ if(!sv3.fWindowed || svw.fActive){
78+ Center();
79+ ShowCursor(FALSE);
80+ Clip();
81+ }
7882 }
7983
8084 /*
85+ * ウィンドウ内にクリップ
86+ */
87+void CCursor::Clip(){
88+ POINT wp = {0, 0};
89+ ClientToScreen(svw.hWnd, &wp);
90+ RECT crc = {wp.x, wp.y, wp.x+g_DispWidth, wp.y+g_DispHeight};
91+ ClipCursor(&crc);
92+}
93+
94+/*
8195 * カーソルを中央へ
8296 */
8397 void CCursor::Center(){
--- trunk/CNeutralMode.h (revision 8)
+++ trunk/CNeutralMode.h (revision 9)
@@ -28,6 +28,7 @@
2828 void EnterCursorScenery();
2929 void ScanInputCursorScenery();
3030 void RenderCursorScenery();
31+ bool IsWindowDivisible(){ return true; }
3132 };
3233
3334 // 外部グローバル
--- trunk/CSaveFile.h (revision 8)
+++ trunk/CSaveFile.h (revision 9)
@@ -62,6 +62,7 @@
6262 void ScanInputWarp(int, VEC3, VEC3);
6363 void ScanInputInst(int, VEC3, VEC3);
6464 int GetGroupNum(){ return m_GroupNum; }
65+ CScene *GetSceneList(){ return m_SceneList; }
6566 void AddScene(CSurfacePlugin *);
6667 void DeleteScene(CScene *);
6768 void ListScene(CListView *);
--- trunk/CCamera.h (revision 8)
+++ trunk/CCamera.h (revision 9)
@@ -71,7 +71,7 @@
7171 int ScanInput(int, CObject *tlocal = NULL);
7272 void Slide(int, CObject *tlocal = NULL);
7373 char *Read(char *);
74- void Save(FILE *);
74+ void Save(FILE *, string indent = "\t\t");
7575 };
7676
7777 // 外部グローバル
--- trunk/RailSim2.cpp (revision 8)
+++ trunk/RailSim2.cpp (revision 9)
@@ -17,12 +17,13 @@
1717 #include "CGameMode.h"
1818
1919 // 内部定数
20-extern const float RAILSIM_VERSION = 2.13f; // 本体バージョン
21-extern const char* VERSION_STRING = "2.13a"; // 表示バージョン文字列 (2.00a 等のバグ修正コードを含む)
20+extern const float RAILSIM_VERSION = 2.14f; // 本体バージョン
21+extern const char* VERSION_STRING = "2.14"; // 表示バージョン文字列 (2.00a 等のバグ修正コードを含む)
2222
2323 // 外部グローバル
2424 extern char *g_PluginViewArg;
2525 extern string g_SelectedSkin;
26+extern bool g_CursorLockable;
2627
2728 // 内部グローバル
2829 int g_RSPV = RSPV_NONE; // RSPV モード
@@ -73,10 +74,6 @@
7374 void Opening(){
7475 static int cnt = 0, loading = 0;
7576 while(PeekAllMessage()){
76- POINT wp = {0, 0};
77- ClientToScreen(svw.hWnd, &wp);
78- RECT crc = {wp.x, wp.y, wp.x+g_DispWidth, wp.y+g_DispHeight};
79- ClipCursor(&crc);
8077 ScanInputDevice();
8178 const int anim = 30;
8279 const int letters = 10, letl = 10;
@@ -316,6 +313,7 @@
316313 skin->SetPreview();
317314 CTreeDirElement::InitMenu();
318315 g_Cursor.Init();
316+ g_CursorLockable = true;
319317 InitGrid();
320318 CGameMode::MainLoop();
321319 DELETE_V(g_SaveFile);
--- trunk/CCamera.cpp (revision 8)
+++ trunk/CCamera.cpp (revision 9)
@@ -47,6 +47,7 @@
4747 float maxdist, // 最大距離
4848 bool clip // クリップ設定
4949 ){
50+ m_LeftState = m_MiddleState = m_RightState = 0;
5051 m_DefDist = defdist;
5152 m_MinDist = mindist;
5253 m_MaxDist = maxdist;
@@ -207,15 +208,22 @@
207208 CObject *tlocal // ローカル系直接指定
208209 ){
209210 if(GetFocusInst()){
210- if(GetFocusInst()->GetScene() && GetFocusInst()->GetScene()!=g_Scene){
211- g_Scene = GetFocusInst()->GetScene();
212- *g_Scene->GetCamera() = *this;
213- g_Scene->Enter(true);
214- *g_Scene->GetCamera() = *this;
211+ if(GetFocusInst()->GetScene()){
212+ if(GetFocusInst()->GetScene()!=g_Scene){
213+ g_Scene = GetFocusInst()->GetScene();
214+ *g_Scene->GetCamera() = *this;
215+ g_Scene->Enter(true);
216+ *g_Scene->GetCamera() = *this;
217+ g_NeutralMode->SetFocusInfo(m_FocusInfo);
218+ return;
219+ }
215220 g_NeutralMode->SetFocusInfo(m_FocusInfo);
216- return;
221+ }else{
222+ g_NeutralMode->SetFocusInfo(CDetectInfo());
217223 }
218224 if(GetFocusInst()->IsWarping()) return;
225+ }else{
226+ g_NeutralMode->SetFocusInfo(CDetectInfo());
219227 }
220228 float sinpitch = sinf(m_Pitch), cospitch = cosf(m_Pitch);
221229 VEC3 pos, up = V3UP;
@@ -405,7 +413,7 @@
405413 if(wh) BeginPrint();
406414 if(CheckShift()){
407415 if(CheckCtrl()){
408- m_FieldOfView = 5*Round(D3DXToDegree(m_FieldOfView/5));
416+ m_FieldOfView = 5.f*Round(D3DXToDegree(m_FieldOfView/5));
409417 if(wh) m_FieldOfView += wh>0 ? -5.0f : 5.0f;
410418 m_FieldOfView = D3DXToRadian(m_FieldOfView);
411419 }else{
@@ -599,13 +607,14 @@
599607 * 保存
600608 */
601609 void CCamera::Save(
602- FILE *df // ファイル
610+ FILE *df, // ファイル
611+ string indent // インデント
603612 ){
604- fprintf(df, "\t\tCamera{\n");
605- fprintf(df, "\t\t\tHead = %f;\n", m_Head);
606- fprintf(df, "\t\t\tPitch = %f;\n", m_Pitch);
607- fprintf(df, "\t\t\tDist = %f;\n", m_Dist);
608- fprintf(df, "\t\t\tFieldOfView = %f;\n", m_FieldOfView);
609- fprintf(df, "\t\t\tFocus = "); V3Save(df, m_Focus, ";\n");
610- fprintf(df, "\t\t}\n");
613+ fprintf(df, "%sCamera{\n", indent.c_str());
614+ fprintf(df, "%s\tHead = %f;\n", indent.c_str(), m_Head);
615+ fprintf(df, "%s\tPitch = %f;\n", indent.c_str(), m_Pitch);
616+ fprintf(df, "%s\tDist = %f;\n", indent.c_str(), m_Dist);
617+ fprintf(df, "%s\tFieldOfView = %f;\n", indent.c_str(), m_FieldOfView);
618+ fprintf(df, "%s\tFocus = ", indent.c_str()); V3Save(df, m_Focus, ";\n");
619+ fprintf(df, "%s}\n", indent.c_str());
611620 }
--- trunk/Distribution/en/RailSim2/Help/opr_neutral.html (revision 8)
+++ trunk/Distribution/en/RailSim2/Help/opr_neutral.html (revision 9)
@@ -55,7 +55,14 @@
5555 <p class="joint">列車を選択した状態で、Shift と Ctrl を押しながらその列車の連結部分をクリックすると、編成の分割が行われます。</p>
5656 <p>列車を選択した状態で、Alt を押しながら列車を別の列車に「衝突」させると、編成の併合が行われます。</p>
5757 </div>
58+<div class="contbox">
59+<h2>画面分割</h2>
60+<p class="joint">ニュートラルモードで画面の端にカーソルを合わせ、黄色い枠が表示されたところで左ドラッグすると画面を分割し、複数の視点でシーンを鑑賞できるようになります。分割は縦分割・横分割・縦横分割が可能です。分割された画面をさらに分割することもできます。</p>
61+<p class="joint">分割枠をドラッグすると分割位置の調整ができます。枠を画面の端に移動すると、自動的に分割が解除されます。</p>
62+<p class="joint">画面ごとに異なるシーンを表示させることも可能です。画面ごとにシーンを切り替えるには、目的の画面上にカーソルを移動した状態で Ctrl + ↑↓キーを押します。画面ごとに車輌などのフォーカスを設定することもできます。ステレオ画面モードを有効にしたり、ニュートラルモード以外のモードに切り替えると、画面分割は一時的に解除されます。</p>
63+<p>画面分割の状態、各画面のカメラの状態はレイアウトデータに保存されます。</p>
5864 </div>
65+</div>
5966 <div class="footbox">
6067 <p class="silent"><a href="opr_basic.html"><PrevSec</a> | <a href="operation.html">▲ChTop</a> | <a href="#pagetop">▲PageTop</a> | <a href="opr_rail.html">NextSec></a><br>Copyright (c) 2003-2009 インターネット停留所</p>
6168 </div>
--- trunk/Distribution/en/RailSim2/Help/history.html (revision 8)
+++ trunk/Distribution/en/RailSim2/Help/history.html (revision 9)
@@ -39,7 +39,8 @@
3939 <tr><td class="nowrap">RailSim II<br>Version 2.10</td><td>2008/11/16<br>Implemented network connection mode.<br>A car can be deleted from the consist with Delete key in the train edit mode.</td></tr>
4040 <tr><td class="nowrap">RailSim II<br>Version 2.11</td><td>2009/02/07<br>Added manual control mode and ignore acceleration and deceleration mode.<br>Implemented splitting and merging of trains.<br>2009/04/26 - 2.11 additional description<br>Added new system-defined coordinate systems: "_CAMERA", "_LIGHT" (which enables billboards etc.).<br>2009/06/06 - 2.11a<br>Fixed a problem of wrong data source of Diffuse and Ambient material value in *.x files for RS2 train plugins. cf. material-changer</td></tr>
4141 <tr><td class="nowrap">RailSim II<br>Version 2.12</td><td>2009/11/16<br>Supported downsampling and AVI saving for video (no audio recording yet).<br>Supported rail blocks and speed limit.<br>Implemented stereoscopy mode (switch at configulations mode).<br>Re-ordering in the train list, the car list and the scene list by drag & drop.<br>Fix: on network connection, UDP port should be opened, not TCP.</td></tr>
42-<tr><td class="nowrap">RailSim II<br>Version 2.13</td><td>2010/11/23<br>The function to move a platform along an object is implemented.<br>The functions to connect platforms dynamically in station plugins (rail-connector, rail-brancher, rail-disconnector) are implemented.<br>Added turntable test, traverser test and point test by a station plugin as sample plugins.<br>Supported select-all by Ctrl + A key on text input.</td></tr>
42+<tr><td class="nowrap">RailSim II<br>Version 2.13</td><td>2010/11/23<br>The function to move a platform along an object is implemented.<br>The functions to connect platforms dynamically in station plugins (rail-connector, rail-brancher, rail-disconnector) are implemented.<br>Added turntable test, traverser test and point test by a station plugin as sample plugins.<br>Supported select-all by Ctrl + A key on text input.<br>2012/03/20 - 2.13a<br>Bug fix on building multi track railways, causing the first track disappear.</td></tr>
43+<tr><td class="nowrap">RailSim II<br>Version 2.14</td><td>2012/08/28<br>The screen is splittable in neutral mode.<br>In diagram setting, stop position at station can be specified with number.<br>Some bug fix on loading layout data.</td></tr>
4344 </table>
4445 </div>
4546 </div>
--- trunk/Distribution/en/RailSim2/index.html (revision 8)
+++ trunk/Distribution/en/RailSim2/index.html (revision 9)
@@ -32,9 +32,9 @@
3232 <p>Thank you for downloading RailSim II.<br>This reference manual is under translation yet. Sorry for inconvenience.<br>English version of <a href="help/opr_quickguide.html">the quick guide</a> is available.</p>
3333 </div>
3434 <div class="contbox">
35-<h2>Version 2.13</h2>
36-<p class="joint">Changes from previous version 2.12 to current 2.13 are below.</p>
37-<p>2010/11/23 - 2.13<br>The function to move a <a href="help/pi_sym_platform.html">platform</a> along an object is implemented.<br>The functions to connect platforms dynamically in station plugins (<a class="nonterm" href="help/pi_sym_rail_connector.html">rail-connector</a>, <a class="nonterm" href="help/pi_sym_rail_brancher.html">rail-brancher</a>, <a class="nonterm" href="help/pi_sym_rail_disconnector.html">rail-disconnector</a>) are implemented.<br>Added turntable test, traverser test and point test by a station plugin as sample plugins.<br>Supported select-all by Ctrl + A key on text input.</p>
35+<h2>Version 2.14</h2>
36+<p class="joint">Changes from previous version 2.13a to current 2.14 are below.</p>
37+<p>2012/08/28 - 2.14<br>The screen is splittable in <a href="help/opr_neutral.html">neutral mode</a>.<br>In diagram setting, stop position at station can be specified with number.<br>Some bug fix on loading layout data.</p>
3838 </div>
3939 <div class="contbox">
4040 <h2>Index</h2>
@@ -52,7 +52,7 @@
5252 </div>
5353 <div class="contbox">
5454 <h2>License</h2>
55-<p>RailSim II is licensed under <a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPL</a>. Please follow LGPL to use the software. The original text of LGPL is included as <a href="COPYING.txt">COPYING.txt</a>.<br><br>RailSim II<br>Copyright (C) 2003-2010, Intaanetto Teiryuujo.<br><br>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.<br><br>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.<br><br>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></p>
55+<p>RailSim II is licensed under <a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPL</a>. Please follow LGPL to use the software. The original text of LGPL is included as <a href="COPYING.txt">COPYING.txt</a>.<br><br>RailSim II<br>Copyright (C) 2003-2012, Intaanetto Teiryuujo.<br><br>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.<br><br>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.<br><br>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></p>
5656 </div>
5757 <p class="open right"><a href="http://www.biwako.ne.jp/~hiroharu/e_index.html"><img src="Help/logo.png" style="border: none;" alt="Presented by Intaanetto Teiryuujo"></a></p>
5858 </div>
--- trunk/Distribution/jp/RailSim2/Help/opr_neutral.html (revision 8)
+++ trunk/Distribution/jp/RailSim2/Help/opr_neutral.html (revision 9)
@@ -55,7 +55,14 @@
5555 <p class="joint">列車を選択した状態で、Shift と Ctrl を押しながらその列車の連結部分をクリックすると、編成の分割が行われます。</p>
5656 <p>列車を選択した状態で、Alt を押しながら列車を別の列車に「衝突」させると、編成の併合が行われます。</p>
5757 </div>
58+<div class="contbox">
59+<h2>画面分割</h2>
60+<p class="joint">ニュートラルモードで画面の端にカーソルを合わせ、黄色い枠が表示されたところで左ドラッグすると画面を分割し、複数の視点でシーンを鑑賞できるようになります。分割は縦分割・横分割・縦横分割が可能です。分割された画面をさらに分割することもできます。</p>
61+<p class="joint">分割枠をドラッグすると分割位置の調整ができます。枠を画面の端に移動すると、自動的に分割が解除されます。</p>
62+<p class="joint">画面ごとに異なるシーンを表示させることも可能です。画面ごとにシーンを切り替えるには、目的の画面上にカーソルを移動した状態で Ctrl + ↑↓キーを押します。画面ごとに車輌などのフォーカスを設定することもできます。ステレオ画面モードを有効にしたり、ニュートラルモード以外のモードに切り替えると、画面分割は一時的に解除されます。</p>
63+<p>画面分割の状態、各画面のカメラの状態はレイアウトデータに保存されます。</p>
5864 </div>
65+</div>
5966 <div class="footbox">
6067 <p class="silent"><a href="opr_basic.html"><PrevSec</a> | <a href="operation.html">▲ChTop</a> | <a href="#pagetop">▲PageTop</a> | <a href="opr_rail.html">NextSec></a><br>Copyright (c) 2003-2009 インターネット停留所</p>
6168 </div>
--- trunk/Distribution/jp/RailSim2/Help/history.html (revision 8)
+++ trunk/Distribution/jp/RailSim2/Help/history.html (revision 9)
@@ -40,7 +40,8 @@
4040 <tr><td class="nowrap">RailSim II<br>Version 2.10</td><td>2008/11/16<br>ネットワーク機能を実装。<br>車輌編成時に Delete キーで車輌を削除できるようにした。</td></tr>
4141 <tr><td class="nowrap">RailSim II<br>Version 2.11</td><td>2009/02/07<br>マニュアル操作モード・加減速度無視モードを追加。<br>編成の分割・併合機能を実装。<br>2009/04/26 - 2.11 追記<br>システム座標系に "_CAMERA", "_LIGHT" を追加(ビルボード等を実現可能)。<br>2009/06/06 - 2.11a<br>RS2 仕様の車輌プラグインにおいて *.x ファイルの Diffuse, Ambient マテリアル値が使用されていない問題を修正。参考: material-changer</td></tr>
4242 <tr><td class="nowrap">RailSim II<br>Version 2.12</td><td>2009/11/16<br>ビデオ撮影にダウンサンプル機能、AVI 形式保存機能を追加(録音は未対応)。<br>閉塞区間機能および制限速度機能を実装。<br>ステレオ画面機能を実装 (オプション設定で切り替え)。<br>編成リスト、車輌リスト、シーンリストのドラッグ&ドロップによる並び替えに対応。<br>訂正: ネットワーク接続で開放が必要なポートは TCP ではなく UDP の誤りでした。<br>2010/08/15<br>LGPL ライセンスによりオープンソース化。</td></tr>
43-<tr><td class="nowrap">RailSim II<br>Version 2.13</td><td>2010/11/23<br>プラットフォームをオブジェクトに連動して動かす機能を実装。<br>駅舎プラグインにおいてプラットフォーム同士を動的に接続する機能 (rail-connector, rail-brancher, rail-disconnector) を実装。<br>サンプルプラグインに転車台テスト、遷車台テスト、駅舎プラグインによる分岐テストを追加。<br>テキスト入力時に Ctrl + A キーによる全選択に対応。</td></tr>
43+<tr><td class="nowrap">RailSim II<br>Version 2.13</td><td>2010/11/23<br>プラットフォームをオブジェクトに連動して動かす機能を実装。<br>駅舎プラグインにおいてプラットフォーム同士を動的に接続する機能 (rail-connector, rail-brancher, rail-disconnector) を実装。<br>サンプルプラグインに転車台テスト、遷車台テスト、駅舎プラグインによる分岐テストを追加。<br>テキスト入力時に Ctrl + A キーによる全選択に対応。<br>2012/03/20 - 2.13a<br>複線設置時に 1 本目のレールが正常に表示されなくなるバグを修正。</td></tr>
44+<tr><td class="nowrap">RailSim II<br>Version 2.14</td><td>2012/08/28<br>ニュートラルモードに画面分割機能を追加。<br>ダイヤ設定のホーム停止位置を数値指定できるようにした。<br>レイアウト読み込み時の不具合を一部修正。</td></tr>
4445 </table>
4546 </div>
4647 </div>
--- trunk/Distribution/jp/RailSim2/index.html (revision 8)
+++ trunk/Distribution/jp/RailSim2/index.html (revision 9)
@@ -32,9 +32,9 @@
3232 <p>RailSim II をダウンロードしていただきありがとうございます。<br>初めてご利用になる方はまず<a href="help/introduction.html">はじめに</a>をお読みください。</p>
3333 </div>
3434 <div class="contbox">
35-<h2>Version 2.13</h2>
36-<p class="joint">前バージョン 2.12 から 2.13 への変更点は以下の通りです。</p>
37-<p>2010/11/23 - 2.13<br><a href="help/pi_sym_platform.html">プラットフォーム</a>をオブジェクトに連動して動かす機能を実装。<br>駅舎プラグインにおいてプラットフォーム同士を動的に接続する機能 (<a class="nonterm" href="help/pi_sym_rail_connector.html">rail-connector</a>, <a class="nonterm" href="help/pi_sym_rail_brancher.html">rail-brancher</a>, <a class="nonterm" href="help/pi_sym_rail_disconnector.html">rail-disconnector</a>) を実装。<br>サンプルプラグインに転車台テスト、遷車台テスト、駅舎プラグインによる分岐テストを追加。<br>テキスト入力時に Ctrl + A キーによる全選択に対応。</p>
35+<h2>Version 2.14</h2>
36+<p class="joint">前バージョン 2.13a から 2.14 への変更点は以下の通りです。</p>
37+<p>2012/08/28 - 2.14<br><a href="help/opr_neutral.html">ニュートラルモード</a>に画面分割機能を追加。<br>ダイヤ設定のホーム停止位置を数値指定できるようにした。<br>レイアウト読み込み時の不具合を一部修正。</p>
3838 </div>
3939 <div class="contbox">
4040 <h2>目次</h2>
@@ -52,7 +52,7 @@
5252 </div>
5353 <div class="contbox">
5454 <h2>ライセンス</h2>
55-<p>RailSim II は <a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPL</a> でライセンスされています。利用にあたっては LGPL に従ってください。LGPL の原文は <a href="COPYING.txt">COPYING.txt</a> として添付されています。<br><br>RailSim II<br>Copyright (C) 2003-2010, Intaanetto Teiryuujo.<br><br>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.<br><br>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.<br><br>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></p>
55+<p>RailSim II は <a href="http://www.gnu.org/licenses/lgpl-2.1.html">LGPL</a> でライセンスされています。利用にあたっては LGPL に従ってください。LGPL の原文は <a href="COPYING.txt">COPYING.txt</a> として添付されています。<br><br>RailSim II<br>Copyright (C) 2003-2012, Intaanetto Teiryuujo.<br><br>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.<br><br>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.<br><br>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br></p>
5656 </div>
5757 <p class="open right"><a href="http://www.biwako.ne.jp/~hiroharu/"><img src="Help/logo.png" style="border: none;" alt="Presented by インターネット停留所"></a></p>
5858 </div>
--- trunk/CConfigMode.h (revision 8)
+++ trunk/CConfigMode.h (revision 9)
@@ -6,6 +6,7 @@
66 #include "CGroupBox.h"
77 #include "CCheckBox.h"
88 #include "CRadioButton.h"
9+#include "CWindowDivInfo.h"
910 #include "CInterfaceMode.h"
1011
1112 const int RES_MODE_NUM = 4; // 解像度タイプ数
@@ -12,6 +13,7 @@
1213 const int MIPMAP_NUM = 4; // ミップマップ区分数
1314 const int PISND_NUM = 4; // プラグインサウンド区分数
1415 const int STEREO_METHOD_NUM = 2; // ステレオ手法数
16+
1517 /*
1618 * 環境設定モード
1719 */
@@ -61,12 +63,18 @@
6163 CRadioButton m_StereoMethod[STEREO_METHOD_NUM]; // ステレオ手法
6264 CStaticCtrl m_StereoIntervalLabel; // ステレオ手法
6365 CEditCtrl m_StereoIntervalEdit; // 視点間隔
66+
67+ CWindowInfo m_RootWindow; // 画面分割情報
68+ CWindowInfo* m_ActiveWindow; // ポイントしている画面
69+
6470 public:
6571 CConfigMode();
66- ~CConfigMode(){}
72+ ~CConfigMode();
6773 void EnterInterface();
6874 void ScanInputInterface();
75+ int ScanInputWindowDiv();
6976 void RenderInterface();
77+ void RenderWindowDiv();
7078 bool Load();
7179 bool Save();
7280 int GetHideTopPanel(){ return m_HideTopPanel.GetCheck(); }
@@ -97,6 +105,11 @@
97105 int GetStereoMethod(){ return m_StereoMethod->GetNumber(); }
98106 float GetStereoInterval();
99107 void CheckHardware();
108+ CWindowInfo* GetRootWindow() { return &m_RootWindow; }
109+ bool IsWindowDiv() { return m_RootWindow.GetDiv()!=NULL; }
110+ CWindowInfo* GetActiveWindow() { return m_ActiveWindow; }
111+ void SetActiveWindow(CWindowInfo* wnd) { m_ActiveWindow = wnd; }
112+ void FreeWindowDiv();
100113 };
101114
102115 // 外部グローバル
--- trunk/CTrainSetMode.h (revision 8)
+++ trunk/CTrainSetMode.h (revision 9)
@@ -20,6 +20,7 @@
2020 void EnterCursorScenery();
2121 void ScanInputCursorScenery();
2222 void RenderCursorScenery();
23+ //bool IsWindowDivisible(){ return true; }
2324 };
2425
2526 // 外部グローバル
--- trunk/CGameMode.cpp (revision 8)
+++ trunk/CGameMode.cpp (revision 9)
@@ -62,11 +62,12 @@
6262 extern bool g_IgnoreAcceleration;
6363
6464 // 内部グローバル
65-int g_BlinkCounter = 0; // 汎用点滅カウンタ (0..MAXFPS-1)
66-float g_BlinkAlpha = 0.0f; // 汎用点滅アルファ (0.0..1.0)
67-bool g_RenderBlink = false; // レンダリング点滅フラグ
68-LONGLONG g_SoundSync = 0; // サウンド同期用タイマ
69-float g_FrameDelta = 0.0f; // フレーム時間 [ms]
65+int g_BlinkCounter = 0; // 汎用点滅カウンタ (0..MAXFPS-1)
66+float g_BlinkAlpha = 0.0f; // 汎用点滅アルファ (0.0..1.0)
67+bool g_RenderBlink = false; // レンダリング点滅フラグ
68+LONGLONG g_SoundSync = 0; // サウンド同期用タイマ
69+float g_FrameDelta = 0.0f; // フレーム時間 [ms]
70+bool g_CursorLockable = false; // カーソルロック開始
7071
7172 CNeutralMode *g_NeutralMode; // ニュートラルモード
7273 CRailSelectMode *g_RailSelectMode; // レール選択モード
@@ -698,6 +699,7 @@
698699 * モードを有効化
699700 */
700701 void CGameMode::Enter(){
702+ SetViewport(0, 0, sv3.width, sv3.height);
701703 ms_TopPanelTime = PANEL_HIDE_FRAME*3;
702704 ModelPluginFreeInst();
703705 CPopMenu::ResetCurrentMenu();
@@ -715,7 +717,6 @@
715717 * モードループ
716718 */
717719 void CGameMode::Spin(){
718-
719720 SetMasterVolume();
720721 while(PeekAllMessage()){
721722 if(IsActive()){
@@ -722,10 +723,7 @@
722723 g_JobTimer.Start();
723724 {
724725 TIMER_RAII("All");
725- POINT wp = {0, 0};
726- ClientToScreen(svw.hWnd, &wp);
727- RECT crc = {wp.x, wp.y, wp.x+g_DispWidth, wp.y+g_DispHeight};
728- ClipCursor(&crc);
726+ if(g_CursorLockable) g_Cursor.Clip();
729727 //カーソル描画直前に
730728 //ScanInputDevice();
731729 //g_Cursor.FixCursor();
@@ -745,8 +743,11 @@
745743 CDragContainer::EndDrag();
746744 }
747745 }
746+ {
747+ TIMER_RAII("SyncFrame");
748+ SyncFrame();
749+ }
748750 g_JobTimer.Stop();
749- SyncFrame();
750751 }else{
751752 SetMasterVolume();
752753 ClipCursor(NULL);
--- trunk/lib/input.cpp (revision 8)
+++ trunk/lib/input.cpp (revision 9)
@@ -115,10 +115,12 @@
115115 svi.pMouse->Acquire();
116116
117117 // フルスクリーン時はカーソルを非表示
118- /*if(!sv3.fWindowed)*/ ShowCursor(FALSE);
118+ if(!sv3.fWindowed){
119+ ShowCursor(FALSE);
119120
120- // カーソルをセンタリング
121- SetCursor(svw.winW/2, svw.winH/2);
121+ // カーソルをセンタリング
122+ SetCursor(svw.winW/2, svw.winH/2);
123+ }
122124
123125 return TRUE;
124126 }
--- trunk/lib/texture.h (revision 8)
+++ trunk/lib/texture.h (revision 9)
@@ -1,7 +1,16 @@
11 // Copyright (c) 2002 Midikyou
22
3+
34 using namespace std;
45
6+#define UDX_TEXTURE_MEASURE (0)
7+
8+#if UDX_TEXTURE_MEASURE
9+#include <vector>
10+#include <string>
11+#include "..\CJobTimer.h"
12+#endif
13+
514 /*
615 * テクスチャーの読込み
716 *
@@ -129,6 +138,9 @@
129138 * pTex : テクスチャ
130139 */
131140 inline void devSetTexture(DWORD n, LPTEX8 pTex){
141+#if UDX_TEXTURE_MEASURE
142+ TIMER_RAII("devSetTexture");
143+#endif
132144 sv3.pDev->SetTexture(n, pTex);
133145 }
134146
--- trunk/lib/window.cpp (revision 8)
+++ trunk/lib/window.cpp (revision 9)
@@ -69,7 +69,7 @@
6969 AdjustWindow();
7070
7171 // アクティブフラグを立てる
72- svw.fActive = TRUE;
72+ svw.fActive = FALSE;
7373
7474 return TRUE;
7575 }
@@ -188,6 +188,12 @@
188188 void OnActivateApp(WPARAM wParam){
189189 svw.fActive = (BOOL)wParam;
190190 Debug(svw.fActive ? "<アクティブ>\n" : "<非アクティブ>\n");
191+ if(svw.fActive){
192+ ShowCursor(FALSE);
193+ }else{
194+ ShowCursor(TRUE);
195+ ClipCursor(NULL);
196+ }
191197 }
192198
193199 /*
--- trunk/lib/view.cpp (revision 8)
+++ trunk/lib/view.cpp (revision 9)
@@ -98,6 +98,13 @@
9898 vp.MinZ = znear;
9999 vp.MaxZ = zfar;
100100 sv3.pDev->SetViewport(&vp);
101+
102+ //ビューポート行列の作成(ワールド→スクリーン座標変換用)
103+ sv3.mtxVPort = MTX4(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
104+ sv3.mtxVPort._11 = (w*0.5f);
105+ sv3.mtxVPort._22 = -(h*0.5f);
106+ sv3.mtxVPort._41 = (w*0.5f)+x;
107+ sv3.mtxVPort._42 = (h*0.5f)+y;
101108 }
102109
103110 /*
--- trunk/lib/mesh.cpp (revision 8)
+++ trunk/lib/mesh.cpp (revision 9)
@@ -2,6 +2,17 @@
22
33 #include "..\stdafx.h"
44
5+#define UDX_MESH_MEASURE (0)
6+
7+#if UDX_MESH_MEASURE
8+#include <vector>
9+#include <string>
10+#include "..\CJobTimer.h"
11+#define UDX_MESH_TIMER_RAII(name) TIMER_RAII(name)
12+#else
13+#define UDX_MESH_TIMER_RAII(name)
14+#endif
15+
516 #include <rmxfguid.h>
617 #include <rmxftmpl.h>
718
@@ -391,6 +402,7 @@
391402 */
392403 void CMesh::RenderCustom(MTX4 *pMtx, CNamedObject *nobj){
393404 if(!m_pMesh) return;
405+ UDX_MESH_TIMER_RAII("CMesh::Render");
394406
395407 devTransform(pMtx);
396408
@@ -414,8 +426,11 @@
414426 if((flag&6)==2 || !alpha) continue;
415427 if(g_AltMaterial){
416428 sv3.pDev->SetMaterial(g_AltMaterial);
417- sv3.pDev->SetTexture(0, NULL);
418- m_pMesh->DrawSubset(order);
429+ devSetTexture(0, NULL);
430+ {
431+ UDX_MESH_TIMER_RAII("DrawSubset");
432+ m_pMesh->DrawSubset(order);
433+ }
419434 }else{
420435 if(flag&8){
421436 devSetEnvMap(1, TRUE);
@@ -436,8 +451,11 @@
436451 }
437452 if(g_RenderBlink) m_pCustomMat[order].Diffuse.a *= g_BlinkAlpha;
438453 sv3.pDev->SetMaterial(&m_pCustomMat[order]);
439- sv3.pDev->SetTexture(0, m_pCustomTex[order]);
440- m_pMesh->DrawSubset(order);
454+ devSetTexture(0, m_pCustomTex[order]);
455+ {
456+ UDX_MESH_TIMER_RAII("DrawSubset");
457+ m_pMesh->DrawSubset(order);
458+ }
441459 if(flag&8){
442460 devSetEnvMap(1, FALSE);
443461 devSetTexture(1, NULL);
@@ -462,6 +480,7 @@
462480 */
463481 void CMesh::Render(MTX4 *pMtx){
464482 if(!m_pMesh) return;
483+ UDX_MESH_TIMER_RAII("CMesh::Render");
465484
466485 devTransform(pMtx);
467486
@@ -470,8 +489,11 @@
470489 float alpha = m_pMat[order].Diffuse.a;
471490 if(g_AltMaterial){
472491 sv3.pDev->SetMaterial(g_AltMaterial);
473- sv3.pDev->SetTexture(0, NULL);
474- m_pMesh->DrawSubset(order);
492+ devSetTexture(0, NULL);
493+ {
494+ UDX_MESH_TIMER_RAII("DrawSubset");
495+ m_pMesh->DrawSubset(order);
496+ }
475497 }else{
476498 if(g_AncientNightFlag){
477499 if(!alpha){
@@ -496,8 +518,11 @@
496518 if(g_RenderBlink) m_pMat[order].Diffuse.a *= g_BlinkAlpha;
497519 sv3.pDev->SetMaterial(&m_pMat[order]);
498520 }
499- sv3.pDev->SetTexture(0, m_pTex[order]);
500- m_pMesh->DrawSubset(order);
521+ devSetTexture(0, m_pTex[order]);
522+ {
523+ UDX_MESH_TIMER_RAII("DrawSubset");
524+ m_pMesh->DrawSubset(order);
525+ }
501526 m_pMat[order].Diffuse.a = alpha;
502527 }
503528 }
@@ -510,6 +535,7 @@
510535 */
511536 void CMesh::RenderAmb(MTX4 *pMtx){
512537 if(!m_pMesh) return;
538+ UDX_MESH_TIMER_RAII("CMesh::Render");
513539
514540 devTransform(pMtx);
515541
@@ -518,8 +544,11 @@
518544 D3DCOLORVALUE &dif = m_pMat[order].Diffuse, tdif = dif;
519545 dif.r = dif.g = dif.b = 0.0f;
520546 sv3.pDev->SetMaterial(&m_pMat[order]);
521- sv3.pDev->SetTexture(0, m_pTex[order]);
522- m_pMesh->DrawSubset(order);
547+ devSetTexture(0, m_pTex[order]);
548+ {
549+ UDX_MESH_TIMER_RAII("DrawSubset");
550+ m_pMesh->DrawSubset(order);
551+ }
523552 dif = tdif;
524553 }
525554 }
@@ -532,6 +561,7 @@
532561 */
533562 void CMesh::RenderT(MTX4 *pMtx, LPTEX8 pTex){
534563 if(!m_pMesh) return;
564+ UDX_MESH_TIMER_RAII("CMesh::Render");
535565
536566 devTransform(pMtx);
537567
@@ -538,8 +568,11 @@
538568 for(DWORD i = 0;i<m_dwNumMat;i++){
539569 DWORD order = m_pMatOrder[i];
540570 sv3.pDev->SetMaterial(&m_pMat[order]);
541- sv3.pDev->SetTexture(0, pTex);
542- m_pMesh->DrawSubset(order);
571+ devSetTexture(0, pTex);
572+ {
573+ UDX_MESH_TIMER_RAII("DrawSubset");
574+ m_pMesh->DrawSubset(order);
575+ }
543576 }
544577 }
545578
@@ -551,6 +584,7 @@
551584 */
552585 void CMesh::RenderA(MTX4 *pMtx, float altalpha){
553586 if(!m_pMesh) return;
587+ UDX_MESH_TIMER_RAII("CMesh::Render");
554588
555589 devTransform(pMtx);
556590
@@ -580,8 +614,11 @@
580614 m_pMat[order].Diffuse.a *= altalpha*(g_RenderBlink ? g_BlinkAlpha : 1.0f);
581615 sv3.pDev->SetMaterial(&m_pMat[order]);
582616 }
583- sv3.pDev->SetTexture(0, m_pTex[order]);
584- m_pMesh->DrawSubset(order);
617+ devSetTexture(0, m_pTex[order]);
618+ {
619+ UDX_MESH_TIMER_RAII("DrawSubset");
620+ m_pMesh->DrawSubset(order);
621+ }
585622 m_pMat[order].Diffuse.a = alpha;
586623 }
587624 }
@@ -594,6 +631,7 @@
594631 */
595632 void CMesh::RenderAP(MTX4 *pMtx, float aplus){
596633 if(!m_pMesh) return;
634+ UDX_MESH_TIMER_RAII("CMesh::Render");
597635
598636 devTransform(pMtx);
599637
@@ -607,8 +645,11 @@
607645 m_pMat[order].Diffuse = m_pMat[order].Ambient = c2;
608646
609647 sv3.pDev->SetMaterial(&m_pMat[order]);
610- sv3.pDev->SetTexture(0, m_pTex[order]);
611- m_pMesh->DrawSubset(order);
648+ devSetTexture(0, m_pTex[order]);
649+ {
650+ UDX_MESH_TIMER_RAII("DrawSubset");
651+ m_pMesh->DrawSubset(order);
652+ }
612653
613654 // α値を復元
614655 m_pMat[order].Diffuse = m_pMat[order].Ambient = c1;
@@ -623,6 +664,7 @@
623664 */
624665 void CMesh::RenderSC(MTX4 *pMtx, MAT8 *pMat){
625666 if(!m_pMesh) return;
667+ UDX_MESH_TIMER_RAII("CMesh::Render");
626668
627669 devTransform(pMtx);
628670
@@ -629,8 +671,11 @@
629671 for(DWORD i = 0;i<m_dwNumMat;i++){
630672 DWORD order = m_pMatOrder[i];
631673 sv3.pDev->SetMaterial(pMat);
632- sv3.pDev->SetTexture(0, NULL);
633- m_pMesh->DrawSubset(order);
674+ devSetTexture(0, NULL);
675+ {
676+ UDX_MESH_TIMER_RAII("DrawSubset");
677+ m_pMesh->DrawSubset(order);
678+ }
634679 }
635680 }
636681
--- trunk/lib/draw.cpp (revision 8)
+++ trunk/lib/draw.cpp (revision 9)
@@ -19,7 +19,7 @@
1919 void Draw2DLine(int x1, int y1, int x2, int y2, D3DCOLOR c1, D3DCOLOR c2){
2020 if(c2==0) c2 = c1;
2121 VTX_TL vt[] = {x1, y1, 0, 1, c1, x2, y2, 0, 1, c2};
22- CVertex v;
22+ //CVertex v;
2323 //v.Create(vt, FVF_TL, sizeof(vt));
2424 //v.RenderLL();
2525 sv3.pDev->SetVertexShader(FVF_TL);
--- trunk/CCursor.h (revision 8)
+++ trunk/CCursor.h (revision 9)
@@ -13,6 +13,7 @@
1313 POINT m_Delta; // 中心からの差分
1414 public:
1515 void Init();
16+ void Clip();
1617 void Center();
1718 void Render();
1819 void ScanInput(bool forcelock = false);
@@ -21,7 +22,7 @@
2122 POINT GetPos(){ return m_Pos; }
2223 POINT GetDelta(){ return m_Delta; }
2324 bool CheckDrag();
24- VEC3 GetVEC3(){ return VEC3(m_Pos.x, m_Pos.y, 0.0f); }
25+ VEC3 GetVEC3(){ return VEC3((float)m_Pos.x, (float)m_Pos.y, 0.0f); }
2526 void Lock();
2627 void Release();
2728 bool IsLock(){ return !!m_State; }
--- trunk/CProfilePlugin.cpp (revision 8)
+++ trunk/CProfilePlugin.cpp (revision 9)
@@ -4,6 +4,7 @@
44 #include "CProfilePlugin.h"
55
66 // 外部グローバル
7+extern CScene *g_Scene;
78 extern bool g_RailMipMap;
89 extern CShadowVolume g_ShadowVolume;
910
@@ -101,8 +102,6 @@
101102 * コンストラクタ
102103 */
103104 CProfile::CProfile(){
104- m_DumpN = NULL;
105- m_DumpNX = NULL;
106105 m_Texture = NULL;
107106 }
108107
@@ -110,11 +109,24 @@
110109 * デストラクタ
111110 */
112111 CProfile::~CProfile(){
113- DELETE_V(m_DumpN);
114- DELETE_V(m_DumpNX);
112+ ClearAll();
115113 }
116114
117115 /*
116+ * すべて解放
117+ */
118+void CProfile::ClearAll(){
119+ map<CScene *, MapPtrValue<CQuadDumpN> >::iterator itr_n;
120+ for(itr_n = m_DumpN.begin(); itr_n!=m_DumpN.end(); ++itr_n){
121+ itr_n->second.SafeDelete();
122+ }
123+ map<CScene *, MapPtrValue<CQuadDumpNX> >::iterator itr_nx;
124+ for(itr_nx = m_DumpNX.begin(); itr_nx!=m_DumpNX.end(); ++itr_nx){
125+ itr_nx->second.SafeDelete();
126+ }
127+}
128+
129+/*
118130 * 読込
119131 */
120132 char *CProfile::Read(
@@ -157,9 +169,11 @@
157169 */
158170 void CProfile::PrepareDump(){
159171 if(m_UseTexture){
160- if(!m_DumpNX) m_DumpNX = new CQuadDumpNX(QUAD_DUMP_MAX, m_Texture);
172+ MapPtrValue<CQuadDumpNX> &dump_nx = m_DumpNX[g_Scene];
173+ if(!dump_nx) dump_nx = new CQuadDumpNX(QUAD_DUMP_MAX, m_Texture);
161174 }else{
162- if(!m_DumpN) m_DumpN = new CQuadDumpN(QUAD_DUMP_MAX);
175+ MapPtrValue<CQuadDumpN> &dump_n = m_DumpN[g_Scene];
176+ if(!dump_n) dump_n = new CQuadDumpN(QUAD_DUMP_MAX);
163177 }
164178 }
165179
@@ -215,7 +229,6 @@
215229 * コンストラクタ
216230 */
217231 CWireframe::CWireframe(){
218- m_DumpN = NULL;
219232 }
220233
221234 /*
@@ -222,10 +235,20 @@
222235 * デストラクタ
223236 */
224237 CWireframe::~CWireframe(){
225- DELETE_V(m_DumpN);
238+ ClearAll();
226239 }
227240
228241 /*
242+ * すべて解放
243+ */
244+void CWireframe::ClearAll(){
245+ map<CScene *, MapPtrValue<CLineDumpN> >::iterator itr_n;
246+ for(itr_n = m_DumpN.begin(); itr_n!=m_DumpN.end(); ++itr_n){
247+ itr_n->second.SafeDelete();
248+ }
249+}
250+
251+/*
229252 * 読込
230253 */
231254 char *CWireframe::Read(
@@ -254,7 +277,8 @@
254277 * ダンパ準備
255278 */
256279 void CWireframe::PrepareDump(){
257- if(!m_DumpN) m_DumpN = new CLineDumpN(LINE_DUMP_MAX);
280+ MapPtrValue<CLineDumpN> &dump_n = m_DumpN[g_Scene];
281+ if(!dump_n) dump_n = new CLineDumpN(LINE_DUMP_MAX);
258282 }
259283
260284 ////////////////////////////////////////////////////////////////////////////////
@@ -368,6 +392,8 @@
368392 devResetMaterial();
369393 }
370394 for(; ip!=m_Profile.end(); ip++){
395+ MapPtrValue<CQuadDumpNX> &dump_nx = ip->m_DumpNX[g_Scene];
396+ MapPtrValue<CQuadDumpN> &dump_n = ip->m_DumpN[g_Scene];
371397 float v1 = ip->m_TexMapVTemp, v2 = v1+ip->m_TexVPerMeter*len;
372398 if(prev&2) devSetTexture(0, ip->m_Texture);
373399 else ip->PrepareDump();
@@ -382,23 +408,23 @@
382408 if(ip->m_UseTexture){
383409 float &tu1 = iv1->m_TexU, &tu2 = iv2->m_TexU;
384410 if(iv1->m_IgnoreCant){
385- if(iv2->m_IgnoreCant) (ip->m_DumpNX->*f_qnx)(
411+ if(iv2->m_IgnoreCant) (dump_nx->*f_qnx)(
386412 ip1+ir1*c1.x+iu1*c1.y, ir1*n1.x+iu1*n1.y, df1, tu1, v1,
387413 ip2+ir2*c1.x+iu2*c1.y, ir2*n1.x+iu2*n1.y, df1, tu1, v2,
388414 ip2+ir2*c2.x+iu2*c2.y, ir2*n2.x+iu2*n2.y, df2, tu2, v2,
389415 ip1+ir1*c2.x+iu1*c2.y, ir1*n2.x+iu1*n2.y, df2, tu2, v1);
390- else (ip->m_DumpNX->*f_qnx)(
416+ else (dump_nx->*f_qnx)(
391417 ip1+ir1*c1.x+iu1*c1.y, ir1*n1.x+iu1*n1.y, df1, tu1, v1,
392418 ip2+ir2*c1.x+iu2*c1.y, ir2*n1.x+iu2*n1.y, df1, tu1, v2,
393419 p2+r2*c2.x+u2*c2.y, r2*n2.x+u2*n2.y, df2, tu2, v2,
394420 p1+r1*c2.x+u1*c2.y, r1*n2.x+u1*n2.y, df2, tu2, v1);
395421 }else{
396- if(iv2->m_IgnoreCant) (ip->m_DumpNX->*f_qnx)(
422+ if(iv2->m_IgnoreCant) (dump_nx->*f_qnx)(
397423 p1+r1*c1.x+u1*c1.y, r1*n1.x+u1*n1.y, df1, tu1, v1,
398424 p2+r2*c1.x+u2*c1.y, r2*n1.x+u2*n1.y, df1, tu1, v2,
399425 ip2+ir2*c2.x+iu2*c2.y, ir2*n2.x+iu2*n2.y, df2, tu2, v2,
400426 ip1+ir1*c2.x+iu1*c2.y, ir1*n2.x+iu1*n2.y, df2, tu2, v1);
401- else (ip->m_DumpNX->*f_qnx)(
427+ else (dump_nx->*f_qnx)(
402428 p1+r1*c1.x+u1*c1.y, r1*n1.x+u1*n1.y, df1, tu1, v1,
403429 p2+r2*c1.x+u2*c1.y, r2*n1.x+u2*n1.y, df1, tu1, v2,
404430 p2+r2*c2.x+u2*c2.y, r2*n2.x+u2*n2.y, df2, tu2, v2,
@@ -406,23 +432,23 @@
406432 }
407433 }else{
408434 if(iv1->m_IgnoreCant){
409- if(iv2->m_IgnoreCant) (ip->m_DumpN->*f_qn)(
435+ if(iv2->m_IgnoreCant) (dump_n->*f_qn)(
410436 ip1+ir1*c1.x+iu1*c1.y, ir1*n1.x+iu1*n1.y, df1,
411437 ip2+ir2*c1.x+iu2*c1.y, ir2*n1.x+iu2*n1.y, df1,
412438 ip2+ir2*c2.x+iu2*c2.y, ir2*n2.x+iu2*n2.y, df2,
413439 ip1+ir1*c2.x+iu1*c2.y, ir1*n2.x+iu1*n2.y, df2);
414- else (ip->m_DumpN->*f_qn)(
440+ else (dump_n->*f_qn)(
415441 ip1+ir1*c1.x+iu1*c1.y, ir1*n1.x+iu1*n1.y, df1,
416442 ip2+ir2*c1.x+iu2*c1.y, ir2*n1.x+iu2*n1.y, df1,
417443 p2+r2*c2.x+u2*c2.y, r2*n2.x+u2*n2.y, df2,
418444 p1+r1*c2.x+u1*c2.y, r1*n2.x+u1*n2.y, df2);
419445 }else{
420- if(iv2->m_IgnoreCant) (ip->m_DumpN->*f_qn)(
446+ if(iv2->m_IgnoreCant) (dump_n->*f_qn)(
421447 p1+r1*c1.x+u1*c1.y, r1*n1.x+u1*n1.y, df1,
422448 p2+r2*c1.x+u2*c1.y, r2*n1.x+u2*n1.y, df1,
423449 ip2+ir2*c2.x+iu2*c2.y, ir2*n2.x+iu2*n2.y, df2,
424450 ip1+ir1*c2.x+iu1*c2.y, ir1*n2.x+iu1*n2.y, df2);
425- else (ip->m_DumpN->*f_qn)(
451+ else (dump_n->*f_qn)(
426452 p1+r1*c1.x+u1*c1.y, r1*n1.x+u1*n1.y, df1,
427453 p2+r2*c1.x+u2*c1.y, r2*n1.x+u2*n1.y, df1,
428454 p2+r2*c2.x+u2*c2.y, r2*n2.x+u2*n2.y, df2,
@@ -440,6 +466,7 @@
440466 IWireframe iw = m_Wireframe.begin();
441467 for(; iw!=m_Wireframe.end(); iw++){
442468 if(!iw->CheckInterval(len)) continue;
469+ MapPtrValue<CLineDumpN> &dump_n = iw->m_DumpN[g_Scene];
443470 if(!(prev&2)) iw->PrepareDump();
444471 IWireframeLine ir = iw->m_Line.begin();
445472 for(; ir!=iw->m_Line.end(); ir++){
@@ -449,17 +476,17 @@
449476 VEC3 &c1 = iv1->m_Coord, &c2 = iv2->m_Coord;
450477 D3DCOLOR &df1 = iv1->m_Diffuse, &df2 = iv2->m_Diffuse;
451478 if(iv1->m_IgnoreCant){
452- if(iv2->m_IgnoreCant) (iw->m_DumpN->*f_ll)(
479+ if(iv2->m_IgnoreCant) (dump_n->*f_ll)(
453480 CalcMidProfile(ip1, ir1, iu1, ip2, ir2, iu2, c1), df1,
454481 CalcMidProfile(ip1, ir1, iu1, ip2, ir2, iu2, c2), df2);
455- else (iw->m_DumpN->*f_ll)(
482+ else (dump_n->*f_ll)(
456483 CalcMidProfile(ip1, ir1, iu1, ip2, ir2, iu2, c1), df1,
457484 CalcMidProfile(p1, r1, u1, p2, r2, u2, c2), df2);
458485 }else{
459- if(iv2->m_IgnoreCant) (iw->m_DumpN->*f_ll)(
486+ if(iv2->m_IgnoreCant) (dump_n->*f_ll)(
460487 CalcMidProfile(p1, r1, u1, p2, r2, u2, c1), df1,
461488 CalcMidProfile(ip1, ir1, iu1, ip2, ir2, iu2, c2), df2);
462- else (iw->m_DumpN->*f_ll)(
489+ else (dump_n->*f_ll)(
463490 CalcMidProfile(p1, r1, u1, p2, r2, u2, c1), df1,
464491 CalcMidProfile(p1, r1, u1, p2, r2, u2, c2), df2);
465492 }
@@ -647,13 +674,23 @@
647674 IProfile ip = m_Profile.begin();
648675 IWireframe iw = m_Wireframe.begin();
649676 for(; ip!=m_Profile.end(); ip++){
650- DELETE_V(ip->m_DumpN);
651- DELETE_V(ip->m_DumpNX);
677+ ip->m_DumpN[g_Scene].SafeDelete();
678+ ip->m_DumpNX[g_Scene].SafeDelete();
652679 }
653- for(; iw!=m_Wireframe.end(); iw++) DELETE_V(iw->m_DumpN);
680+ for(; iw!=m_Wireframe.end(); iw++) iw->m_DumpN[g_Scene].SafeDelete();
654681 }
655682
656683 /*
684+ * ダンパすべて解放
685+ */
686+void CProfilePlugin::ClearDumpAll(){
687+ IProfile ip = m_Profile.begin();
688+ IWireframe iw = m_Wireframe.begin();
689+ for(; ip!=m_Profile.end(); ip++) ip->ClearAll();
690+ for(; iw!=m_Wireframe.end(); iw++) iw->ClearAll();
691+}
692+
693+/*
657694 * バーテックス準備
658695 */
659696 void CProfilePlugin::PrepareVertex(){
@@ -660,10 +697,15 @@
660697 IProfile ip = m_Profile.begin();
661698 IWireframe iw = m_Wireframe.begin();
662699 for(; ip!=m_Profile.end(); ip++){
663- if(ip->m_DumpN) ip->m_DumpN->PrepareVertex();
664- if(ip->m_DumpNX) ip->m_DumpNX->PrepareVertex();
700+ MapPtrValue<CQuadDumpN> &dump_n = ip->m_DumpN[g_Scene];
701+ MapPtrValue<CQuadDumpNX> &dump_nx = ip->m_DumpNX[g_Scene];
702+ if(dump_n) dump_n->PrepareVertex();
703+ if(dump_nx) dump_nx->PrepareVertex();
665704 }
666- for(; iw!=m_Wireframe.end(); iw++) if(iw->m_DumpN) iw->m_DumpN->PrepareVertex();
705+ for(; iw!=m_Wireframe.end(); iw++){
706+ MapPtrValue<CLineDumpN> &dump_n = iw->m_DumpN[g_Scene];
707+ if(dump_n) dump_n->PrepareVertex();
708+ }
667709 }
668710
669711 /*
@@ -675,11 +717,16 @@
675717 devSetLighting(TRUE);
676718 devResetMaterial();
677719 for(; ip!=m_Profile.end(); ip++){
678- if(ip->m_DumpN) ip->m_DumpN->Render(false);
679- if(ip->m_DumpNX) ip->m_DumpNX->Render(false);
720+ MapPtrValue<CQuadDumpN> &dump_n = ip->m_DumpN[g_Scene];
721+ MapPtrValue<CQuadDumpNX> &dump_nx = ip->m_DumpNX[g_Scene];
722+ if(dump_n) dump_n->Render(false);
723+ if(dump_nx) dump_nx->Render(false);
680724 }
681725 devSetLineMaterial();
682- for(; iw!=m_Wireframe.end(); iw++) if(iw->m_DumpN) iw->m_DumpN->Render(false);
726+ for(; iw!=m_Wireframe.end(); iw++){
727+ MapPtrValue<CLineDumpN> &dump_n = iw->m_DumpN[g_Scene];
728+ if(dump_n) dump_n->Render(false);
729+ }
683730 }
684731
685732 ////////////////////////////////////////////////////////////////////////////////
@@ -697,8 +744,19 @@
697744 }
698745
699746 /*
700- * ダンパ解放
747+ * ダンパすべて解放
701748 */
749+void CProfilePluginList::ClearDumpAll(){
750+ CProfilePlugin *ptr = Root();
751+ while(ptr){
752+ ptr->ClearDumpAll();
753+ ptr = ptr->Next();
754+ }
755+}
756+
757+/*
758+ * ダンパ準備
759+ */
702760 void CProfilePluginList::PrepareVertex(){
703761 CProfilePlugin *ptr = Root();
704762 while(ptr){
--- trunk/CScene.cpp (revision 8)
+++ trunk/CScene.cpp (revision 9)
@@ -50,6 +50,7 @@
5050 m_Struct = NULL;
5151 m_SurfacePlugin = NULL;
5252 m_EnvPlugin = NULL;
53+ m_IsDumpReady = false;
5354 m_Next = NULL;
5455 }
5556
@@ -139,7 +140,7 @@
139140 m_Camera.SetFocusInfo(R2L(CDetectInfo()));
140141 if(selectcamera) m_Camera.Select();
141142 m_ArrowPos = m_Camera.GetFocus();
142- Dump();
143+ if(!m_IsDumpReady) Dump();
143144 if(g_RailBuildMode) g_RailBuildMode->ResetBuilder();
144145 }
145146
@@ -647,6 +648,7 @@
647648 g_GirderPluginList->PrepareVertex();
648649 g_PierPluginList->PrepareVertex();
649650 g_LinePluginList->PrepareVertex();
651+ m_IsDumpReady = true;
650652 }
651653
652654 /*
--- trunk/CConfigMode.cpp (revision 8)
+++ trunk/CConfigMode.cpp (revision 9)
@@ -1,7 +1,10 @@
11 #include "stdafx.h"
22 #include "CSimpleDialog.h"
33 #include "CSkinPlugin.h"
4+#include "CScene.h"
5+#include "CSaveFile.h"
46 #include "CFileMode.h"
7+#include "CSceneryMode.h"
58 #include "CConfigMode.h"
69
710 // 内部定数
@@ -143,9 +146,17 @@
143146 half-TILE_UNIT*6, TILE_UNIT, FlashIn("%s [m]", lang(StereoscopyInterval)), &m_StereoGroup, 0, 1);
144147 m_StereoIntervalEdit.Init(half-TILE_UNIT*5, TILE_UNIT*5+TILE_QUAD,
145148 TILE_UNIT*4, TILE_UNIT, "1.00", &m_StereoGroup, 8);
149+
150+ m_ActiveWindow = NULL;
146151 }
147152
148153 /*
154+ * デストラクタ
155+ */
156+CConfigMode::~CConfigMode(){
157+}
158+
159+/*
149160 * モードを有効化
150161 */
151162 void CConfigMode::EnterInterface(){
@@ -168,6 +179,20 @@
168179 }
169180
170181 /*
182+ * 入力チェック
183+ */
184+int CConfigMode::ScanInputWindowDiv(){
185+ devSetTexture(0, NULL);
186+ devBLEND_ALPHA();
187+ if(IsWindowDiv() && GetButton(DIM_LEFT)==S_FREE && GetButton(DIM_MIDDLE)==S_FREE && GetButton(DIM_RIGHT)==S_FREE){
188+ m_ActiveWindow = m_RootWindow.GetPointWindow(0, 0, g_DispWidth, g_DispHeight, g_Cursor.GetPos());
189+ }
190+ int ret = CWindowDivInfo::ScanInput(m_RootWindow.GetDivAdr(), 0, 0, g_DispWidth, g_DispHeight, g_Scene->GetCamera(), &g_Scene);
191+ CWindowDivInfo::RenderInterface();
192+ return ret;
193+}
194+
195+/*
171196 * レンダリング
172197 */
173198 void CConfigMode::RenderInterface(){
@@ -177,6 +202,17 @@
177202 }
178203
179204 /*
205+ * レンダリング
206+ */
207+void CConfigMode::RenderWindowDiv(){
208+ devSetTexture(0, NULL);
209+ devBLEND_ALPHA();
210+ if(m_RootWindow.GetDiv()){
211+ m_RootWindow.GetDiv()->RenderInterfaceRecursive(0, 0, g_DispWidth, g_DispHeight);
212+ }
213+}
214+
215+/*
180216 * 設定読込
181217 */
182218 bool CConfigMode::Load(){
@@ -475,3 +511,12 @@
475511 for(i = 0; i<4; i++) m_PluginSound[i].SetCheck(0);
476512 }
477513 }
514+
515+/*
516+ * 画面分割関連初期化
517+ */
518+void CConfigMode::FreeWindowDiv(){
519+ m_RootWindow.Free();
520+ CWindowDivInfo::InitState();
521+ m_ActiveWindow = NULL;
522+}
--- trunk/CSceneryMode.cpp (revision 8)
+++ trunk/CSceneryMode.cpp (revision 9)
@@ -6,6 +6,7 @@
66 #include "CJobTimer.h"
77 #include "CScene.h"
88 #include "CSaveFile.h"
9+#include "CWindowDivInfo.h"
910 #include "CSurfacePlugin.h"
1011 #include "CSimulationMode.h"
1112 #include "CFileMode.h"
@@ -32,11 +33,16 @@
3233
3334 // static メンバ
3435 int CSceneryMode::ms_PhotoMode = 0;
36+bool CSceneryMode::ms_NeedResetViewport = false;
3537
3638 /*
3739 * シーンカメラ取得
3840 */
3941 CCamera *CSceneryMode::GetCamera(){
42+ if(IsWindowDivisible() && g_ConfigMode->IsWindowDiv()){
43+ CWindowInfo *wnd = g_ConfigMode->GetActiveWindow();
44+ if(wnd) return wnd->GetCamera();
45+ }
4046 return g_Scene ? g_Scene->GetCamera() : NULL;
4147 }
4248
@@ -54,14 +60,14 @@
5460 * モードループ
5561 */
5662 void CSceneryMode::SpinGame(){
57-// static double aaa = 0.0, sss = 0.95;
58-// double bbb = HighTimer();
5963 devSetState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
6064 g_ConfigMode->SetTexFilter();
6165 if(!g_ModalDialog && !IsPausedScenery()) g_SaveFile->Simulate(-1);
62- ApplyCamera();
63- SpinSound();
66+ ms_NeedResetViewport = false;
67+ CWindowInfo* active_wnd = NULL;
6468 if(g_ConfigMode->GetStereo()){
69+ ApplyCamera();
70+ SpinSound();
6571 float interval = g_ConfigMode->GetStereoInterval()
6672 *(g_ConfigMode->GetStereoMethod() ? -1 : 1);
6773 // left
@@ -77,45 +83,102 @@
7783 g_SaveFile->RenderScene(!ms_PhotoMode);
7884 sv3.pDev->EndScene();
7985 // reset
86+ //SetViewport(0, 0, sv3.width, sv3.height);
87+ //g_StereoInterval = 0.0f;
88+ //ApplyCamera();
89+ BeginScene(0);
90+ ms_NeedResetViewport = true;
91+ }else if(IsWindowDivisible() && g_ConfigMode->IsWindowDiv()){
92+ ApplyCamera();
93+ SpinSound();
94+ g_ConfigMode->GetRootWindow()->RenderScene(0, 0, g_DispWidth, g_DispHeight, this, !ms_PhotoMode);
8095 SetViewport(0, 0, sv3.width, sv3.height);
81- g_StereoInterval = 0.0f;
82- ApplyCamera();
96+ active_wnd = g_ConfigMode->GetActiveWindow();
8397 BeginScene(0);
98+ g_ConfigMode->RenderWindowDiv();
99+ if(active_wnd){
100+ sv3.pDev->EndScene();
101+ g_Scene = active_wnd->GetScene();
102+ *g_Scene->GetCamera() = *active_wnd->GetCamera();
103+ active_wnd->ApplyViewportAndCamera();
104+ BeginScene(0);
105+ }
106+ SpinSound();
107+ ms_NeedResetViewport = true;
84108 }else{
109+ ApplyCamera();
110+ SpinSound();
85111 g_SaveFile->RenderScene(!ms_PhotoMode);
86112 }
113+ const bool divisible = IsWindowDivisible() && !g_ConfigMode->GetStereo();
114+ bool enable_scenery_input = true;
115+ #define SCAN_INPUT_WINDOW_DIV() \
116+ if(divisible){ \
117+ switch(g_ConfigMode->ScanInputWindowDiv()){ \
118+ case 2: \
119+ active_wnd = NULL; \
120+ case 1: \
121+ enable_scenery_input = false; \
122+ break; \
123+ default:; \
124+ } \
125+ }
87126 switch(ms_PhotoMode){
88127 case 0:
89128 RenderScenery();
90-// aaa = HighTimer()-bbb+sss*aaa;
91-// g_StrTex->RenderCenter(g_DispWidth/2, TILE_UNIT+FontY(TILE_UNIT),
92-// 0xffff8000, 0xff000000, FlashIn("Render %.1f[ms]", (1.0-sss)*aaa));
129+ SCAN_INPUT_WINDOW_DIV();
93130 break;
94131 case 1:
95132 RenderScenery();
133+ g_Cursor.ScanInput(!g_ModalDialog && IsArrowMode());
134+ SCAN_INPUT_WINDOW_DIV();
135+ if(ms_NeedResetViewport) ResetViewport();
96136 GetCamera()->PrintInfo(CameraCtrlExp());
97137 RenderFrame(3);
98138 RenderNetworkInterface();
99139 RenderDialog();
100- g_Cursor.ScanInput(!g_ModalDialog && IsArrowMode());
101140 g_Cursor.Render();
102141 break;
103142 case 2:
104143 g_Cursor.ScanInput(!g_ModalDialog && IsArrowMode());
144+ if(ms_NeedResetViewport) ResetViewport();
105145 if(RenderDialog()) g_Cursor.Render();
106146 break;
107147 }
108148
149+#if ENABLE_JOB_TIMER
109150 g_JobTimer.DrawResult();
151+#endif
110152
111- EndScene();
112-
153+ if(active_wnd){
154+ sv3.pDev->EndScene();
155+ g_Scene = active_wnd->GetScene();
156+ active_wnd->ApplyViewportAndCamera();
157+ BeginScene(0);
158+ }
159+ if(enable_scenery_input) ScanInputScenery();
160+ {
161+ TIMER_RAII("EndScene");
162+ EndScene();
163+ }
113164 VideoCapture(1|(ms_PhotoMode==2 ? 4 : 0)
114165 |(!g_SimulationMode->GetSimSpeed() || IsPaused() ? 2 : 0), this);
115- ScanInputScenery();
116166 }
117167
118168 /*
169+ * ビューポート etc. リセット
170+ */
171+void CSceneryMode::ResetViewport(){
172+ SetViewport(0, 0, sv3.width, sv3.height);
173+ if(g_ConfigMode->GetStereo()){
174+ g_StereoInterval = 0.0f;
175+ ApplyCamera();
176+ BeginScene(0);
177+ }else if(IsWindowDivisible() && g_ConfigMode->IsWindowDiv()){
178+ }
179+}
180+
181+/*
119182 * カメラ適用
120183 */
121184 void CSceneryMode::ApplyCamera(){
@@ -456,6 +519,7 @@
456519 devTEX_POINT(0);
457520 devTEX_POINT(1);
458521 if(ms_PhotoMode) return;
522+ if(ms_NeedResetViewport) ResetViewport();
459523 m_Interface.Render();
460524 GetCamera()->PrintInfo(CameraCtrlExp());
461525 RenderFrame(1);
--- trunk/CProfilePlugin.h (revision 8)
+++ trunk/CProfilePlugin.h (revision 9)
@@ -3,10 +3,26 @@
33
44 #include "CPlugin.h"
55
6+class CScene;
67 class CQuadDumpNX;
78 class CLineDumpN;
89
910 /*
11+ * デフォルト NULL で初期化されるポインタ
12+ */
13+template< typename TYPE >
14+class MapPtrValue {
15+private:
16+ TYPE *m_Ptr;
17+public:
18+ MapPtrValue(): m_Ptr(NULL){}
19+ operator TYPE*(){ return m_Ptr; }
20+ TYPE* operator->(){ return m_Ptr; }
21+ TYPE*& operator=(TYPE* p){ return m_Ptr = p; }
22+ void SafeDelete(){ if(m_Ptr){ delete m_Ptr; m_Ptr = NULL; } }
23+};
24+
25+/*
1026 * 断面頂点データ
1127 */
1228 class CProfileVertex{
@@ -58,11 +74,12 @@
5874 string m_TexFileName; // テクスチャファイル名
5975 LPTEX8 m_Texture; // テクスチャ
6076 list<CProfileFace> m_Face; // 断面
61- CQuadDumpN *m_DumpN; // ダンパ (テクスチャなし)
62- CQuadDumpNX *m_DumpNX; // ダンパ (テクスチャあり)
77+ map<CScene *, MapPtrValue<CQuadDumpN> > m_DumpN; // ダンパ (テクスチャなし)
78+ map<CScene *, MapPtrValue<CQuadDumpNX> > m_DumpNX; // ダンパ (テクスチャあり)
6379 public:
6480 CProfile();
6581 ~CProfile();
82+ void ClearAll();
6683 char *Read(char *);
6784 void LoadTexture();
6885 void PrepareDump();
@@ -113,10 +130,11 @@
113130 float m_MinInterval; // 最小間隔
114131 float m_MaxInterval; // 最大間隔
115132 list<CWireframeLine> m_Line; // 断面
116- CLineDumpN *m_DumpN; // ダンパ
133+ map<CScene *, MapPtrValue<CLineDumpN> > m_DumpN; // ダンパ
117134 public:
118135 CWireframe();
119136 ~CWireframe();
137+ void ClearAll();
120138 char *Read(char *);
121139 void PrepareDump();
122140 bool CheckInterval(float l){
@@ -190,6 +208,7 @@
190208 void AddMapTemp(float);
191209 void SetMapTemp(vector<float> &);
192210 void ClearDump();
211+ void ClearDumpAll();
193212 void PrepareVertex();
194213 void RenderAll();
195214 CPLUGIN_CASTFUNC(CProfilePlugin);
@@ -204,6 +223,7 @@
204223 virtual char *DirName() = 0;
205224 virtual char *TextName2() = 0;
206225 void ClearDump();
226+ void ClearDumpAll();
207227 void PrepareVertex();
208228 void RenderAll();
209229 virtual CPlugin *NewEntry(char *) = 0;
--- trunk/CRailConnector.cpp (revision 8)
+++ trunk/CRailConnector.cpp (revision 9)
@@ -3,6 +3,7 @@
33 #include "CRailWay.h"
44 #include "CScene.h"
55 #include "CTrainGroup.h"
6+#include "CConfigMode.h"
67
78 // 関数宣言
89 void CalcCantAxis(VEC3 *, VEC3 *, VEC3 *, float);
@@ -136,8 +137,17 @@
136137 */
137138 void CRailWayLink::WarpToOppositeEnd(){
138139 CScene *scene = m_Link->m_Link[!m_Side].m_Link->GetScene();
139- if(scene!=g_Scene) scene->Enter(true);
140- CCamera::GetCurrentCamera()->SetFocus(m_Link->m_Link[!m_Side].GetPos());
140+ CCamera *camera = NULL;
141+ if(scene!=g_Scene){
142+ scene->Enter(true);
143+ CWindowInfo *active_wnd = g_ConfigMode->GetActiveWindow();
144+ if(g_ConfigMode->IsWindowDiv() && active_wnd){
145+ active_wnd->SetScene(g_Scene);
146+ camera = active_wnd->GetCamera();
147+ }
148+ }
149+ if(!camera) camera = CCamera::GetCurrentCamera();
150+ camera->SetFocus(m_Link->m_Link[!m_Side].GetPos());
141151 }
142152
143153 /*
@@ -459,6 +469,8 @@
459469 int i, j;
460470 for(i = 0; i<2; i++) for(j = 0; j<2; j++) m_Link[i][j].RestoreAddress();
461471 m_PointInst.RestoreAddress();
472+ m_User = (CTrainGroup *)ReplaceAdr(m_User);
473+
462474 }
463475
464476 /*
--- trunk/CJobTimer.cpp (revision 8)
+++ trunk/CJobTimer.cpp (revision 9)
@@ -121,6 +121,7 @@
121121 const int area_y = g_DispHeight-50;
122122 const int area_width = g_DispWidth-200;
123123 const int area_height = bar_height*frame_data.m_ObjList.size();
124+ const int number_width = 50;
124125 int pos_y = area_y;
125126 devResetMatrix();
126127 devSetLighting(false);
@@ -146,11 +147,14 @@
146147 Draw2DLine(area_x+line_x, area_y-area_height, area_x+line_x, area_y, 0xffffffff);
147148 }
148149 pos_y = area_y;
150+ const int str_base_x = area_x+number_width;
149151 for(i = 0; i<frame_data.m_ObjList.size(); ++i){
150152 CTimerObj* obj = frame_data.m_ObjList[i];
151153 const CTimerObj::CFrameData &obj_frame = obj->GetFrameData(1);
152154 const double frame_percent = FromHighTimerCountToMs(obj_frame.m_Total)*100.0/FRAME_UNIT;
153- g_StrTex->RenderLeft(area_x, pos_y-bar_height, 0xffffffff, 0, FlashIn("%7.2lf x%d: %s", frame_percent, obj_frame.m_Data.size(), obj->GetName()));
155+ const int str_base_y = pos_y-bar_height;
156+ g_StrTex->RenderRight(str_base_x, str_base_y, 0xffffffff, 0, FlashIn("%.0lf x%d", frame_percent, obj_frame.m_Data.size()));
157+ g_StrTex->RenderLeft(str_base_x, str_base_y, 0xffffffff, 0, FlashIn(": %s", obj->GetName()));
154158 pos_y -= bar_height;
155159 }
156160 #endif
--- trunk/CDiaDialog.cpp (revision 8)
+++ trunk/CDiaDialog.cpp (revision 9)
@@ -386,9 +386,9 @@
386386 void CDiaDialog::Init(
387387 CInterface *p // 親
388388 ){
389- int ww = TILE_UNIT*16, wh = TILE_UNIT*24;
389+ int ww = TILE_UNIT*16, wh = TILE_UNIT*25;
390390 CDiaDialogBase::Init(TILE_UNIT, g_DispHeight-wh-TILE_UNIT,
391- ww, wh, lang(DiaSetting), p, lang(Action), TILE_UNIT*7);
391+ ww, wh, lang(DiaSetting), p, lang(Action), TILE_UNIT*8);
392392 char *alabel[3] = {lang(Stop), lang(Return), lang(Pass)};
393393 char *tlabel[2] = {lang(StopDuration), lang(DeptTime)};
394394 int i;
@@ -403,6 +403,8 @@
403403 m_SecondEdit.Init(0, 0, TILE_UNIT*2, TILE_UNIT, "", &m_DiaGroup, 2);
404404 m_SecondLabel.Init(0, 0, TILE_UNIT, TILE_UNIT, lang(Sec), &m_DiaGroup, 0, 1);
405405 // m_JointCheck.Init(0, 0, 1, 1, "他編成との連結を許可", &m_DiaGroup);
406+ m_StopPosEdit.Init(0, 0, TILE_UNIT*8-TILE_HALF, TILE_UNIT, "", &m_DiaGroup, 9);
407+ m_StopPosButton.Init(0, 0, TILE_UNIT*3, TILE_UNIT, lang(Apply), &m_DiaGroup);
406408 InitFoot();
407409 m_OffsetSlide = 0;
408410 }
@@ -431,6 +433,8 @@
431433 m_SecondLabel.SetPos(tx+TILE_UNIT*11+TILE_HALF, TILE_UNIT*3+TILE_QUAD);
432434 // m_JointCheck.SetPos(TILE_UNIT, TILE_UNIT*4+TILE_QUAD);
433435 // m_JointCheck.SetSize(w-TILE_UNIT*2, TILE_UNIT);
436+ m_StopPosEdit.SetPos(tx+TILE_UNIT, TILE_UNIT*6+TILE_QUAD);
437+ m_StopPosButton.SetPos(tx+TILE_UNIT*9, TILE_UNIT*6+TILE_QUAD);
434438 }
435439
436440 /*
@@ -468,6 +472,19 @@
468472 // de->m_Joint = jt;
469473 // update = true;
470474 // }
475+ if(m_StopPosEdit.IsFocus() && !m_StopPosEdit.IsComp()
476+ && (GetKey(DIK_RETURN)|GetKey(DIK_NUMPADENTER))==S_PUSH){
477+ m_StopPosEdit.FinishInput();
478+ m_StopPosButton.SetPush(true);
479+ }
480+ if(m_StopPosButton.IsPushed()){
481+ de->m_Offset = 0.0f;
482+ sscanf(m_StopPosEdit.GetText(), "%f", &de->m_Offset);
483+ ValueArea(&de->m_Offset, -1.0f, 1.0f);
484+ m_StopPosEdit.SetText(FlashIn("%f", de->m_Offset));
485+ m_StopPosEdit.GiveFocus(false);
486+ return;
487+ }
471488 if(GetButton(DIM_LEFT)>=S_PUSH){
472489 int px, py, tw = m_DiaGroup.GetWidth()-TILE_UNIT*2;
473490 m_DiaGroup.GetAbsPos(&px, &py);
@@ -481,6 +498,8 @@
481498 de->m_Offset = (pos.x-px-tw*0.5f)*3.0f/tw;
482499 if(py+TILE_UNIT<pos.y) de->m_Offset = Round(de->m_Offset*10.0f)*0.1f;
483500 ValueArea(&de->m_Offset, -1.0f, 1.0f);
501+ m_StopPosEdit.FinishInput();
502+ m_StopPosEdit.SetText(FlashIn("%f", de->m_Offset));
484503 update = true;
485504 }
486505 }else{
@@ -533,6 +552,7 @@
533552 m_MinuteEdit.SetText(FlashIn("%02d", de->m_Minute));
534553 m_SecondEdit.SetText(FlashIn("%02d", de->m_Second));
535554 // m_JointCheck.SetCheck(de->m_Joint);
555+ m_StopPosEdit.SetText(FlashIn("%f", de->m_Offset));
536556 }else{
537557 m_Action[0].SetCheck();
538558 m_TimeType[0].SetCheck();
@@ -539,6 +559,7 @@
539559 m_HourEdit.SetText("");
540560 m_MinuteEdit.SetText("");
541561 m_SecondEdit.SetText("");
562+ m_StopPosEdit.SetText("");
542563 // m_JointCheck.SetCheck(0);
543564 }
544565 }
--- trunk/CWindowDivInfo.cpp (nonexistent)
+++ trunk/CWindowDivInfo.cpp (revision 9)
@@ -0,0 +1,512 @@
1+#include "stdafx.h"
2+#include "CWindowDivInfo.h"
3+#include "CConfigMode.h"
4+#include "CSceneryMode.h"
5+#include "CSkinPlugin.h"
6+#include "CScene.h"
7+#include "CSaveFile.h"
8+
9+// 内部定数
10+const int DRAG_BAR_WIDTH = 1;
11+
12+CWindowInfo::CWindowInfo(){
13+ m_Scene = NULL;
14+ m_Div = NULL;
15+ m_Camera.Init(200.0f, 2.0f, 5000.0f, true);
16+}
17+
18+CWindowInfo::~CWindowInfo(){
19+ Free();
20+}
21+
22+void CWindowInfo::Free(){
23+ m_Scene = NULL;
24+ m_Camera.SetFocusInfo(CDetectInfo());
25+ DELETE_V(m_Div);
26+}
27+
28+CWindowInfo *CWindowInfo::GetPointWindow(int x, int y, int w, int h, const POINT& pos){
29+ if(m_Div){
30+ return m_Div->GetPointWindow(x, y, w, h, pos);
31+ }else if(x<=pos.x && pos.x<x+w && y<=pos.y && pos.y<y+h){
32+ return this;
33+ }
34+ return NULL;
35+}
36+
37+CWindowInfo *CWindowInfo::GetFirstLeaf(){
38+ return m_Div ? m_Div->m_ChildWindow[0][0].GetFirstLeaf() : this;
39+}
40+
41+void CWindowInfo::ApplyViewportAndCamera(){
42+ SetViewport(m_PosX, m_PosY, m_Width, m_Height);
43+ m_Scene->Enter(false);
44+ m_Camera.Apply(false);
45+}
46+
47+void CWindowInfo::RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt){
48+ m_PosX = x; m_PosY = y;
49+ m_Width = w; m_Height = h;
50+ if(m_Div){
51+ m_Div->RenderScene(x, y, w, h, mode, opt);
52+ }else{
53+ ApplyViewportAndCamera();
54+ m_Scene = g_Scene;
55+ g_SaveFile->RenderScene(opt);
56+ sv3.pDev->EndScene();
57+ }
58+}
59+
60+void CWindowInfo::OnDeleteScene(CScene *scene){
61+ if(m_Scene==scene) m_Scene = g_Scene;
62+ if(m_Div){
63+ m_Div->OnDeleteScene(scene);
64+ }
65+}
66+
67+/*
68+ * 読込
69+ */
70+char *CWindowInfo::Read(
71+ char *str // 対象文字列
72+){
73+ char *eee;
74+ if(!(str = BeginBlock(eee = str, "WindowInfo"))) throw CSynErr(eee);
75+ bool is_div;
76+ if(!(str = AsgnYesNo(eee = str, "Divided", &is_div))) throw CSynErr(eee);
77+ if(is_div){
78+ m_Div = new CWindowDivInfo;
79+ str = m_Div->Read(str);
80+ m_Scene = GetFirstLeaf()->GetScene();
81+ }else{
82+ if(!(str = AsgnPointer(eee = str, "Scene", (void **)&m_Scene))) throw CSynErr(eee);
83+ m_Scene = (CScene *)ReplaceAdr(m_Scene);
84+ str = m_Camera.Read(str);
85+ }
86+ if(!(str = EndBlock(eee = str))) throw CSynErr(eee, ERR_ENDBLOCK);
87+ return str;
88+}
89+
90+/*
91+ * 保存
92+ */
93+void CWindowInfo::Save(
94+ FILE *df, // ファイル
95+ string indent // インデント
96+){
97+ fprintf(df, "%sWindowInfo{\n", indent.c_str());
98+ fprintf(df, "%s\tDivided = %s;\n", indent.c_str(), YESNO[m_Div!=NULL]);
99+ string indent2 = indent+"\t";
100+ if(m_Div){
101+ m_Div->Save(df, indent2);
102+ }else{
103+ fprintf(df, "%s\tScene = %p;\n", indent.c_str(), m_Scene);
104+ m_Camera.Save(df, indent2);
105+ }
106+ fprintf(df, "%s}\n", indent.c_str());
107+}
108+
109+////////////////////////////////////////////////////////////////////////////////
110+////////////////////////////////////////////////////////////////////////////////
111+
112+CWindowDivInfo **CWindowDivInfo::s_DragDivInfo = NULL;
113+CWindowDivInfo *CWindowDivInfo::s_MoveDivInfo = NULL;
114+CCamera *CWindowDivInfo::s_DragDivCamera = NULL;
115+CScene **CWindowDivInfo::s_DragDivScene = NULL;
116+int CWindowDivInfo::s_DragState = CWindowDivInfo::DRAG_STATE_NONE;
117+int CWindowDivInfo::s_ShrinkState = CWindowDivInfo::DRAG_STATE_NONE;
118+int CWindowDivInfo::s_ShrinkAnim = 0;
119+int CWindowDivInfo::s_TargetPosX, CWindowDivInfo::s_TargetPosY;
120+int CWindowDivInfo::s_TargetWidth, CWindowDivInfo::s_TargetHeight;
121+
122+void CWindowDivInfo::InitState(){
123+ s_DragDivInfo = NULL;
124+ s_MoveDivInfo = NULL;
125+ s_DragDivCamera = NULL;
126+ s_DragDivScene = NULL;
127+ s_DragState = CWindowDivInfo::DRAG_STATE_NONE;
128+ s_ShrinkState = CWindowDivInfo::DRAG_STATE_NONE;
129+}
130+
131+CWindowDivInfo::CWindowDivInfo(){
132+ m_DragState = 0;
133+ m_HorzRatio = m_VertRatio = 0.f;
134+}
135+
136+CWindowDivInfo::~CWindowDivInfo(){
137+}
138+
139+void CWindowDivInfo::CalcChildSize(int w, int h){
140+ m_ChildWidth[0] = m_HorzRatio ? Round(w*m_HorzRatio) : w;
141+ m_ChildWidth[1] = w-m_ChildWidth[0];
142+ m_ChildHeight[0] = m_VertRatio ? Round(h*m_VertRatio) : h;
143+ m_ChildHeight[1] = h-m_ChildHeight[0];
144+}
145+
146+int CWindowDivInfo::ScanInputSelf(CWindowDivInfo** info, int x, int y, int w, int h){
147+ int ret = 1;
148+ int i;
149+ if(s_ShrinkState!=DRAG_STATE_NONE){
150+ if(++s_ShrinkAnim<5){
151+ if(s_ShrinkState&DRAG_STATE_VERT){
152+ m_HorzRatio += m_HorzRatio<.5f ? -m_HorzRatio * .5f : (1.f-m_HorzRatio)*.5f;
153+ }
154+ if(s_ShrinkState&DRAG_STATE_HORZ){
155+ m_VertRatio += m_VertRatio<.5f ? -m_VertRatio * .5f : (1.f-m_VertRatio)*.5f;
156+ }
157+ }else{
158+ if(s_ShrinkState&DRAG_STATE_VERT){
159+ for(i = 0; i<WIN_DIV_MAX; ++i){
160+ if(m_HorzRatio<.5f){
161+ m_ChildWindow[i][0].Free();
162+ m_ChildWindow[i][0] = m_ChildWindow[i][1];
163+ m_ChildWindow[i][1].m_Div = NULL;
164+ }else{
165+ m_ChildWindow[i][1].Free();
166+ }
167+ }
168+ m_HorzRatio = 0.f;
169+ }
170+ if(s_ShrinkState&DRAG_STATE_HORZ){
171+ for(i = 0; i<WIN_DIV_MAX; ++i){
172+ if(m_VertRatio<.5f){
173+ m_ChildWindow[0][i].Free();
174+ m_ChildWindow[0][i] = m_ChildWindow[1][i];
175+ m_ChildWindow[1][i].m_Div = NULL;
176+ }else{
177+ m_ChildWindow[1][i].Free();
178+ }
179+ }
180+ m_VertRatio = 0.f;
181+ }
182+ if(!m_HorzRatio && !m_VertRatio){
183+ CWindowInfo *p_wnd = &m_ChildWindow[0][0];
184+ if(p_wnd->m_Div){
185+ *info = p_wnd->m_Div;
186+ p_wnd->m_Div = NULL;
187+ }else{
188+ *info = NULL;
189+ }
190+ p_wnd = p_wnd->GetFirstLeaf();
191+ *s_DragDivCamera = p_wnd->m_Camera;
192+ *s_DragDivScene = p_wnd->m_Scene;
193+ delete this;
194+ g_ConfigMode->SetActiveWindow(NULL);
195+ ret = 2;
196+ }
197+ s_DragDivInfo = NULL;
198+ s_ShrinkState = DRAG_STATE_NONE;
199+ }
200+ }else{
201+ POINT pos = g_Cursor.GetPos();
202+ if(s_DragState&DRAG_STATE_HORZ){
203+ const float min_frac = 1.f/h;
204+ m_VertRatio = (pos.y-y)*1.f/h;
205+ ValueArea(&m_VertRatio, min_frac, 1.f-min_frac);
206+ }
207+ if(s_DragState&DRAG_STATE_VERT){
208+ const float min_frac = 1.f/w;
209+ m_HorzRatio = (pos.x-x)*1.f/w;
210+ ValueArea(&m_HorzRatio, min_frac, 1.f-min_frac);
211+ }
212+ if(GetButton(DIM_LEFT)<S_PUSH){
213+ CalcChildSize(w, h);
214+ s_ShrinkState = DRAG_STATE_NONE;
215+ if(s_DragState&DRAG_STATE_VERT && (m_ChildWidth[0]<WIN_DIV_MIN_SIZE || m_ChildWidth[1]<WIN_DIV_MIN_SIZE)) s_ShrinkState |= DRAG_STATE_VERT;
216+ if(s_DragState&DRAG_STATE_HORZ && (m_ChildHeight[0]<WIN_DIV_MIN_SIZE || m_ChildHeight[1]<WIN_DIV_MIN_SIZE)) s_ShrinkState |= DRAG_STATE_HORZ;
217+ if(s_ShrinkState!=DRAG_STATE_NONE){
218+ s_ShrinkAnim = 0;
219+ }else{
220+ s_DragDivInfo = NULL;
221+ }
222+ }
223+ }
224+ return ret;
225+}
226+
227+int CWindowDivInfo::ScanInput(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene){
228+ s_MoveDivInfo = NULL;
229+ if(s_DragDivInfo && *s_DragDivInfo){
230+ return (*s_DragDivInfo)->ScanInputSelf(s_DragDivInfo, s_TargetPosX, s_TargetPosY, s_TargetWidth, s_TargetHeight);
231+ }else{
232+ return ScanInputRecursive(info, x, y, w, h, cam, scene);
233+ }
234+}
235+
236+int CWindowDivInfo::ScanInputRecursive(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene){
237+ int i, j;
238+ POINT pos = g_Cursor.GetPos();
239+ if(x<=pos.x && pos.x<x+w && y<=pos.y && pos.y<y+h){
240+ s_DragState = DRAG_STATE_NONE;
241+ if(*info){
242+ (*info)->CalcChildSize(w, h);
243+ const int tx = x+(*info)->m_ChildWidth[0];
244+ const int ty = y+(*info)->m_ChildHeight[0];
245+ bool copy_h = false, swap_h = false;
246+ bool copy_v = false, swap_v = false;
247+ if((*info)->m_ChildWidth[1] && tx-WIN_DIV_MOVE_MARGIN<=pos.x && pos.x<=tx+WIN_DIV_MOVE_MARGIN){
248+ if((*info)->m_ChildHeight[1] && ty-WIN_DIV_MOVE_MARGIN<=pos.y && pos.y<=ty+WIN_DIV_MOVE_MARGIN){
249+ s_DragState = DRAG_STATE_HORZVERT;
250+ }else{
251+ if(!(*info)->m_ChildHeight[1] && (pos.y<y+WIN_DIV_MARGIN || y+h-WIN_DIV_MARGIN<=pos.y)){
252+ s_DragState = DRAG_STATE_HORZVERT;
253+ copy_v = true;
254+ swap_v = pos.y<y+WIN_DIV_MARGIN;
255+ }else{
256+ s_DragState = DRAG_STATE_VERT;
257+ }
258+ }
259+ }else{
260+ if((*info)->m_ChildHeight[1] && ty-WIN_DIV_MOVE_MARGIN<=pos.y && pos.y<=ty+WIN_DIV_MOVE_MARGIN){
261+ if(!(*info)->m_ChildWidth[1] && (pos.x<x+WIN_DIV_MARGIN || x+w-WIN_DIV_MARGIN<=pos.x)){
262+ s_DragState = DRAG_STATE_HORZVERT;
263+ copy_h = true;
264+ swap_h = pos.x<x+WIN_DIV_MARGIN;
265+ }else{
266+ s_DragState = DRAG_STATE_HORZ;
267+ }
268+ }else{
269+ for(i = 0; i<WIN_DIV_MAX; ++i){
270+ if((*info)->m_ChildHeight[i]<=0) continue;
271+ const int cy = i ? ty : y;
272+ const int ch = (*info)->m_ChildHeight[i];
273+ for(j = 0; j<WIN_DIV_MAX; ++j){
274+ if((*info)->m_ChildWidth[j]<=0) continue;
275+ const int cx = j ? tx : x;
276+ const int cw = (*info)->m_ChildWidth[j];
277+ CWindowInfo &wnd = (*info)->m_ChildWindow[i][j];
278+ int ret = ScanInputRecursive(&wnd.m_Div, cx, cy, cw, ch, &wnd.m_Camera, &wnd.m_Scene);
279+ if(ret) return ret;
280+ }
281+ }
282+ return 0;
283+ }
284+ }
285+ if(s_DragState!=DRAG_STATE_NONE){
286+ s_TargetPosX = x;
287+ s_TargetPosY = y;
288+ s_TargetWidth = w;
289+ s_TargetHeight = h;
290+ if(GetButton(DIM_LEFT)==S_PUSH){
291+ g_Skin->MouseDown();
292+ s_DragDivInfo = info;
293+ s_DragDivCamera = cam;
294+ s_DragDivScene = scene;
295+ if(copy_h){
296+ for(i = 0; i<WIN_DIV_MAX; ++i){
297+ (*info)->m_ChildWindow[i][1] = *(*info)->m_ChildWindow[i][0].GetFirstLeaf();
298+ if(swap_h){
299+ CWindowInfo t = (*info)->m_ChildWindow[i][1];
300+ (*info)->m_ChildWindow[i][1] = (*info)->m_ChildWindow[i][0];
301+ (*info)->m_ChildWindow[i][0] = t;
302+ }
303+ }
304+ if(swap_h) (*info)->m_HorzRatio = 1.f/w;
305+ }
306+ if(copy_v){
307+ for(i = 0; i<WIN_DIV_MAX; ++i){
308+ (*info)->m_ChildWindow[1][i] = *(*info)->m_ChildWindow[0][i].GetFirstLeaf();
309+ if(swap_v){
310+ CWindowInfo t = (*info)->m_ChildWindow[1][i];
311+ (*info)->m_ChildWindow[1][i] = (*info)->m_ChildWindow[0][i];
312+ (*info)->m_ChildWindow[0][i] = t;
313+ }
314+ }
315+ if(swap_v) (*info)->m_VertRatio = 1.f/h;
316+ }
317+ return 1;
318+ }else{
319+ s_MoveDivInfo = *info;
320+ }
321+ }
322+ }else{
323+ if(pos.x<x+WIN_DIV_MARGIN || x+w-WIN_DIV_MARGIN<=pos.x){
324+ if(pos.y<y+WIN_DIV_MARGIN || y+h-WIN_DIV_MARGIN<=pos.y){
325+ s_DragState = DRAG_STATE_HORZVERT;
326+ }else{
327+ s_DragState = DRAG_STATE_VERT;
328+ }
329+ }else{
330+ if(pos.y<y+WIN_DIV_MARGIN || y+h-WIN_DIV_MARGIN<=pos.y){
331+ s_DragState = DRAG_STATE_HORZ;
332+ }else{
333+ }
334+ }
335+ if(s_DragState!=DRAG_STATE_NONE){
336+ s_TargetPosX = x;
337+ s_TargetPosY = y;
338+ s_TargetWidth = w;
339+ s_TargetHeight = h;
340+ if(GetButton(DIM_LEFT)==S_PUSH){
341+ g_Skin->MouseDown();
342+ *info = new CWindowDivInfo;
343+ (*info)->InitCamera(*cam, *scene);
344+ s_DragDivInfo = info;
345+ s_DragDivCamera = cam;
346+ s_DragDivScene= scene;
347+ return 1;
348+ }
349+ }
350+ }
351+ }else{
352+ }
353+ return 0;
354+}
355+
356+void CWindowDivInfo::RenderInterface(){
357+ if(s_DragState==DRAG_STATE_NONE) return;
358+ POINT pos = g_Cursor.GetPos();
359+ const D3DCOLOR rect_color = 0xffffff00;
360+ const D3DCOLOR div_color = 0xffff0000;
361+ const int tx1 = s_TargetPosX+WIN_DIV_MARGIN, tx2 = s_TargetPosX+s_TargetWidth-WIN_DIV_MARGIN;
362+ const int ty1 = s_TargetPosY+WIN_DIV_MARGIN, ty2 = s_TargetPosY+s_TargetHeight-WIN_DIV_MARGIN;
363+ Fill2DRect(s_TargetPosX, s_TargetPosY, s_TargetPosX+s_TargetWidth, ty1, rect_color);
364+ Fill2DRect(s_TargetPosX, ty2, s_TargetPosX+s_TargetWidth, s_TargetPosY+s_TargetHeight, rect_color);
365+ Fill2DRect(s_TargetPosX, ty1, tx1, ty2, rect_color);
366+ Fill2DRect(tx2, ty1, s_TargetPosX+s_TargetWidth, ty2, rect_color);
367+ if(s_MoveDivInfo){
368+ }else{
369+ if(s_DragDivInfo){
370+ ValueArea((int*)&pos.x, s_TargetPosX, s_TargetPosX+s_TargetWidth-1);
371+ ValueArea((int*)&pos.y, s_TargetPosY, s_TargetPosY+s_TargetHeight-1);
372+ }else{
373+ pos.x = pos.x<s_TargetPosX+s_TargetWidth/2 ? s_TargetPosX : s_TargetPosX+s_TargetWidth-1;
374+ pos.y = pos.y<s_TargetPosY+s_TargetHeight/2 ? s_TargetPosY : s_TargetPosY+s_TargetHeight-1;
375+ if(s_DragState&DRAG_STATE_HORZ){
376+ Fill2DRect(s_TargetPosX, pos.y-DRAG_BAR_WIDTH, s_TargetPosX+s_TargetWidth, pos.y+DRAG_BAR_WIDTH+1, div_color);
377+ }
378+ if(s_DragState&DRAG_STATE_VERT){
379+ Fill2DRect(pos.x-DRAG_BAR_WIDTH, s_TargetPosY, pos.x+DRAG_BAR_WIDTH+1, s_TargetPosY+s_TargetHeight, 0xffff0000);
380+ }
381+ }
382+ }
383+}
384+
385+void CWindowDivInfo::InitCamera(const CCamera& cam, CScene *scene){
386+ int i, j;
387+ for(i = 0; i<WIN_DIV_MAX; ++i){
388+ for(j = 0; j<WIN_DIV_MAX; ++j){
389+ CWindowInfo &wnd = m_ChildWindow[i][j];
390+ wnd.SetCamera(cam);
391+ wnd.SetScene(scene);
392+ }
393+ }
394+}
395+
396+void CWindowDivInfo::RenderInterfaceRecursive(int x, int y, int w, int h){
397+ const bool dragging = s_DragDivInfo && *s_DragDivInfo==this;
398+ const bool div_horz = (s_DragState&DRAG_STATE_HORZ)!=0;
399+ const bool div_vert = (s_DragState&DRAG_STATE_VERT)!=0;
400+ D3DCOLOR div_color_horz = (dragging || s_MoveDivInfo==this) && div_horz ? 0xffff0000 : 0xff000000;
401+ D3DCOLOR div_color_vert = (dragging || s_MoveDivInfo==this) && div_vert ? 0xffff0000 : 0xff000000;
402+ CalcChildSize(w, h);
403+ int i, j;
404+ for(i = 0; i<2; ++i){
405+ if(i==!div_vert && m_ChildHeight[0]>0 && m_ChildHeight[1]>0){
406+ Fill2DRect(x, y+m_ChildHeight[0]-WIN_DIV_PADDING/2, x+w, y+m_ChildHeight[0]-WIN_DIV_PADDING/2+WIN_DIV_PADDING, div_color_horz);
407+ }
408+ if(i==!!div_vert && m_ChildWidth[0]>0 && m_ChildWidth[1]>0){
409+ Fill2DRect(x+m_ChildWidth[0]-WIN_DIV_PADDING/2, y, x+m_ChildWidth[0]-WIN_DIV_PADDING/2+WIN_DIV_PADDING, y+h, div_color_vert);
410+ }
411+ }
412+ for(i = 0; i<WIN_DIV_MAX; ++i){
413+ if(m_ChildHeight[i]<=0) continue;
414+ const int cy = i ? y+m_ChildHeight[i-1] : y;
415+ const int ch = m_ChildHeight[i];
416+ for(j = 0; j<WIN_DIV_MAX; ++j){
417+ if(m_ChildWidth[j]<=0) continue;
418+ const int cx = j ? x+m_ChildWidth[j-1] : x;
419+ const int cw = m_ChildWidth[j];
420+ if(m_ChildWindow[i][j].m_Div){
421+ m_ChildWindow[i][j].m_Div->RenderInterfaceRecursive(cx, cy, cw, ch);
422+ }
423+ }
424+ }
425+}
426+
427+void CWindowDivInfo::RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt){
428+ CalcChildSize(w, h);
429+ int i, j;
430+ for(i = 0; i<WIN_DIV_MAX; ++i){
431+ if(m_ChildHeight[i]<=0) continue;
432+ const int cy = i ? y+m_ChildHeight[i-1] : y;
433+ const int ch = m_ChildHeight[i];
434+ for(j = 0; j<WIN_DIV_MAX; ++j){
435+ if(m_ChildWidth[j]<=0) continue;
436+ const int cx = j ? x+m_ChildWidth[j-1] : x;
437+ const int cw = m_ChildWidth[j];
438+ m_ChildWindow[i][j].RenderScene(cx, cy, cw, ch, mode, opt);
439+ }
440+ }
441+}
442+
443+CWindowInfo *CWindowDivInfo::GetPointWindow(int x, int y, int w, int h, const POINT& pos){
444+ CalcChildSize(w, h);
445+ int i, j;
446+ for(i = 0; i<WIN_DIV_MAX; ++i){
447+ if(m_ChildHeight[i]<=0) continue;
448+ const int cy = i ? y+m_ChildHeight[i-1] : y;
449+ const int ch = m_ChildHeight[i];
450+ for(j = 0; j<WIN_DIV_MAX; ++j){
451+ if(m_ChildWidth[j]<=0) continue;
452+ const int cx = j ? x+m_ChildWidth[j-1] : x;
453+ const int cw = m_ChildWidth[j];
454+ CWindowInfo *ret = m_ChildWindow[i][j].GetPointWindow(cx, cy, cw, ch, pos);
455+ if(ret) return ret;
456+ }
457+ }
458+ return NULL;
459+}
460+
461+void CWindowDivInfo::OnDeleteScene(CScene *scene){
462+ int i, j;
463+ for(i = 0; i<WIN_DIV_MAX; ++i){
464+ for(j = 0; j<WIN_DIV_MAX; ++j){
465+ m_ChildWindow[i][j].OnDeleteScene(scene);
466+ }
467+ }
468+}
469+
470+/*
471+ * 読込
472+ */
473+char *CWindowDivInfo::Read(
474+ char *str // 対象文字列
475+){
476+ char *eee;
477+ if(!(str = BeginBlock(eee = str, "WindowDivInfo"))) throw CSynErr(eee);
478+ if(!(str = AsgnFloat(eee = str, "HorzRatio", &m_HorzRatio))) throw CSynErr(eee);
479+ if(!(str = AsgnFloat(eee = str, "VertRatio", &m_VertRatio))) throw CSynErr(eee);
480+ int i, j;
481+ for(i = 0; i<WIN_DIV_MAX; ++i){
482+ if(i && !m_VertRatio) break;
483+ for(j = 0; j<WIN_DIV_MAX; ++j){
484+ if(j && !m_HorzRatio) break;
485+ str = m_ChildWindow[i][j].Read(str);
486+ }
487+ }
488+ if(!(str = EndBlock(eee = str))) throw CSynErr(eee, ERR_ENDBLOCK);
489+ return str;
490+}
491+
492+/*
493+ * 保存
494+ */
495+void CWindowDivInfo::Save(
496+ FILE *df, // ファイル
497+ string indent // インデント
498+){
499+ fprintf(df, "%sWindowDivInfo{\n", indent.c_str());
500+ fprintf(df, "%s\tHorzRatio = %f;\n", indent.c_str(), m_HorzRatio);
501+ fprintf(df, "%s\tVertRatio = %f;\n", indent.c_str(), m_VertRatio);
502+ string indent2 = indent+"\t";
503+ int i, j;
504+ for(i = 0; i<WIN_DIV_MAX; ++i){
505+ if(i && !m_VertRatio) break;
506+ for(j = 0; j<WIN_DIV_MAX; ++j){
507+ if(j && !m_HorzRatio) break;
508+ m_ChildWindow[i][j].Save(df, indent2);
509+ }
510+ }
511+ fprintf(df, "%s}\n", indent.c_str());
512+}
Show on old repository browser