diff mm7_4.cpp @ 3:540178ef9b18

Main menu functionality
author Nomad
date Wed, 10 Oct 2012 19:10:15 +0200
parents 2ca04ccb612a
children 509744251c8e
line wrap: on
line diff
--- a/mm7_4.cpp	Wed Oct 10 14:21:15 2012 +0200
+++ b/mm7_4.cpp	Wed Oct 10 19:10:15 2012 +0200
@@ -2860,20 +2860,14 @@
 //----- (0048B561) --------------------------------------------------------
 int _48B561_mess_with_scaling_along_z(/*int a1, */float a2)
 {
-  float v2; // ST08_4@1
-  double v3; // ST00_8@1
-  int v4; // ST0C_4@1
-  double v5; // ST00_8@1
-  float v7; // [sp+18h] [bp+8h]@1
-
-  __debugbreak(); // check parameters carefully
-
-  v2 = a2 - 0.5;
-  v3 = v2 + 6.7553994e15;
-  v4 = LODWORD(v3);
-  v7 = (a2 - (double)SLODWORD(v3)) * 65536.0;
-  v5 = v7 + 6.7553994e15;
-  return LODWORD(v5) | (v4 << 16);
+  //v2 = a2 - 0.5;
+  //v3 = v2 + 6.7553994e15;
+  int v4 = floorf(a2 - 0.5f + 0.5f);
+  //v7 = (a2 - (double)SLODWORD(v3)) * 65536.0;
+  //v5 = v7 + 6.7553994e15;
+  //return LODWORD(v5) | (v4 << 16);
+  int v5 = floorf((a2 - v4) * 65536.0f + 0.5f);
+  return v5 | (v4 << 16);
 }
 
 
@@ -6739,7 +6733,7 @@
   unsigned int teal; // eax@19
   //Texture v12; // [sp+Ch] [bp-130h]@5
   //RGBTexture v16; // [sp+54h] [bp-E8h]@1
-  double v15; // [sp+7Ch] [bp-C0h]@9
+  //double v15; // [sp+7Ch] [bp-C0h]@9
   MSG Msg; // [sp+84h] [bp-B8h]@10
   int v17; // [sp+A0h] [bp-9Ch]@9
   int a2; // [sp+A4h] [bp-98h]@9
@@ -6769,7 +6763,7 @@
   if ( !pIcons_LOD->uNumPrevLoadedFiles )
     pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
   dword_A74C88 = 0;
-  pAudioPlayer->PlayMusicTrack(0xFu);
+  pAudioPlayer->PlayMusicTrack(MUSIC_Credits);
   v16.Load("mm6title.pcx", 0);
   v0 = (char *)pEvents_LOD->LoadRaw("credits.txt", 0);
   v1 = v0;
@@ -6803,7 +6797,8 @@
   v21.pPixels = (unsigned __int16 *)v7;
   v9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu);
   fill_pixels_fast(v9, v21.pPixels, v8);
-  *(int *)&v21.field_20 = 0;
+  v21.field_20 = 0;
+  v21.field_22 = 0;
   a7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x70u, 0x8Fu, 0xFEu);
   a8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xECu, 0xE6u, 0x9Cu);
   pString = (char *)operator new(2 * v3);
@@ -6832,10 +6827,10 @@
     v21.pPixels,
     (signed __int16)v21.uWidth);
   free(pString);
-  pWindow_Credits = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr);
-  pWindow_Credits->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, nullstring, 0);
+  pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr);
+  pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, nullstring, 0);
   uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 9;
-  SetCurrentMenuID(8u);
+  SetCurrentMenuID(MENU_Credits);
   pRenderer->BeginScene();
   pRenderer->DrawTextureRGB(0, 0, &v16);
   pRenderer->Clip(a2, a3, a2 + v20, a3 + a4);
@@ -6843,8 +6838,8 @@
   pRenderer->ResetClip();
   pRenderer->EndScene();
   pString = (char *)0x447A0000;
-  v15 = 1000.0 + 6.7553994e15;
-  v17 = LODWORD(v15);
+  //v15 = 1000.0 + 6.7553994e15;
+  v17 = floorf(1000.0f + 0.5f);//(v15);
   GetTickCount();
   pRenderer->Present();
   do
@@ -6928,11 +6923,11 @@
   pAllocator->FreeChunk(ptr);
   pAllocator->FreeChunk(pFontQuick);
   pAllocator->FreeChunk(pFontCChar);
-  pWindow_Credits->Release();
+  pWindow_MainMenu->Release();
   pIcons_LOD->_4114F2();
   v16.Release();
   v21.Release();
-  return (MENU_STATE)(GetCurrentMenuID() - (int)MENU_Credits);     // return MENU_Main
+  return MENU_MAIN;     // return MENU_Main
 }