summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2Message.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2Message.cpp274
1 files changed, 257 insertions, 17 deletions
diff --git a/src/T2DLL/T2Message.cpp b/src/T2DLL/T2Message.cpp
index e089c1b..73850eb 100644
--- a/src/T2DLL/T2Message.cpp
+++ b/src/T2DLL/T2Message.cpp
@@ -1,49 +1,289 @@
+#include "CT2App.h"
#include "T2Message.h"
+static BOOL s100E3E08;
+
+// unknown name - 100E3E0C
+static BOOL sVisible;
+
T2Message::T2Message() {
}
-void T2Message::ShowMessage(const CString&) {
-}
+void T2Message::ShowMessage(const CString& str) {
+ if (!sVisible) {
+ sVisible = true;
+ s100E3E08 = true;
-/*virtual*/ T2Message::~T2Message() {
-}
+ // "MS Pゴシック"
+ mFont.CreatePointFont(100, "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E");
+
+ void *buffer = malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2 + 8 * 8);
+
+ BITMAPINFOHEADER *bmi = (BITMAPINFOHEADER *) buffer;
+ memset(bmi, 0, sizeof(BITMAPINFOHEADER));
+ bmi->biSize = sizeof(BITMAPINFOHEADER);
+ bmi->biWidth = 8;
+ bmi->biHeight = 8;
+ bmi->biPlanes = 1;
+ bmi->biBitCount = 8;
+ bmi->biClrUsed = 2;
+ bmi->biClrImportant = 2;
+
+ RGBQUAD *cols = (RGBQUAD *) (((char *) buffer) + sizeof(BITMAPINFOHEADER));
+ cols[0].rgbRed = 0;
+ cols[0].rgbGreen = 0;
+ cols[0].rgbBlue = 0;
+ cols[1].rgbRed = 255;
+ cols[1].rgbGreen = 255;
+ cols[1].rgbBlue = 0;
-/*static*/ const AFX_MSGMAP* __stdcall T2Message::_GetBaseMessageMap() {
+ unsigned char *pixels = ((unsigned char *) buffer) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2;
+ unsigned char row[8];
+ row[0] = 1;
+ row[1] = 1;
+ row[2] = 1;
+ row[3] = 1;
+ row[4] = 0;
+ row[5] = 0;
+ row[6] = 0;
+ row[7] = 0;
+
+ for (int y = 0; y < 8; y++) {
+ for (int x = 0; x < 8; x++) {
+ pixels[x + y * 8] = row[(x + y) % 8];
+ }
+ }
+
+ int result = mBrush.CreateDIBPatternBrush((const void *) buffer, DIB_RGB_COLORS);
+ free(buffer);
+#line 64
+ _ASSERT(result != 0);
+
+ mString = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW | CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH));
+
+ RECT rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = 100;
+ rect.bottom = 50;
+
+ CreateEx(0, mString, str, WS_POPUP, rect, AfxGetMainWnd(), 0);
+ } else {
+ delete this;
+ }
}
-/*virtual*/ const AFX_MSGMAP* T2Message::GetMessageMap() const {
+/*virtual*/ T2Message::~T2Message() {
}
+BEGIN_MESSAGE_MAP(T2Message, CWnd)
+ ON_WM_CREATE()
+ ON_WM_TIMER()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_RBUTTONDOWN()
+ ON_WM_KEYDOWN()
+ ON_WM_DESTROY()
+ ON_WM_ERASEBKGND()
+ ON_MESSAGE(WM_USER + 10, OnHookMessage)
+END_MESSAGE_MAP()
+
/*virtual*/ void T2Message::PostNcDestroy() {
+ sVisible = false;
+ delete this;
+ ((CT2App *) AfxGetApp())->app_vfAC();
}
-int T2Message::OnCreate(CREATESTRUCTA*) {
+int T2Message::OnCreate(CREATESTRUCT* cs) {
+ if (CWnd::OnCreate(cs) == -1)
+ return -1;
+
+ CString str;
+ GetWindowText(str);
+
+ CRect desktopRect;
+ GetDesktopWindow()->GetClientRect(desktopRect);
+
+ CDC *dc = GetDC();
+ int save = dc->SaveDC();
+
+ dc->SelectObject(&mFont);
+
+ mRect2.SetRect(0, 0, (desktopRect.right * 2) / 5, desktopRect.bottom);
+ dc->DrawText(str, mRect2, DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
+ mRect2.InflateRect(0, 0, 20, 20);
+
+ dc->RestoreDC(save);
+ ReleaseDC(dc);
+
+ CRect clientRect;
+
+ GetWindowRect(mRect1);
+ GetClientRect(clientRect);
+ mRect1.OffsetRect(-mRect1.left, -mRect1.top);
+ mRect1.right = mRect1.Width() - clientRect.Width() + mRect2.Width();
+ mRect1.bottom = mRect1.Height() - clientRect.Height() + mRect2.Height();
+
+ CPoint cursorPos;
+ GetCursorPos(&cursorPos);
+
+ if ((cursorPos.x - mRect1.right) >= 0)
+ mRect1.OffsetRect(cursorPos.x - mRect1.right, 0);
+ else
+ mRect1.OffsetRect(cursorPos.x, 0);
+
+ if ((cursorPos.y - mRect1.bottom) >= 0)
+ mRect1.OffsetRect(0, cursorPos.y - mRect1.bottom);
+ else
+ mRect1.OffsetRect(0, cursorPos.y);
+
+ m78 = false;
+
+ SetTimer(1, 50, NULL);
+
+ m74 = GetTickCount();
+
+ ((CT2App *) AfxGetApp())->app_vfA8(this);
+
+ return 0;
}
-void T2Message::OnTimer(unsigned int) {
+void T2Message::OnTimer(UINT) {
+ unsigned int counter;
+ DWORD tickCount = GetTickCount();
+
+ if (m74 <= tickCount)
+ counter = tickCount - m74;
+ else
+ counter = -1 - m74 + tickCount;
+
+ if (counter >= 250) {
+ if (counter >= 1250) {
+ DestroyWindow();
+ return;
+ }
+
+ if (s100E3E08 == true) {
+ KillTimer(1);
+ SetTimer(1, 200, NULL);
+ s100E3E08 = false;
+ }
+
+ counter = 250;
+ m78 = true;
+ }
+
+ CRect rect;
+ CPoint pt = mRect1.CenterPoint();
+
+ if (counter <= 80) {
+ rect.left = pt.x - 10;
+ rect.right = pt.x + 10;
+
+ rect.top = pt.y - (((pt.y - mRect1.top) * counter) / 80);
+ rect.bottom = pt.y + (((mRect1.bottom - pt.y) * counter) / 80);
+ } else {
+ counter -= 80;
+
+ rect.top = mRect1.top;
+ rect.bottom = mRect1.bottom;
+
+ rect.left = pt.x - (((pt.x - mRect1.left - 10) * counter) / 170) - 10;
+ rect.right = pt.x + (((mRect1.right - pt.x - 10) * counter) / 170) + 10;
+ }
+
+ SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
+ ShowWindow(SW_SHOWNA);
}
-long T2Message::OnHookMessage(unsigned int, long) {
+LONG T2Message::OnHookMessage(UINT, LONG arg) {
+ MSG *pMsg = (MSG *) arg;
+
+ if (pMsg->hwnd != m_hWnd) {
+ if (pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_RBUTTONDOWN || pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
+ DestroyWindow();
+ }
+
+ return 0;
}
-void T2Message::OnLButtonDown(unsigned int, CPoint) {
+void T2Message::OnLButtonDown(UINT, CPoint) {
+ DestroyWindow();
}
-void T2Message::OnRButtonDown(unsigned int, CPoint) {
+void T2Message::OnRButtonDown(UINT, CPoint) {
+ DestroyWindow();
}
-void T2Message::OnKeyDown(unsigned int, unsigned int, unsigned int) {
+void T2Message::OnKeyDown(UINT, UINT, UINT) {
+ DestroyWindow();
}
void T2Message::OnDestroy() {
+ CWnd::OnDestroy();
+ KillTimer(1);
}
-int T2Message::OnEraseBkgnd(CDC*) {
-}
+int T2Message::OnEraseBkgnd(CDC* dc) {
+ CRect rect1;
+ GetClientRect(rect1);
-/*static*/ const AFX_MSGMAP T2Message::messageMap {
-}
+ int save = dc->SaveDC();
+
+ CBrush brush;
+ brush.CreateStockObject(NULL_BRUSH);
+
+ CPen pen;
+ pen.CreateStockObject(BLACK_PEN);
+
+ dc->SelectObject(brush);
+ dc->SelectObject(pen);
+ dc->Rectangle(rect1);
+
+ rect1.top++;
+ rect1.left++;
+ rect1.bottom--;
+ rect1.right--;
+
+ CRect rect2;
+
+ rect2 = rect1;
+ rect2.right = rect2.left + 5;
+ dc->FillRect(rect2, &mBrush);
+
+ rect2 = rect1;
+ rect2.bottom = rect2.top + 5;
+ dc->FillRect(rect2, &mBrush);
+
+ rect2 = rect1;
+ rect2.left = rect2.right - 5;
+ dc->FillRect(rect2, &mBrush);
+
+ rect2 = rect1;
+ rect2.top = rect2.bottom - 5;
+ dc->FillRect(rect2, &mBrush);
+
+ CBrush brush2;
+ brush2.CreateStockObject(WHITE_BRUSH);
+
+ rect2.top = rect1.top + 5;
+ rect2.left = rect1.left + 5;
+ rect2.bottom = rect1.bottom - 5;
+ rect2.right = rect1.right - 5;
+ dc->FillRect(rect2, &brush2);
+
+ if (m78) {
+ dc->SetTextColor(RGB(128, 0, 0));
+ dc->SetBkMode(TRANSPARENT);
+ dc->SelectObject(mFont);
+
+ CString str;
+ GetWindowText(str);
+
+ CRect textRect = mRect2;
+ textRect.InflateRect(-10, -10, -10, -10);
+ dc->DrawText(str, textRect, DT_WORDBREAK | DT_NOPREFIX);
+ }
-/*static*/ const AFX_MSGMAP_ENTRY* const T2Message::_messageEntries {
+ dc->RestoreDC(save);
+ return 1;
}