Mercurial > mm7
comparison Keyboard.cpp @ 1297:5450af4f57ef
moving files mm7_x ending
author | Ritor1 |
---|---|
date | Wed, 19 Jun 2013 17:06:58 +0600 |
parents | 0aeac0b9ca30 |
children | 2ca62c9e7b3c |
comparison
equal
deleted
inserted
replaced
1296:c423f946dc99 | 1297:5450af4f57ef |
---|---|
7 #include "GUIWindow.h" | 7 #include "GUIWindow.h" |
8 #include "Game.h" | 8 #include "Game.h" |
9 #include "OSInfo.h" | 9 #include "OSInfo.h" |
10 | 10 |
11 #include "mm7_data.h" | 11 #include "mm7_data.h" |
12 | 12 #include "Vis.h" |
13 | 13 #include "MM7.h" |
14 | 14 #include "Actor.h" |
15 | 15 #include "DecorationList.h" |
16 #include "Indoor.h" | |
17 #include "viewport.h" | |
18 #include "AudioPlayer.h" | |
16 | 19 |
17 | 20 |
18 struct KeyboardActionMapping *pKeyActionMap; | 21 struct KeyboardActionMapping *pKeyActionMap; |
19 struct AsyncKeyboard *pAsyncKeyboard; | 22 struct AsyncKeyboard *pAsyncKeyboard; |
20 | 23 |
956 //----- (0045B0CE) -------------------------------------------------------- | 959 //----- (0045B0CE) -------------------------------------------------------- |
957 bool Keyboard::WasKeyPressed(int vKey) | 960 bool Keyboard::WasKeyPressed(int vKey) |
958 { | 961 { |
959 return GetAsyncKeyState(vKey) & 1; | 962 return GetAsyncKeyState(vKey) & 1; |
960 } | 963 } |
964 //----- (0046A14B) -------------------------------------------------------- | |
965 void OnPressSpace() | |
966 { | |
967 //SHORT v0; // ax@2 | |
968 int *v1; // eax@2 | |
969 char *v2; // ebx@5 | |
970 unsigned int v3; // esi@5 | |
971 signed int v4; // edi@7 | |
972 unsigned int v5; // edx@7 | |
973 int v6; // ecx@8 | |
974 int v7; // eax@8 | |
975 int v8; // ecx@17 | |
976 int *v9; // esi@22 | |
977 signed int v10; // ebx@22 | |
978 int i; // edi@23 | |
979 int v12; // edx@24 | |
980 int v13; // ecx@24 | |
981 int j; // esi@28 | |
982 int v16; // [sp+4h] [bp-1Ch]@0 | |
983 char *v17; // [sp+8h] [bp-18h]@5 | |
984 unsigned int v18; // [sp+Ch] [bp-14h]@5 | |
985 int v19; // [sp+10h] [bp-10h]@8 | |
986 int *v20; // [sp+14h] [bp-Ch]@5 | |
987 int *v21; // [sp+18h] [bp-8h]@7 | |
988 int v22; // [sp+1Ch] [bp-4h]@4 | |
989 | |
990 if ( pRenderer->pRenderD3D ) | |
991 { | |
992 pGame->PickKeyboard(GetAsyncKeyState(VK_CONTROL) & 0x8001, &vis_sprite_filter_3, &vis_door_filter); | |
993 auto pid = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
994 if ( pid != -1 ) | |
995 DoInteractionWithTopmostZObject(pid & 0xFFFF, PID_ID(pid)); | |
996 return; | |
997 } | |
998 | |
999 | |
1000 // software render stuff following | |
1001 | |
1002 static int dword_720660[100]; // 720660 | |
1003 static int dword_7207F0[100]; // 7207F0 | |
1004 | |
1005 v22 = 0; | |
1006 v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1);//wrong pointer | |
1007 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
1008 { | |
1009 v2 = (char *)v1 - 50; | |
1010 v1 = (int *)((char *)v1 + 50); | |
1011 v3 = 640 * viewparams->uScreen_topL_Y; | |
1012 v17 = v2; | |
1013 v20 = v1; | |
1014 v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; | |
1015 do | |
1016 { | |
1017 if ( (signed int)v2 < (signed int)v20 ) | |
1018 { | |
1019 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; | |
1020 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; | |
1021 v4 = v22; | |
1022 v5 = (((char *)v20 - v2 - 1) >> 1) + 1; | |
1023 do | |
1024 { | |
1025 v6 = 0; | |
1026 v7 = *v1 & 0xFFFF; | |
1027 v19 = 0; | |
1028 if ( v4 > 0 ) | |
1029 { | |
1030 do | |
1031 { | |
1032 if ( dword_7207F0[v6] == v7 ) | |
1033 break; | |
1034 ++v6; | |
1035 v19 = v6; | |
1036 } | |
1037 while ( v6 < v22 ); | |
1038 } | |
1039 if ( PID_TYPE(v7) == OBJECT_Decoration) | |
1040 { | |
1041 v16 = (unsigned int)PID_ID(v7); | |
1042 if ( (signed int)(((unsigned int)*v21 >> 16) | |
1043 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)PID_ID(v7)].uDecorationDescID].uRadius) <= 512 ) | |
1044 if ( v19 == v22 && v4 < 100 ) | |
1045 { | |
1046 ++v22; | |
1047 ++v4; | |
1048 v8 = *v21; | |
1049 dword_7207F0[v4 - 1] = v7; | |
1050 dword_720660[v4 - 1] = v8; | |
1051 } | |
1052 } | |
1053 else if ( (unsigned int)*v21 <= 0x2000000 ) | |
1054 { | |
1055 if ( v19 == v22 && v4 < 100 ) | |
1056 { | |
1057 ++v22; | |
1058 ++v4; | |
1059 v8 = *v21; | |
1060 dword_7207F0[v4 - 1] = v7; | |
1061 dword_720660[v4 - 1] = v8; | |
1062 } | |
1063 } | |
1064 v1 = v21 + 2; | |
1065 --v5; | |
1066 v21 += 2; | |
1067 } | |
1068 while ( v5 ); | |
1069 v2 = v17; | |
1070 } | |
1071 v3 += 1280; | |
1072 --v18; | |
1073 } | |
1074 while ( v18 ); | |
1075 } | |
1076 if ( v22 > 0 ) | |
1077 { | |
1078 v9 = dword_720660; | |
1079 v10 = 1; | |
1080 do | |
1081 { | |
1082 for ( i = v10; i < v22; ++i ) | |
1083 { | |
1084 v12 = *v9; | |
1085 v13 = dword_720660[i]; | |
1086 if ( v13 < *v9 ) | |
1087 { | |
1088 *v9 = v13; | |
1089 dword_720660[i] = v12; | |
1090 } | |
1091 } | |
1092 ++v10; | |
1093 ++v9; | |
1094 LOBYTE(v1) = v10 - 1; | |
1095 } | |
1096 while ( v10 - 1 < v22 ); | |
1097 } | |
1098 for ( j = 0; j < v22; ++j ) | |
1099 { | |
1100 LOBYTE(v1) = DoInteractionWithTopmostZObject(dword_720660[j] & 0xFFFF, v16); | |
1101 if ( !(char)v1 ) | |
1102 break; | |
1103 } | |
1104 } |