comparison mm7_3.cpp @ 226:c2f2d2644304

DrawDialogueUI NPCData
author zipi
date Sun, 17 Feb 2013 11:40:10 +0100
parents 125354fe1b9f
children 99ef31ffa74e 2799737f8a74
comparison
equal deleted inserted replaced
225:e3fd201a58f0 226:c2f2d2644304
5181 //----- (00476977) -------------------------------------------------------- 5181 //----- (00476977) --------------------------------------------------------
5182 void NPCStats::Initialize2() 5182 void NPCStats::Initialize2()
5183 { 5183 {
5184 char *v4; // eax@4 5184 char *v4; // eax@4
5185 char v5; // dl@5 5185 char v5; // dl@5
5186 char *v6; // ecx@5 5186 int v6; // ecx@5
5187 int v7; // edi@9 5187 char *v7; // edi@9
5188 char *v9; // eax@21 5188 char *v9; // eax@21
5189 char v10; // dl@22 5189 char v10; // dl@22
5190 char *v11; // ecx@22 5190 int v11; // ecx@22
5191 int v12; // edi@26 5191 char *v12; // edi@26
5192 char *v14; // eax@39 5192 char *v14; // eax@39
5193 char v15; // dl@40 5193 char v15; // dl@40
5194 int v16; // ecx@40 5194 int v16; // ecx@40
5195 int v17; // edi@44 5195 char *v17; // edi@44
5196 char v18; // zf@47 5196 char v18; // zf@47
5197 NPCStats_stru0 *v19; // eax@57 5197 NPCStats_stru0 *v19; // eax@57
5198 signed int v20; // edx@57 5198 signed int v20; // edx@57
5199 signed int v21; // ecx@58 5199 signed int v21; // ecx@58
5200 char *v22; // [sp+10h] [bp-10h]@4 5200 int v22; // [sp+10h] [bp-10h]@4
5201 char *v23; // [sp+10h] [bp-10h]@21 5201 int v23; // [sp+10h] [bp-10h]@21
5202 char *v25; // [sp+14h] [bp-Ch]@4 5202 int v25; // [sp+14h] [bp-Ch]@4
5203 char *v26; // [sp+14h] [bp-Ch]@21 5203 int v26; // [sp+14h] [bp-Ch]@21
5204 signed int v27; // [sp+14h] [bp-Ch]@39 5204 signed int v27; // [sp+14h] [bp-Ch]@39
5205 //signed int v28; // [sp+18h] [bp-8h]@3 5205 //signed int v28; // [sp+18h] [bp-8h]@3
5206 //signed int v29; // [sp+18h] [bp-8h]@20 5206 //signed int v29; // [sp+18h] [bp-8h]@20
5207 signed int v30; // [sp+18h] [bp-8h]@37 5207 signed int v30; // [sp+18h] [bp-8h]@37
5208 char *v31; // [sp+1Ch] [bp-4h]@37 5208 char *v31; // [sp+1Ch] [bp-4h]@37
5217 strtok(pNPCTextTXT_Raw, "\r"); 5217 strtok(pNPCTextTXT_Raw, "\r");
5218 5218
5219 for (uint i = 0; i < 789; ++i) 5219 for (uint i = 0; i < 789; ++i)
5220 { 5220 {
5221 v4 = strtok(nullptr, "\r") + 1; 5221 v4 = strtok(nullptr, "\r") + 1;
5222 v22 = nullptr; 5222 v22 = 0;
5223 v25 = nullptr; 5223 v25 = 0;
5224 do 5224 do
5225 { 5225 {
5226 v5 = *v4; 5226 v5 = *v4;
5227 v6 = 0; 5227 v6 = 0;
5228 if ( *v4 != 9 ) 5228 if ( *v4 != 9 )
5230 do 5230 do
5231 { 5231 {
5232 if ( !v5 ) 5232 if ( !v5 )
5233 break; 5233 break;
5234 ++v6; 5234 ++v6;
5235 v5 = v4[(int)v6]; 5235 v5 = v4[v6];
5236 } 5236 }
5237 while ( v5 != 9 ); 5237 while ( v5 != 9 );
5238 //v2 = 0; 5238 //v2 = 0;
5239 } 5239 }
5240 v7 = (int)&v4[(int)v6]; 5240 v7 = &v4[v6];
5241 if ( !v4[(int)v6] ) 5241 if ( !v4[v6] )
5242 v25 = (char *)1; 5242 v25 = 1;
5243 *(char *)v7 = 0; 5243 *v7 = 0;
5244 if ( v6 == nullptr ) 5244 if ( v6 == 0 )
5245 { 5245 {
5246 v25 = (char *)1; 5246 v25 = 1;
5247 } 5247 }
5248 else 5248 else
5249 { 5249 {
5250 if ( v22 == (char *)1 ) 5250 if ( v22 == 1 )
5251 pNPCTopics[i].pText = RemoveQuotes(v4); 5251 pNPCTopics[i].pText = RemoveQuotes(v4);
5252 } 5252 }
5253 ++v22; 5253 ++v22;
5254 v4 = (char *)(v7 + 1); 5254 v4 = v7 + 1;
5255 } 5255 }
5256 while ( (signed int)(v22 - 1) <= 1 && v25 == nullptr ); 5256 while ( (signed int)(v22 - 1) <= 1 && !v25);// == nullptr );
5257 } 5257 }
5258 5258
5259 if (pNPCTopicTXT_Raw) 5259 if (pNPCTopicTXT_Raw)
5260 pAllocator->FreeChunk(pNPCTopicTXT_Raw); 5260 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
5261 5261
5264 strtok(pNPCTopicTXT_Raw, "\r"); 5264 strtok(pNPCTopicTXT_Raw, "\r");
5265 5265
5266 for (uint i = 0; i < 579; ++i) 5266 for (uint i = 0; i < 579; ++i)
5267 { 5267 {
5268 v9 = strtok(nullptr, "\r") + 1; 5268 v9 = strtok(nullptr, "\r") + 1;
5269 v23 = nullptr; 5269 v23 = 0;
5270 v26 = nullptr; 5270 v26 = 0;
5271 do 5271 do
5272 { 5272 {
5273 v10 = *v9; 5273 v10 = *v9;
5274 v11 = 0; 5274 v11 = 0;
5275 if ( *v9 != 9 ) 5275 if ( *v9 != 9 )
5277 do 5277 do
5278 { 5278 {
5279 if ( !v10 ) 5279 if ( !v10 )
5280 break; 5280 break;
5281 ++v11; 5281 ++v11;
5282 v10 = v9[(int)v11]; 5282 v10 = v9[v11];
5283 } 5283 }
5284 while ( v10 != 9 ); 5284 while ( v10 != 9 );
5285 //v2 = 0; 5285 //v2 = 0;
5286 } 5286 }
5287 v12 = (int)&v9[(int)v11]; 5287 v12 = &v9[v11];
5288 if ( !v9[(int)v11] ) 5288 if ( !v9[v11] )
5289 v26 = (char *)1; 5289 v26 = 1;
5290 *(char *)v12 = 0; 5290 *v12 = 0;
5291 if ( v11 == nullptr ) 5291 if ( v11 == 0 )
5292 { 5292 {
5293 v26 = (char *)1; 5293 v26 = 1;
5294 } 5294 }
5295 else 5295 else
5296 { 5296 {
5297 if ( v23 == (char *)1 ) 5297 if ( v23 == 1 )
5298 pNPCTopics[i].pTopic = RemoveQuotes(v9); 5298 pNPCTopics[i].pTopic = RemoveQuotes(v9);
5299 } 5299 }
5300 ++v23; 5300 ++v23;
5301 v9 = (char *)(v12 + 1); 5301 v9 = v12 + 1;
5302 } 5302 }
5303 while ( (signed int)(v23 - 1) <= 1 && v26 == nullptr ); 5303 while ( (signed int)(v23 - 1) <= 1 && !v26 );
5304 } 5304 }
5305 5305
5306 if (pNPCDistTXT_Raw) 5306 if (pNPCDistTXT_Raw)
5307 pAllocator->FreeChunk(pNPCDistTXT_Raw); 5307 pAllocator->FreeChunk(pNPCDistTXT_Raw);
5308 5308
5333 v15 = v14[v16]; 5333 v15 = v14[v16];
5334 } 5334 }
5335 while ( v15 != 9 ); 5335 while ( v15 != 9 );
5336 v2 = v24; 5336 v2 = v24;
5337 } 5337 }
5338 v17 = (int)&v14[v16]; 5338 v17 = &v14[v16];
5339 if ( !v14[v16] ) 5339 if ( !v14[v16] )
5340 v27 = 1; 5340 v27 = 1;
5341 *(char *)v17 = 0; 5341 *v17 = 0;
5342 if ( !v16 ) 5342 if ( !v16 )
5343 { 5343 {
5344 v27 = 1; 5344 v27 = 1;
5345 goto LABEL_54; 5345 goto LABEL_54;
5346 } 5346 }
5356 } 5356 }
5357 if ( v18 ) 5357 if ( v18 )
5358 *v31 = 10; 5358 *v31 = 10;
5359 LABEL_54: 5359 LABEL_54:
5360 ++v2; 5360 ++v2;
5361 v14 = (char *)(v17 + 1); 5361 v14 = v17 + 1;
5362 v24 = v2; 5362 v24 = v2;
5363 } 5363 }
5364 while ( (signed int)(v2 - 1) <= 77 && !v27 ); 5364 while ( (signed int)(v2 - 1) <= 77 && !v27 );
5365 ++v30; 5365 ++v30;
5366 ++v31; 5366 ++v31;
9663 pOutdoorCamera->uPickDepth = band3 * 512; 9663 pOutdoorCamera->uPickDepth = band3 * 512;
9664 //v4 = stru_76E5C8; // v4: 0 -> 65536 9664 //v4 = stru_76E5C8; // v4: 0 -> 65536
9665 for (uint i = 0; i < 16384; ++i) 9665 for (uint i = 0; i < 16384; ++i)
9666 //do 9666 //do
9667 { 9667 {
9668 auto v4 = stru_76E5C8 + i; 9668 auto v4 = stru_76E5C8[i];
9669 //band3a = 256; 9669 //band3a = 256;
9670 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8); 9670 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8);
9671 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128 9671 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128
9672 { 9672 {
9673 v5 = pow(j * 512 + 256, 2.0); 9673 v5 = pow(j * 512 + 256, 2.0);
9675 //*((float *)&v5 + 1) = sqrt(v6 + v5); 9675 //*((float *)&v5 + 1) = sqrt(v6 + v5);
9676 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15; 9676 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15;
9677 if (v7 >= v10) 9677 if (v7 >= v10)
9678 { 9678 {
9679 if (v7 >= v9) 9679 if (v7 >= v9)
9680 v4->field_0 = ((v7 >= v3) - 1) & 2; 9680 v4.field_0 = ((v7 >= v3) - 1) & 2;
9681 else 9681 else
9682 v4->field_0 = 2; 9682 v4.field_0 = 2;
9683 } 9683 }
9684 else 9684 else
9685 { 9685 {
9686 v4->field_0 = 1; 9686 v4.field_0 = 1;
9687 } 9687 }
9688 //band3a += 512; 9688 //band3a += 512;
9689 v4->distance = v7; 9689 v4.distance = v7;
9690 ++v4; 9690 //++v4;
9691 } 9691 }
9692 //while ( band3a < 65792 ); 9692 //while ( band3a < 65792 );
9693 } 9693 }
9694 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); 9694 //while ( (signed int)v4 < (signed int)arary_77E5C8 );
9695 } 9695 }
16451 GUIWindow v52; // [sp+ACh] [bp-68h]@42 16451 GUIWindow v52; // [sp+ACh] [bp-68h]@42
16452 char *Str; // [sp+100h] [bp-14h]@104 16452 char *Str; // [sp+100h] [bp-14h]@104
16453 __int16 v54[2]; // [sp+104h] [bp-10h]@2 16453 __int16 v54[2]; // [sp+104h] [bp-10h]@2
16454 unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 16454 unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
16455 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 16455 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
16456 char *pInString; // [sp+110h] [bp-4h]@32 16456 char *pInString=NULL; // [sp+110h] [bp-4h]@32
16457 16457
16458 if ( !pDialogueWindow ) 16458 if ( !pDialogueWindow )
16459 return; 16459 return;
16460 memcpy(&v51, pDialogueWindow, sizeof(v51)); 16460 memcpy(&v51, pDialogueWindow, sizeof(v51));
16461 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); 16461 pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID);
17003 { 17003 {
17004 if ( npcid >= 501 ) 17004 if ( npcid >= 501 )
17005 { 17005 {
17006 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0); 17006 MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0);
17007 } 17007 }
17008 return &pNPCStats->pNewNPCData[v1 - 1]; 17008 return &pNPCStats->pNewNPCData[v1];// - 1];
17009 } 17009 }
17010 return &pNPCStats->array_13EF4[npcid - 5000]; 17010 return &pNPCStats->array_13EF4[npcid - 5000];
17011 } 17011 }
17012 17012
17013 17013