comparison Party.cpp @ 89:98cd93e14777

pointer fixes
author zipi
date Wed, 06 Feb 2013 21:19:42 +0000
parents be45fc285970
children d61f6bc04bf2
comparison
equal deleted inserted replaced
88:7bdf8f1150eb 89:98cd93e14777
80 int Party::GetNextActiveCharacter() 80 int Party::GetNextActiveCharacter()
81 { 81 {
82 Party *v1; // esi@1 82 Party *v1; // esi@1
83 int v2; // eax@4 83 int v2; // eax@4
84 signed int v4; // ecx@6 84 signed int v4; // ecx@6
85 char *v5; // edx@6 85 Player *v5; // edx@6
86 Player *v6; // eax@7 86 Player *v6; // eax@7
87 char *v7; // ecx@23 87 Player *v7; // ecx@23
88 signed int v8; // esi@23 88 signed int v8; // esi@23
89 signed int v9; // edx@23 89 signed int v9; // edx@23
90 Player **v10; // edi@23 90 Player **v10; // edi@23
91 Player *v11; // eax@24 91 Player *v11; // eax@24
92 int v12; // [sp+Ch] [bp-4h]@1 92 int v12; // [sp+Ch] [bp-4h]@1
99 return 0; 99 return 0;
100 v2 = pTurnEngine->pQueue[0].uPackedID >> 3; 100 v2 = pTurnEngine->pQueue[0].uPackedID >> 3;
101 return v2 + 1; 101 return v2 + 1;
102 } 102 }
103 v4 = 0; 103 v4 = 0;
104 v5 = (char *)&v1->pPlayers[0].uTimeToRecovery; 104 v5 = v1->pPlayers;//[0].uTimeToRecovery;
105 while ( 1 ) 105 while ( 1 )
106 { 106 {
107 v6 = ::pPlayers[v4 + 1]; 107 v6 = ::pPlayers[v4 + 1];
108 if ( v6->pConditions[2] 108 if ( v6->pConditions[2]
109 || v6->pConditions[12] 109 || v6->pConditions[12]
110 || v6->pConditions[13] 110 || v6->pConditions[13]
111 || v6->pConditions[14] 111 || v6->pConditions[14]
112 || v6->pConditions[15] 112 || v6->pConditions[15]
113 || v6->pConditions[16] 113 || v6->pConditions[16]
114 || *(short *)v5 ) 114 || v5->uTimeToRecovery )
115 { 115 {
116 byte_AE3368[v4] = 1; 116 byte_AE3368[v4] = 1;
117 goto LABEL_21;
118 } 117 }
119 if ( !byte_AE3368[v4] ) 118 else if ( !byte_AE3368[v4] )
120 break; 119 break;
121 LABEL_21:
122 ++v4; 120 ++v4;
123 v5 += 6972; 121 ++v5;
124 if ( v4 >= 4 ) 122 if ( v4 >= 4 )
125 goto LABEL_16; 123 break;
126 } 124 }
127 v12 = v4; 125 if(v4<4)
128 byte_AE3368[v4] = 1; 126 {
129 LABEL_16: 127 v12 = v4;
128 byte_AE3368[v4] = 1;
129 }
130 if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] ) 130 if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] )
131 memset(byte_AE3368, 0, 4u); 131 memset(byte_AE3368, 0, 4u);
132 v2 = v12; 132 v2 = v12;
133 if ( v12 ) 133 if ( v12 )
134 return v2 + 1; 134 return v2 + 1;
135 v7 = (char *)&v1->pPlayers[0].uSpeedBonus; 135 v7 = v1->pPlayers;//[0].uSpeedBonus;
136 v8 = 0; 136 v8 = 0;
137 v9 = 1; 137 v9 = 1;
138 v10 = &::pPlayers[1]; 138 v10 = &::pPlayers[1];
139 while ( 2 ) 139 while ( 2 )
140 { 140 {
143 && !v11->pConditions[12] 143 && !v11->pConditions[12]
144 && !v11->pConditions[13] 144 && !v11->pConditions[13]
145 && !v11->pConditions[14] 145 && !v11->pConditions[14]
146 && !v11->pConditions[15] 146 && !v11->pConditions[15]
147 && !v11->pConditions[16] 147 && !v11->pConditions[16]
148 && !*((short *)v7 + 3123) ) 148 && !v7->uTimeToRecovery )
149 { 149 {
150 if ( v12 ) 150 if ( v12 )
151 { 151 {
152 if ( *(short *)v7 > v8 ) 152 if ( v7->uSpeedBonus > v8 )
153 { 153 {
154 v8 = *(short *)v7; 154 v8 = v7->uSpeedBonus;
155 goto LABEL_35; 155 v12 = v9;
156 } 156 }
157 } 157 }
158 else 158 else
159 { 159 {
160 v8 = *(short *)v7; 160 v8 = *(short *)v7;
161 LABEL_35:
162 v12 = v9; 161 v12 = v9;
163 } 162 }
164 } 163 }
165 ++v10; 164 ++v10;
166 ++v9; 165 ++v9;
167 v7 += 6972; 166 ++v7;
168 if ( v9 - 1 < 4 ) 167 if ( v9 - 1 < 4 )
169 continue; 168 continue;
170 return v12; 169 return v12;
171 } 170 }
172 } 171 }
173 172
174 173
175 //----- (00493244) -------------------------------------------------------- 174 //----- (00493244) --------------------------------------------------------
176 bool Party::HasItem(unsigned int uItemID) 175 bool Party::HasItem(unsigned int uItemID)
177 { 176 {
178 char *v2; // edx@1 177 Player *v2; // edx@1
179 signed int v3; // ecx@2 178 signed int v3; // ecx@2
180 ItemGen *v4; // eax@2 179 ItemGen *v4; // eax@2
181 180
182 v2 = (char *)pParty->pPlayers[0].pInventoryItems; 181 v2 = pParty->pPlayers;//[0].pInventoryItems;
183 while ( 2 ) 182 while ( v2 <= &pParty->pPlayers[3] )
184 { 183 {
185 v3 = 0; 184 v3 = 0;
186 v4 = (ItemGen *)v2; 185 v4 = v2->pInventoryItems;
187 do 186 do
188 { 187 {
189 if ( v4->uItemID == uItemID ) 188 if ( v4->uItemID == uItemID )
190 return 1; 189 return 1;
191 ++v3; 190 ++v3;
192 ++v4; 191 ++v4;
193 } 192 }
194 while ( v3 < 138 ); 193 while ( v3 < 138 );
195 v2 += 6972; 194 ++v2;
196 if ( (signed int)v2 < (signed int)&pParty->field_777C[85] )
197 continue;
198 break;
199 } 195 }
200 return 0; 196 return 0;
201 } 197 }
202 198
203 199
259 255
260 //----- (0049135E) -------------------------------------------------------- 256 //----- (0049135E) --------------------------------------------------------
261 unsigned int Party::GetPartyFame() 257 unsigned int Party::GetPartyFame()
262 { 258 {
263 signed int v1; // eax@1 259 signed int v1; // eax@1
264 char *v2; // ecx@1 260 Player *v2; // ecx@1
265 signed int v3; // edx@1 261 signed int v3; // edx@1
266 262
267 v1 = 0; 263 v1 = 0;
268 v2 = (char *)&this->pPlayers[0].uExperience; 264 v2 = this->pPlayers;//[0].uExperience;
269 v3 = 4; // (E exp) / 1000 265 v3 = 4; // (E exp) / 1000
270 do 266 do
271 { 267 {
272 v1 += *(int *)v2; 268 v1 += (int)v2->uExperience; // needs review
273 v2 += 6972; 269 ++v2;
274 --v3; 270 --v3;
275 } 271 }
276 while ( v3 ); 272 while ( v3 );
277 return v1 / 1000; 273 return v1 / 1000;
278 } 274 }
812 808
813 //----- (00491BF9) -------------------------------------------------------- 809 //----- (00491BF9) --------------------------------------------------------
814 void Party::ResetPosMiscAndSpellBuffs() 810 void Party::ResetPosMiscAndSpellBuffs()
815 { 811 {
816 Party *v1; // esi@1 812 Party *v1; // esi@1
817 char *v2; // edi@1 813 Player *v2; // edi@1
818 SpellBuff *v3; // ebx@2 814 SpellBuff *v3; // ebx@2
819 SpellBuff *v4; // esi@5 815 SpellBuff *v4; // esi@5
820 signed int v5; // edi@5 816 signed int v5; // edi@5
821 signed int v6; // [sp+8h] [bp-8h]@1 817 signed int v6; // [sp+8h] [bp-8h]@1
822 signed int v7; // [sp+Ch] [bp-4h]@2 818 signed int v7; // [sp+Ch] [bp-4h]@2
837 this->field_20_prolly_turn_speed = 90; 833 this->field_20_prolly_turn_speed = 90;
838 this->field_24 = 5; 834 this->field_24 = 5;
839 this->field_6FC = 0; 835 this->field_6FC = 0;
840 this->field_708 = 15; 836 this->field_708 = 15;
841 this->field_0 = 25; 837 this->field_0 = 25;
842 v2 = (char *)this->pPlayers[0].pPlayerBuffs; 838 v2 = this->pPlayers;//[0].pPlayerBuffs;
843 v6 = 4; 839 v6 = 4;
844 do 840 do
845 { 841 {
846 v3 = (SpellBuff *)v2; 842 v3 = v2->pPlayerBuffs;
847 v7 = 24; 843 v7 = 24;
848 do 844 do
849 { 845 {
850 v3->Reset(); 846 v3->Reset();
851 ++v3; 847 ++v3;
852 --v7; 848 --v7;
853 } 849 }
854 while ( v7 ); 850 while ( v7 );
855 v2 += 6972; 851 ++v2;
856 --v6; 852 --v6;
857 } 853 }
858 while ( v6 ); 854 while ( v6 );
859 v4 = v1->pPartyBuffs; 855 v4 = v1->pPartyBuffs;
860 v5 = 20; 856 v5 = 20;