comparison mm7_3.cpp @ 920:34ed2d5e7cfb

MagicShopDialog clean and other
author Ritor1
date Sun, 28 Apr 2013 19:11:36 +0600
parents 8cd0b155bebe
children 3696848c0413
comparison
equal deleted inserted replaced
919:befaac4bc0e3 920:34ed2d5e7cfb
15989 } 15989 }
15990 15990
15991 //----- (004059DB) -------------------------------------------------------- 15991 //----- (004059DB) --------------------------------------------------------
15992 signed int stru262_TurnBased::Start() 15992 signed int stru262_TurnBased::Start()
15993 { 15993 {
15994 stru262_TurnBased *v1; // ebx@1 15994 //stru262_TurnBased *v1; // ebx@1
15995 unsigned int v2; // edi@1 15995 unsigned int v2; // edi@1
15996 int v3; // esi@1 15996 int v3; // esi@1
15997 int v4; // eax@5 15997 int v4; // eax@5
15998 unsigned int v5; // esi@7 15998 unsigned int v5; // esi@7
15999 Actor *v6; // edi@7 15999 Actor *pActor; // edi@7
16000 unsigned int v7; // eax@9 16000 unsigned int v7; // eax@9
16001 unsigned int v8; // edx@10 16001 unsigned int v8; // edx@10
16002 unsigned __int8 v9; // zf@14 16002 unsigned __int8 v9; // zf@14
16003 unsigned __int8 v10; // sf@14 16003 unsigned __int8 v10; // sf@14
16004 unsigned __int8 v11; // of@14 16004 unsigned __int8 v11; // of@14
16023 AIDirection v31; // [sp+28h] [bp-4Ch]@10 16023 AIDirection v31; // [sp+28h] [bp-4Ch]@10
16024 AIDirection a3; // [sp+44h] [bp-30h]@10 16024 AIDirection a3; // [sp+44h] [bp-30h]@10
16025 int v33; // [sp+60h] [bp-14h]@10 16025 int v33; // [sp+60h] [bp-14h]@10
16026 int *v34; // [sp+64h] [bp-10h]@6 16026 int *v34; // [sp+64h] [bp-10h]@6
16027 int v35; // [sp+68h] [bp-Ch]@5 16027 int v35; // [sp+68h] [bp-Ch]@5
16028 Player *v40; // [sp+6Ch] [bp-8h]@1 16028 Player *pPlayer; // [sp+6Ch] [bp-8h]@1
16029 int v40b; 16029 int v40b;
16030 unsigned int v37; // [sp+70h] [bp-4h]@7 16030 unsigned int v37; // [sp+70h] [bp-4h]@7
16031 16031
16032 pTurnEngine->field_18 &= 0xFFFFFFFDu; 16032 pTurnEngine->field_18 &= 0xFFFFFFFDu;
16033 v1 = this; 16033 //v1 = this;
16034 pEventTimer->TrackGameTime(); 16034 pEventTimer->TrackGameTime();
16035 pAudioPlayer->StopChannels(-1, -1); 16035 pAudioPlayer->StopChannels(-1, -1);
16036 v2 = 0; 16036 v2 = 0;
16037 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); 16037 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0);
16038 v40 = pParty->pPlayers; 16038 pPlayer = pParty->pPlayers;
16039 dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength; 16039 dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength;
16040 dword_50C994 = 0; 16040 dword_50C994 = 0;
16041 v1->field_10 = 100; 16041 this->field_10 = 100;
16042 v1->field_0 = 0; 16042 this->field_0 = 0;
16043 v1->field_8 = 64; 16043 this->field_8 = 64;
16044 v1->field_4 = 1; 16044 this->field_4 = 1;
16045 v1->uActorQueueSize = 0; 16045 this->uActorQueueSize = 0;
16046 v3 = 0; 16046 v3 = 0;
16047 do 16047 do
16048 { 16048 {
16049 if ( v40->CanAct() ) 16049 if ( pPlayer->CanAct() )
16050 { 16050 {
16051 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(OBJECT_Player,v3); 16051 *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = PID(OBJECT_Player,v3);
16052 v1->pQueue[v1->uActorQueueSize].field_C = 2; 16052 this->pQueue[this->uActorQueueSize].field_C = 2;
16053 v1->pQueue[v1->uActorQueueSize].uActionLength = 0; 16053 this->pQueue[this->uActorQueueSize].uActionLength = 0;
16054 pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0; 16054 pParty->pTurnBasedPlayerRecoveryTimes[this->uActorQueueSize++] = 0;
16055 } 16055 }
16056 ++v40; 16056 ++pPlayer;
16057 ++v3; 16057 ++v3;
16058 } 16058 }
16059 while ( v40 <=&pParty->pPlayers[3] ); 16059 while ( pPlayer <= &pParty->pPlayers[3] );
16060 v35 = v1->uActorQueueSize; 16060 v35 = this->uActorQueueSize;
16061 v4 = v35; 16061 v4 = v35;
16062 v40b = v35; 16062 v40b = v35;
16063 if ( v40b < v40b + ai_arrays_size ) 16063 if ( v40b < v40b + ai_arrays_size )
16064 { 16064 {
16065 v34 = (int *)ai_near_actors_ids; 16065 v34 = (int *)ai_near_actors_ids;
16066 do 16066 do
16067 { 16067 {
16068 v37 = *v34; 16068 v37 = *v34;
16069 v5 = v37; 16069 v5 = v37;
16070 v6 = &pActors[v37]; 16070 pActor = &pActors[v37];
16071 if ( v37 != 10 ) 16071 if ( v37 != 10 )
16072 { 16072 {
16073 if ( pActors[v37].CanAct() ) 16073 if ( pActors[v37].CanAct() )
16074 { 16074 {
16075 v7 = v6->uAttributes; 16075 v7 = pActor->uAttributes;
16076 if ( v7 & 0x8000 < 0 ) 16076 if ( v7 & 0x8000 < 0 )
16077 { 16077 {
16078 v8 = ai_near_actors_targets_pid[v5]; 16078 v8 = ai_near_actors_targets_pid[v5];
16079 LOBYTE(v7) = v7 | 0x80; 16079 LOBYTE(v7) = v7 | 0x80;
16080 v6->uAttributes = v7; 16080 pActor->uAttributes = v7;
16081 v33 = PID(OBJECT_Actor,v5); 16081 v33 = PID(OBJECT_Actor,v5);
16082 memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31)); 16082 memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31));
16083 memcpy(&v30, &v31, sizeof(v30)); 16083 memcpy(&v30, &v31, sizeof(v30));
16084 Actor::AI_StandOrBored(v37, 4, 32, &v30); 16084 Actor::AI_StandOrBored(v37, 4, 32, &v30);
16085 *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33; 16085 *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = v33;
16086 v1->pQueue[v1->uActorQueueSize].field_C = 2; 16086 this->pQueue[this->uActorQueueSize].field_C = 2;
16087 v1->pQueue[v1->uActorQueueSize++].uActionLength = 0; 16087 this->pQueue[this->uActorQueueSize++].uActionLength = 0;
16088 } 16088 }
16089 } 16089 }
16090 v4 = v35; 16090 v4 = v35;
16091 } 16091 }
16092 ++v40b; 16092 ++v40b;
16093 ++v34; 16093 ++v34;
16094 } 16094 }
16095 while ( v40b < v4 + ai_arrays_size ); 16095 while ( v40b < v4 + ai_arrays_size );
16096 v2 = 0; 16096 v2 = 0;
16097 } 16097 }
16098 v11 = __OFSUB__(v1->uActorQueueSize, v2); 16098 v11 = __OFSUB__(this->uActorQueueSize, v2);
16099 v9 = v1->uActorQueueSize == v2; 16099 v9 = this->uActorQueueSize == v2;
16100 v10 = ((v1->uActorQueueSize - v2) & 0x80000000u) != 0; 16100 v10 = ((this->uActorQueueSize - v2) & 0x80000000u) != 0;
16101 v37 = v2; 16101 v37 = v2;
16102 v40b = v2; 16102 v40b = v2;
16103 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) 16103 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
16104 { 16104 {
16105 v12 = (char *)&v1->pQueue[0].field_4; 16105 v12 = (char *)&this->pQueue[0].field_4;
16106 while ( 1 ) 16106 while ( 1 )
16107 { 16107 {
16108 v13 = PID_TYPE(*((int *)v12 - 1)); 16108 v13 = PID_TYPE(*((int *)v12 - 1));
16109 if ( v13 != OBJECT_Player ) 16109 if ( v13 != OBJECT_Player )
16110 break; 16110 break;
16111 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; 16111 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery;
16112 if ( v14 != (short)v2 ) 16112 if ( v14 != (short)v2 )
16113 { 16113 {
16114 v33 = v14; 16114 v33 = v14;
16115 v16 = (signed __int64)((double)v14 * 0.46875); 16115 v16 = (signed __int64)((double)v14 * 0.46875);
16116 LABEL_20:
16117 *(int *)v12 = v16; 16116 *(int *)v12 = v16;
16118 goto LABEL_26; 16117 goto LABEL_26;
16119 } 16118 }
16120 v15 = v37++; 16119 v15 = v37++;
16121 *(&a3.uDistance + v15) = v40b; 16120 *(&a3.uDistance + v15) = v40b;
16122 LABEL_26: 16121 LABEL_26:
16123 ++v40b; 16122 ++v40b;
16124 v12 += 16; 16123 v12 += 16;
16125 if ( v40b >= v1->uActorQueueSize ) 16124 if ( v40b >= this->uActorQueueSize )
16126 goto LABEL_27; 16125 goto LABEL_27;
16127 } 16126 }
16128 if ( v13 != 3 ) 16127 if ( v13 != 3 )
16129 { 16128 {
16130 *(int *)v12 = 666; 16129 *(int *)v12 = 666;
16137 goto LABEL_26; 16136 goto LABEL_26;
16138 } 16137 }
16139 LODWORD(v16) = SHIDWORD(v16) < 66; 16138 LODWORD(v16) = SHIDWORD(v16) < 66;
16140 LOBYTE(v16) = SHIDWORD(v16) >= 66; 16139 LOBYTE(v16) = SHIDWORD(v16) >= 66;
16141 LODWORD(v16) = 2 * v16 + 3; 16140 LODWORD(v16) = 2 * v16 + 3;
16142 goto LABEL_20; 16141 *(int *)v12 = v16;
16142 goto LABEL_26;
16143 } 16143 }
16144 LABEL_27: 16144 LABEL_27:
16145 v18 = 0; 16145 v18 = 0;
16146 if ( (signed int)v37 > (signed int)v2 ) 16146 if ( (signed int)v37 > (signed int)v2 )
16147 { 16147 {
16148 do 16148 do
16149 { 16149 {
16150 __debugbreak(); 16150 __debugbreak();
16151 *(&v31.uDistance + v18) = pParty->pPlayers[*(&v1->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime( 16151 *(&v31.uDistance + v18) = pParty->pPlayers[*(&this->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime(v2);
16152 v2);
16153 ++v18; 16152 ++v18;
16154 } 16153 }
16155 while ( (signed int)v18 < (signed int)v37 ); 16154 while ( (signed int)v18 < (signed int)v37 );
16156 if ( (signed int)v37 > (signed int)v2 ) 16155 if ( (signed int)v37 > (signed int)v2 )
16157 { 16156 {
16195 { 16194 {
16196 v27 = v2 + 2; 16195 v27 = v2 + 2;
16197 v28 = *(&a3.uDistance + v2++); 16196 v28 = *(&a3.uDistance + v2++);
16198 v11 = __OFSUB__(v2, v37); 16197 v11 = __OFSUB__(v2, v37);
16199 v10 = ((v2 - v37) & 0x80000000u) != 0; 16198 v10 = ((v2 - v37) & 0x80000000u) != 0;
16200 v1->pQueue[v28].field_4 = v27; 16199 this->pQueue[v28].field_4 = v27;
16201 } 16200 }
16202 while ( v10 ^ v11 ); 16201 while ( v10 ^ v11 );
16203 } 16202 }
16204 } 16203 }
16205 } 16204 }
16206 return v1->_404544(); 16205 return this->_404544();
16207 } 16206 }