changeset 696:4e1b2a24a6e3

GUIWindow::Release clean
author zipi
date Sun, 17 Mar 2013 13:57:46 +0000
parents af0332a32034
children 2dfb67633b01
files GUIWindow.cpp
diffstat 1 files changed, 65 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sun Mar 17 11:59:37 2013 +0000
+++ b/GUIWindow.cpp	Sun Mar 17 13:57:46 2013 +0000
@@ -294,11 +294,6 @@
 void GUIWindow::Release()
 {
   GUIWindow *v1; // esi@1
-  unsigned int v2; // eax@2
-  int v3; // eax@5
-  int v4; // eax@6
-  int v5; // eax@14
-  int v6; // eax@15
   int i; // edi@20
   GUIButton *v8; // eax@26
   GUIButton *v9; // edi@27
@@ -309,82 +304,78 @@
   v1 = this;
   if ( !this )
     return;
-  v2 = this->eWindowType;
-  if ( (signed int)v2 > 18 )
+  
+  switch( this->eWindowType )
   {
-    v5 = v2 - 19;
-    if ( !v5 )
-    {
-      pIcons_LOD->_40F9C5();
-      pCurrentScreen = pMainScreenNum;
-      pKeyActionMap->_459ED1(3);
-      goto LABEL_26;
-    }
-    v6 = v5 - 6;
-    if ( !v6 )
-    {
-      for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
-        pDialogueNPCPortraits[i]->Release();
-      uNumDialogueNPCPortraits = 0;
-      pTexture_Dialogue_Background->Release();
+	case WINDOW_GreetingNPC:
+		{
+		pIcons_LOD->_40F9C5();
+		pCurrentScreen = pMainScreenNum;
+		pKeyActionMap->_459ED1(3);
+		break;
+		}
+	case WINDOW_HouseInterior:
+		{
+		for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
+			pDialogueNPCPortraits[i]->Release();
+		uNumDialogueNPCPortraits = 0;
+		pTexture_Dialogue_Background->Release();
 
-      pIcons_LOD->_40F9C5();
-      pIcons_LOD->_4114F2();
-      dword_5C35D4 = 0;
-      if ( bFlipOnExit )
-      {
-        pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi
-                                                                       + pIndoorCamera->sRotationY);
-        pParty->sRotationY = pIndoorCamera->sRotationY;
-      }
-      pParty->uFlags |= 2u;
-      goto LABEL_26;
-    }
-    if ( v6 == 1 )
-    {
-      pVideoPlayer->Unload();
-      goto LABEL_18;
-    }
-  }
-  else
-  {
-    if ( v2 == 18 )
-    {
-      sub_41140B();
-      sub_411473();
-    }
-    else
-    {
-      if ( !v2 )
-        return;
-      v3 = v2 - 9;
-      if ( v3 )
-      {
-        v4 = v3 - 1;
-        if ( !v4 )
-        {
-          if ( !dword_591084 )
-            pDialogueNPCPortraits[0]->Release();
-          uNumDialogueNPCPortraits = 0;
-          pTexture_Dialogue_Background->Release();
-
-          pIcons_LOD->_40F9C5();
-          goto LABEL_19;
-        }
-        if ( v4 != 7 )
-          goto LABEL_26;
-LABEL_18:
+		pIcons_LOD->_40F9C5();
+		pIcons_LOD->_4114F2();
+		dword_5C35D4 = 0;
+		if ( bFlipOnExit )
+		{
+			pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi
+																			+ pIndoorCamera->sRotationY);
+			pParty->sRotationY = pIndoorCamera->sRotationY;
+		}
+		pParty->uFlags |= 2u;
+		break;
+		}
+	case WINDOW_Transition:
+		{
+		pVideoPlayer->Unload();
+		pTexture_outside->Release();
+		pTexture_Dialogue_Background->Release();
+		pIcons_LOD->_40F9C5();
+		pCurrentScreen = pMainScreenNum;
+		break;
+		}
+	case WINDOW_SpellBook:
+		{
+		sub_41140B();
+		sub_411473();
+		break;
+		}
+	case WINDOW_Book:
+		{
+		OnCloseSpellook();
+		break;
+		}
+	case WINDOW_ChangeLocation:
+		{
         pTexture_outside->Release();
         pTexture_Dialogue_Background->Release();
         pIcons_LOD->_40F9C5();
-LABEL_19:
         pCurrentScreen = pMainScreenNum;
-        goto LABEL_26;
-      }
-      OnCloseSpellook();
-    }
+        break;
+		}
+	case WINDOW_Dialogue:
+		{
+        if ( !dword_591084 )
+	        pDialogueNPCPortraits[0]->Release();
+        uNumDialogueNPCPortraits = 0;
+        pTexture_Dialogue_Background->Release();
+
+        pIcons_LOD->_40F9C5();
+        pCurrentScreen = pMainScreenNum;
+		}
+	default:
+		{
+		break;
+		}
   }
-LABEL_26:
   v8 = v1->pControlsHead;
   if ( v8 )
   {