comparison mm7_2.cpp @ 1296:c423f946dc99

moving files continue
author Ritor1
date Tue, 18 Jun 2013 17:28:11 +0600
parents d8033eb56d7e
children 5450af4f57ef
comparison
equal deleted inserted replaced
1295:86a83e12d795 1296:c423f946dc99
4669 } 4669 }
4670 fclose(File); 4670 fclose(File);
4671 return 1; 4671 return 1;
4672 } 4672 }
4673 4673
4674 //----- (00459064) --------------------------------------------------------
4675 void ObjectList::InitializeSprites()
4676 {
4677 for (uint i = 0; i < uNumObjects; ++i)
4678 pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID);
4679 }
4680
4681 //----- (00459090) --------------------------------------------------------
4682 void ObjectList::ToFile()
4683 {
4684 ObjectList *v1; // esi@1
4685 FILE *v2; // eax@1
4686 FILE *v3; // edi@1
4687
4688 v1 = this;
4689 v2 = fopen("data\\dobjlist.bin", "wb");
4690 v3 = v2;
4691 if ( !v2 )
4692 Abortf("Unable to save dobjlist.bin!");
4693 fwrite(v1, 4u, 1u, v2);
4694 fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3);
4695 fclose(v3);
4696 }
4697
4698 //----- (004590DC) --------------------------------------------------------
4699 void ObjectList::FromFile(void *pSerialized)
4700 {
4701 uNumObjects = *(int *)pSerialized;
4702 pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip");
4703 memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects);
4704 }
4705
4706 //----- (00459123) --------------------------------------------------------
4707 bool ObjectList::FromFileTxt(const char *Args)
4708 {
4709 ObjectList *v2; // ebx@1
4710 __int32 v3; // edi@1
4711 FILE *v4; // eax@1
4712 unsigned int v5; // esi@3
4713 void *v6; // eax@9
4714 FILE *v7; // ST0C_4@11
4715 char *i; // eax@11
4716 unsigned __int16 v9; // ax@14
4717 const char *v10; // ST20_4@14
4718 __int16 v11; // ax@14
4719 const char *v12; // ST1C_4@14
4720 __int16 v13; // ax@14
4721 const char *v14; // ST18_4@14
4722 __int16 v15; // ax@14
4723 const char *v16; // ST14_4@14
4724 __int16 v17; // ax@14
4725 const char *v18; // ST10_4@14
4726 __int16 v19; // ax@14
4727 const char *v20; // ST0C_4@14
4728 int v21; // esi@16
4729 const char *v22; // edi@16
4730 int v23; // eax@17
4731 int v24; // eax@19
4732 int v25; // eax@21
4733 int v26; // eax@21
4734 int v27; // eax@21
4735 int v28; // eax@23
4736 int v29; // eax@25
4737 int v30; // eax@27
4738 int v31; // eax@29
4739 const char *v32; // edi@30
4740 const char *v33; // ST20_4@35
4741 int v34; // eax@35
4742 char v35; // al@35
4743 const char *v36; // ST1C_4@35
4744 char v37; // al@35
4745 const char *v38; // ST18_4@35
4746 FrameTableTxtLine v40; // [sp+8h] [bp-460h]@14
4747 FrameTableTxtLine v41; // [sp+84h] [bp-3E4h]@12
4748 char Dest; // [sp+100h] [bp-368h]@14
4749 char Buf; // [sp+178h] [bp-2F0h]@3
4750 FrameTableTxtLine v44; // [sp+36Ch] [bp-FCh]@4
4751 FrameTableTxtLine v45; // [sp+3E8h] [bp-80h]@4
4752 FILE *File; // [sp+464h] [bp-4h]@1
4753 unsigned int Argsa; // [sp+470h] [bp+8h]@3
4754 int Argsb; // [sp+470h] [bp+8h]@15
4755
4756 v2 = this;
4757 pAllocator->FreeChunk(this->pObjects);
4758 v3 = 0;
4759 v2->pObjects = 0;
4760 v2->uNumObjects = 0;
4761 v4 = fopen(Args, "r");
4762 File = v4;
4763 if ( !v4 )
4764 Abortf("ObjectDescriptionList::load - Unable to open file: %s.");
4765 v5 = 0;
4766 Argsa = 0;
4767 if ( fgets(&Buf, 490, v4) )
4768 {
4769 do
4770 {
4771 *strchr(&Buf, 10) = 0;
4772 memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45));
4773 if ( v45.uPropCount && *v45.pProperties[0] != '/' )
4774 ++Argsa;
4775 }
4776 while ( fgets(&Buf, 490, File) );
4777 v5 = Argsa;
4778 v3 = 0;
4779 }
4780 v2->uNumObjects = v5;
4781 v6 = pAllocator->AllocNamedChunk(v2->pObjects, 56 * v5, "Obj Descrip");
4782 v2->pObjects = (ObjectDesc *)v6;
4783 if ( v6 == (void *)v3 )
4784 Abortf("ObjectDescriptionList::load - Out of Memory!");
4785 memset(v6, v3, 56 * v2->uNumObjects);
4786 v7 = File;
4787 v2->uNumObjects = v3;
4788 fseek(v7, v3, v3);
4789 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
4790 {
4791 *strchr(&Buf, 10) = 0;
4792 memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45));
4793 if ( v45.uPropCount && *v45.pProperties[0] != 47 )
4794 {
4795 strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]);
4796 v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]);
4797 v10 = v45.pProperties[2];
4798 v2->pObjects[v2->uNumObjects].uSpriteID = v9;
4799 v11 = atoi(v10);
4800 v12 = v45.pProperties[3];
4801 v2->pObjects[v2->uNumObjects].uObjectID = v11;
4802 v13 = atoi(v12);
4803 v14 = v45.pProperties[4];
4804 v2->pObjects[v2->uNumObjects].uRadius = v13;
4805 v15 = atoi(v14);
4806 v16 = v45.pProperties[5];
4807 v2->pObjects[v2->uNumObjects].uHeight = v15;
4808 v17 = atoi(v16);
4809 v18 = v45.pProperties[6];
4810 v2->pObjects[v2->uNumObjects].uLifetime = v17;
4811 v19 = atoi(v18);
4812 v20 = v45.pProperties[7];
4813 v2->pObjects[v2->uNumObjects].uSpeed = v19;
4814 strcpy(&Dest, v20);
4815 memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44));
4816 if ( v45.uPropCount > 7 )
4817 {
4818 for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb )
4819 {
4820 v21 = Argsb;
4821 v22 = v44.pProperties[Argsb];
4822 if ( !_stricmp(v44.pProperties[Argsb], "NoDraw") )
4823 {
4824 v23 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4825 *(char *)v23 |= 1u;
4826 }
4827 if ( !_stricmp(v22, "Lifetime") )
4828 {
4829 v24 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4830 *(char *)v24 |= 4u;
4831 }
4832 if ( !_stricmp(v22, "FTLifetime") )
4833 {
4834 v25 = (int)&v2->pObjects[v2->uNumObjects];
4835 *(short *)(v25 + 42) = 8 * pSpriteFrameTable->pSpriteSFrames[*(short *)(v25 + 40)].uAnimLength;
4836 v26 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4837 *(char *)v26 |= 8u;
4838 v27 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4839 *(char *)v27 |= 4u;
4840 }
4841 if ( !_stricmp(v22, "NoPickup") )
4842 {
4843 v28 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4844 *(char *)v28 |= 0x10u;
4845 }
4846 if ( !_stricmp(v22, "NoGravity") )
4847 {
4848 v29 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4849 *(char *)v29 |= 0x20u;
4850 }
4851 if ( !_stricmp(v22, "FlagOnIntercept") )
4852 {
4853 v30 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4854 *(char *)v30 |= 0x40u;
4855 }
4856 if ( !_stricmp(v22, "Bounce") )
4857 {
4858 v31 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4859 *(char *)v31 |= 0x80u;
4860 }
4861 v32 = v45.pProperties[v21];
4862 if ( !_stricmp(v45.pProperties[v21], "Fire") )
4863 HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 2u;
4864 if ( !_stricmp(v32, "Lines") )
4865 HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 4u;
4866 if ( !_stricmp(v44.pProperties[v21], "bits") )
4867 {
4868 v33 = v44.pProperties[v21 + 1];
4869 v34 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
4870 *(char *)(v34 + 1) |= 1u;
4871 v35 = atoi(v33);
4872 v36 = v44.pProperties[v21 + 2];
4873 v2->pObjects[v2->uNumObjects].uParticleTrailColorR = v35;
4874 v37 = atoi(v36);
4875 v38 = v44.pProperties[v21 + 3];
4876 v2->pObjects[v2->uNumObjects].uParticleTrailColorG = v37;
4877 v2->pObjects[v2->uNumObjects].uParticleTrailColorB = atoi(v38);
4878 }
4879 }
4880 }
4881 ++v2->uNumObjects;
4882 }
4883 }
4884 fclose(File);
4885 return 1;
4886 }
4887
4888 //----- (0045E03A) -------------------------------------------------------- 4674 //----- (0045E03A) --------------------------------------------------------
4889 unsigned short * MakeScreenshot( signed int width, signed int height ) 4675 unsigned short * MakeScreenshot( signed int width, signed int height )
4890 { 4676 {
4891 //signed int v2; // edi@1 4677 //signed int v2; // edi@1
4892 unsigned __int16 *v3; // ebx@1 4678 unsigned __int16 *v3; // ebx@1