int __thiscall CCamera__CamControl(CCamera *this)
{
CCamera *thiss; // ebp@1
CPad *v2; // eax@16
CPlayerPed *v3; // eax@16
CAutomobile *v4; // edi@21
char v5; // cl@21
CEntity *v6; // esi@26
char v7; // al@26
CPad *v8; // eax@30
CPad *v9; // eax@37
double v10; // st6@45
double v11; // st7@50
CEntity *v12; // edx@53
int v13; // ebx@58
int v14; // eax@62
int v15; // eax@69
int v16; // eax@69
int v17; // eax@71
float v18; // ST2C_4@71
float v19; // ST28_4@71
float v20; // ST24_4@71
float v21; // STA0_4@71
float v22; // ST28_4@75
float v23; // ST24_4@75
float v24; // ST2C_4@75
float v25; // ST28_4@75
float v26; // ST24_4@75
float v27; // ST2C_4@75
float v28; // STA4_4@75
int v29; // eax@76
int v30; // ecx@76
int v31; // eax@78
int v32; // eax@78
int v33; // eax@79
int v34; // eax@79
int v35; // edx@83
float v36; // ST28_4@84
float v37; // ST24_4@84
char *v38; // eax@84
float v39; // ST2C_4@86
float v40; // ST28_4@86
float *v41; // eax@86
char *v42; // eax@89
int v43; // eax@91
int v44; // esi@96
float v45; // ST28_4@98
char *v46; // eax@98
signed int v47; // eax@118
double v48; // st7@118
double v49; // st6@122
float v50; // ST9C_4@133
int v51; // edx@138
int v52; // ecx@138
char v53; // al@142
double v54; // st6@143
double v55; // st7@143
double v56; // st5@144
double v57; // st7@146
double v58; // st5@147
double v59; // st7@151
double v60; // st7@152
double v61; // st5@153
double v62; // st7@156
double v63; // st5@157
double v64; // st6@161
double v65; // st7@161
double v66; // st5@162
double v67; // st7@164
double v68; // st5@165
char *v69; // eax@171
CPad *v70; // eax@178
CPad *v71; // eax@190
double v72; // st6@202
CPad *v73; // eax@212
CPad *v74; // eax@213
CPad *v75; // eax@216
CPad *v76; // eax@217
CPad *v77; // eax@224
CPed *v78; // eax@227
CPad *v79; // eax@231
double v80; // st7@232
char v81; // al@238
double v82; // st6@239
double v83; // st7@239
double v84; // st5@240
double v85; // st7@242
double v86; // st5@243
double v87; // st7@249
double v88; // st7@250
double v89; // st5@251
double v90; // st7@254
double v91; // st5@255
double v92; // st6@259
double v93; // st7@259
double v94; // st5@260
double v95; // st7@262
double v96; // st5@263
char *v97; // eax@269
int v98; // ebx@277
int v99; // eax@280
int v100; // eax@285
int v101; // eax@288
int v102; // eax@288
int v103; // eax@289
float v104; // ST2C_4@289
float v105; // ST28_4@289
float v106; // ST24_4@289
float v107; // STAC_4@289
float v108; // ST28_4@294
float v109; // ST24_4@294
int v110; // eax@300
int v111; // eax@301
int v112; // edi@301
int v113; // eax@303
int v114; // eax@303
int v115; // eax@304
int v116; // eax@304
int v117; // esi@309
float v118; // ST28_4@310
float v119; // ST24_4@310
char *v120; // eax@310
float v121; // ST2C_4@312
float v122; // ST28_4@312
float *v123; // eax@312
char *v124; // eax@315
int v125; // eax@317
int v126; // ecx@323
float v127; // ST28_4@325
char *v128; // eax@325
CPlayerPed *v129; // eax@331
int v130; // eax@331
int v131; // eax@331
int v132; // edi@350
float v133; // ST2C_4@350
float v134; // ST28_4@350
float v135; // ST24_4@350
float v136; // ST2C_4@350
float v137; // STB0_4@350
int v138; // eax@351
float v139; // ST2C_4@351
float v140; // ST28_4@351
float v141; // ST24_4@351
float v142; // ST2C_4@351
float v143; // STB4_4@351
int v144; // edx@359
int v145; // ecx@359
CPad *v146; // eax@365
__int16 v147; // ax@370
int v148; // eax@385
float v149; // STE0_4@392
float v150; // ST2C_4@392
double v151; // st7@392
float v152; // STE4_4@392
double v153; // st6@392
float v154; // ST2C_4@392
double i; // st7@393
float v156; // ST2C_4@399
float v157; // STBC_4@399
double v158; // st7@403
int v159; // ST30_4@415
int v160; // eax@415
float v161; // STC0_4@415
float v162; // STC4_4@415
int v163; // eax@415
RwV3D *v164; // eax@416
char v165; // dl@422
CPlayerPed *v166; // ecx@424
CEntity *v167; // esi@441
signed int j; // edi@442
int v169; // eax@443
int v170; // ebx@445
int v171; // eax@445
float v172; // ST2C_4@445
float v173; // ST28_4@445
float v174; // ST24_4@445
float v175; // STC8_4@445
float v176; // STCC_4@445
CEntity *v177; // esi@464
int v178; // eax@484
char v179; // al@485
CEntity *v180; // ecx@487
__int16 v181; // si@513
__int16 v182; // di@517
__int16 v183; // cx@529
CEntity *v184; // edi@538
char v185; // zf@539
__int16 v186; // bx@541
int v187; // edx@545
__int16 v188; // ax@545
float v189; // ST98_4@562
int v190; // eax@563
CPlayerPed *v191; // eax@564
int v192; // eax@564
int v193; // eax@579
char v194; // bl@584
CEntity *v195; // esi@587
char v196; // al@593
int v197; // edx@608
CEntity *v198; // ecx@608
int v199; // edx@610
__int16 v200; // si@612
char v201; // bl@613
CPlayerPed *v202; // eax@622
CPlayerPed *v203; // eax@622
CPlayerPed *v204; // eax@622
CEntity *v205; // ecx@622
float v206; // STD0_4@624
float v207; // STD4_4@624
int v208; // ebx@638
__int16 v209; // ax@644
char v210; // al@652
int v211; // ebx@659
int v212; // ecx@671
__int16 v213; // di@673
CPlayerPed *v214; // eax@680
CPlayerPed *v215; // eax@681
char v216; // bl@682
__int16 v217; // si@685
int result; // eax@685
CPad *v219; // eax@689
int *v220; // [sp+8h] [bp-40Ch]@416
void *v221; // [sp+8h] [bp-40Ch]@608
int v222; // [sp+Ch] [bp-408h]@0
char v223; // [sp+Ch] [bp-408h]@639
char v224; // [sp+14h] [bp-400h]@541
char v225; // [sp+18h] [bp-3FCh]@385
signed int v226; // [sp+1Ch] [bp-3F8h]@71
signed int v227; // [sp+20h] [bp-3F4h]@289
char v228; // [sp+24h] [bp-3F0h]@639
char v229; // [sp+28h] [bp-3ECh]@76
char v230; // [sp+2Ch] [bp-3E8h]@301
char v231; // [sp+30h] [bp-3E4h]@441
char v232; // [sp+34h] [bp-3E0h]@3
char v233; // [sp+38h] [bp-3DCh]@3
char v234; // [sp+3Ch] [bp-3D8h]@3
int v235; // [sp+40h] [bp-3D4h]@3
RwMatrix *v236; // [sp+44h] [bp-3D0h]@53
char v237; // [sp+48h] [bp-3CCh]@424
char v238; // [sp+4Ch] [bp-3C8h]@464
float v239; // [sp+50h] [bp-3C4h]@20
float v240; // [sp+54h] [bp-3C0h]@20
float v241; // [sp+58h] [bp-3BCh]@91
float v242; // [sp+5Ch] [bp-3B8h]@317
float v243; // [sp+60h] [bp-3B4h]@383
float v244; // [sp+64h] [bp-3B0h]@392
float v245; // [sp+68h] [bp-3ACh]@392
float v246; // [sp+6Ch] [bp-3A8h]@390
float v247; // [sp+70h] [bp-3A4h]@403
float v248; // [sp+84h] [bp-390h]@133
float v249; // [sp+94h] [bp-380h]@392
float v250; // [sp+B4h] [bp-360h]@78
float v251; // [sp+B8h] [bp-35Ch]@303
float v252; // [sp+CCh] [bp-348h]@75
float v253; // [sp+D0h] [bp-344h]@75
float v254; // [sp+D4h] [bp-340h]@75
float v255; // [sp+D8h] [bp-33Ch]@71
float v256; // [sp+DCh] [bp-338h]@71
float v257; // [sp+E0h] [bp-334h]@71
char v258; // [sp+E4h] [bp-330h]@90
int v259; // [sp+ECh] [bp-328h]@74
float v260; // [sp+F0h] [bp-324h]@69
float arg4; // [sp+F4h] [bp-320h]@71
float arg8; // [sp+F8h] [bp-31Ch]@71
float v263; // [sp+FCh] [bp-318h]@91
int v264; // [sp+104h] [bp-310h]@93
char v265; // [sp+108h] [bp-30Ch]@101
float v266; // [sp+110h] [bp-304h]@101
int v267; // [sp+114h] [bp-300h]@76
int v268; // [sp+118h] [bp-2FCh]@76
int v269; // [sp+11Ch] [bp-2F8h]@76
RwV3D a2; // [sp+120h] [bp-2F4h]@78
char v271; // [sp+12Fh] [bp-2E5h]@91
int v272; // [sp+130h] [bp-2E4h]@118
int v273; // [sp+134h] [bp-2E0h]@301
int v274; // [sp+138h] [bp-2DCh]@301
int v275; // [sp+13Ch] [bp-2D8h]@301
RwV3D v276; // [sp+140h] [bp-2D4h]@303
char v277; // [sp+14Fh] [bp-2C5h]@317
int v278; // [sp+150h] [bp-2C4h]@385
int v279; // [sp+154h] [bp-2C0h]@385
int v280; // [sp+158h] [bp-2BCh]@385
float v281; // [sp+15Ch] [bp-2B8h]@385
float v282; // [sp+160h] [bp-2B4h]@385
float v283; // [sp+164h] [bp-2B0h]@385
float v284; // [sp+168h] [bp-2ACh]@385
float v285; // [sp+16Ch] [bp-2A8h]@385
int v286; // [sp+170h] [bp-2A4h]@385
RwV3D a4; // [sp+174h] [bp-2A0h]@415
CColInfo vec1; // [sp+180h] [bp-294h]@415
RwV3D a6; // [sp+1A8h] [bp-26Ch]@415
int v290; // [sp+1B4h] [bp-260h]@564
float v291; // [sp+1B8h] [bp-25Ch]@622
float v292; // [sp+1BCh] [bp-258h]@622
float v293; // [sp+1C0h] [bp-254h]@622
RwV3D a1; // [sp+1C4h] [bp-250h]@71
char v295; // [sp+1D0h] [bp-244h]@75
float v296; // [sp+1DCh] [bp-238h]@75
float v297; // [sp+1E0h] [bp-234h]@75
char v298; // [sp+1E8h] [bp-22Ch]@76
int v299; // [sp+1ECh] [bp-228h]@76
char v300; // [sp+1F4h] [bp-220h]@78
float v301; // [sp+1F8h] [bp-21Ch]@78
float v302; // [sp+1FCh] [bp-218h]@78
int v303; // [sp+200h] [bp-214h]@78
char v304; // [sp+20Ch] [bp-208h]@79
int v305; // [sp+218h] [bp-1FCh]@79
char v306; // [sp+224h] [bp-1F0h]@84
char v307; // [sp+230h] [bp-1E4h]@86
char v308; // [sp+23Ch] [bp-1D8h]@89
char v309; // [sp+248h] [bp-1CCh]@90
char v310; // [sp+254h] [bp-1C0h]@98
int v311; // [sp+260h] [bp-1B4h]@98
char v312; // [sp+26Ch] [bp-1A8h]@99
int v313; // [sp+278h] [bp-19Ch]@99
char v314; // [sp+284h] [bp-190h]@100
int v315; // [sp+290h] [bp-184h]@100
RwV3D a3; // [sp+29Ch] [bp-178h]@101
char v317; // [sp+2A8h] [bp-16Ch]@289
char v318; // [sp+2B4h] [bp-160h]@294
char v319; // [sp+2C0h] [bp-154h]@300
char v320; // [sp+2CCh] [bp-148h]@301
int v321; // [sp+2D0h] [bp-144h]@301
char v322; // [sp+2D8h] [bp-13Ch]@303
float v323; // [sp+2DCh] [bp-138h]@303
float v324; // [sp+2E0h] [bp-134h]@303
int v325; // [sp+2E4h] [bp-130h]@303
char v326; // [sp+2F0h] [bp-124h]@304
int v327; // [sp+2FCh] [bp-118h]@304
char v328; // [sp+308h] [bp-10Ch]@310
char v329; // [sp+314h] [bp-100h]@312
char v330; // [sp+320h] [bp-F4h]@315
char v331; // [sp+32Ch] [bp-E8h]@316
char v332; // [sp+338h] [bp-DCh]@325
int v333; // [sp+344h] [bp-D0h]@325
char v334; // [sp+350h] [bp-C4h]@326
int v335; // [sp+35Ch] [bp-B8h]@326
char v336; // [sp+368h] [bp-ACh]@327
int v337; // [sp+374h] [bp-A0h]@327
char v338; // [sp+380h] [bp-94h]@328
int v339; // [sp+38Ch] [bp-88h]@328
int v340; // [sp+398h] [bp-7Ch]@335
int v341; // [sp+39Ch] [bp-78h]@335
int v342; // [sp+3A0h] [bp-74h]@335
float v343; // [sp+3A4h] [bp-70h]@350
float v344; // [sp+3A8h] [bp-6Ch]@350
float v345; // [sp+3B0h] [bp-64h]@351
float v346; // [sp+3B4h] [bp-60h]@351
char v347; // [sp+3BCh] [bp-58h]@385
float v348; // [sp+3C0h] [bp-54h]@385
float v349; // [sp+3C4h] [bp-50h]@385
char v350; // [sp+3C8h] [bp-4Ch]@385
float v351; // [sp+3CCh] [bp-48h]@385
int v352; // [sp+3D0h] [bp-44h]@385
int v353; // [sp+3D4h] [bp-40h]@416
int v354; // [sp+3D8h] [bp-3Ch]@416
int v355; // [sp+3DCh] [bp-38h]@416
int v356; // [sp+3E0h] [bp-34h]@417
int v357; // [sp+3E4h] [bp-30h]@417
int v358; // [sp+3E8h] [bp-2Ch]@417
char v359; // [sp+3ECh] [bp-28h]@445
char v360; // [sp+3F8h] [bp-1Ch]@564
float v361; // [sp+3FCh] [bp-18h]@564
thiss = this;
if ( !byte_703899 )
{
byte_703899 = 1;
byte_703898 = 0;
}
v234 = 0;
v232 = 0;
v233 = 0;
v235 = this->cams[this->activeCam].field_C;
this->gap_5E[0] = 0;
this->gap_5E[1] = 0;
this->field_67 = 0;
this->field_66 = 0;
this->field_58 = 0;
this->gap_65[0] = 0;
this->field_52 = 0;
this->field_50 = 0;
byte_703684 = 0;
if ( !this->cams[this->activeCam].targetedEntity && !this->targetedEntity )
this->targetedEntity = (CEntity *)players[currentPlayer].pPed;
++this->field_CC;
if ( this->field_CC > this->field_C8 )
this->field_CC = 1;
this->field_4E = this->field_CC == this->field_C8;
if ( this->field_4E == 1 )
{
if ( sub_57E1C0() )
thiss->field_73 = 1;
else
thiss->field_73 = 0;
}
if ( thiss->field_5B == 1 )
{
v2 = CPad__GetPad(0);
v2->flags &= 0xFFFEu;
v3 = FindPlayerPed();
v3->__parent.__parent.__parent.field_52 = v3->__parent.__parent.__parent.field_52 & 0xFB | 4;
}
if ( !menuFreeze && !dvdNotInDrive && !thiss->field_51 )
{
v239 = flt_68ADD8;
v240 = flt_68ADD8;
if ( thiss->field_64 == 1 )
{
v4 = (CAutomobile *)thiss->targetedEntity;
v5 = 0;
if ( (v4->__parent.__parent.__parent.flags & 7) != 2 || v4->__parent.vehicleType != 2 )
v5 = 1;
if ( v5 )
{
sub_46BC7D(thiss);
thiss->gap_65[0] = 1;
thiss->field_64 = 0;
CCamera__SetWideScreenOff(thiss);
}
}
v6 = thiss->targetedEntity;
v7 = v6->flags & 7;
if ( v7 == 2 )
{
if ( v6[6].placeable.matrix.matrixPtr == (RwMatrix *)1 && v6->modelIndex != 190 )
v233 = 1;
v8 = CPad__GetPad(0);
if ( (unsigned __int8)CPad__CycleCameraModeUpJustDown(v8) && byte_A10AF6 != 1 && (thiss->field_5B == 1 || thiss->field_D0 == 2) )
{
if ( !thiss->wideScreen )
{
thiss->field_DC = thiss->field_DC - dword_68AE2C;
if ( flt_68ADE8 != thiss->field_DC )
thiss->field_DC = thiss->field_DC - dword_68AE2C;
}
}
v9 = CPad__GetPad(0);
if ( (unsigned __int8)CPad__CycleCameraModeDownJustDown(v9) && byte_A10AF6 != 1 && (thiss->field_5B == 1 || thiss->field_D0 == 2) )
{
if ( !thiss->wideScreen )
{
thiss->field_DC = thiss->field_DC + dword_68AE2C;
if ( flt_68ADE8 != thiss->field_DC )
thiss->field_DC = thiss->field_DC + dword_68AE2C;
}
}
if ( !thiss->field_73 )
{
v10 = thiss->field_DC;
if ( v10 <= flt_68ADCC )
{
if ( v10 >= flt_68ADD8 )
LODWORD(thiss->field_DC) = 1084227584;
}
else
{
LODWORD(thiss->field_DC) = 0;
}
}
if ( thiss->field_73 )
{
v11 = thiss->field_DC;
if ( flt_68ADE8 == v11 )
{
if ( flt_68ADD8 == v11 )
word_70388A = 18;
}
}
v12 = thiss->targetedEntity;
v236 = v12[6].placeable.matrix.matrixPtr;
if ( v12[6].placeable.matrix.matrixPtr == (RwMatrix *)1 && v12->modelIndex == 190 )
v236 = 0;
if ( v236 && v236 != (RwMatrix *)5 )
{
if ( v236 == (RwMatrix *)1 )
word_70388A = 22;
LABEL_118:
v47 = sub_5BAA80((CVehicle *)thiss->targetedEntity);
v272 = 0;
sub_46F659(v47, &v272);
v48 = thiss->field_DC;
if ( flt_68ADD8 != v48 && !thiss->field_56 )
{
*(_DWORD *)&thiss->gap_E0[0] = 0;
word_70388A = 16;
LABEL_128:
if ( flt_68ADE8 != thiss->field_DC && !thiss->field_56 )
{
*(_DWORD *)&thiss->gap_E0[0] = 1065353216;
word_70388A = 1;
}
if ( !v236 )
{
if ( !thiss->field_56 )
{
v50 = *(float *)(sub_4739B2(pmodels[thiss->targetedEntity->modelIndex]) + 24);
v248 = *(float *)(sub_4739B2(pmodels[thiss->targetedEntity->modelIndex]) + 36) - v50;
if ( (unsigned __int8)sub_57E180() )
{
if ( v248 >= (double)flt_68AF14 && !thiss->field_6F0 )
{
word_70388A = 16;
thiss->field_52 = 1;
}
}
}
}
if ( word_70388A == 1 && ((unsigned __int8)sub_57E180() || (unsigned __int8)CCullZones__CamNoRain(v52, v51) || CCullZones__PlayerNoRain()) )
word_70388A = 16;
v53 = thiss->field_69;
if ( v53 == 1 )
{
v54 = *(float *)&thiss->field_130;
v55 = *(float *)&thiss->field_E4;
if ( *(float *)&thiss->field_E4 < v54 )
{
v58 = v55 - flt_68AF18 * fGameEngineSpeed;
if ( v54 > v58 )
v58 = *(float *)&thiss->field_130;
v57 = v58;
}
else
{
v56 = flt_68AF18 * fGameEngineSpeed + v55;
if ( v54 >= v56 )
v56 = *(float *)&thiss->field_130;
v57 = v56;
}
}
else
{
if ( thiss->field_73 )
{
v239 = flt_68AF1C;
v59 = *(float *)&thiss->field_E4;
if ( *(float *)&thiss->field_E4 < (double)flt_68AF20 )
{
v62 = v59 - flt_68AF18 * fGameEngineSpeed;
if ( flt_68AF20 <= v62 )
v63 = v62;
else
v63 = flt_68AF20;
v57 = v63;
}
else
{
v60 = flt_68AF18 * fGameEngineSpeed + v59;
if ( flt_68AF20 < v60 )
v61 = v60;
else
v61 = flt_68AF20;
v57 = v61;
}
}
else
{
if ( v53 )
goto LABEL_171;
v64 = *(float *)&thiss->gap_E0[0];
v65 = *(float *)&thiss->field_E4;
if ( *(float *)&thiss->field_E4 < v64 )
{
v68 = v65 - flt_68AF18 * fGameEngineSpeed;
if ( v64 > v68 )
v68 = *(float *)&thiss->gap_E0[0];
v67 = v68;
}
else
{
v66 = flt_68AF18 * fGameEngineSpeed + v65;
if ( v64 >= v66 )
v66 = *(float *)&thiss->gap_E0[0];
v67 = v66;
}
*(float *)&thiss->field_E4 = v67;
if ( flt_68ADF4 == thiss->field_DC || (v57 = *(float *)&thiss->gap_E0[0], flt_68ADD8 == v57) )
goto LABEL_171;
}
}
*(float *)&thiss->field_E4 = v57;
LABEL_171:
v69 = (char *)thiss + 460 * thiss->activeCam;
sub_4864E3(v239, (int)(v69 + 492), (int)(v69 + 496), flt_68AEB8, dword_68AF24, 0);
if ( (unsigned __int8)sub_485B17(&thiss->cams[thiss->activeCam].?camPos)
&& !v233
&& (thiss->cams[thiss->activeCam].targetedEntity->flags & 7) != 3
&& thiss->targetedEntity->modelIndex != 190
&& thiss->targetedEntity->modelIndex != 177 )
word_70388A = 23;
goto LABEL_420;
}
if ( dword_68AE2C == v48 )
{
if ( flt_68ADE4 == v48 )
{
if ( flt_68ADF4 == v48 )
goto LABEL_128;
v49 = flt_68AB98[v272];
}
else
{
v49 = flt_68AB84[v272];
}
}
else
{
v49 = flt_68AB70[v272];
}
*(float *)&thiss->gap_E0[0] = v49;
goto LABEL_128;
}
v13 = 0;
if ( v236 == (RwMatrix *)5 )
{
if ( (unsigned __int8)sub_57E1A0() )
{
v13 = sub_57E470();
if ( v13 )
v234 = 1;
}
}
v14 = Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
if ( !(unsigned __int8)CGarages__IsPointInAGarageCameraZone(*(_DWORD *)v14) && !v234 )
{
if ( thiss->field_56 )
{
thiss->field_58 = 1;
thiss->field_56 = 0;
}
thiss->cameraInFreeMode = 0;
goto LABEL_115;
}
if ( (thiss->cameraInFreeMode || thiss->field_5B != 1) && thiss->field_D0 != 2 || !thiss->field_6EC && !v13 )
{
LABEL_102:
if ( ((unsigned __int8)CGarages__CameraShouldBeOutside() || v234)
&& thiss->cameraInFreeMode == 1
&& (thiss->field_5B == 1 || thiss->field_D0 == 2) )
{
if ( thiss->field_6EC || v13 )
{
word_70388A = 15;
thiss->field_56 = 1;
}
goto LABEL_118;
}
if ( thiss->field_56 )
{
thiss->field_58 = 1;
thiss->field_56 = 0;
}
LABEL_115:
word_70388A = 18;
goto LABEL_118;
}
v15 = sub_423020(&thiss->targetedEntity->placeable);
sub_473A87((int)&v260, v15);
v16 = thiss->field_6EC;
if ( v16 )
{
if ( *(_DWORD *)(v16 + 12) )
{
v226 = 1;
arg8 = 0.0;
v255 = *(float *)(v16 + 92);
v17 = thiss->field_6EC;
v257 = 0.0;
v256 = *(float *)(v17 + 96);
v18 = 0.0 - 0.0;
v19 = arg4 - v256;
v20 = v260 - v255;
sub_473A6E(&a1, v20, v19, v18);
v21 = sub_473A4F(&a1);
sub_422FC0(v21);
}
else
{
if ( *(_DWORD *)(v16 + 16) )
{
v226 = 2;
}
else
{
v226 = 1;
v255 = *(float *)Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
v256 = *(float *)(Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent) + 4);
v259 = 0;
}
}
}
else
{
v226 = 1;
sub_473A87((int)&v255, (int)&thiss->cams[thiss->activeCam].?camPos);
v22 = (double)((*(_WORD *)(v13 + 4) + (signed int)*(_WORD *)(v13 + 6)) / 2);
v23 = (double)((*(_WORD *)v13 + (signed int)*(_WORD *)(v13 + 2)) / 2);
sub_473A6E(&v295, v23, v22, flt_68ADD8);
sub_473A87((int)&v252, (int)&v295);
v24 = v254 - v257;
v25 = v253 - v256;
v26 = v252 - v255;
sub_473A6E(&v296, v26, v25, v24);
v27 = v297 * v297 + v296 * v296;
v28 = sub_422FC0(v27);
if ( v28 > (double)flt_68AE28 )
{
v229 = 1;
v29 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_473A1C(&v298, v29, &v252);
v267 = *(_DWORD *)&v298;
v268 = v299;
v269 = 0;
CVector__Normalise((int)&v267);
v30 = *(_WORD *)(v13 + 2) - *(_WORD *)v13;
if ( v30 <= *(_WORD *)(v13 + 6) - (signed int)*(_WORD *)(v13 + 4) )
v30 = *(_WORD *)(v13 + 6) - *(_WORD *)(v13 + 4);
v250 = (double)v30 * flt_68ADE4;
sub_4739E9((int)&v303, v250, (int)&v267);
v31 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_4739B6(&v300, v31, &v303);
LODWORD(a2.x) = *(_DWORD *)&v300;
a2.y = v301;
a2.z = v302;
v32 = Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent);
if ( !CWorld__IsLineOfSightClear((RwV3D *)v32, &a2, 1, 0, 0, 0, 0, 0, 1) )
{
sub_4739E9((int)&v305, v250, (int)&v267);
v33 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_473A1C(&v304, v33, &v305);
sub_473A87((int)&a2, (int)&v304);
v34 = Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent);
if ( !CWorld__IsLineOfSightClear((RwV3D *)v34, &a2, 1, 0, 0, 0, 0, 0, 1) )
v229 = 0;
}
if ( v229 )
sub_473A87((int)&v255, (int)&a2);
}
}
v35 = thiss->field_6EC;
if ( v35 )
{
v36 = (*(float *)(v35 + 76) + *(float *)(v35 + 80)) * flt_68AE08;
v37 = (*(float *)(v35 + 68) + *(float *)(v35 + 72)) * flt_68AE08;
sub_473A6E(&v306, v37, v36, flt_68ADD8);
v38 = &v306;
}
else
{
v257 = 0.0;
if ( v13 )
{
LABEL_88:
if ( v226 == 1 )
{
sub_473A1C(&v308, &v255, &v252);
v42 = &v308;
}
else
{
sub_473A1C(&v309, &v258, &v252);
v42 = &v309;
}
sub_473A87((int)&v263, (int)v42);
v43 = sub_423020(&thiss->targetedEntity->placeable);
sub_473A87((int)&v260, v43);
v241 = CWorld__FindGroundZFor3DCoord(v260, arg4, arg8, (int)&v271);
if ( !v271 )
v241 = arg8 - flt_68AEBC;
v264 = 0;
CVector__Normalise((int)&v263);
if ( v226 == 1 )
{
if ( thiss->field_6EC || !v13 )
{
sub_4739E9((int)&v313, dword_68AF0C, (int)&v263);
sub_4739B6(&v312, &v255, &v313);
v46 = &v312;
}
else
{
v44 = *(_WORD *)(v13 + 2) - *(_WORD *)v13;
if ( v44 <= *(_WORD *)(v13 + 6) - (signed int)*(_WORD *)(v13 + 4) )
v44 = *(_WORD *)(v13 + 6) - *(_WORD *)(v13 + 4);
v45 = (double)v44 * flt_68AF04 + flt_68AF08;
sub_4739E9((int)&v311, v45, (int)&v263);
sub_4739B6(&v310, &v252, &v311);
v46 = &v310;
}
}
else
{
sub_4739E9((int)&v315, dword_68AF0C, (int)&v263);
sub_4739B6(&v314, &v258, &v315);
v46 = &v314;
}
sub_473A87((int)&v265, (int)v46);
LODWORD(a3.x) = 0;
v266 = v241 + flt_68AF10;
LODWORD(a3.z) = 0;
LODWORD(a3.y) = 0;
CCamera__SetCamPositionForFixedMode(thiss, (RwV3D *)&v265, &a3);
thiss->cameraInFreeMode = 1;
goto LABEL_102;
}
v39 = flt_68ADD8;
LODWORD(v40) = *(_DWORD *)(sub_423020(&thiss->targetedEntity->placeable) + 4);
v41 = (float *)sub_423020(&thiss->targetedEntity->placeable);
sub_473A6E(&v307, *v41, v40, v39);
v38 = &v307;
}
sub_473A87((int)&v252, (int)v38);
goto LABEL_88;
}
if ( v7 != 3 )
goto LABEL_420;
v70 = CPad__GetPad(0);
if ( (unsigned __int8)CPad__CycleCameraModeUpJustDown(v70)
&& byte_A10AF6 != 1
&& (thiss->field_5B == 1 || thiss->field_D0 == 2)
&& !thiss->wideScreen
&& !thiss->field_73
&& !thiss->gap_4F[0] )
{
if ( menu.standartControls )
{
thiss->field_164 = thiss->field_164 - dword_68AE2C;
}
else
{
if ( flt_68ADF4 == thiss->field_164 )
LODWORD(thiss->field_164) = 1077936128;
else
LODWORD(thiss->field_164) = 1065353216;
}
}
v71 = CPad__GetPad(0);
if ( (unsigned __int8)CPad__CycleCameraModeDownJustDown(v71)
&& byte_A10AF6 != 1
&& (thiss->field_5B == 1 || thiss->field_D0 == 2)
&& !thiss->wideScreen
&& !thiss->field_73
&& !thiss->gap_4F[0] )
{
if ( menu.standartControls )
{
thiss->field_164 = thiss->field_164 + dword_68AE2C;
}
else
{
if ( flt_68ADF4 == thiss->field_164 )
LODWORD(thiss->field_164) = 1077936128;
else
LODWORD(thiss->field_164) = 1065353216;
}
}
v72 = thiss->field_164;
if ( v72 <= flt_68ADF4 )
{
if ( v72 >= dword_68AE2C )
LODWORD(thiss->field_164) = 1077936128;
}
else
{
LODWORD(thiss->field_164) = 1065353216;
}
word_70388A = 4;
if ( (thiss->field_5B == 1 || thiss->field_71)
&& (dword_7E4E94->__parent.__parent.flags & 7) == 3
&& (!thiss->wideScreen || thiss->field_71)
&& !sub_4758B0((int)&unk_7E4810) )
{
v73 = CPad__GetPad(0);
if ( (unsigned __int16)sub_4A9A80(v73) || (v74 = CPad__GetPad(0), (unsigned __int16)CPad__LookAroundUpDown(v74)) )
{
*(_DWORD *)&thiss->gap_7C[0] = globalTimer;
thiss->gap_4F[0] = 1;
}
if ( !thiss->gap_4F[0] )
{
LABEL_227:
v78 = (CPed *)FindPlayerPed();
if ( !CPed__IsPedInControl(v78) || FindPlayerPed()->walkSpeed > (double)flt_68ADD8 )
thiss->gap_4F[0] = 0;
if ( thiss->gap_4F[0] )
{
word_70388A = 16;
v79 = CPad__GetPad(0);
v79->flags |= 1u;
}
v80 = thiss->field_164;
if ( dword_68AE2C == v80 )
{
if ( flt_68ADE4 == v80 )
{
if ( flt_68ADF4 != v80 )
*(_DWORD *)&thiss->gap_140[4] = 1077516698;
}
else
{
*(_DWORD *)&thiss->gap_140[4] = 1069547520;
}
}
else
{
*(_DWORD *)&thiss->gap_140[4] = 1048576000;
}
v81 = thiss->field_68;
if ( v81 == 1 )
{
v82 = *(float *)&thiss->field_148;
v83 = *(float *)&thiss->field_14C;
if ( *(float *)&thiss->field_14C < v82 )
{
v86 = v83 - flt_68AF18 * fGameEngineSpeed;
if ( v82 > v86 )
v86 = *(float *)&thiss->field_148;
v85 = v86;
}
else
{
v84 = flt_68AF18 * fGameEngineSpeed + v83;
if ( v82 >= v84 )
v84 = *(float *)&thiss->field_148;
v85 = v84;
}
}
else
{
if ( thiss->field_73 )
{
if ( !byte_7038A0 )
{
byte_7038A0 = 1;
dword_70389C = 1056964608;
}
v240 = flt_68AF04;
v87 = *(float *)&thiss->field_14C;
if ( *(float *)&thiss->field_14C < (double)*(float *)&dword_70389C )
{
v90 = v87 - flt_68AF18 * fGameEngineSpeed;
if ( *(float *)&dword_70389C <= v90 )
v91 = v90;
else
v91 = *(float *)&dword_70389C;
v85 = v91;
}
else
{
v88 = flt_68AF18 * fGameEngineSpeed + v87;
if ( *(float *)&dword_70389C < v88 )
v89 = v88;
else
v89 = *(float *)&dword_70389C;
v85 = v89;
}
}
else
{
if ( v81 )
goto LABEL_269;
v92 = *(float *)&thiss->gap_140[4];
v93 = *(float *)&thiss->field_14C;
if ( *(float *)&thiss->field_14C < v92 )
{
v96 = v93 - flt_68AF18 * fGameEngineSpeed;
if ( v92 > v96 )
v96 = *(float *)&thiss->gap_140[4];
v95 = v96;
}
else
{
v94 = flt_68AF18 * fGameEngineSpeed + v93;
if ( v92 >= v94 )
v94 = *(float *)&thiss->gap_140[4];
v95 = v94;
}
*(float *)&thiss->field_14C = v95;
if ( flt_68ADF4 == thiss->field_164 || (v85 = *(float *)&thiss->gap_140[4], flt_68ADD8 == v85) )
{
LABEL_269:
v97 = (char *)thiss + 460 * thiss->activeCam;
sub_4864E3(v240, (int)(v97 + 484), (int)(v97 + 488), flt_68AEB8, dword_68AF2C, 0);
if ( !thiss->gap_4F[0] )
{
if ( FindPlayerPed()->__parent.actionState == 17 && !byte_A10B4C )
word_70388A = 36;
if ( *((_DWORD *)&dword_7E4E94[1].vehicleAI.field_40 + 6 * dword_7E4E94[1].field_248[28]) == 6
&& FindPlayerPed()->__parent.actionState == 16
&& !byte_A10B4C )
word_70388A = 36;
}
v98 = 0;
if ( (unsigned __int8)sub_57E1A0() )
{
v98 = sub_57E470();
if ( v98 )
v234 = 1;
}
v99 = Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
if ( (!(unsigned __int8)CGarages__IsPointInAGarageCameraZone(*(_DWORD *)v99) || byte_A10B4C) && !v234 )
{
if ( thiss->field_56 )
{
thiss->field_58 = 1;
thiss->field_56 = 0;
}
thiss->cameraInFreeMode = 0;
goto LABEL_349;
}
if ( thiss->cameraInFreeMode || thiss->field_5B != 1 || (v100 = thiss->field_6EC) == 0 && !v234 )
{
LABEL_336:
if ( ((unsigned __int8)CGarages__CameraShouldBeOutside() || v234) && thiss->field_5B == 1 && thiss->cameraInFreeMode == 1 )
{
if ( thiss->field_6EC || v234 )
{
word_70388A = 15;
thiss->field_56 = 1;
}
}
else
{
if ( thiss->field_56 )
{
thiss->field_58 = 1;
thiss->field_56 = 0;
}
word_70388A = 4;
}
LABEL_349:
if ( !thiss->gap_4F[0] )
{
v132 = Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
v133 = *(float *)(v132 + 8) - flt_68ADD8;
v134 = *(float *)(v132 + 4) - flt_68AF58;
v135 = *(float *)v132 - flt_68AF5C;
sub_473A6E(&v343, v135, v134, v133);
v136 = v344 * v344 + v343 * v343;
v137 = sub_422FC0(v136);
if ( v137 >= (double)flt_68AE1C )
{
v138 = Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
v139 = *(float *)(v138 + 8) - flt_68ADD8;
v140 = *(float *)(v138 + 4) - flt_68AF58;
v141 = *(float *)v138 - flt_68AF5C;
sub_473A6E(&v345, v141, v140, v139);
v142 = v346 * v346 + v345 * v345;
v143 = sub_422FC0(v142);
if ( v143 >= (double)flt_68AF60
|| *(float *)(Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent) + 8) > (double)flt_68AE44 )
{
if ( !sub_4758B0((int)&thiss->cams[thiss->activeCam]) )
word_70388A = 38;
}
}
}
if ( (unsigned __int8)sub_485B17(&thiss->cams[thiss->activeCam].?camPos)
&& (thiss->cams[thiss->activeCam].targetedEntity->flags & 7) == 3 )
word_70388A = 23;
if ( flt_68ADE8 != thiss->field_164
&& !(unsigned __int8)sub_57E180()
&& !(unsigned __int8)CCullZones__CamNoRain(v145, v144)
&& !CCullZones__PlayerNoRain()
&& !thiss->gap_4F[0]
&& !thiss->field_56 )
word_70388A = 37;
v146 = CPad__GetPad(0);
if ( !CPad__GetTarget(v146) && LOWORD(thiss->field_700) != 45 )
sub_46FE51(thiss);
if ( *(_WORD *)&thiss->gap_6F4[0] )
word_70388A = *(_WORD *)&thiss->gap_6F4[0];
v147 = LOWORD(thiss->field_700);
if ( v147 && !v234 )
{
if ( v147 == 34
|| (unsigned __int16)(v147 - 7) <= 2u
|| (unsigned __int16)(v147 - 45) <= 1u
|| (unsigned __int8)sub_485D78(&thiss->cams[thiss->activeCam]) )
{
if ( players[currentPlayer].pPed->__parent.actionState != 24
|| word_70388A == 37
|| (unsigned __int8)sub_485D78(&thiss->cams[thiss->activeCam]) )
word_70388A = LOWORD(thiss->field_700);
else
word_70388A = 4;
}
else
{
if ( word_70388A != 37 && flt_68ADF4 == flt_7E47EC )
{
v243 = flt_68ADE8;
if ( !byte_7038A8 )
{
byte_7038A8 = 1;
dword_7038A4 = 1073741824;
}
v225 = 0;
v148 = sub_423020(&thiss->targetedEntity->placeable);
v278 = *(_DWORD *)v148;
v279 = *(_DWORD *)(v148 + 4);
v280 = *(_DWORD *)(v148 + 8);
sub_473A1C(&v347, &thiss->field_724, &v278);
LODWORD(v281) = *(_DWORD *)&v347;
v282 = v348;
v283 = v349;
sub_473A1C(&v350, &thiss->cams[thiss->activeCam].?camPos, &v278);
LODWORD(v284) = *(_DWORD *)&v350;
v285 = v351;
v286 = v352;
if ( dword_68AE2C != thiss->field_164 )
v243 = flt_68AF64;
if ( FindPlayerPed()->__parent.objectiveTarget )
{
if ( *(_DWORD *)&FindPlayerPed()->__parent.objectiveTarget[5].flags != 55
&& *(_DWORD *)&FindPlayerPed()->__parent.objectiveTarget[5].flags != 54 )
{
v246 = *(float *)&dword_7038A4;
}
else
{
v225 = 1;
v246 = v243;
}
v149 = v282;
v150 = v282 * v282 + v281 * v281;
v151 = sqrt__(v150);
v152 = v285;
v249 = v151;
v153 = v284 * v284;
v154 = v285 * v285 + v153;
sqrt__(v154);
v245 = CGeneral__GetATanOfXY(v284, v152);
v244 = CGeneral__GetATanOfXY(v281, v149);
word_70388A = LOWORD(thiss->field_700);
if ( thiss->cams[thiss->activeCam].field_C != 11 )
{
v153 = v245 - v244;
for ( i = v153; i >= flt_68AE70; i = i - flt_68AE74 )
;
while ( i >= flt_68AE78 )
i = i + flt_68AE74;
v156 = i;
v157 = fabs__(v156);
if ( v157 >= (double)flt_68AE68 )
{
if ( v249 >= (double)flt_68AE20 && v283 > (double)flt_68AED8 )
word_70388A = 28;
}
}
v158 = flt_68ADD8;
v247 = flt_68ADD8;
if ( word_70388A == 28 || word_70388A == 11 )
{
if ( !byte_7E4711 || thiss->cams[thiss->activeCam].field_C == 35 )
{
v158 = v249;
if ( v249 >= (double)v246 )
{
if ( v225 )
{
if ( word_70388A == 28 )
v158 = flt_68ADCC;
else
v158 = flt_68AF68;
v247 = v158;
word_70388A = 35;
}
}
}
}
if ( word_70388A == 35 )
{
if ( !byte_703898 )
{
sub_4230E0(&vec1, v222);
sub_4230E0(&vec1.normal, v159);
LODWORD(a6.x) = 0;
v160 = sub_423020(&thiss->targetedEntity->placeable);
sub_473A87((int)&a4, v160);
sub_423BA0(v245);
v161 = v153;
a4.x = v247 * v161 + a4.x;
sub_423B70(v245);
v162 = v158;
a4.y = v247 * v162 + a4.y;
a4.z = a4.z + flt_68AF6C;
v163 = Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
if ( CWorld__ProcessLineOfSight((RwV3D *)v163, &a4, &vec1, (CEntity **)&a6, 1, 0, 0, 1, 0, 1, 1, 0) )
{
v353 = 0;
v164 = (RwV3D *)&vec1;
v354 = 0;
v220 = &v353;
v355 = 0;
}
else
{
v356 = 0;
v164 = &a4;
v357 = 0;
v220 = &v356;
v358 = 0;
}
CCamera__SetCamPositionForFixedMode(thiss, v164, (RwV3D *)v220);
byte_703898 = 1;
}
}
else
{
byte_703898 = 0;
}
}
}
}
}
goto LABEL_420;
}
if ( v100 )
{
v101 = sub_423020(&thiss->targetedEntity->placeable);
sub_473A87((int)&v260, v101);
v102 = thiss->field_6EC;
if ( *(_DWORD *)(v102 + 12) )
{
v227 = 1;
arg8 = 0.0;
v255 = *(float *)(v102 + 92);
v103 = thiss->field_6EC;
v257 = 0.0;
v256 = *(float *)(v103 + 96);
v104 = 0.0 - 0.0;
v105 = arg4 - v256;
v106 = v260 - v255;
sub_473A6E(&v317, v106, v105, v104);
v107 = sub_473A4F((RwV3D *)&v317);
sub_422FC0(v107);
}
else
{
if ( *(_DWORD *)(v102 + 16) )
{
v227 = 2;
}
else
{
v227 = 1;
v255 = *(float *)Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent);
v256 = *(float *)(Matrix__GetPos(&thiss->targetedEntity->placeable.matrix.__parent) + 4);
v259 = 0;
}
}
goto LABEL_309;
}
v227 = 1;
sub_473A87((int)&v255, (int)&thiss->cams[thiss->activeCam].?camPos);
if ( !v98 )
goto LABEL_309;
v108 = (double)((*(_WORD *)(v98 + 4) + (signed int)*(_WORD *)(v98 + 6)) / 2);
v109 = (double)((*(_WORD *)v98 + (signed int)*(_WORD *)(v98 + 2)) / 2);
sub_473A6E(&v318, v109, v108, flt_68ADD8);
sub_473A87((int)&v252, (int)&v318);
if ( *(float *)Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) <= (double)flt_68AF30
|| *(float *)Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) < (double)flt_68AF34
|| *(float *)(Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) + 4) <= (double)flt_68AF38
|| *(float *)(Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) + 4) < (double)flt_68AF3C
|| *(float *)(Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) + 8) <= (double)flt_68AF40
|| *(float *)(Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent) + 8) < (double)flt_68AF44 )
{
v230 = 1;
v111 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_473A1C(&v320, v111, &v252);
v273 = *(_DWORD *)&v320;
v274 = v321;
v275 = 0;
CVector__Normalise((int)&v273);
v112 = *(_WORD *)(v98 + 2) - *(_WORD *)v98;
if ( v112 <= *(_WORD *)(v98 + 6) - (signed int)*(_WORD *)(v98 + 4) )
v112 = *(_WORD *)(v98 + 6) - *(_WORD *)(v98 + 4);
v251 = (double)v112 * flt_68ADE4;
sub_4739E9((int)&v325, v251, (int)&v273);
v113 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_4739B6(&v322, v113, &v325);
LODWORD(v276.x) = *(_DWORD *)&v322;
v276.y = v323;
v276.z = v324;
v114 = Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent);
if ( !CWorld__IsLineOfSightClear((RwV3D *)v114, &v276, 1, 0, 0, 0, 0, 0, 1) )
{
sub_4739E9((int)&v327, v251, (int)&v273);
v115 = sub_423020(&dword_7E4E94->__parent.__parent.placeable);
sub_473A1C(&v326, v115, &v327);
sub_473A87((int)&v276, (int)&v326);
v116 = Matrix__GetPos(&dword_7E4E94->__parent.__parent.placeable.matrix.__parent);
if ( !CWorld__IsLineOfSightClear((RwV3D *)v116, &v276, 1, 0, 0, 0, 0, 0, 1) )
v230 = 0;
}
if ( !v230 )
{
LABEL_309:
v117 = thiss->field_6EC;
if ( v117 )
{
v118 = (*(float *)(v117 + 76) + *(float *)(v117 + 80)) * flt_68AE08;
v119 = (*(float *)(v117 + 68) + *(float *)(v117 + 72)) * flt_68AE08;
sub_473A6E(&v328, v119, v118, flt_68ADD8);
v120 = &v328;
}
else
{
v257 = 0.0;
if ( v98 )
{
LABEL_314:
if ( v227 == 1 )
{
sub_473A1C(&v330, &v255, &v252);
v124 = &v330;
}
else
{
sub_473A1C(&v331, &v258, &v252);
v124 = &v331;
}
sub_473A87((int)&v263, (int)v124);
v125 = sub_423020(&thiss->targetedEntity->placeable);
sub_473A87((int)&v260, v125);
v242 = CWorld__FindGroundZFor3DCoord(v260, arg4, arg8, (int)&v277);
if ( !v277 )
v242 = arg8 - flt_68AEBC;
v264 = 0;
if ( v227 == 1 )
{
if ( thiss->field_6EC || !v234 )
{
CVector__Normalise((int)&v263);
sub_4739E9((int)&v337, dword_68AF0C, (int)&v263);
sub_4739B6(&v336, &v255, &v337);
v128 = &v336;
}
else
{
CVector__Normalise((int)&v263);
if ( v98 )
{
v126 = *(_WORD *)(v98 + 2) - *(_WORD *)v98;
if ( v126 <= *(_WORD *)(v98 + 6) - (signed int)*(_WORD *)(v98 + 4) )
v126 = *(_WORD *)(v98 + 6) - *(_WORD *)(v98 + 4);
v127 = (double)v126 * flt_68AF04 + flt_68AF08;
sub_4739E9((int)&v333, v127, (int)&v263);
sub_4739B6(&v332, &v252, &v333);
v128 = &v332;
}
else
{
sub_4739E9((int)&v335, flt_68AF08, (int)&v263);
sub_4739B6(&v334, &v255, &v335);
v128 = &v334;
}
}
}
else
{
CVector__Normalise((int)&v263);
sub_4739E9((int)&v339, dword_68AF0C, (int)&v263);
sub_4739B6(&v338, &v258, &v339);
v128 = &v338;
}
sub_473A87((int)&v265, (int)v128);
if ( flt_68ADE8 == thiss->field_164 || v234 )
{
v266 = v242 + flt_68AF10;
}
else
{
sub_473A87((int)&v265, (int)&v252);
v129 = FindPlayerPed();
v130 = Matrix__GetPos(&v129->__parent.__parent.__parent.placeable.matrix.__parent);
v266 = flt_68AF54 + *(float *)(v130 + 8) + v266;
v131 = thiss->field_6EC;
if ( v131 && v266 > (double)*(float *)(v131 + 72) )
v266 = *(float *)(v131 + 72);
}
v340 = 0;
v342 = 0;
v341 = 0;
CCamera__SetCamPositionForFixedMode(thiss, (RwV3D *)&v265, (RwV3D *)&v340);
thiss->cameraInFreeMode = 1;
goto LABEL_336;
}
v121 = flt_68ADD8;
LODWORD(v122) = *(_DWORD *)(sub_423020(&thiss->targetedEntity->placeable) + 4);
v123 = (float *)sub_423020(&thiss->targetedEntity->placeable);
sub_473A6E(&v329, *v123, v122, v121);
v120 = &v329;
}
sub_473A87((int)&v252, (int)v120);
goto LABEL_314;
}
v110 = (int)&v276;
}
else
{
sub_473A6E(&v319, dword_68AF50, dword_68AF4C, dword_68AF48);
v110 = (int)&v319;
}
sub_473A87((int)&v255, v110);
goto LABEL_309;
}
}
}
*(float *)&thiss->field_14C = v85;
goto LABEL_269;
}
v75 = CPad__GetPad(0);
if ( !sub_4AAE30(v75) )
{
v76 = CPad__GetPad(0);
if ( !CPad__GetPedWalkLeftRight(v76) )
{
if ( !CPad__GetPad(0)->activePadState.Button14
&& !CPad__GetPad(0)->activePadState.Button15
&& !CPad__GetPad(0)->activePadState.Button16
&& !CPad__GetPad(0)->activePadState.Button17
&& !CPad__GetPad(0)->activePadState.Button13
&& (double)(globalTimer - *(_DWORD *)&thiss->gap_7C[0]) <= flt_68AF28 )
{
v77 = CPad__GetPad(0);
if ( (unsigned __int8)CPad__TargetJustDown(v77) )
{
thiss->gap_4F[0] = 0;
thiss->field_50 = 1;
}
goto LABEL_227;
}
}
}
}
thiss->gap_4F[0] = 0;
goto LABEL_227;
}
LABEL_420:
if ( word_A10AB0 )
word_70388A = word_A10AB0;
v165 = 0;
if ( !byte_7038AA )
{
byte_7038AA = 1;
byte_7038A9 = 0;
}
v237 = 0;
v166 = players[currentPlayer].pPed;
if ( v166->__parent.actionState == 62 )
{
byte_7038A9 = 1;
}
else
{
if ( byte_7038A9 )
{
v237 = 1;
byte_7038A9 = 0;
}
}
if ( dword_703890 == 62 || v166->__parent.actionState != 62 )
{
v165 = 0;
}
else
{
if ( flt_68ADD8 == thiss->field_DC || (thiss->targetedEntity->flags & 7) != 2 )
v165 = 1;
}
dword_703890 = v166->__parent.actionState;
if ( v165 == 1 )
{
dword_703894 = 32;
word_70388A = 32;
thiss->cams[thiss->activeCam].field_A = 1;
}
else
{
if ( v166->__parent.actionState == 62 )
word_70388A = dword_703894;
}
if ( players[currentPlayer].pPed->__parent.actionState == 55 )
{
if ( thiss->cams[thiss->activeCam].field_C == 29 )
{
word_70388A = 29;
}
else
{
v231 = 0;
v167 = thiss->targetedEntity;
if ( (v167->flags & 7) == 3 )
{
for ( j = 0; j < SLOWORD(v167[14].placeable.matrix.__parent.top.z); ++j )
{
v169 = *((_DWORD *)&v167[13].field_58 + j);
if ( v169 )
{
if ( *(_DWORD *)(v169 + 580) == 49 )
{
v170 = Matrix__GetPos(&v167->placeable.matrix.__parent);
v171 = Matrix__GetPos((RwMatrix *)(*((_DWORD *)&v167[13].field_58 + j) + 4));
v172 = *(float *)(v171 + 8) - *(float *)(v170 + 8);
v173 = *(float *)(v171 + 4) - *(float *)(v170 + 4);
v174 = *(float *)v171 - *(float *)v170;
sub_473A6E(&v359, v174, v173, v172);
v175 = sub_473A4F((RwV3D *)&v359);
v176 = sub_422FC0(v175);
if ( v176 >= (double)flt_68ADE8 )
{
word_70388A = 32;
v231 = 1;
thiss->cams[thiss->activeCam].field_A = 1;
break;
}
}
}
}
}
if ( !v231 )
{
word_70388A = 29;
thiss->cams[thiss->activeCam].field_A = 1;
}
}
}
if ( thiss->field_60 == 1 )
{
if ( (unsigned __int16)(word_70388A - 7) > 1u
&& word_70388A != 46
&& word_70388A != 11
&& word_70388A != 28
&& (unsigned __int16)(word_70388A - 34) > 1u
&& word_70388A != 18
&& (unsigned __int16)(word_70388A - 3) > 1u
&& !byte_A10B4C )
CCamera__SetBehindPlayer(&camera);
word_70388A = thiss->field_948;
thiss->cams[thiss->activeCam].field_C = word_70388A;
byte_7E46E2 = 1;
thiss->cams[thiss->activeCam].field_A = 1;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[48], (int)&flt_7E4DB8);
thiss->cams[thiss->activeCam].targetedEntity = (CEntity *)dword_7E4E94;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[60], (int)&stru_7E4DC4);
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[72], (int)&dword_7E4DD0);
thiss->cams[thiss->activeCam].field_2 = 0;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[84], (int)&thiss->cams[(thiss->activeCam + 1) % 2].gap_FC[84]);
thiss->field_60 = 0;
thiss->cams[thiss->activeCam].field_A = 1;
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
CEntity__RegisterReference(thiss->cams[thiss->activeCam].targetedEntity, &thiss->cams[thiss->activeCam].targetedEntity);
*(float *)&thiss->field_E4 = *(float *)&thiss->gap_E0[0];
*(float *)&thiss->field_14C = *(float *)&thiss->gap_140[4];
thiss->field_89 = 0;
thiss->field_869 = 0;
}
if ( byte_A10B4F )
word_70388A = 9;
v238 = 1;
v177 = thiss->targetedEntity;
if ( v177 )
{
if ( (v177->flags & 7) == 2 )
{
if ( flt_68ADCC != thiss->field_DC )
thiss->gap_5E[1] = 1;
}
else
{
if ( flt_68ADCC != thiss->field_164 )
thiss->gap_5E[0] = 1;
}
}
if ( thiss->field_64 == 1
|| (unsigned __int16)(word_70388A - 28) <= 1u
|| word_70388A == 11
|| (unsigned __int16)(word_70388A - 7) <= 1u
|| word_70388A == 23
|| (unsigned __int16)(word_70388A - 32) <= 4u
|| (unsigned __int16)(word_70388A - 39) <= 4u
|| (unsigned __int16)(word_70388A - 45) <= 1u
|| thiss->field_D0 == 1
|| thiss->field_58
|| thiss->field_56 )
v238 = 0;
if ( thiss->gap_5E[0] && v238 == 1 )
{
v178 = sub_46BE18(thiss);
}
else
{
v179 = thiss->gap_5E[1];
if ( v179 && v238 == 1 )
{
v180 = thiss->targetedEntity;
if ( (v180->flags & 7) != 2 || sub_5BAA80((CVehicle *)v180) != 3 && thiss->targetedEntity[6].placeable.matrix.matrixPtr != (RwMatrix *)1 )
v178 = sub_46BFEE(thiss);
else
v178 = sub_46BEE6(thiss);
}
else
{
if ( thiss->field_56 && v179 )
v232 = 1;
v238 = 0;
v178 = sub_46FE13(thiss);
}
}
if ( thiss->field_5B == 1 )
{
if ( word_70388A != 1 && word_70388A != 16 && word_70388A != 37 )
{
if ( word_70388A != 18 && word_70388A != 22 )
{
if ( word_70388A != 15 || thiss->cams[thiss->activeCam].field_C != 1 )
{
LABEL_509:
if ( word_70388A == 11 || word_70388A == 28 )
v232 = 1;
if ( word_70388A == 1 )
{
v181 = thiss->cams[thiss->activeCam].field_C;
if ( v181 != 37 && v181 != 29 )
goto LABEL_520;
}
else
{
if ( word_70388A != 37 || (v182 = thiss->cams[thiss->activeCam].field_C, v182 != 1) && v182 != 29 )
goto LABEL_520;
}
v232 = 0;
LABEL_520:
if ( (word_70388A == 16
|| (unsigned __int16)(word_70388A - 7) <= 1u
|| (unsigned __int16)(word_70388A - 39) <= 4u
|| word_70388A == 45
|| (unsigned __int16)(word_70388A - 32) <= 2u
|| word_70388A == 46)
&& (thiss->targetedEntity->flags & 7) == 3 )
goto LABEL_578;
if ( word_70388A != 15 || thiss->field_56 != 1 )
{
if ( word_70388A == 4 )
{
v224 = 0;
v186 = thiss->cams[thiss->activeCam].field_C;
if ( (v186 == 11 || v186 == 28) && !(unsigned __int8)sub_50B220(thiss->targetedEntity) )
v224 = 1;
v187 = thiss->activeCam;
v188 = thiss->cams[v187].field_C;
if ( (v188 == 16
|| (unsigned __int16)(v188 - 7) <= 1u
|| (unsigned __int16)(v188 - 32) <= 2u
|| (unsigned __int16)(v188 - 29) <= 1u
|| (unsigned __int16)(v188 - 39) <= 4u
|| v188 == 1
|| v188 == 37
|| (unsigned __int16)(v188 - 45) <= 1u
|| v224
|| v237)
&& !thiss->field_58 )
{
if ( (unsigned __int16)(v188 - 7) <= 1u || v188 == 34 || v188 == 16 || (unsigned __int16)(v188 - 39) <= 4u || v188 == 45 || v188 == 46 )
{
v189 = CGeneral__GetATanOfXY(thiss->cams[v187].field_168.x, thiss->cams[v187].field_168.y) - flt_68AE68;
dword_7E4E94[1].__parent.CenterOfMass.y = v189;
dword_7E4E94[1].__parent.CenterOfMass.z = v189;
}
byte_7E46EF = 1;
v232 = 1;
v190 = thiss->activeCam;
if ( thiss->cams[v190].field_C == 37 )
{
v191 = FindPlayerPed();
v192 = sub_423020(&v191->__parent.__parent.__parent.placeable);
sub_473A1C(&v360, &camera.cams[thiss->activeCam].?camPos, v192);
LODWORD(a6.y) = *(_DWORD *)&v360;
a6.z = v361;
v290 = 0;
CVector__Normalise((int)&a6.y);
LODWORD(a6.y) = 981668463;
if ( 0.001 == flt_68ADD8 )
{
LODWORD(a6.z) = 981668463;
if ( 0.001 == flt_68ADD8 )
LODWORD(a6.z) = 1065353216;
}
flt_7E48AC[115 * thiss->activeCam] = CGeneral__GetATanOfXY(a6.y, a6.z);
}
else
{
flt_7E48AC[115 * thiss->activeCam] = CGeneral__GetATanOfXY(thiss->cams[v190].field_168.x, thiss->cams[v190].field_168.y)
+ flt_68AE70;
}
}
goto LABEL_579;
}
if ( word_70388A != 36 )
{
if ( word_70388A == 38
|| (unsigned __int16)(word_70388A - 32) <= 1u
|| word_70388A == 29
|| word_7E481C[230 * thiss->activeCam] == 29 && word_70388A != 29 )
goto LABEL_578;
goto LABEL_579;
}
v185 = thiss->cams[thiss->activeCam].field_C == 16;
}
else
{
v183 = thiss->cams[thiss->activeCam].field_C;
if ( v183 != 7
&& v183 != 45
&& v183 != 8
&& v183 != 34
&& v183 != 37
&& !v234
&& v183 != 16
&& (unsigned __int16)(v183 - 39) > 4u
&& v183 != 46
|| (v184 = thiss->targetedEntity) == 0 )
goto LABEL_579;
v185 = (v184->flags & 7) == 2;
}
if ( v185 )
LABEL_578:
v232 = 1;
LABEL_579:
v193 = 460 * thiss->activeCam;
if ( word_70388A != *(__int16 *)((char *)word_7E481C + v193) && !*(int *)((char *)dword_7E49C0 + v193) )
v232 = 1;
if ( thiss->field_56 )
{
if ( dword_7E4D74 )
{
v194 = *dword_7E4D74;
if ( *dword_7E4D74 == 2 || v194 == 3 || v194 == 4 )
{
v195 = thiss->targetedEntity;
if ( (v195->flags & 7) == 2 )
{
if ( v195->modelIndex == 153 && word_70388A != *(__int16 *)((char *)&thiss->cams[0].field_C + v193) )
v232 = 1;
}
}
}
}
if ( byte_A10B2D )
word_70388A = 44;
v196 = thiss->field_89;
if ( (!v196 || v232 == 1) && word_70388A != thiss->cams[thiss->activeCam].field_C )
{
if ( v232 == 1 )
{
if ( (!thiss->field_56 || thiss->field_58)
&& word_70388A != 4
&& (unsigned __int16)(word_70388A - 7) > 1u
&& word_70388A != 46
&& word_70388A != 11
&& word_70388A != 16
&& word_70388A != 28
&& (unsigned __int16)(word_70388A - 34) > 1u
&& !byte_A10B4C )
CCamera__SetBehindPlayer(&camera);
thiss->cams[thiss->activeCam].field_C = word_70388A;
byte_7E46E2 = 1;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[48], (int)&flt_7E4DB8);
thiss->cams[thiss->activeCam].targetedEntity = (CEntity *)dword_7E4E94;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[60], (int)&stru_7E4DC4);
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[72], (int)&dword_7E4DD0);
thiss->cams[thiss->activeCam].field_2 = byte_7E46E4;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[84], (int)&thiss->cams[(thiss->activeCam + 1) % 2].gap_FC[84]);
*(float *)&thiss->field_E4 = *(float *)&thiss->gap_E0[0];
*(float *)&thiss->field_14C = *(float *)&thiss->gap_140[4];
thiss->field_89 = 0;
thiss->field_869 = 0;
thiss->field_62 = 0;
thiss->cams[thiss->activeCam].field_A = 1;
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v197 = thiss->activeCam;
v198 = thiss->cams[v197].targetedEntity;
v221 = &thiss->cams[v197].targetedEntity;
}
else
{
if ( thiss->field_6A )
goto LABEL_671;
LOWORD(v193) = word_70388A;
sub_46AB08(v193);
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v199 = thiss->activeCam;
v198 = thiss->cams[v199].targetedEntity;
v221 = &thiss->cams[v199].targetedEntity;
}
goto LABEL_660;
}
if ( v196 && (v200 = thiss->cams[thiss->activeCam].field_C, word_70388A != v200) )
{
v201 = 1;
if ( word_70388A == 36 || v200 == 36 )
v201 = 0;
if ( word_70388A == 4 && v200 == 36 )
v201 = 0;
if ( !thiss->field_6A )
{
if ( thiss->field_5B )
{
if ( v196 )
{
v202 = FindPlayerPed();
v291 = *(float *)Matrix__GetPos(&v202->__parent.__parent.__parent.placeable.matrix.__parent) - thiss->__parent.matrix.__parent.pos.x;
v203 = FindPlayerPed();
v292 = *(float *)(Matrix__GetPos(&v203->__parent.__parent.__parent.placeable.matrix.__parent) + 4)
- thiss->__parent.matrix.__parent.pos.y;
v204 = FindPlayerPed();
v193 = Matrix__GetPos(&v204->__parent.__parent.__parent.placeable.matrix.__parent);
v293 = *(float *)(v193 + 8) - thiss->__parent.matrix.__parent.pos.z;
v205 = thiss->targetedEntity;
if ( v205 )
{
if ( (v205->flags & 7) == 3 )
{
v206 = sub_473A4F((RwV3D *)&v291);
v207 = sub_422FC0(v206);
if ( v207 > (double)flt_68AF70 )
{
if ( word_70388A == 11 || word_70388A == 28 )
thiss->field_6A = 1;
}
}
}
}
}
}
if ( thiss->field_6A == 1 )
v201 = 0;
if ( v201 )
{
LOWORD(v193) = word_70388A;
sub_46AAF5(v193);
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v198 = thiss->cams[thiss->activeCam].targetedEntity;
v221 = &thiss->cams[thiss->activeCam].targetedEntity;
LABEL_660:
CEntity__RegisterReference(v198, v221);
goto LABEL_671;
}
}
else
{
if ( word_70388A == 15 && dword_7E4E94 != (CVehicle *)dword_7E49C0[115 * (unsigned __int8)byte_7E46FE] && thiss->field_56 )
{
if ( v196 )
{
LOWORD(v193) = word_70388A;
sub_46AAF5(v193);
}
else
{
LOWORD(v193) = word_70388A;
sub_46AB08(v193);
}
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v208 = thiss->activeCam;
v198 = thiss->cams[v208].targetedEntity;
v221 = &thiss->cams[v208].targetedEntity;
goto LABEL_660;
}
}
goto LABEL_671;
}
}
else
{
if ( thiss->cams[thiss->activeCam].field_C != 1 && thiss->cams[thiss->activeCam].field_C != 16 && thiss->cams[thiss->activeCam].field_C != 37 )
goto LABEL_509;
}
}
v232 = 1;
goto LABEL_509;
}
v228 = 0;
v223 = 0;
if ( thiss->field_71 == 1 || thiss->field_72 == 1 )
{
if ( word_70388A == 16 )
{
if ( thiss->cams[thiss->activeCam].field_C != word_70388A )
v223 = 1;
}
else
{
v209 = LOWORD(thiss->field_700);
if ( (v209 == 7 || v209 == 16 || v209 == 8) && (v178 = (int)CPad__GetPad(0), CPad__GetTarget((CPad *)v178)) && thiss->field_72 )
{
v228 = 1;
v223 = 1;
}
else
{
if ( thiss->cams[thiss->activeCam].field_C != thiss->field_948 )
{
thiss->field_62 = 1;
thiss->fixedMoveMode = 2;
v178 = (int)CPad__GetPad(0);
*(_WORD *)(v178 + 240) &= 0xFFFEu;
}
}
}
}
v210 = thiss->field_89;
if ( !v210 && thiss->field_62 == 1 && thiss->fixedMoveMode == 1 )
{
word_70388A = thiss->field_948;
LOWORD(v178) = word_70388A;
sub_46AB08(v178);
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v198 = thiss->cams[thiss->activeCam].targetedEntity;
v221 = &thiss->cams[thiss->activeCam].targetedEntity;
goto LABEL_660;
}
if ( v210 && thiss->field_62 == 1 && thiss->fixedMoveMode == 1 )
{
word_70388A = thiss->field_948;
LOWORD(v178) = word_70388A;
sub_46AAF5(v178);
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
v211 = thiss->activeCam;
v198 = thiss->cams[v211].targetedEntity;
v221 = &thiss->cams[v211].targetedEntity;
goto LABEL_660;
}
if ( thiss->field_62 == 1 && thiss->fixedMoveMode == 2 || v223 )
{
thiss->field_89 = 0;
thiss->field_869 = 0;
if ( thiss->field_71 != 1 || word_70388A != 16 )
{
if ( v228 )
thiss->cams[thiss->activeCam].field_C = LOWORD(thiss->field_700);
else
thiss->cams[thiss->activeCam].field_C = thiss->field_948;
}
else
{
thiss->cams[thiss->activeCam].field_C = word_70388A;
}
byte_7E46E2 = 1;
thiss->cams[thiss->activeCam].field_A = 1;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[48], (int)&flt_7E4DB8);
thiss->cams[thiss->activeCam].targetedEntity = (CEntity *)dword_7E4E94;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[60], (int)&stru_7E4DC4);
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[72], (int)&dword_7E4DD0);
thiss->cams[thiss->activeCam].field_2 = byte_7E46E4;
sub_473A87((int)&thiss->cams[thiss->activeCam].gap_FC[84], (int)&thiss->cams[(thiss->activeCam + 1) % 2].gap_FC[84]);
byte_7E46E2 = 1;
CEntity__RegisterReference(&dword_7E4E94->__parent.__parent, &dword_7E4E94);
CEntity__RegisterReference(thiss->cams[thiss->activeCam].targetedEntity, &thiss->cams[thiss->activeCam].targetedEntity);
*(float *)&thiss->field_E4 = *(float *)&thiss->gap_E0[0];
*(float *)&thiss->field_14C = *(float *)&thiss->gap_140[4];
}
LABEL_671:
thiss->field_62 = 0;
v212 = thiss->activeCam;
if ( !thiss->cams[v212].targetedEntity )
thiss->cams[v212].targetedEntity = (CEntity *)dword_7E4E94;
v213 = thiss->cams[thiss->activeCam].field_C;
if ( v213 != 17
&& ((thiss->targetedEntity->flags & 7) != 3 || v213 != 16 && v213 != 7 && v213 != 34 && (unsigned __int16)(v213 - 45) > 1u && v213 != 8) )
{
v215 = FindPlayerPed();
v215->__parent.__parent.__parent.field_52 = v215->__parent.__parent.__parent.field_52 & 0xFB | 4;
}
else
{
v214 = FindPlayerPed();
v214->__parent.__parent.__parent.field_52 &= 0xFBu;
}
v216 = 0;
if ( !v238 && thiss->field_D0 == 2 )
{
sub_46BB24(thiss);
v216 = 1;
CCamera__SetBehindPlayer(thiss);
}
v217 = thiss->cams[thiss->activeCam].field_C;
result = thiss->cams[thiss->activeCam].field_C;
if ( v235 != result || v216 || v217 == 4 || v217 == 18 )
{
v219 = CPad__GetPad(0);
result = CPad__ChangeStationJustDown(v219);
if ( (_BYTE)result )
{
if ( byte_A10AF6 != 1 && (thiss->field_5B == 1 || thiss->field_D0 == 2) )
{
if ( !thiss->wideScreen && (thiss->field_D0 != 2 || byte_703684 == 1) )
result = cDMAudio__PlayFrontEndSound(179, 0.0);
}
}
}
return result;
}