diff mm7_2.cpp @ 920:34ed2d5e7cfb

MagicShopDialog clean and other
author Ritor1
date Sun, 28 Apr 2013 19:11:36 +0600
parents 897b10712a1a
children d4ca429eecd4 a78f08dbeb88
line wrap: on
line diff
--- a/mm7_2.cpp	Sat Apr 27 09:37:22 2013 +0600
+++ b/mm7_2.cpp	Sun Apr 28 19:11:36 2013 +0600
@@ -6832,8 +6832,6 @@
   {
     switch ( Msg )
     {
-      default:
-        goto _def_wnd_proc;
       case WM_DEVICECHANGE:
         if ( wParam == 0x8000 )
           PostMessageA(hInsertCDWindow, WM_CHOOSEFONT_GETLOGFONT, 0, 0);
@@ -6845,12 +6843,10 @@
         if ( pArcomageGame->bGameInProgress )
         {
           if (pAsyncMouse)
-            goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           pArcomageGame->stru1.field_0 = 7;
-          v29 = 1;
-LABEL_210:
-          v30 = 0;
-          goto LABEL_263;
+          ArcomageGame::OnMouseClick(0, 1);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if ( pVideoPlayer->pVideoFrame.pPixels )
           pVideoPlayer->bStopBeforeSchedule = 1;
@@ -6862,42 +6858,77 @@
       case WM_RBUTTONDOWN:
         v31 = 0;
         if ( !pArcomageGame->bGameInProgress )
-          goto LABEL_240;
+          //goto LABEL_240;
+        {
+          if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 )
+            pVideoPlayer->bStopBeforeSchedule = 1;
+          if (!pAsyncMouse)
+            pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
+          if (pGame)
+          {
+            if (pAsyncMouse)
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            v33 = pGame->pIndoorCameraD3D->GetPickDepth();
+            pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter);
+          }
+          if (!pAsyncMouse)
+          {
+            sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
+          }
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
+        }
         if (pAsyncMouse)
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         pArcomageGame->stru1.field_0 = 8;
-        v29 = 1;
-        goto LABEL_262;
+        ArcomageGame::OnMouseClick(1, 1);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_LBUTTONUP:
         v32 = 0;
         if ( !pArcomageGame->bGameInProgress )
-          goto LABEL_218;
-        if (pAsyncMouse)
-          goto _def_wnd_proc;
-        pArcomageGame->stru1.field_0 = 3;
-        v29 = 0;
-        goto LABEL_210;
-      case WM_RBUTTONUP:
-        v32 = 0;
-        if ( !pArcomageGame->bGameInProgress )
-        {
-LABEL_218:
+          //goto LABEL_218;
+        {
           if ( pAsyncMouse != v32 )
-            goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           back_to_game();
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if (pAsyncMouse)
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
+        pArcomageGame->stru1.field_0 = 3;
+        ArcomageGame::OnMouseClick(0, 0);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
+      case WM_RBUTTONUP:
+        v32 = 0;
+        if ( !pArcomageGame->bGameInProgress )
+        {
+//LABEL_218:
+          if ( pAsyncMouse != v32 )
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
+          back_to_game();
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
+        }
+        if (pAsyncMouse)
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         pArcomageGame->stru1.field_0 = 4;
         v29 = 0;
-        goto LABEL_262;
+        //goto LABEL_262;
+        v30 = 1;
+        ArcomageGame::OnMouseClick(v30, v29);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_LBUTTONDBLCLK:
         v28 = 0;
         if ( pArcomageGame->bGameInProgress )
         {
           if (pAsyncMouse)
-            goto _def_wnd_proc;
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           pArcomageGame->stru1.field_0 = 7;
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
@@ -6918,7 +6949,8 @@
         if ( pGame != (Game *)v28 )
         {
           if ( pAsyncMouse != (void *)v28 )
-            goto _def_wnd_proc;
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, v28, &vis_sprite_filter_3, &vis_door_filter);
         }
         if ( pAsyncMouse == (void *)v28 )
@@ -6926,12 +6958,13 @@
           UI_OnMouseLeftClick(0);
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
-        goto _def_wnd_proc;
+        //goto _def_wnd_proc;
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_RBUTTONDBLCLK:
         v31 = 0;
         if ( !pArcomageGame->bGameInProgress )
         {
-LABEL_240:
+//LABEL_240:
           if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 )
             pVideoPlayer->bStopBeforeSchedule = 1;
           if (!pAsyncMouse)
@@ -6939,7 +6972,8 @@
           if (pGame)
           {
             if (pAsyncMouse)
-              goto _def_wnd_proc;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
             v33 = pGame->pIndoorCameraD3D->GetPickDepth();
             pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter);
           }
@@ -6948,10 +6982,12 @@
             sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
             return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if (pAsyncMouse)
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         pArcomageGame->stru1.field_0 = 8;
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MBUTTONDOWN:
@@ -6963,41 +6999,46 @@
             pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter);
             return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if ( !pGame )
-          goto _def_wnd_proc;
+          //goto _def_wnd_proc;
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         sub_417871(0);
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MOUSEMOVE:
         if ( pArcomageGame->bGameInProgress )
         {
           if (pAsyncMouse)
-            goto _def_wnd_proc;
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           pXY[0] = (unsigned __int16)lParam;
           pXY[1] = lParam >> 16;
           ArcomageGame::OnMouseMove((POINT *)pXY);
           ArcomageGame::OnMouseClick(0, wParam & 1);
           v29 = (wParam >> 1) & 1;
-LABEL_262:
-          v30 = 1;
-LABEL_263:
-          ArcomageGame::OnMouseClick(v30, v29);
+          ArcomageGame::OnMouseClick(1, v29);
         }
         else
         {
           if (pAsyncMouse)
-            goto _def_wnd_proc;
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
         }
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
+      default:
+        //goto _def_wnd_proc;
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
   }
   if ( Msg == WM_SYSCOMMAND )
   {
     if ( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER )
       return 0;
-    goto _def_wnd_proc;
+    //goto _def_wnd_proc;
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   }
   if ( Msg > WM_ACTIVATEAPP )
   {
@@ -7011,7 +7052,8 @@
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
       }
-      goto _def_wnd_proc;
+      //goto _def_wnd_proc;
+      return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
     if ( Msg != WM_KEYFIRST )
     {
@@ -7022,10 +7064,12 @@
           dword_507B98_ctrl_pressed = 0;
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
-        goto _def_wnd_proc;
+        //goto _def_wnd_proc;
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
       if ( Msg != WM_COMMAND )
-        goto _def_wnd_proc;
+        //goto _def_wnd_proc;
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       if ( wParam != 101 )
       {
         if ( wParam == 103 )
@@ -7088,7 +7132,7 @@
             return 0;
           v38 = 0;
           v37 = 104;
-LABEL_126:
+//LABEL_126:
           v36 = 273;
           v35 = hWnd;
           SendMessageA(hWnd, WM_COMMAND, v37, v38);
@@ -7118,24 +7162,116 @@
           if ( !v24 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 123;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v25 = v24 - 1;
           if ( !v25 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 124;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v26 = v25 - 1;
           if ( !v26 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 125;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           if ( v26 == 3 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 126;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
         }
         else
@@ -7143,30 +7279,145 @@
           if ( v13 == 61 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 43;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v21 = v13 - 55;
           if ( !v21 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 38;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v22 = v21 - 1;
           if ( !v22 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 42;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v23 = v22 - 1;
           if ( !v23 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 40;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           if ( v23 == 2 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 58;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
         }
       }
@@ -7175,7 +7426,30 @@
         if ( (unsigned __int16)v13 == 54 )
         {
           LOBYTE(pArcomageGame->stru1.field_8) = 94;
-          goto LABEL_181;
+          //goto LABEL_181;
+          if ( wParam == 27 )
+          {
+            pArcomageGame->field_F5 = 1;
+            pArcomageGame->field_F4 = 1;
+            pArcomageGame->uGameResult = 2;
+            pArcomageGame->field_B0 = -2;
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
+          }
+          if ( wParam != 114 )
+          {
+            if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+              SendMessageA(hWnd, 0x111u, 0x68u, 0);
+            //goto _def_wnd_proc;
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
+          }
+          v38 = 0;
+          v37 = 103;
+          //goto LABEL_126;
+          v36 = 273;
+          v35 = hWnd;
+          SendMessageA(hWnd, WM_COMMAND, v37, v38);
+          return 0;
         }
         if ( v13 > 49 )
         {
@@ -7183,24 +7457,116 @@
           if ( !v18 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 64;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v19 = v18 - 1;
           if ( !v19 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 35;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v20 = v19 - 1;
           if ( !v20 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 36;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           if ( v20 == 1 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 37;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
         }
         else
@@ -7208,60 +7574,204 @@
           if ( v13 == 49 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 33;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v14 = v13 - 39;
           if ( !v14 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 34;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v15 = v14 - 5;
           if ( !v15 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 60;
-            goto LABEL_181;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
           v16 = v15 - 2;
           if ( !v16 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 62;
-            goto LABEL_181;
-          }
-          v17 = v16 - 1;
-          if ( !v17 )
-          {
-            LOBYTE(pArcomageGame->stru1.field_8) = 63;
-            goto LABEL_181;
-          }
-          if ( v17 == 1 )
-          {
-            LOBYTE(pArcomageGame->stru1.field_8) = 41;
-LABEL_181:
+            //goto LABEL_181;
             if ( wParam == 27 )
             {
               pArcomageGame->field_F5 = 1;
               pArcomageGame->field_F4 = 1;
               pArcomageGame->uGameResult = 2;
               pArcomageGame->field_B0 = -2;
-              goto _def_wnd_proc;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
+          }
+          v17 = v16 - 1;
+          if ( !v17 )
+          {
+            LOBYTE(pArcomageGame->stru1.field_8) = 63;
+            //goto LABEL_181;
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
             if ( wParam != 114 )
             {
               if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
                 SendMessageA(hWnd, 0x111u, 0x68u, 0);
-              goto _def_wnd_proc;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
             v38 = 0;
             v37 = 103;
-            goto LABEL_126;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
+          }
+          if ( v17 == 1 )
+          {
+            LOBYTE(pArcomageGame->stru1.field_8) = 41;
+//LABEL_181:
+            if ( wParam == 27 )
+            {
+              pArcomageGame->field_F5 = 1;
+              pArcomageGame->field_F4 = 1;
+              pArcomageGame->uGameResult = 2;
+              pArcomageGame->field_B0 = -2;
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            if ( wParam != 114 )
+            {
+              if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+                SendMessageA(hWnd, 0x111u, 0x68u, 0);
+              //goto _def_wnd_proc;
+              return DefWindowProcA(hWnd, Msg, wParam, lParam);
+            }
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
+            return 0;
           }
         }
       }
       v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u);
     }
     LOBYTE(pArcomageGame->stru1.field_8) = v27;
-    goto LABEL_181;
+    //goto LABEL_181;
+    if ( wParam == 27 )
+    {
+      pArcomageGame->field_F5 = 1;
+      pArcomageGame->field_F4 = 1;
+      pArcomageGame->uGameResult = 2;
+      pArcomageGame->field_B0 = -2;
+      //goto _def_wnd_proc;
+      return DefWindowProcA(hWnd, Msg, wParam, lParam);
+    }
+    if ( wParam != 114 )
+    {
+      if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() )
+      SendMessageA(hWnd, 0x111u, 0x68u, 0);
+      //goto _def_wnd_proc;
+      return DefWindowProcA(hWnd, Msg, wParam, lParam);
+    }
+    v38 = 0;
+    v37 = 103;
+    //goto LABEL_126;
+    v36 = 273;
+    v35 = hWnd;
+    SendMessageA(hWnd, WM_COMMAND, v37, v38);
+    return 0;
   }
   if ( Msg == WM_ACTIVATEAPP )
   {
@@ -7314,8 +7824,8 @@
     {
       if ( !(dword_6BE364_game_settings_1 & 0x100) )
       {
-	  while(initing); //ADDED spinlock to allow int players ets! Gloval
-        dword_4E98BC_bApplicationActive = 0;
+        while(initing); //ADDED spinlock to allow int players ets! Gloval
+          dword_4E98BC_bApplicationActive = 0;
         if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie )
           pVideoPlayer->bStopBeforeSchedule = 1;
         if (pAsyncMouse)
@@ -7387,7 +7897,7 @@
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
     }
-_def_wnd_proc:
+//_def_wnd_proc:
     return DefWindowProcA(hWnd, Msg, wParam, lParam);
   }
   if ( Msg != WM_KILLFOCUS )
@@ -7405,21 +7915,27 @@
       else
       {
         if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() )
-          goto LABEL_20;
+          //goto LABEL_20;
+        {
+          EndPaint(hWnd, &Paint);
+          return 0;
+        }
         v5 = pRenderer;
       }
       pRenderer->Present();
-LABEL_20:
+//LABEL_20:
       EndPaint(hWnd, &Paint);
       return 0;
     }
-    goto _def_wnd_proc;
+    //goto _def_wnd_proc;
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   }
   if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse )
     return DefWindowProcA(hWnd, Msg, wParam, lParam);
   pAsyncMouse->Resume();
   if ( !pAsyncMouse )
-    goto _def_wnd_proc;
+    //goto _def_wnd_proc;
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   pAsyncMouse->Clip();
   return DefWindowProcA(hWnd, Msg, wParam, lParam);
 }