changeset 2002:2e6c63bdcfa9

RenderBillboardD3D initialization Viewport initialization some more constructor functions
author zipi
date Tue, 05 Nov 2013 23:35:21 +0000
parents 79cdb74efa93
children 72af4d93bdfb
files ParticleEngine.cpp Render.cpp Render.h UI/UIPopup.cpp Vis.cpp mm7_3.cpp mm7_7.cpp stru6.cpp
diffstat 8 files changed, 97 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/ParticleEngine.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/ParticleEngine.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -632,7 +632,7 @@
   //Particle *v14; // eax@28
   RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1
 
-  v15.uParentBillboardID = -1;
+  v15.sParentBillboardID = -1;
 
   for (uint i = uStartParticle; i < uEndParticle; ++i)
   {
@@ -746,7 +746,7 @@
   //int v15; // [sp+5Ch] [bp-8h]@9
   int v16; // [sp+60h] [bp-4h]@1
 
-  pBillboard.uParentBillboardID = -1;
+  pBillboard.sParentBillboardID = -1;
   pParticleEngine = this;
   //v2 = this->uStartParticle;
   //v5 = v2 > this->uEndParticle;//  v5 = __OFSUB__(v2, this->uEndParticle);
--- a/Render.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/Render.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -128,6 +128,35 @@
   return v0;
 }
 
+void Render::sub_4A19B0()
+{
+  char *result; // eax@1
+  signed int v1; // ecx@1
+  /*
+  result = (char *)&this->pBillboardRenderListD3D[0].uOpacity;
+  v1 = 1000;
+  do
+  {
+    *(_DWORD *)result = 0;
+    *((_DWORD *)result + 1) = -1;
+    *((_DWORD *)result + 3) = -1;
+    *((_DWORD *)result - 34) = 4;
+    result += 156;
+    --v1;
+  }
+  while ( v1 );
+  */
+  for( int i = 0; i < 1000; i++ )
+  {
+	this->pBillboardRenderListD3D[i].uOpacity = (RenderBillboardD3D::OpacityType)0;
+	this->pBillboardRenderListD3D[i].field_90 = -1;
+	this->pBillboardRenderListD3D[i].sParentBillboardID = -1;
+	this->pBillboardRenderListD3D[i].uNumVertices = 4;
+  }
+
+  return;
+}
+
 //----- (00440CB8) --------------------------------------------------------
 void Render::DrawBillboardList_BLV()
 {
@@ -135,7 +164,7 @@
   int v5; // eax@11
   RenderBillboardTransform_local0 soft_billboard; // [sp+4h] [bp-50h]@1
 
-  soft_billboard.uParentBillboardID = -1;
+  soft_billboard.sParentBillboardID = -1;
   soft_billboard.pTarget = pBLVRenderParams->pRenderTarget;
   soft_billboard.pTargetZ = pBLVRenderParams->pTargetZBuffer;
   soft_billboard.uTargetPitch = pRenderer->uTargetSurfacePitch;
@@ -150,7 +179,7 @@
     RenderBillboard* p = &pBillboardRenderList[i];
 
       soft_billboard.uScreenSpaceX = p->uScreenSpaceX;
-      soft_billboard.uParentBillboardID = i;
+      soft_billboard.sParentBillboardID = i;
       soft_billboard.uScreenSpaceY = p->uScreenSpaceY;
       soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat;
       soft_billboard._screenspace_y_scaler_packedfloat = p->_screenspace_y_scaler_packedfloat;
@@ -378,7 +407,7 @@
   //int v17; // [sp+5Ch] [bp-8h]@2
   int v18; // [sp+60h] [bp-4h]@13
 
-  billboard.uParentBillboardID = -1;
+  billboard.sParentBillboardID = -1;
   billboard.pTarget = pRenderer->pTargetSurface;
   billboard.pTargetZ = pRenderer->pActiveZBuffer;
   billboard.uTargetPitch = pRenderer->uTargetSurfacePitch;
@@ -394,7 +423,7 @@
 
     billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;
     billboard.uScreenSpaceY = pBillboard->uScreenSpaceY;
-    billboard.uParentBillboardID = i;
+    billboard.sParentBillboardID = i;
     billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat;
     billboard.uTintColor = pBillboard->uTintColor;
     billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat;
@@ -2095,6 +2124,7 @@
 
   hd_water_tile_id = -1;
   hd_water_current_frame = 0;
+  sub_4A19B0();
 }
 
 bool Render::Initialize(bool bWindowed, OSWindow *window, bool bColoredLights, uint32_t uDetailLevel, bool bTinting)
@@ -4508,7 +4538,7 @@
 //----- (004A1EA3) --------------------------------------------------------
 unsigned int Render::GetParentBillboardID(unsigned int uBillboardID)
 {
-  return pRenderer->pBillboardRenderListD3D[uBillboardID].uParentBillboardID;
+  return pRenderer->pBillboardRenderListD3D[uBillboardID].sParentBillboardID;
 }
 
 //----- (004A1EB6) --------------------------------------------------------
@@ -5597,7 +5627,7 @@
     //v10 = a3;
     pBillboardRenderListD3D[v7].field_90 = pSoftBillboard->field_44;
     pBillboardRenderListD3D[v7].sZValue = pSoftBillboard->sZValue;
-    pBillboardRenderListD3D[v7].uParentBillboardID = pSoftBillboard->uParentBillboardID;
+    pBillboardRenderListD3D[v7].sParentBillboardID = pSoftBillboard->sParentBillboardID;
     //v25 = pSoftBillboard->uScreenSpaceX;
     //v24 = pSoftBillboard->uScreenSpaceY;
     a1 = (pSoftBillboard->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(pSoftBillboard->_screenspace_x_scaler_packedfloat);
@@ -5730,7 +5760,7 @@
       pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1;
       pBillboardRenderListD3D[v8].field_90 = a2->field_44;
       pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-      pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
+      pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
       //v9 = a2->uScreenSpaceX;
       //v10 = a2->uScreenSpaceY;
       v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat);
@@ -5903,7 +5933,7 @@
     pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1;
     pBillboardRenderListD3D[v8].field_90 = a2->field_44;
     pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-    pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
+    pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
     v9 = a2->uScreenSpaceX;
     v10 = a2->uScreenSpaceY;
     v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat);
@@ -6117,7 +6147,7 @@
   pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth;
   pBillboardRenderListD3D[v8].field_90 = a2->field_44;
   pBillboardRenderListD3D[v8].sZValue = a2->sZValue;
-  pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID;
+  pBillboardRenderListD3D[v8].sParentBillboardID = a2->sParentBillboardID;
 
   if (a2->uTintColor & 0xFF000000)
     pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_3;
@@ -6306,7 +6336,7 @@
 
   v5 = Billboard_ProbablyAddToListAndSortByZOrder(depth);
   pBillboardRenderListD3D[v5].field_90 = 0;
-  pBillboardRenderListD3D[v5].uParentBillboardID = -1;
+  pBillboardRenderListD3D[v5].sParentBillboardID = -1;
   pBillboardRenderListD3D[v5].uOpacity = RenderBillboardD3D::Opaque_2;
   pBillboardRenderListD3D[v5].pTexture = 0;
   pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
--- a/Render.h	Tue Nov 05 22:07:34 2013 +0000
+++ b/Render.h	Tue Nov 05 23:35:21 2013 +0000
@@ -203,7 +203,7 @@
   OpacityType uOpacity;
   int field_90;
   int sZValue;
-  unsigned int uParentBillboardID;
+  signed int sParentBillboardID;
 };
 #pragma pack(pop)
 
@@ -369,7 +369,7 @@
   //void ExecOutdoorDrawSW();
   void ChangeBetweenWinFullscreenModes();
   void DrawBillboardList_BLV();
-
+  void __cdecl sub_4A19B0();
 
   //unsigned int bUserDirect3D;
   unsigned int bStartInWindow;
@@ -498,7 +498,7 @@
   unsigned int uViewportZ;
   unsigned int uViewportW;
   int field_44;
-  int uParentBillboardID;
+  int sParentBillboardID;
   int uTintColor;
 };
 #pragma pack(pop)
--- a/UI/UIPopup.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/UI/UIPopup.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -473,7 +473,7 @@
     Actor::Actor(&pMonsterInfoUI_Doll);
     atexit(nullsub_3);
   }*/
-  v106.uParentBillboardID = -1;
+  v106.sParentBillboardID = -1;
   v115 = monster_popup_y_offsets[((signed __int16)pActors[uActorID].pMonsterInfo.uID - 1) / 3] - 40;
   if ( pActors[uActorID].pMonsterInfo.uID == pMonsterInfoUI_Doll.pMonsterInfo.uID )
     v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
--- a/Vis.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/Vis.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -132,8 +132,8 @@
     {
       if (v13 == -1)
         v13 = i;
-      else  if ((unsigned int)pBillboardRenderList[billboard->uParentBillboardID].sZValue < 
-                  pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue)
+      else  if ((unsigned int)pBillboardRenderList[billboard->sParentBillboardID].sZValue < 
+                  pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].sParentBillboardID].sZValue)
         v13 = i;
     }
   }
@@ -221,9 +221,9 @@
     {
       if (DoesRayIntersectBillboard(fPickDepth, i))
       {
-        RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->uParentBillboardID];
+        RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->sParentBillboardID];
 
-        list->AddObject((void *)d3d_billboard->uParentBillboardID, VisObjectType_Sprite, billboard->sZValue);
+        list->AddObject((void *)d3d_billboard->sParentBillboardID, VisObjectType_Sprite, billboard->sZValue);
       }
     }
   }
@@ -260,7 +260,7 @@
   float v29; // [sp+8h] [bp-4h]@2
   float a1a; // [sp+14h] [bp+8h]@2
 
-  if ( a1->uParentBillboardID == -1 )
+  if ( a1->sParentBillboardID == -1 )
     return false;
 
   //result = a1;
@@ -1379,9 +1379,9 @@
     {
       if (DoesRayIntersectBillboard(pick_depth, i))
       {
-        RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->uParentBillboardID];
+        RenderBillboard* billboard = &pBillboardRenderList[d3d_billboard->sParentBillboardID];
 
-        list->AddObject((void *)d3d_billboard->uParentBillboardID, VisObjectType_Sprite, billboard->sZValue);
+        list->AddObject((void *)d3d_billboard->sParentBillboardID, VisObjectType_Sprite, billboard->sZValue);
       }
     }
   }
@@ -1414,8 +1414,8 @@
     case VisObjectType_Sprite:
     {
       v5 = filter->select_flags;
-      int object_idx = PID_ID(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].object_pid);
-      int object_type = PID_TYPE(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].object_pid);
+      int object_idx = PID_ID(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid);
+      int object_type = PID_TYPE(pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].sParentBillboardID].object_pid);
       if ( v5 & 2 )
       {
         if (object_type == filter->object_id)
@@ -1541,7 +1541,7 @@
 
   static Vis_SelectionList Vis_static_stru_F91E10;
   Vis_static_stru_F91E10.uNumPointers = 0;
-  v3 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID;
+  v3 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].sParentBillboardID;
   if (v3 == -1)
     return false;
 
--- a/mm7_3.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/mm7_3.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -5655,7 +5655,7 @@
   int v12; // [sp+60h] [bp-8h]@1
   int v13; // [sp+64h] [bp-4h]@6
 
-  v10.uParentBillboardID = -1;
+  v10.sParentBillboardID = -1;
   v10.pTarget = pRenderer->pTargetSurface;
   v10.pTargetZ = pRenderer->pActiveZBuffer;
   v10.uTargetPitch = pRenderer->field_10;
--- a/mm7_7.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/mm7_7.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -6,6 +6,7 @@
 #include "Render.h"
 #include "texts.h"
 #include "Party.h"
+#include "Viewport.h"
 
 int __cdecl sub_401022()
 {
@@ -90,11 +91,18 @@
   pPartyActionQueue->uNumActions = 0;
 }
 
+void __cdecl sub_4C023F()
+{
+  pViewport->field_30 = 32768;
+  pViewport->SetScreen(0, 0, 639u, 479u);
+}
+
 void constructors()
 {
 	sub_401022();
 	sub_423B4A();
 	crt_init_globals_46BD9F();
+	sub_4C023F();
 
 	//no call to these anywhere
 	uGameUIFontMain_initialize();
@@ -317,7 +325,7 @@
 byte
 
 .data:004DF184                 dd offset crt_call_global_ctor_45BAA5
-X stru_69BD44 = "effpar03" , need RECHECK
+stru_69BD44 = "effpar03" , need RECHECK
 
 .data:004DF188                 dd offset crt_deconstruct_45DEF7
 .data:004DF18C                 dd offset crt_deconstruct_45DF53
@@ -416,19 +424,15 @@
 
 
 .data:004DF228                 dd offset sub_47A368
-
-
 .data:004DF22C                 dd offset sub_47C778
-
-
 .data:004DF230                 dd offset sub_47CDBE
-
+byte
 
 .data:004DF234                 dd offset sub_47CDDA
 
 
 .data:004DF238                 dd offset sub_47F483
-
+byte
 
 .data:004DF23C                 dd offset sub_47F49F
 
@@ -437,217 +441,120 @@
 
 
 .data:004DF244                 dd offset sub_482A74
-
-
 .data:004DF248                 dd offset sub_485F37
-
-
 .data:004DF24C                 dd offset sub_486A0C
-
-
 .data:004DF250                 dd offset crt_deconstruct_487DF7
-
-
 .data:004DF254                 dd offset sub_488E07
-
-
 .data:004DF258                 dd offset sub_489572
-
-
 .data:004DF25C                 dd offset crt_deconstruct_489B44
-
-
 .data:004DF260                 dd offset crt_deconstruct_489BBA
-
+byte
 
 .data:004DF264                 dd offset crt_construct_489BD6_ptr_080D198
-
+X PaletteManager
 
 .data:004DF268                 dd offset sub_48AAA9
-
-
 .data:004DF26C                 dd offset sub_48C20E
-
+byte
 
 .data:004DF270                 dd offset sub_48C22A
-
-
 .data:004DF274                 dd offset loc_48C234
-
-
 .data:004DF278                 dd offset loc_48C243
-
-
 .data:004DF27C                 dd offset loc_48C252
-
-
 .data:004DF280                 dd offset loc_48C3C0
-
-
 .data:004DF284                 dd offset loc_48C474
-
+Party constructor
 
 .data:004DF288                 dd offset sub_49801C
-
-
 .data:004DF28C                 dd offset sub_498077
-
-
 .data:004DF290                 dd offset sub_498A25
-
-
 .data:004DF294                 dd offset sub_49AFE5
-
-
 .data:004DF298                 dd offset crt_deconstruct_49B36B
-
+byte
 
 .data:004DF29C                 dd offset crt_construct_stru187@AE5BA8
-
-
+X DecalBuilder
 
 .data:004DF2A0                 dd offset crt_construct_ptr_AE5B94
-
+std__string_AE5B94 = "hwsplat04", need RECHECK
 
 .data:004DF2A4                 dd offset sub_49C594
-
-
 .data:004DF2A8                 dd offset sub_49D6C8
-
-
 .data:004DF2AC                 dd offset sub_49D6E4
-
-
 .data:004DF2B0                 dd offset sub_49E71A
-
+byte
 
 .data:004DF2B4                 dd offset sub_49E736
-
+X Render
 
 .data:004DF2B8                 dd offset sub_4A198F
-
+byte
 
 .data:004DF2BC                 dd offset sub_4A19AB
-
+added
 
 .data:004DF2C0                 dd offset sub_4A51AF
-
-
 .data:004DF2C4                 dd offset sub_4A7047
-
-
 .data:004DF2C8                 dd offset sub_4A94EB
-
-
 .data:004DF2CC                 dd offset sub_4A963E
-
+byte
 
 .data:004DF2D0                 dd offset sub_4A965A
-
+X pSoundList
 
 .data:004DF2D4                 dd offset AudioPlayer__AudioPlayer
-
+X
 
 .data:004DF2D8                 dd offset sub_4AC1AD
-
-
 .data:004DF2DC                 dd offset sub_4AC662
-
-
 .data:004DF2E0                 dd offset sub_4ACC1C
-
-
 .data:004DF2E4                 dd offset sub_4AD369
-
-
 .data:004DF2E8                 dd offset crt_deconstruct_4AD44B
-
+byte
 
 .data:004DF2EC                 dd offset crt_construct_4AD467_ptr_F79D68
-
+X OSVersion
 
 .data:004DF2F0                 dd offset crt_deconstruct_4AD4DE
-
+byte
 
 .data:004DF2F4                 dd offset crt_construct_ptr_F7CE30
-
+X Texture
 
 .data:004DF2F8                 dd offset sub_4B142B
-
-
 .data:004DF2FC                 dd offset crt_sub_4BE344
-
+byte
 
 .data:004DF300                 dd offset j_Random__ctor
-
+X
 
 .data:004DF304                 dd offset crt_sub_4BE6B5
-
-
 .data:004DF308                 dd offset crt_sub_4BE6D4
-
+byte
 
 .data:004DF30C                 dd offset crt_j_VideoPlayer__ctor
-
+RECHECK
 
 .data:004DF310                 dd offset sub_4C021E
-
+byte
 
 .data:004DF314                 dd offset sub_4C023A
-
+added
 
 .data:004DF318                 dd offset sub_4C035A
-
-
 .data:004DF31C                 dd offset sub_4C03A3
-
+byte
 
 .data:004DF320                 dd offset sub_4C03BF
-
-
 .data:004DF324                 dd offset sub_4C03F1
-
-
 .data:004DF328                 dd offset sub_4C0423
-
-
 .data:004DF32C                 dd offset sub_4C044B
-
-
 .data:004DF330                 dd offset sub_4C047D
-
+X vis filters
 
 .data:004DF334                 dd offset sub_4C2A6E
-
-
 .data:004DF338                 dd offset sub_4C2A8A
-
-
 .data:004DF33C                 dd offset sub_4C2F7C
-
-
-.data:004DF340                 dd offset unknown_libname_24 ; Microsoft VisualC 2-10/net runtime
-
-
-.data:004DF34C                 dd offset ___onexitinit
-
-
-.data:004DF350                 dd offset ___lconv_init
-
-
-.data:004DF354                 dd offset ___initstdio
-
-
-.data:004DF358                 dd offset ___initmbctable
-
-
-.data:004DF35C                 dd offset sub_4D298A
-
-
-.data:004DF368                 dd offset ___endstdio
-
-
-.data:004DF374                 dd offset sub_4D299B
-
+byte
 
 */
\ No newline at end of file
--- a/stru6.cpp	Tue Nov 05 22:07:34 2013 +0000
+++ b/stru6.cpp	Tue Nov 05 23:35:21 2013 +0000
@@ -1549,7 +1549,7 @@
     else
     {
       vsr.pTarget = pRenderer->pTargetSurface;
-      vsr.uParentBillboardID = -1;
+      vsr.sParentBillboardID = -1;
       vsr.pTargetZ = pRenderer->pActiveZBuffer;
       vsr.uScreenSpaceX = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
       vsr.uScreenSpaceY = pViewport->uViewportBR_Y;
@@ -1563,7 +1563,7 @@
       vsr._screenspace_y_scaler_packedfloat = v18 / 0x1000000;
       vsr.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v70->uPaletteIndex, 0, 1);
       vsr.uTargetPitch = pRenderer->uTargetSurfacePitch;
-      vsr.uParentBillboardID = -1;
+      vsr.sParentBillboardID = -1;
       vsr.uViewportX = pViewport->uViewportTL_X;
       vsr.uViewportZ = pViewport->uViewportBR_X;
       vsr.uViewportY = pViewport->uViewportTL_Y;