Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CColModel *__cdecl CShadows::CastShadowEntity(CEntity *entity, int a2, int a3, int a4, int a5, RwV3D *a6, float a7, float a8, float a9, float a10, __int16 a11, char a12, char a13, char a14, float a15, float a16, int a17, char *cBuf, int a19)
- {
- int v19; // eax@1
- CColModel *result; // eax@7
- ColDataHeader *_pColData; // ebp@7
- CMatrix *m1; // edi@11
- CMatrix *m2; // eax@13
- int v24; // edi@15
- int v25; // eax@17
- int v26; // edi@19
- int v27; // eax@21
- CMatrix *v28; // edi@23
- CMatrix *v29; // eax@25
- RwV3D *v30; // ecx@25
- RwV3D *v31; // ecx@27
- long double v32; // fst7@27
- CMatrix *v33; // edi@31
- CMatrix *v34; // eax@33
- CMatrix *v35; // edi@35
- CMatrix *v36; // eax@37
- long double v37; // fst7@37
- long double v38; // fst6@37
- long double v39; // t0@37
- long double v40; // fst6@37
- RwV3D *v41; // eax@38
- long double v42; // fst7@44
- long double v43; // fst7@53
- long double v44; // fst7@62
- long double v45; // fst7@71
- int v46; // ecx@83
- int numFaces; // eax@87
- float v48; // edx@87
- int v49; // edx@90
- int v50; // esi@91
- int v51; // ecx@91
- int v52; // esi@91
- int v53; // edx@109
- signed int v54; // ecx@109
- signed __int16 v55; // bx@109
- int v56; // ebp@109
- int *v57; // edi@109
- int v58; // esi@109
- long double v59; // fst6@109
- long double v60; // fst7@109
- long double v61; // fst5@110
- long double v62; // fst5@114
- long double v63; // fst5@114
- long double v64; // fst5@118
- long double v65; // fst5@118
- long double v66; // fst5@121
- int v67; // eax@125
- long double v68; // fst5@125
- long double v69; // fst5@125
- int v70; // eax@126
- signed __int16 v71; // bx@126
- int v72; // ebp@126
- int v73; // edx@127
- int v74; // ecx@127
- int v75; // esi@127
- long double v76; // fst5@128
- long double v77; // fst5@132
- long double v78; // fst5@132
- long double v79; // fst5@136
- long double v80; // fst5@136
- long double v81; // fst5@139
- int v82; // eax@143
- int v83; // ecx@143
- long double v84; // fst5@143
- long double v85; // fst5@143
- int v86; // ecx@144
- signed __int16 v87; // bx@144
- signed int v88; // ebp@144
- int v89; // edx@145
- int v90; // ecx@145
- int v91; // esi@145
- long double v92; // fst5@146
- long double v93; // fst5@150
- long double v94; // fst5@150
- long double v95; // fst5@154
- long double v96; // fst5@154
- long double v97; // fst5@158
- int v98; // eax@162
- long double v99; // fst5@162
- int v100; // ecx@162
- long double v101; // fst7@162
- long double v102; // fst7@162
- signed int v103; // ecx@164
- long double v104; // fst7@164
- int v105; // eax@164
- int v106; // edx@164
- int v107; // eax@164
- int v108; // ecx@164
- signed int v109; // edx@164
- long double v110; // fst7@164
- long double v111; // fst7@164
- int v112; // eax@165
- signed int v113; // edx@165
- long double v114; // fst6@165
- long double v115; // fst5@166
- float *v116; // eax@168
- int v117; // edx@168
- long double v118; // fst7@168
- int v119; // esi@171
- int v120; // ebx@174
- int v121; // eax@176
- int v122; // ecx@176
- int v123; // ebx@180
- int v124; // eax@182
- int v125; // ecx@182
- int v126; // eax@184
- int v127; // eax@185
- long double v128; // fst7@187
- char v129; // zf@187
- int v130; // ebx@189
- int v131; // edi@191
- int v132; // esi@191
- unsigned __int64 v133; // qax@192
- signed int v134; // eax@194
- int v135; // ecx@194
- int v136; // edi@194
- int v137; // ebx@204
- int v138; // ebx@204
- signed int v139; // esi@204
- char v140; // al@204
- int pVertices; // eax@205
- int v142; // edx@205
- int v143; // ecx@205
- signed int v144; // edi@205
- long double v145; // fst7@206
- long double v146; // fst7@206
- long double v147; // fst7@206
- long double v148; // fst7@206
- int v149; // ebx@206
- long double v150; // fst7@206
- long double v151; // fst7@206
- int v152; // eax@209
- int v153; // edx@209
- int v154; // ecx@209
- int v155; // ebp@209
- long double v156; // fst7@210
- int v157; // esi@210
- long double v158; // fst7@210
- int i; // ecx@212
- unsigned int v160; // ecx@212
- int v161; // edi@212
- __int16 *v162; // esi@212
- int v163; // edi@212
- unsigned __int8 v164; // cf@212
- char v165[7]; // [sp+11h] [bp-73h]@110
- float v166; // [sp+18h] [bp-6Ch]@47
- float v167; // [sp+1Ch] [bp-68h]@27
- float v168; // [sp+20h] [bp-64h]@25
- float v169; // [sp+24h] [bp-60h]@21
- ColDataHeader *pColData; // [sp+28h] [bp-5Ch]@7
- float v171; // [sp+2Ch] [bp-58h]@17
- int v172; // [sp+30h] [bp-54h]@13
- float v173; // [sp+34h] [bp-50h]@33
- float v174; // [sp+38h] [bp-4Ch]@29
- int v175; // [sp+3Ch] [bp-48h]@90
- int v176; // [sp+40h] [bp-44h]@89
- CColModel *v177; // [sp+44h] [bp-40h]@79
- int v178; // [sp+48h] [bp-3Ch]@90
- float v179; // [sp+4Ch] [bp-38h]@172
- int v180; // [sp+50h] [bp-34h]@91
- float v181; // [sp+54h] [bp-30h]@91
- float v182; // [sp+58h] [bp-2Ch]@97
- float v183; // [sp+5Ch] [bp-28h]@103
- float v184; // [sp+60h] [bp-24h]@91
- float v185; // [sp+64h] [bp-20h]@98
- float v186; // [sp+68h] [bp-1Ch]@104
- float v187; // [sp+6Ch] [bp-18h]@91
- float v188; // [sp+70h] [bp-14h]@99
- float v189; // [sp+74h] [bp-10h]@105
- float v190; // [sp+78h] [bp-Ch]@164
- float v191; // [sp+7Ch] [bp-8h]@164
- v19 = dword_C4B8C8;
- if ( !(dword_C4B8C8 & 1) )
- {
- v19 = dword_C4B8C8 | 1;
- dword_C4B8C8 |= 1u;
- }
- if ( !(v19 & 2) )
- {
- v19 |= 2u;
- dword_C4B8C8 = v19;
- }
- if ( !(v19 & 4) )
- dword_C4B8C8 = v19 | 4;
- result = modelPtrs[entity->m_wModelIndex]->m_pColModel;
- pColData = result->m_pColData;
- _pColData = pColData;
- if ( pColData && pColData->numberOfFaces )
- {
- sub_418580(result);
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- m1 = entity->__parent.m_pCoords;
- if ( !m1 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- m2 = entity->__parent.m_pCoords;
- *&v172 = a8 * m2->matrix.right.y + a7 * m1->matrix.right.x;
- if ( !m2 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v24 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v25 = entity->__parent.m_pCoords;
- v171 = a7 * *(v24 + 16) + a8 * *(v25 + 20);
- if ( !v25 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v26 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v27 = entity->__parent.m_pCoords;
- v169 = a10 * *(v27 + 4) + a9 * *v26;
- if ( !v27 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v28 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v29 = entity->__parent.m_pCoords;
- v30 = &v29->matrix.pos;
- v168 = a9 * v28->matrix.top.x + a10 * v29->matrix.top.y;
- if ( !v29 )
- v30 = &entity->__parent.placement.pos;
- v32 = a6->x - v30->x;
- v31 = &v29->matrix.pos;
- v167 = v32;
- if ( !v29 )
- v31 = &entity->__parent.placement.pos;
- v174 = a6->y - v31->y;
- if ( !v29 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v33 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v34 = entity->__parent.m_pCoords;
- v173 = v174 * v34->matrix.right.y + v167 * v33->matrix.right.x;
- if ( !v34 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v35 = entity->__parent.m_pCoords;
- if ( !v35 )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v37 = v174 * *(entity->__parent.m_pCoords + 20) + v167 * v35->matrix.top.x;
- flt_C4B898 = v173 + *&v172 - v169;
- flt_C4B89C = v171 + v37 - v168;
- flt_C4B8A4 = v173 + v169 + *&v172;
- flt_C4B8A8 = v168 + v37 + v171;
- v38 = v173 - *&v172;
- flt_C4B8B0 = v169 + v38;
- v39 = v38;
- v40 = v37 - v171;
- v174 = v40;
- flt_C4B8B4 = v40 + v168;
- flt_C4B8BC = v39 - v169;
- flt_C4B8C0 = v174 - v168;
- v36 = entity->__parent.m_pCoords;
- v41 = v36 ? &v36->matrix.pos : &entity->__parent.placement;
- v171 = a6->z - v41->z;
- v173 = flt_C4B8B0 >= flt_C4B8BC ? flt_C4B8BC : flt_C4B8B0;
- v42 = flt_C4B898 >= flt_C4B8A4 ? flt_C4B8A4 : flt_C4B898;
- v166 = v42 >= v173 ? v173 : v42;
- v173 = flt_C4B8B0 <= flt_C4B8BC ? flt_C4B8BC : flt_C4B8B0;
- v43 = flt_C4B898 <= flt_C4B8A4 ? flt_C4B8A4 : flt_C4B898;
- v167 = v43 <= v173 ? v173 : v43;
- v173 = flt_C4B8B4 >= flt_C4B8C0 ? flt_C4B8C0 : flt_C4B8B4;
- v44 = flt_C4B89C >= flt_C4B8A8 ? flt_C4B8A8 : flt_C4B89C;
- v168 = v44 >= v173 ? v173 : v44;
- v173 = flt_C4B8B4 <= flt_C4B8C0 ? flt_C4B8C0 : flt_C4B8B4;
- v45 = flt_C4B89C <= flt_C4B8A8 ? flt_C4B8A8 : flt_C4B89C;
- v169 = v45 <= v173 ? v173 : v45;
- result = (pColData->flags & 2 ? *(pColData->meshFaces - 4) : 1);
- v177 = result;
- v174 = 0.0;
- if ( result > 0 )
- {
- while ( 1 )
- {
- if ( _pColData->flags & 2 )
- {
- v46 = _pColData->meshFaces - 28 * LODWORD(v174) - 32;
- if ( v167 <= *v46 || v166 >= *(v46 + 12) || v169 <= *(v46 + 4) || v168 >= *(v46 + 16) )
- goto LABEL_217;
- LODWORD(v48) = *(v46 + 24);
- numFaces = *(v46 + 26) + 1;
- }
- else
- {
- numFaces = _pColData->numberOfFaces;
- LODWORD(v48) = 0;
- }
- v176 = numFaces;
- v173 = v48;
- if ( SLODWORD(v48) < numFaces )
- {
- LABEL_90:
- v49 = pColData->pMeshFaces;
- v178 = 10 * LODWORD(v173);
- v175 = *(v49 + 10 * LODWORD(v173) + 4);
- if ( fabs(v175 * 0.00024414062) <= 0.1
- || (v50 = pColData->meshFaces,
- v51 = *(v50 + 8 * LODWORD(v173)),
- v52 = 8 * LODWORD(v173) + v50,
- v180 = 8 * LODWORD(v173),
- sub_40F5E0(&v181, v51),
- sub_40F5E0(&v184, *(v52 + 2)),
- sub_40F5E0(&v187, *(v52 + 4)),
- v181 <= v166)
- && v184 <= v166
- && v187 <= v166
- || v181 >= v167 && v184 >= v167 && v187 >= v167
- || v182 <= v168 && v185 <= v168 && v188 <= v168
- || v182 >= v169 && v185 >= v169 && v188 >= v169
- || v183 >= v171 && v186 >= v171 && v189 >= v171
- || (*&v172 = v171 - a15, v183 <= *&v172) && v186 <= *&v172 && v189 <= *&v172 )
- goto LABEL_216;
- v60 = v184 - v181;
- v59 = v185 - v182;
- dword_C4B7A8[0] = LODWORD(flt_C4B898);
- dword_C4B7AC[0] = LODWORD(flt_C4B89C);
- dword_C4B7B8 = LODWORD(flt_C4B8A8);
- dword_C4B7C0 = LODWORD(flt_C4B8B0);
- dword_C4B7B4 = LODWORD(flt_C4B8A4);
- dword_C4B7CC = LODWORD(flt_C4B8BC);
- dword_C4B7D0 = LODWORD(flt_C4B8C0);
- v56 = 0;
- v55 = 0;
- v54 = 0;
- dword_C4B7C4 = LODWORD(flt_C4B8B4);
- dword_C4B6B8[0] = 0;
- dword_C4B6BC[0] = 0;
- dword_C4B6C4 = 0x3F800000u;
- dword_C4B6C8 = 0;
- dword_C4B6D0 = 0x3F800000u;
- dword_C4B6D4 = 0x3F800000u;
- dword_C4B6DC = 0;
- dword_C4B6E0 = 0x3F800000u;
- v58 = dword_C4B820;
- v53 = dword_C4B730;
- v57 = &dword_C4B7A8[-2];
- while ( 1 )
- {
- v61 = (*&dword_C4B7A8[v54] - v181) * v59 - (*&dword_C4B7AC[v54] - v182) * v60;
- *&v165[3] = v61;
- if ( v61 <= 0.0 )
- {
- if ( v55 == 1 )
- {
- ++v56;
- v53 += 12;
- v58 += 12;
- v64 = fabs((*&v57[v54 - 1] - v181) * v59 - (*&v57[v54] - v182) * v60);
- v65 = v64 / (fabs(*&v165[3]) + v64);
- *(v53 - 12) = v65 * *&dword_C4B6B8[v54] + (1.0 - v65) * flt_C4B6AC[v54];
- *(v53 - 8) = (1.0 - v65) * flt_C4B6B0[v54] + v65 * *&dword_C4B6BC[v54];
- *(v58 - 12) = v65 * *&dword_C4B7A8[v54] + (1.0 - v65) * *&v57[v54 - 1];
- *(v58 - 8) = v65 * *&dword_C4B7AC[v54] + (1.0 - v65) * *&v57[v54];
- }
- v55 = 2;
- goto LABEL_120;
- }
- if ( !v55 || v55 == 1 )
- goto LABEL_115;
- if ( v55 == 2 )
- break;
- LABEL_116:
- v55 = 1;
- LABEL_120:
- v54 += 3;
- if ( v54 >= 12 )
- {
- v66 = (*dword_C4B7A8 - v181) * v59 - (*dword_C4B7AC - v182) * v60;
- *&v165[3] = v66;
- if ( v66 > 0.0 && v55 == 2 || *&v165[3] <= 0.0 && v55 == 1 )
- {
- v67 = 3 * v56++;
- v68 = fabs((*&dword_C4B7CC - v181) * v59 - (*&dword_C4B7D0 - v182) * v60);
- v69 = v68 / (fabs(*&v165[3]) + v68);
- *&dword_C4B730[v67] = *&dword_C4B6DC * (1.0 - v69) + v69 * *dword_C4B6B8;
- *&dword_C4B734[v67] = *&dword_C4B6E0 * (1.0 - v69) + v69 * *dword_C4B6BC;
- *&dword_C4B820[v67] = *&dword_C4B7CC * (1.0 - v69) + v69 * *dword_C4B7A8;
- *&dword_C4B824[v67] = (1.0 - v69) * *&dword_C4B7D0 + v69 * *dword_C4B7AC;
- }
- v70 = v56;
- v72 = 0;
- v71 = 0;
- v172 = v70;
- if ( v70 > 0 )
- {
- v75 = dword_C4B7A8;
- v73 = dword_C4B6B8;
- v74 = 0;
- v60 = v187 - v184;
- v175 = v70;
- v59 = v188 - v185;
- while ( 1 )
- {
- v76 = (*&dword_C4B820[v74] - v184) * v59 - (*&dword_C4B824[v74] - v185) * v60;
- *&v165[3] = v76;
- if ( v76 <= 0.0 )
- {
- if ( v71 == 1 )
- {
- ++v72;
- v73 += 12;
- v75 += 12;
- v79 = fabs((flt_C4B814[v74] - v184) * v59 - (flt_C4B818[v74] - v185) * v60);
- v80 = v79 / (fabs(*&v165[3]) + v79);
- *(v73 - 12) = v80 * *&dword_C4B730[v74] + (1.0 - v80) * flt_C4B724[v74];
- *(v73 - 8) = (1.0 - v80) * flt_C4B728[v74] + v80 * *&dword_C4B734[v74];
- *(v75 - 12) = v80 * *&dword_C4B820[v74] + (1.0 - v80) * flt_C4B814[v74];
- *(v75 - 8) = v80 * *&dword_C4B824[v74] + (1.0 - v80) * flt_C4B818[v74];
- }
- v71 = 2;
- goto LABEL_138;
- }
- if ( !v71 || v71 == 1 )
- goto LABEL_133;
- if ( v71 == 2 )
- break;
- LABEL_134:
- v71 = 1;
- LABEL_138:
- v74 += 3;
- --v175;
- if ( !v175 )
- goto LABEL_139;
- }
- ++v72;
- v73 += 12;
- v75 += 12;
- v77 = fabs((flt_C4B814[v74] - v184) * v59 - (flt_C4B818[v74] - v185) * v60);
- v78 = v77 / (fabs(*&v165[3]) + v77);
- *(v73 - 12) = (1.0 - v78) * flt_C4B724[v74] + v78 * *&dword_C4B730[v74];
- *(v73 - 8) = (1.0 - v78) * flt_C4B728[v74] + v78 * *&dword_C4B734[v74];
- *(v75 - 12) = v78 * *&dword_C4B820[v74] + (1.0 - v78) * flt_C4B814[v74];
- *(v75 - 8) = v78 * *&dword_C4B824[v74] + (1.0 - v78) * flt_C4B818[v74];
- LABEL_133:
- *v73 = dword_C4B730[v74];
- *(v73 + 4) = dword_C4B734[v74];
- *v75 = dword_C4B820[v74];
- v73 += 12;
- *(v75 + 4) = dword_C4B824[v74];
- ++v72;
- v75 += 12;
- goto LABEL_134;
- }
- LABEL_139:
- v81 = (*dword_C4B820 - v184) * v59 - (*dword_C4B824 - v185) * v60;
- *&v165[3] = v81;
- if ( v81 > 0.0 && v71 == 2 || *&v165[3] <= 0.0 && v71 == 1 )
- {
- v82 = 3 * v172;
- v83 = 3 * v72++;
- v84 = fabs((flt_C4B814[3 * v172] - v184) * v59 - (flt_C4B818[3 * v172] - v185) * v60);
- v85 = v84 / (fabs(*&v165[3]) + v84);
- *&dword_C4B6B8[v83] = (1.0 - v85) * flt_C4B724[3 * v172] + *dword_C4B730 * v85;
- *&dword_C4B6BC[v83] = (1.0 - v85) * flt_C4B728[v82] + *dword_C4B734 * v85;
- *&dword_C4B7A8[v83] = *dword_C4B820 * v85 + (1.0 - v85) * flt_C4B814[v82];
- *&dword_C4B7AC[v83] = (1.0 - v85) * flt_C4B818[v82] + *dword_C4B824 * v85;
- }
- v86 = v72;
- v88 = 0;
- v87 = 0;
- v172 = v86;
- if ( v86 > 0 )
- {
- v91 = dword_C4B820;
- v89 = dword_C4B730;
- v60 = v181 - v187;
- v90 = 0;
- v175 = v172;
- v59 = v182 - v188;
- while ( 1 )
- {
- v92 = (*&dword_C4B7A8[v90] - v187) * v59 - (*&dword_C4B7AC[v90] - v188) * v60;
- *&v165[3] = v92;
- if ( v92 <= 0.0 )
- {
- if ( v87 == 1 )
- {
- ++v88;
- v89 += 12;
- v91 += 12;
- v95 = fabs((*&v57[v90 - 1] - v187) * v59 - (*&v57[v90] - v188) * v60);
- v96 = v95 / (fabs(*&v165[3]) + v95);
- *(v89 - 12) = v96 * *&dword_C4B6B8[v90] + (1.0 - v96) * flt_C4B6AC[v90];
- *(v89 - 8) = v96 * *&dword_C4B6BC[v90] + (1.0 - v96) * flt_C4B6B0[v90];
- *(v91 - 12) = v96 * *&dword_C4B7A8[v90] + (1.0 - v96) * *&v57[v90 - 1];
- *(v91 - 8) = v96 * *&dword_C4B7AC[v90] + (1.0 - v96) * *&v57[v90];
- }
- v87 = 2;
- goto LABEL_156;
- }
- if ( !v87 || v87 == 1 )
- goto LABEL_151;
- if ( v87 == 2 )
- break;
- LABEL_152:
- v87 = 1;
- LABEL_156:
- v90 += 3;
- --v175;
- if ( !v175 )
- {
- v86 = v172;
- goto LABEL_158;
- }
- }
- ++v88;
- v89 += 12;
- v91 += 12;
- v93 = fabs((*&v57[v90 - 1] - v187) * v59 - (*&v57[v90] - v188) * v60);
- v94 = v93 / (fabs(*&v165[3]) + v93);
- *(v89 - 12) = (1.0 - v94) * flt_C4B6AC[v90] + v94 * *&dword_C4B6B8[v90];
- *(v89 - 8) = v94 * *&dword_C4B6BC[v90] + (1.0 - v94) * flt_C4B6B0[v90];
- *(v91 - 12) = v94 * *&dword_C4B7A8[v90] + (1.0 - v94) * *&v57[v90 - 1];
- *(v91 - 8) = v94 * *&dword_C4B7AC[v90] + (1.0 - v94) * *&v57[v90];
- LABEL_151:
- *v89 = dword_C4B6B8[v90];
- *(v89 + 4) = dword_C4B6BC[v90];
- *v91 = dword_C4B7A8[v90];
- v89 += 12;
- *(v91 + 4) = dword_C4B7AC[v90];
- ++v88;
- v91 += 12;
- goto LABEL_152;
- }
- LABEL_158:
- v97 = (*dword_C4B7A8 - v187) * v59 - (*dword_C4B7AC - v188) * v60;
- *&v165[3] = v97;
- if ( v97 > 0.0 && v87 == 2 || *&v165[3] <= 0.0 && v87 == 1 )
- {
- v98 = 3 * v86;
- v99 = flt_C4B79C[3 * v86];
- v100 = 3 * v88++;
- v101 = fabs((v99 - v187) * v59 - (flt_C4B7A0[v98] - v188) * v60);
- v102 = v101 / (fabs(*&v165[3]) + v101);
- *&dword_C4B730[v100] = (1.0 - v102) * flt_C4B6AC[v98] + v102 * *dword_C4B6B8;
- *&dword_C4B734[v100] = (1.0 - v102) * flt_C4B6B0[v98] + v102 * *dword_C4B6BC;
- *&dword_C4B820[v100] = v102 * *dword_C4B7A8 + (1.0 - v102) * flt_C4B79C[v98];
- *&dword_C4B824[v100] = (1.0 - v102) * flt_C4B7A0[v98] + v102 * *dword_C4B7AC;
- }
- if ( v88 >= 3 )
- {
- v105 = pColData->pMeshFaces;
- v106 = *(v105 + v178);
- v107 = v178 + v105;
- v108 = *(v107 + 2);
- v178 = v106;
- v109 = *(v107 + 4);
- v110 = v178;
- v178 = v108;
- v103 = 0;
- v190 = v110 * 0.00024414062;
- v111 = v178;
- v178 = v109;
- v191 = v111 * 0.00024414062;
- v104 = v109 * 0.00024414062;
- *&v165[3] = v183 * v104 + v191 * v182 + v190 * v181;
- if ( v88 >= 4 )
- {
- v113 = 3;
- v114 = -1.0 / v104;
- v112 = flt_C4B828;
- do
- {
- v113 += 4;
- v115 = v191 * *(v112 - 4);
- v103 += 4;
- v112 += 48;
- *(v112 - 48) = (v115 + v190 * *(v112 - 56) - *&v165[3]) * v114;
- *(v112 - 36) = (v191 * *(v112 - 40) + v190 * *(v112 - 44) - *&v165[3]) * v114;
- *(v112 - 24) = (v191 * *(v112 - 28) + v190 * *(v112 - 32) - *&v165[3]) * v114;
- *(v112 - 12) = (v191 * *(v112 - 16) + v190 * *(v112 - 20) - *&v165[3]) * v114;
- }
- while ( v113 < v88 );
- }
- if ( v103 < v88 )
- {
- v118 = -1.0 / v104;
- v116 = &flt_C4B828[3 * v103];
- v117 = v88 - v103;
- do
- {
- v116 += 3;
- --v117;
- *(v116 - 3) = (v191 * *(v116 - 4) + v190 * *(v116 - 5) - *&v165[3]) * v118;
- }
- while ( v117 );
- }
- if ( v88 > 0 )
- {
- v119 = dword_C4B824;
- v175 = v88;
- do
- {
- LODWORD(v179) = *(v119 - 4);
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v120 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v121 = entity->__parent.m_pCoords;
- v122 = v121 + 48;
- if ( !v121 )
- v122 = &entity->__parent.placement;
- *(v119 - 4) = *(v121 + 16) * *v119 + *v120 * *(v119 - 4) + *v122;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v123 = entity->__parent.m_pCoords;
- if ( !entity->__parent.m_pCoords )
- {
- CPlaceable__allocateL1XYZ(entity);
- Placement__toMatrix(entity->__parent.m_pCoords);
- }
- v124 = entity->__parent.m_pCoords;
- v125 = v124 + 48;
- if ( !v124 )
- v125 = &entity->__parent.placement;
- *v119 = *(v124 + 20) * *v119 + v179 * *(v123 + 4) + *(v125 + 4);
- v126 = entity->__parent.m_pCoords;
- if ( v126 )
- v127 = v126 + 48;
- else
- v127 = &entity->__parent.placement;
- v128 = *(v127 + 8) + *(v119 + 4);
- v119 += 12;
- v129 = v175-- == 1;
- *(v119 - 8) = v128;
- }
- while ( !v129 );
- }
- *cBuf = *(v180 + pColData->meshFaces + 7);
- if ( a17 )
- {
- v130 = dword_C403D8;
- if ( dword_C403D8 )
- {
- dword_C403D8 = *(dword_C403D8 + 84);
- *(v130 + 0x54) = *a17;
- *a17 = v130;
- *(v130 + 0x58) = v88;
- if ( v88 > 0 )
- {
- v131 = v130 + 97;
- v132 = 0;
- do
- {
- *(v132 * 4 + v130) = dword_C4B820[v132];
- *(v132 * 4 + v130 + 4) = dword_C4B820[v132 + 1];
- *(v132 * 4 + v130 + 8) = dword_C4B820[v132 + 2];
- *(v131 - 7) = (*&dword_C4B730[v132] * 200.0);
- v133 = (*&dword_C4B734[v132] * 200.0);
- v132 += 3;
- *v131++ = v133;
- --v88;
- }
- while ( v88 );
- }
- }
- }
- else
- {
- v135 = numIndices;
- v134 = numVerts;
- v136 = 3 * v88 - 6;
- v180 = 3 * v88 - 6;
- if ( numIndices + v136 >= 4096 )
- {
- if ( numVerts && RwIm3DTransform(&pVerts, numVerts, 0, 1u) )
- {
- RwIm3DRenderIndexedPrimitive(3, indices, numIndices);
- RwIm3DEnd();
- }
- v135 = 0;
- v134 = 0;
- numIndices = 0;
- numVerts = 0;
- }
- if ( v134 + v88 >= 2048 )
- {
- if ( v134 && RwIm3DTransform(&pVerts, v134, 0, 1u) )
- {
- RwIm3DRenderIndexedPrimitive(3, indices, numIndices);
- RwIm3DEnd();
- }
- v135 = 0;
- v134 = 0;
- numIndices = 0;
- numVerts = 0;
- }
- v138 = 9 * v134;
- v175 = 2 * v135 + 0xC4B958;
- dword_C40410 = 3 * v88 - 6;
- dword_C40414 = v88;
- v140 = *cBuf;
- v137 = 4 * v138 + 12900696;
- v178 = v137;
- sub_707850(a19, v140, a12, a13, a14, v165, &v165[1], &v165[2]);
- v139 = 0;
- if ( v88 >= 4 )
- {
- v142 = v165[2] | ((v165[1] | ((v165[0] | (a11 << 8)) << 8)) << 8);
- v144 = 3;
- pVertices = v137 + 0x1C;
- v143 = 0;
- do
- {
- v145 = a16 * *&dword_C4B730[v143];
- *(pVertices - 28) = dword_C4B820[v143];
- *(pVertices - 24) = dword_C4B824[v143];
- *pVertices = v145;
- v146 = a16 * *&dword_C4B734[v143];
- *(pVertices + 8) = dword_C4B82C[v143];
- *(pVertices + 12) = dword_C4B830[v143];
- *(pVertices + 4) = v146;
- v147 = flt_C4B828[v143] + 0.059999999;
- *(pVertices + 44) = dword_C4B838[v143];
- *(pVertices + 48) = dword_C4B83C[v143];
- *(pVertices - 20) = v147;
- *(pVertices + 80) = dword_C4B844[v143];
- v148 = a16 * flt_C4B73C[v143];
- v149 = dword_C4B848[v143];
- *(pVertices - 4) = v142;
- *(pVertices + 32) = v142;
- *(pVertices + 36) = v148;
- *(pVertices + 68) = v142;
- v150 = a16 * flt_C4B740[v143];
- *(pVertices + 104) = v142;
- *(pVertices + 84) = v149;
- v144 += 4;
- *(pVertices + 40) = v150;
- v139 += 4;
- v151 = flt_C4B834[v143] + 0.059999999;
- v143 += 12;
- pVertices += 144;
- *(pVertices - 128) = v151;
- *(pVertices - 72) = a16 * flt_C4B718[v143];
- *(pVertices - 68) = a16 * flt_C4B71C[v143];
- *(pVertices - 92) = flt_C4B810[v143] + 0.059999999;
- *(pVertices - 36) = a16 * flt_C4B724[v143];
- *(pVertices - 32) = a16 * flt_C4B728[v143];
- *(pVertices - 56) = flt_C4B81C[v143] + 0.059999999;
- }
- while ( v144 < v88 );
- v136 = v180;
- v137 = v178;
- }
- if ( v139 < v88 )
- {
- v154 = v165[2] | ((v165[1] | ((v165[0] | (a11 << 8)) << 8)) << 8);
- v153 = v137 + 36 * v139 + 28;
- v152 = 3 * v139;
- v155 = v88 - v139;
- do
- {
- v156 = a16 * *&dword_C4B730[v152];
- *(v153 - 28) = dword_C4B820[v152];
- v157 = dword_C4B824[v152];
- *(v153 - 4) = v154;
- *v153 = v156;
- *(v153 - 24) = v157;
- v158 = a16 * *&dword_C4B734[v152];
- v152 += 3;
- v153 += 36;
- --v155;
- *(v153 - 32) = v158;
- *(v153 - 56) = flt_C4B81C[v152] + 0.059999999;
- }
- while ( v155 );
- }
- if ( v136 > 0 )
- {
- v160 = v136;
- v163 = v175;
- v164 = v160 & 1;
- v160 >>= 1;
- memcpy(v175, word_C403A8, 4 * v160);
- v162 = &word_C403A8[2 * v160];
- v161 = v163 + 4 * v160;
- for ( i = v164; i; --i )
- {
- *v161 = *v162;
- ++v162;
- v161 += 2;
- }
- }
- sub_7077A0();
- }
- }
- LABEL_216:
- ++LODWORD(v173);
- if ( SLODWORD(v173) >= v176 )
- goto LABEL_217;
- goto LABEL_90;
- }
- }
- ++v56;
- v53 += 12;
- v58 += 12;
- v62 = fabs((*&v57[v54 - 1] - v181) * v59 - (*&v57[v54] - v182) * v60);
- v63 = v62 / (fabs(*&v165[3]) + v62);
- *(v53 - 12) = (1.0 - v63) * flt_C4B6AC[v54] + v63 * *&dword_C4B6B8[v54];
- *(v53 - 8) = (1.0 - v63) * flt_C4B6B0[v54] + v63 * *&dword_C4B6BC[v54];
- *(v58 - 12) = v63 * *&dword_C4B7A8[v54] + (1.0 - v63) * *&v57[v54 - 1];
- *(v58 - 8) = v63 * *&dword_C4B7AC[v54] + (1.0 - v63) * *&v57[v54];
- LABEL_115:
- *v53 = dword_C4B6B8[v54];
- *(v53 + 4) = dword_C4B6BC[v54];
- *v58 = dword_C4B7A8[v54];
- v53 += 12;
- *(v58 + 4) = dword_C4B7AC[v54];
- ++v56;
- v58 += 12;
- goto LABEL_116;
- }
- LABEL_217:
- result = (LODWORD(v174)++ + 1);
- if ( SLODWORD(v174) >= v177 )
- return result;
- _pColData = pColData;
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment