diff mm7_1.cpp @ 1030:7735bdb3c30f

Doors and other bmodel triggers are now clickable.
author Nomad
date Tue, 21 May 2013 12:52:38 +0200
parents 9ac94d00012e
children 39f42990698f 76ce871b0076
line wrap: on
line diff
--- a/mm7_1.cpp	Tue May 21 12:10:08 2013 +0200
+++ b/mm7_1.cpp	Tue May 21 12:52:38 2013 +0200
@@ -984,7 +984,7 @@
 }
 
 //----- (0042213C) --------------------------------------------------------
-void __cdecl OnGameViewportClick()
+void OnGameViewportClick()
 {
   signed int v0; // ebx@2
   POINT *v1; // esi@3
@@ -1086,14 +1086,14 @@
     }
     else
     {
-      if ( PID_TYPE(v0) != OBJECT_BModel || (signed)v0 >= 0x2000000 )
+      if ( PID_TYPE(v0) != OBJECT_BModel || HIWORD(v0) >= 512 )
 	  {
           v4 = pParty->pPickedItem.uItemID;
           if ( !pParty->pPickedItem.uItemID )
             return;
           goto LABEL_14;
 	  }
-      v2 = (signed int)(unsigned __int16)v0 >> 3;
+      v2 = PID_ID(v0);
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
       {
         v3 = &pIndoor->pFaces[v2];
@@ -1160,8 +1160,8 @@
       }
       else
       {
-        v12 = &pOutdoor->pBModels[(signed int)(unsigned __int16)v0 >> 9].pFaces[v2 & 0x3F];
-        if ( !(v12->uAttributes & 0x2000000) )
+        v12 = &pOutdoor->pBModels[(signed int)(v0 & 0xFFFF) >> 9].pFaces[v2 & 0x3F];
+        if ( !v12->Clickable())
           goto LABEL_11;
         v11 = v12->sCogTriggeredID;
       }
@@ -1188,7 +1188,7 @@
   {
     if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) )
     {
-      if ( (unsigned int)v0 >= 0x2000000 )
+      if ( HIWORD(v0) >= 512)
 	  {
           v4 = pParty->pPickedItem.uItemID;
           if ( !pParty->pPickedItem.uItemID )