comparison mm7_5.cpp @ 1184:a90dc4aee8f4

arcomage refactoring continued
author Gloval
date Thu, 06 Jun 2013 08:33:43 +0400
parents fa30ea497e94
children 0dbf6c4dd029
comparison
equal deleted inserted replaced
1183:fa30ea497e94 1184:a90dc4aee8f4
9032 { 9032 {
9033 return 0; 9033 return 0;
9034 } 9034 }
9035 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); 9035 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int);
9036 9036
9037 //----- (0040DFD1) -------------------------------------------------------- 9037
9038 void stru272::_40DFD1()
9039 {
9040 stru272 *v1; // esi@1
9041 stru272_stru0 *v2; // eax@1
9042
9043 v1 = this;
9044 v2 = (stru272_stru0 *)malloc(0x5Cu);
9045 v1->ptr_0 = v2;
9046 v2->field_0 = 0x67707274u;
9047 v1->ptr_0->field_8 = 0;
9048 v1->ptr_0->field_30 = 0.0;
9049 v1->ptr_0->field_58 = 0;
9050 v1->ptr_0->field_59 = 0;
9051 }
9052
9053 //----- (0040DFFE) --------------------------------------------------------
9054 int stru272_stru0::_40DFFE()
9055 {
9056 signed int result; // eax@2
9057
9058 if ( this->field_0 == 0x67707274 )
9059 {
9060 this->field_0 = 0x78787878u;
9061 free(this);
9062 result = 0;
9063 }
9064 else
9065 {
9066 result = 2;
9067 }
9068 return result;
9069 }
9070
9071 //----- (0040E01A) --------------------------------------------------------
9072 int stru272_stru0::_40E01A(int a2)
9073 {
9074 signed int result; // eax@2
9075
9076 auto a1 = this;
9077 if ( a1->field_0 == 0x67707274 )
9078 {
9079 a1->field_4 = *(int *)(a2 + 32);
9080 a1->field_C = *(int *)a2 << 16;
9081 a1->field_10 = *(int *)(a2 + 4) << 16;
9082 a1->field_14 = *(int *)(a2 + 8) << 16;
9083 a1->field_18 = *(int *)(a2 + 12) << 16;
9084 a1->field_1C = *(int *)(a2 + 16);
9085 a1->field_20 = *(int *)(a2 + 20);
9086 a1->field_24 = *(int *)(a2 + 24);
9087 a1->field_28 = *(float *)(a2 + 28) * 65536.0;
9088 LODWORD(a1->field_2C) = *(int *)(a2 + 36);
9089 a1->field_34 = (signed __int64)(*(float *)(a2 + 40) * 65536.0);
9090 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0);
9091 a1->field_3C = *(int *)(a2 + 48);
9092 a1->field_40 = *(int *)(a2 + 52);
9093 a1->field_54 = *(int *)(a2 + 56);
9094 a1->field_59 = 1;
9095 result = 0;
9096 }
9097 else
9098 {
9099 result = 2;
9100 }
9101 return result;
9102 }
9103
9104 //----- (0040E0F5) --------------------------------------------------------
9105 int stru272_stru0::_40E0F5(char a2, char a3)
9106 {
9107 signed int result; // eax@2
9108 int v4; // edx@7
9109 int v5; // eax@7
9110
9111 auto a1 = this;
9112 if ( a1->field_0 == 0x67707274 )
9113 {
9114 if ( a2 )
9115 {
9116 a1->field_8 = 0;
9117 a1->field_30 = 0.0;
9118 }
9119 if ( a1->field_59 && a3 )
9120 {
9121 v4 = a1->field_4;
9122 v5 = a1->field_54;
9123 do
9124 {
9125 *(int *)v5 = 0;
9126 v5 += 28;
9127 --v4;
9128 }
9129 while ( v4 );
9130 a1->field_58 = 0;
9131 }
9132 result = 0;
9133 }
9134 else
9135 {
9136 result = 2;
9137 }
9138 return result;
9139 }
9140
9141 //----- (0040E133) --------------------------------------------------------
9142 int stru272_stru0::_40E133()
9143 {
9144 stru272_stru0 *v1; // edi@1
9145 int v3; // ST18_4@3
9146 double v4; // st7@3
9147 double v5; // st6@4
9148 char v6; // bl@8
9149 int v7; // esi@8
9150 int v8; // ecx@10
9151 signed int v9; // eax@10
9152 int v10; // ecx@10
9153 signed int v11; // eax@10
9154 signed int v12; // edx@12
9155 signed int v13; // edx@12
9156 int v14; // [sp+8h] [bp-10h]@8
9157 int v15; // [sp+Ch] [bp-Ch]@8
9158 float v16; // [sp+14h] [bp-4h]@3
9159
9160 v1 = this;
9161 if ( this->field_0 != 0x67707274 )
9162 return 2;
9163 v3 = this->field_8;
9164 v16 = this->field_30;
9165 v4 = (double)v3;
9166 if ( v3 > 0 )
9167 {
9168 v5 = v16 + this->field_2C;
9169 v16 = v5;
9170 if ( v5 > v4 )
9171 v16 = v4;
9172 }
9173 if ( v16 >= 1.0 || this->field_58 )
9174 {
9175 v6 = 0;
9176 v7 = this->field_54;
9177 v14 = (signed __int64)this->field_28;
9178 v15 = this->field_4;
9179 while ( *(int *)v7 <= 0 )
9180 {
9181 if ( v16 >= 1.0 )
9182 {
9183 *(int *)v7 = v1->field_3C + rand() % (v1->field_40 - v1->field_3C + 1);
9184 *(int *)(v7 + 20) = (rand() % 17 - 8) << 16;
9185 *(int *)(v7 + 24) = (rand() % 17 - 8) << 16;
9186 v12 = v1->field_C + rand() % (v1->field_14 - 1 - v1->field_C + 1);
9187 *(int *)(v7 + 12) = v12;
9188 *(int *)(v7 + 4) = v12 >> 16;
9189 v16 = v16 - 1.0;
9190 v13 = v1->field_10 + rand() % (v1->field_18 - 1 - v1->field_10 + 1);
9191 *(int *)(v7 + 16) = v13;
9192 *(int *)(v7 + 8) = v13 >> 16;
9193 --v1->field_8;
9194 goto LABEL_13;
9195 }
9196 LABEL_14:
9197 v7 += 28;
9198 --v15;
9199 if ( !v15 )
9200 {
9201 v1->field_58 = v6;
9202 v1->field_30 = v16;
9203 return 0;
9204 }
9205 }
9206 v8 = *(int *)(v7 + 20);
9207 --*(int *)v7;
9208 v9 = v8 + *(int *)(v7 + 12);
9209 v10 = v14 + *(int *)(v7 + 24);
9210 *(int *)(v7 + 12) = v9;
9211 *(int *)(v7 + 4) = v9 >> 16;
9212 v11 = v10 + *(int *)(v7 + 16);
9213 *(int *)(v7 + 24) = v10;
9214 *(int *)(v7 + 16) = v11;
9215 *(int *)(v7 + 8) = v11 >> 16;
9216 LABEL_13:
9217 v6 = 1;
9218 goto LABEL_14;
9219 }
9220 return 0;
9221 }
9222
9223 //----- (0040E2A7) --------------------------------------------------------
9224 int stru272_stru0::_40E2A7()
9225 {
9226 int result; // eax@2
9227
9228 if ( this->field_0 == 0x67707274 )
9229 {
9230 if ( this->field_8 <= 0 )
9231 result = this->field_58 != 0 ? 2 : 0;
9232 else
9233 result = 1;
9234 }
9235 else
9236 {
9237 result = 3;
9238 }
9239 return result;
9240 }
9241 9038
9242 //----- (0040F82D) -------------------------------------------------------- 9039 //----- (0040F82D) --------------------------------------------------------
9243 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) 9040 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
9244 { 9041 {
9245 assert(uTextureId != -1); 9042 assert(uTextureId != -1);