Mercurial > mm7
comparison mm7_2.cpp @ 701:d5b16a44d9b3
frame_table parser, new files for UI func
author | Gloval |
---|---|
date | Mon, 18 Mar 2013 22:53:56 +0400 |
parents | 1d05543f522d |
children | a9c1fb7483c2 |
comparison
equal
deleted
inserted
replaced
700:1d05543f522d | 701:d5b16a44d9b3 |
---|---|
2489 fclose(v3); | 2489 fclose(v3); |
2490 fflush(v3); | 2490 fflush(v3); |
2491 } | 2491 } |
2492 } | 2492 } |
2493 | 2493 |
2494 //----- (004BE3BF) -------------------------------------------------------- | |
2495 FrameTableTxtLine *texture_frame_table_txt_parser(const char *_this, FrameTableTxtLine *a2) | |
2496 { | |
2497 char *v2; // eax@3 | |
2498 signed int v3; // edx@3 | |
2499 unsigned int v4; // edi@3 | |
2500 char v5; // cl@4 | |
2501 FrameTableTxtLine *result; // eax@21 | |
2502 signed int v7; // [sp+Ch] [bp-4h]@3 | |
2503 | |
2504 static struct FrameTableTxtLine static_stru_F8BA58; // weak | |
2505 static_stru_F8BA58.field_0 = 0; | |
2506 if ( _this && *_this ) | |
2507 { | |
2508 int i = 0; | |
2509 v2 = (char *)&array_F8B668; | |
2510 v3 = 1; | |
2511 v7 = 0; | |
2512 v4 = _this - (char *)&array_F8B668; | |
2513 do | |
2514 { | |
2515 v5 = v2[v4]; | |
2516 *v2 = v5; | |
2517 if ( !v5 ) | |
2518 break; | |
2519 if ( v5 != 32 && v5 != 44 && v5 != 9 || v7 ) | |
2520 { | |
2521 if ( v5 == 34 ) | |
2522 { | |
2523 *v2 = 0; | |
2524 v3 = 1; | |
2525 if ( v7 ) | |
2526 { | |
2527 v7 = 0; | |
2528 } | |
2529 else | |
2530 { | |
2531 v7 = 1; | |
2532 if ( v2[v4 + 1] == 34 ) | |
2533 { | |
2534 static_stru_F8BA58.pProperties[static_stru_F8BA58.field_0] = v2; | |
2535 ++static_stru_F8BA58.field_0; | |
2536 } | |
2537 } | |
2538 } | |
2539 else | |
2540 { | |
2541 if ( v3 ) | |
2542 { | |
2543 static_stru_F8BA58.pProperties[static_stru_F8BA58.field_0] = v2; | |
2544 ++static_stru_F8BA58.field_0; | |
2545 } | |
2546 v3 = 0; | |
2547 } | |
2548 } | |
2549 else | |
2550 { | |
2551 *v2 = 0; | |
2552 v3 = 1; | |
2553 } | |
2554 if ( static_stru_F8BA58.field_0 >= 30 ) | |
2555 break; | |
2556 ++v2; | |
2557 ++i; | |
2558 } | |
2559 while (i < 1000); | |
2560 *v2 = 0; | |
2561 } | |
2562 result = a2; | |
2563 memcpy(a2, &static_stru_F8BA58, 0x7Cu); | |
2564 return result; | |
2565 } | |
2566 // F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58; | |
2567 | |
2568 //----- (004BE485) -------------------------------------------------------- | |
2569 FrameTableTxtLine *__thiscall frame_table_txt_parser(const char *pString, FrameTableTxtLine *a2) | |
2570 { | |
2571 char *v2; // eax@3 | |
2572 signed int v3; // edi@3 | |
2573 signed int v4; // edx@3 | |
2574 char v5; // cl@4 | |
2575 FrameTableTxtLine *result; // eax@24 | |
2576 unsigned int v7; // [sp+Ch] [bp-4h]@3 | |
2577 | |
2578 stru_F8B5E8.field_0 = 0; | |
2579 if ( pString && *pString ) | |
2580 { | |
2581 v2 = (char *)&unk_F8B1F8; | |
2582 v3 = 0; | |
2583 v7 = pString - (const char *)&unk_F8B1F8; | |
2584 v4 = 1; | |
2585 while ( 1 ) | |
2586 { | |
2587 v5 = v2[v7]; | |
2588 *v2 = v5; | |
2589 if ( !v5 ) | |
2590 { | |
2591 //LABEL_23: | |
2592 *v2 = 0; | |
2593 break; | |
2594 } | |
2595 if ( v5 == ',' ) | |
2596 { | |
2597 if ( v3 ) | |
2598 { | |
2599 if ( v4 ) | |
2600 { | |
2601 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; | |
2602 ++stru_F8B5E8.field_0; | |
2603 } | |
2604 v4 = 0; | |
2605 } | |
2606 else | |
2607 { | |
2608 *v2 = 0; | |
2609 v4 = 1; | |
2610 } | |
2611 } | |
2612 else | |
2613 { | |
2614 if ( v5 != '\t' ) | |
2615 { | |
2616 if ( v5 == '"' ) | |
2617 { | |
2618 *v2 = 0; | |
2619 v4 = 1; | |
2620 if ( v3 ) | |
2621 { | |
2622 v3 = 0; | |
2623 } | |
2624 else | |
2625 { | |
2626 v3 = 1; | |
2627 if ( v2[v7 + 1] == 34 ) | |
2628 { | |
2629 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; | |
2630 ++stru_F8B5E8.field_0; | |
2631 } | |
2632 } | |
2633 } | |
2634 else | |
2635 { | |
2636 //LABEL_18: | |
2637 if ( v4 ) | |
2638 { | |
2639 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; | |
2640 ++stru_F8B5E8.field_0; | |
2641 } | |
2642 v4 = 0; | |
2643 } | |
2644 } | |
2645 else | |
2646 { | |
2647 if ( v3 ) | |
2648 { | |
2649 if ( v4 ) | |
2650 { | |
2651 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; | |
2652 ++stru_F8B5E8.field_0; | |
2653 } | |
2654 v4 = 0; | |
2655 } | |
2656 else | |
2657 { | |
2658 *v2 = 0; | |
2659 if ( v4 ) | |
2660 { | |
2661 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; | |
2662 ++stru_F8B5E8.field_0; | |
2663 } | |
2664 v4 = 1; | |
2665 } | |
2666 } | |
2667 } | |
2668 //LABEL_21: | |
2669 if ( stru_F8B5E8.field_0 < 30 ) | |
2670 { | |
2671 ++v2; | |
2672 if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 ) | |
2673 continue; | |
2674 } | |
2675 *v2 = 0; | |
2676 break; | |
2677 } | |
2678 } | |
2679 result = a2; | |
2680 memcpy(a2, &stru_F8B5E8, 0x7Cu); | |
2681 return result; | |
2682 } | |
2683 // F8B5E8: using guessed type FrameTableTxtLine stru_F8B5E8; | |
2684 | 2494 |
2685 | 2495 |
2686 | 2496 |
2687 //----- (004BF91E) -------------------------------------------------------- | 2497 //----- (004BF91E) -------------------------------------------------------- |
2688 unsigned int __thiscall GameOverMenu(void *ecx0) | 2498 unsigned int __thiscall GameOverMenu(void *ecx0) |
7261 { | 7071 { |
7262 do | 7072 do |
7263 { | 7073 { |
7264 *strchr(&Buf, 10) = 0; | 7074 *strchr(&Buf, 10) = 0; |
7265 memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42)); | 7075 memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42)); |
7266 if ( v42.field_0 && *v42.pProperties[0] != 47 && v42.field_0 >= 3 ) | 7076 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) |
7267 ++Argsa; | 7077 ++Argsa; |
7268 } | 7078 } |
7269 while ( fgets(&Buf, 490, File) ); | 7079 while ( fgets(&Buf, 490, File) ); |
7270 v4 = Argsa; | 7080 v4 = Argsa; |
7271 } | 7081 } |
7279 fseek(v6, 0, 0); | 7089 fseek(v6, 0, 0); |
7280 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 7090 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |
7281 { | 7091 { |
7282 *strchr(&Buf, 10) = 0; | 7092 *strchr(&Buf, 10) = 0; |
7283 memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42)); | 7093 memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42)); |
7284 if ( v42.field_0 && *v42.pProperties[0] != 47 && v42.field_0 >= 3 ) | 7094 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 ) |
7285 { | 7095 { |
7286 strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); | 7096 strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]); |
7287 v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); | 7097 v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName); |
7288 v9 = v42.pProperties[2]; | 7098 v9 = v42.pProperties[2]; |
7289 v2->pDecorations[v2->uNumDecorations].uSpriteID = v8; | 7099 v2->pDecorations[v2->uNumDecorations].uSpriteID = v8; |
7307 v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19; | 7117 v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19; |
7308 v21 = atoi(v20); | 7118 v21 = atoi(v20); |
7309 v22 = v42.pProperties[9]; | 7119 v22 = v42.pProperties[9]; |
7310 v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; | 7120 v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21; |
7311 v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); | 7121 v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22); |
7312 v25 = __OFSUB__(v42.field_0, 10); | 7122 v25 = __OFSUB__(v42.uPropCount, 10); |
7313 v23 = v42.field_0 == 10; | 7123 v23 = v42.uPropCount == 10; |
7314 v24 = v42.field_0 - 10 < 0; | 7124 v24 = v42.uPropCount - 10 < 0; |
7315 v2->pDecorations[v2->uNumDecorations].uFlags = 0; | 7125 v2->pDecorations[v2->uNumDecorations].uFlags = 0; |
7316 if ( !((unsigned __int8)(v24 ^ v25) | v23) ) | 7126 if ( !((unsigned __int8)(v24 ^ v25) | v23) ) |
7317 { | 7127 { |
7318 strcpy(&Dest, v42.pProperties[10]); | 7128 strcpy(&Dest, v42.pProperties[10]); |
7319 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); | 7129 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); |
7320 for ( j = 0; j < v41.field_0; ++j ) | 7130 for ( j = 0; j < v41.uPropCount; ++j ) |
7321 { | 7131 { |
7322 v27 = v41.pProperties[j]; | 7132 v27 = v41.pProperties[j]; |
7323 if ( _strcmpi(v41.pProperties[j], "NBM") ) | 7133 if ( _strcmpi(v41.pProperties[j], "NBM") ) |
7324 { | 7134 { |
7325 if ( _strcmpi(v27, "Invisible") ) | 7135 if ( _strcmpi(v27, "Invisible") ) |
7503 { | 7313 { |
7504 do | 7314 do |
7505 { | 7315 { |
7506 *strchr(&Buf, 10) = 0; | 7316 *strchr(&Buf, 10) = 0; |
7507 memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45)); | 7317 memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45)); |
7508 if ( v45.field_0 && *v45.pProperties[0] != '/' ) | 7318 if ( v45.uPropCount && *v45.pProperties[0] != '/' ) |
7509 ++Argsa; | 7319 ++Argsa; |
7510 } | 7320 } |
7511 while ( fgets(&Buf, 490, File) ); | 7321 while ( fgets(&Buf, 490, File) ); |
7512 v5 = Argsa; | 7322 v5 = Argsa; |
7513 v3 = 0; | 7323 v3 = 0; |
7523 fseek(v7, v3, v3); | 7333 fseek(v7, v3, v3); |
7524 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 7334 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |
7525 { | 7335 { |
7526 *strchr(&Buf, 10) = 0; | 7336 *strchr(&Buf, 10) = 0; |
7527 memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45)); | 7337 memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45)); |
7528 if ( v45.field_0 && *v45.pProperties[0] != 47 ) | 7338 if ( v45.uPropCount && *v45.pProperties[0] != 47 ) |
7529 { | 7339 { |
7530 strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]); | 7340 strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]); |
7531 v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]); | 7341 v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]); |
7532 v10 = v45.pProperties[2]; | 7342 v10 = v45.pProperties[2]; |
7533 v2->pObjects[v2->uNumObjects].uSpriteID = v9; | 7343 v2->pObjects[v2->uNumObjects].uSpriteID = v9; |
7546 v19 = atoi(v18); | 7356 v19 = atoi(v18); |
7547 v20 = v45.pProperties[7]; | 7357 v20 = v45.pProperties[7]; |
7548 v2->pObjects[v2->uNumObjects].uSpeed = v19; | 7358 v2->pObjects[v2->uNumObjects].uSpeed = v19; |
7549 strcpy(&Dest, v20); | 7359 strcpy(&Dest, v20); |
7550 memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44)); | 7360 memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44)); |
7551 if ( v45.field_0 > 7 ) | 7361 if ( v45.uPropCount > 7 ) |
7552 { | 7362 { |
7553 for ( Argsb = 0; Argsb < v44.field_0; ++Argsb ) | 7363 for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb ) |
7554 { | 7364 { |
7555 v21 = Argsb; | 7365 v21 = Argsb; |
7556 v22 = v44.pProperties[Argsb]; | 7366 v22 = v44.pProperties[Argsb]; |
7557 if ( !_strcmpi(v44.pProperties[Argsb], "NoDraw") ) | 7367 if ( !_strcmpi(v44.pProperties[Argsb], "NoDraw") ) |
7558 { | 7368 { |