diff Keyboard.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents 0aeac0b9ca30
children 2ca62c9e7b3c
line wrap: on
line diff
--- a/Keyboard.cpp	Tue Jun 18 17:28:11 2013 +0600
+++ b/Keyboard.cpp	Wed Jun 19 17:06:58 2013 +0600
@@ -9,10 +9,13 @@
 #include "OSInfo.h"
 
 #include "mm7_data.h"
-
-
-
-
+#include "Vis.h"
+#include "MM7.h"
+#include "Actor.h"
+#include "DecorationList.h"
+#include "Indoor.h"
+#include "viewport.h"
+#include "AudioPlayer.h"
 
 
 struct KeyboardActionMapping *pKeyActionMap;
@@ -958,3 +961,144 @@
 {
   return GetAsyncKeyState(vKey) & 1;
 }
+//----- (0046A14B) --------------------------------------------------------
+void OnPressSpace()
+{
+  //SHORT v0; // ax@2
+  int *v1; // eax@2
+  char *v2; // ebx@5
+  unsigned int v3; // esi@5
+  signed int v4; // edi@7
+  unsigned int v5; // edx@7
+  int v6; // ecx@8
+  int v7; // eax@8
+  int v8; // ecx@17
+  int *v9; // esi@22
+  signed int v10; // ebx@22
+  int i; // edi@23
+  int v12; // edx@24
+  int v13; // ecx@24
+  int j; // esi@28
+  int v16; // [sp+4h] [bp-1Ch]@0
+  char *v17; // [sp+8h] [bp-18h]@5
+  unsigned int v18; // [sp+Ch] [bp-14h]@5
+  int v19; // [sp+10h] [bp-10h]@8
+  int *v20; // [sp+14h] [bp-Ch]@5
+  int *v21; // [sp+18h] [bp-8h]@7
+  int v22; // [sp+1Ch] [bp-4h]@4
+
+  if ( pRenderer->pRenderD3D )
+  {
+    pGame->PickKeyboard(GetAsyncKeyState(VK_CONTROL) & 0x8001, &vis_sprite_filter_3, &vis_door_filter);
+    auto pid = pGame->pVisInstance->get_picked_object_zbuf_val();
+    if ( pid != -1 )
+      DoInteractionWithTopmostZObject(pid & 0xFFFF, PID_ID(pid));
+    return;
+  }
+
+  
+  // software render stuff following
+
+  static int dword_720660[100]; // 720660
+  static int dword_7207F0[100]; // 7207F0
+
+  v22 = 0;
+  v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer
+  if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
+  {
+	  v2 = (char *)v1 - 50;
+	  v1 = (int *)((char *)v1 + 50);
+	  v3 = 640 * viewparams->uScreen_topL_Y;
+	  v17 = v2;
+	  v20 = v1;
+	  v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1;
+	  do
+	  {
+		if ( (signed int)v2 < (signed int)v20 )
+		{
+			v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
+			v4 = v22;
+			v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
+			do
+			{
+			  v6 = 0;
+			  v7 = *v1 & 0xFFFF;
+			  v19 = 0;
+			  if ( v4 > 0 )
+			  {
+				do
+				{
+				  if ( dword_7207F0[v6] == v7 )
+					break;
+				  ++v6;
+				  v19 = v6;
+				}
+				while ( v6 < v22 );
+			  }
+			  if ( PID_TYPE(v7) == OBJECT_Decoration)
+			  {
+				v16 = (unsigned int)PID_ID(v7);
+				if ( (signed int)(((unsigned int)*v21 >> 16)
+								- pDecorationList->pDecorations[pLevelDecorations[(unsigned int)PID_ID(v7)].uDecorationDescID].uRadius) <= 512 )
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207F0[v4 - 1] = v7;
+					dword_720660[v4 - 1] = v8;
+				  }
+			  }
+			  else if ( (unsigned int)*v21 <= 0x2000000 )
+			  {
+				  if ( v19 == v22 && v4 < 100 )
+				  {
+					++v22;
+					++v4;
+					v8 = *v21;
+					dword_7207F0[v4 - 1] = v7;
+					dword_720660[v4 - 1] = v8;
+				  }
+			  }
+			  v1 = v21 + 2;
+			  --v5;
+			  v21 += 2;
+			}
+			while ( v5 );
+			v2 = v17;
+		}
+		v3 += 1280;
+		--v18;
+	  }
+	  while ( v18 );
+  }
+  if ( v22 > 0 )
+  {
+    v9 = dword_720660;
+    v10 = 1;
+    do
+    {
+      for ( i = v10; i < v22; ++i )
+      {
+        v12 = *v9;
+        v13 = dword_720660[i];
+        if ( v13 < *v9 )
+        {
+          *v9 = v13;
+          dword_720660[i] = v12;
+        }
+      }
+      ++v10;
+      ++v9;
+      LOBYTE(v1) = v10 - 1;
+    }
+    while ( v10 - 1 < v22 );
+  }
+  for ( j = 0; j < v22; ++j )
+  {
+    LOBYTE(v1) = DoInteractionWithTopmostZObject(dword_720660[j] & 0xFFFF, v16);
+    if ( !(char)v1 )
+      break;
+  }
+}