comparison Player.cpp @ 310:4c2cdda88562

m
author Gloval
date Wed, 20 Feb 2013 01:40:18 +0400
parents b0db84628733
children e41fe9cf3613
comparison
equal deleted inserted replaced
308:6d584c95dcf8 310:4c2cdda88562
8299 pParty->uNumGoldInBank = a3; 8299 pParty->uNumGoldInBank = a3;
8300 return; 8300 return;
8301 } 8301 }
8302 if ( var <= VAR_Counter8 ) 8302 if ( var <= VAR_Counter8 )
8303 { 8303 {
8304 if ( (signed int)var >= 245 ) 8304 if ( (signed int)var >= 0xF5 )
8305 { 8305 {
8306 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); 8306 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed);
8307 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); 8307 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed);
8308 } 8308 }
8309 else 8309 else
8326 } 8326 }
8327 return; 8327 return;
8328 } 8328 }
8329 if ( var < VAR_Counter9 ) 8329 if ( var < VAR_Counter9 )
8330 return; 8330 return;
8331 if ( (signed int)var <= 274 ) 8331 if ( (signed int)var <= 0x112 )
8332 { 8332 {
8333 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); 8333 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed);
8334 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); 8334 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed);
8335 } 8335 }
8336 else 8336 else
8762 } 8762 }
8763 8763
8764 8764
8765 8765
8766 //----- (0044AFFB) -------------------------------------------------------- 8766 //----- (0044AFFB) --------------------------------------------------------
8767 void Player::AddVariable(enum VariableType var, signed int val) 8767 void Player::AddVariable(enum VariableType var_type, signed int val)
8768 { 8768 {
8769 char v3; // bl@1 8769 char v3; // bl@1
8770 Player *v4; // esi@1 8770 Player *v4; // esi@1
8771 signed int uPlayerIdx; // edi@1 8771 signed int uPlayerIdx; // edi@1
8772 int v6; // eax@15 8772 int v6; // eax@15
8791 int v25; // eax@150 8791 int v25; // eax@150
8792 char v26; // zf@151 8792 char v26; // zf@151
8793 DDM_DLV_Header *v27; // eax@153 8793 DDM_DLV_Header *v27; // eax@153
8794 signed int v28; // eax@176 8794 signed int v28; // eax@176
8795 int v29; // [sp-8h] [bp-40h]@84 8795 int v29; // [sp-8h] [bp-40h]@84
8796 signed int v30; // [sp-4h] [bp-3Ch]@4 8796 // signed int v30; // [sp-4h] [bp-3Ch]@4
8797 int v31; // [sp-4h] [bp-3Ch]@84 8797 int v31; // [sp-4h] [bp-3Ch]@84
8798 ItemGen item; // [sp+Ch] [bp-2Ch]@45 8798 ItemGen item; // [sp+Ch] [bp-2Ch]@45
8799 unsigned int v33; // [sp+30h] [bp-8h]@34 8799 unsigned int v33; // [sp+30h] [bp-8h]@34
8800 char v34; // [sp+37h] [bp-1h]@1 8800 char v34; // [sp+37h] [bp-1h]@1
8801 8801
8803 v3 = 0; 8803 v3 = 0;
8804 v34 = 0; 8804 v34 = 0;
8805 v4 = Dst; 8805 v4 = Dst;
8806 uPlayerIdx = 0; 8806 uPlayerIdx = 0;
8807 if ( Dst == pPlayers[2] ) 8807 if ( Dst == pPlayers[2] )
8808 {
8809 uPlayerIdx = 1; 8808 uPlayerIdx = 1;
8810 goto LABEL_8; 8809 else if ( Dst == pPlayers[3] )
8811 } 8810 uPlayerIdx = 2;
8812 if ( Dst == pPlayers[3] ) 8811 else if ( Dst == pPlayers[4] )
8813 { 8812 uPlayerIdx = 3;
8814 v30 = 2; 8813
8815 } 8814 if ( var_type <= VAR_AutoNotes )
8816 else 8815 {
8817 { 8816 if ( var_type != VAR_AutoNotes )
8818 if ( Dst != pPlayers[4] ) 8817 {
8819 goto LABEL_8; 8818 if ( var_type <= VAR_ActualMight )
8820 v30 = 3; 8819 {
8821 } 8820 if ( var_type != VAR_ActualMight )
8822 uPlayerIdx = v30; 8821 {
8823 LABEL_8: 8822 switch ( var_type )
8824 if ( var <= VAR_AutoNotes )
8825 {
8826 if ( var != VAR_AutoNotes )
8827 {
8828 if ( var <= VAR_ActualMight )
8829 {
8830 if ( var != VAR_ActualMight )
8831 {
8832 switch ( var )
8833 { 8823 {
8834 case VAR_RandomGold: 8824 case VAR_RandomGold:
8835 if ( !val ) 8825 if ( !val )
8836 val = 1; 8826 val = 1;
8837 v6 = rand(); 8827 v6 = rand();
9000 } 8990 }
9001 LABEL_62: 8991 LABEL_62:
9002 v19 = (__int16 *)&Dst->uMightBonus; 8992 v19 = (__int16 *)&Dst->uMightBonus;
9003 goto LABEL_113; 8993 goto LABEL_113;
9004 } 8994 }
9005 if ( var <= VAR_FireResistanceBonus ) 8995 if ( var_type <= VAR_FireResistanceBonus )
9006 { 8996 {
9007 if ( var != VAR_FireResistanceBonus ) 8997 if ( var_type != VAR_FireResistanceBonus )
9008 { 8998 {
9009 switch ( var ) 8999 switch ( var_type )
9010 { 9000 {
9011 case VAR_ActualIntellect: 9001 case VAR_ActualIntellect:
9012 LABEL_66: 9002 LABEL_66:
9013 v19 = (__int16 *)&Dst->uIntelligenceBonus; 9003 v19 = (__int16 *)&Dst->uIntelligenceBonus;
9014 goto LABEL_113; 9004 goto LABEL_113;
9083 LABEL_116: 9073 LABEL_116:
9084 v3 = 1; 9074 v3 = 1;
9085 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); 9075 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31);
9086 goto _play_anim_and_maybe_sound; 9076 goto _play_anim_and_maybe_sound;
9087 } 9077 }
9088 if ( var <= VAR_DisarmTrapSkill ) 9078 if ( var_type <= VAR_DisarmTrapSkill )
9089 { 9079 {
9090 if ( var != VAR_DisarmTrapSkill ) 9080 if ( var_type != VAR_DisarmTrapSkill )
9091 { 9081 {
9092 if ( var <= VAR_BodyResistanceBonus ) 9082 if ( var_type <= VAR_BodyResistanceBonus )
9093 { 9083 {
9094 switch ( var ) 9084 switch ( var_type )
9095 { 9085 {
9096 case VAR_BodyResistanceBonus: 9086 case VAR_BodyResistanceBonus:
9097 v19 = &Dst->sResBodyBonus; 9087 v19 = &Dst->sResBodyBonus;
9098 break; 9088 break;
9099 case VAR_AirResistanceBonus: 9089 case VAR_AirResistanceBonus:
9107 break; 9097 break;
9108 case VAR_SpiritResistanceBonus: 9098 case VAR_SpiritResistanceBonus:
9109 v19 = &Dst->sResSpiritBonus; 9099 v19 = &Dst->sResSpiritBonus;
9110 break; 9100 break;
9111 default: 9101 default:
9112 if ( var != 62 ) 9102 if ( var_type != 62 )
9113 return; 9103 return;
9114 v19 = &Dst->sResMindBonus; 9104 v19 = &Dst->sResMindBonus;
9115 break; 9105 break;
9116 } 9106 }
9117 goto LABEL_113; 9107 goto LABEL_113;
9118 } 9108 }
9119 if ( var == VAR_LightResistanceBonus ) 9109 if ( var_type == VAR_LightResistanceBonus )
9120 { 9110 {
9121 v19 = &Dst->sResLightBonus; 9111 v19 = &Dst->sResLightBonus;
9122 goto LABEL_113; 9112 goto LABEL_113;
9123 } 9113 }
9124 if ( var == VAR_DarkResistanceBonus ) 9114 if ( var_type == VAR_DarkResistanceBonus )
9125 { 9115 {
9126 v19 = &Dst->sResDarkBonus; 9116 v19 = &Dst->sResDarkBonus;
9127 goto LABEL_113; 9117 goto LABEL_113;
9128 } 9118 }
9129 if ( var == VAR_MagicResistanceBonus ) 9119 if ( var_type == VAR_MagicResistanceBonus )
9130 { 9120 {
9131 v19 = &Dst->sResMagicBonus; 9121 v19 = &Dst->sResMagicBonus;
9132 goto LABEL_113; 9122 goto LABEL_113;
9133 } 9123 }
9134 if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) 9124 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill )
9135 return; 9125 return;
9136 } 9126 }
9137 goto LABEL_106; 9127 goto LABEL_106;
9138 } 9128 }
9139 if ( var == VAR_LearningSkill ) 9129 if ( var_type == VAR_LearningSkill )
9140 { 9130 {
9141 LABEL_106: 9131 LABEL_106:
9142 if ( val <= VAR_BodyResistanceBonus ) 9132 if ( val <= VAR_BodyResistanceBonus )
9143 { 9133 {
9144 *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus; 9134 *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus;
9145 } 9135 }
9146 else 9136 else
9147 { 9137 {
9148 v20 = (char *)&Dst->pConditions[16] + 2 * var; 9138 v20 = (char *)&Dst->pConditions[16] + 2 * var_type;
9149 v21 = *(short *)v20; 9139 v21 = *(short *)v20;
9150 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); 9140 v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus);
9151 if ( v22 > 60 ) 9141 if ( v22 > 60 )
9152 LOWORD(v22) = 60; 9142 LOWORD(v22) = 60;
9153 LOBYTE(v21) = v21 & 0xC0; 9143 LOBYTE(v21) = v21 & 0xC0;
9154 *(short *)v20 = v22 | v21; 9144 *(short *)v20 = v22 | v21;
9155 } 9145 }
9156 goto _play_anim_and_exit; 9146 goto _play_anim_and_exit;
9157 } 9147 }
9158 if ( var <= VAR_LearningSkill ) 9148 if ( var_type <= VAR_LearningSkill )
9159 return; 9149 return;
9160 if ( var <= VAR_Eradicated ) 9150 if ( var_type <= VAR_Eradicated )
9161 { 9151 {
9162 Dst->SetCondition(var - 105, 0); 9152 Dst->SetCondition(var_type - 105, 0);
9163 } 9153 }
9164 else 9154 else
9165 { 9155 {
9166 if ( var != VAR_MajorCondition ) 9156 if ( var_type != VAR_MajorCondition )
9167 { 9157 {
9168 if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) 9158 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells )
9169 { 9159 {
9170 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 ) 9160 if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 )
9171 byte_5E4C15[var] += val; 9161 byte_5E4C15[var_type] += val;
9172 else 9162 else
9173 byte_5E4C15[var] = -1; 9163 byte_5E4C15[var_type] = -1;
9174 } 9164 }
9175 return; 9165 return;
9176 } 9166 }
9177 memset(Dst, 0, 0xA0u); 9167 memset(Dst, 0, 0xA0u);
9178 } 9168 }
9201 LABEL_173: 9191 LABEL_173:
9202 if ( v34 != 1 ) 9192 if ( v34 != 1 )
9203 goto _maybe_play_sound; 9193 goto _maybe_play_sound;
9204 goto _play_anim_and_maybe_sound; 9194 goto _play_anim_and_maybe_sound;
9205 } 9195 }
9206 if ( var > VAR_GoldInBank ) 9196 if ( var_type > VAR_GoldInBank )
9207 { 9197 {
9208 if ( var == 307 ) 9198 if ( var_type == 307 )
9209 { 9199 {
9210 pParty->uNumDeaths += val; 9200 pParty->uNumDeaths += val;
9211 goto LABEL_173; 9201 goto LABEL_173;
9212 } 9202 }
9213 switch ( var ) 9203 switch ( var_type )
9214 { 9204 {
9215 case 308: 9205 case 308:
9216 pParty->uNumBountiesCollected += val; 9206 pParty->uNumBountiesCollected += val;
9217 break; 9207 break;
9218 case 309: 9208 case 309:
9232 break; 9222 break;
9233 } 9223 }
9234 } 9224 }
9235 else 9225 else
9236 { 9226 {
9237 if ( var == VAR_GoldInBank ) 9227 if ( var_type == VAR_GoldInBank )
9238 { 9228 {
9239 pParty->uNumGoldInBank += val; 9229 pParty->uNumGoldInBank += val;
9240 return; 9230 return;
9241 } 9231 }
9242 if ( var <= VAR_Counter8 ) 9232 if ( var_type <= VAR_Counter8 )
9243 { 9233 {
9244 if ( (signed int)var >= 245 ) 9234 if ( (signed int)var_type >= 245 )
9245 { 9235 {
9246 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); 9236 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);
9247 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); 9237 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
9248 } 9238 }
9249 else 9239 else
9250 { 9240 {
9251 switch ( var ) 9241 switch ( var_type )
9252 { 9242 {
9253 case VAR_MonthEquals|VAR_CurrentSP: 9243 case VAR_MonthEquals|VAR_CurrentSP:
9254 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); 9244 _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u);
9255 break; 9245 break;
9256 case VAR_NPCs2: 9246 case VAR_NPCs2:
9264 break; 9254 break;
9265 } 9255 }
9266 } 9256 }
9267 return; 9257 return;
9268 } 9258 }
9269 if ( var < VAR_Counter9 ) 9259 if ( var_type < VAR_Counter9 )
9270 return; 9260 return;
9271 if ( (signed int)var <= 274 ) 9261 if ( (signed int)var_type <= 274 )
9272 { 9262 {
9273 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); 9263 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);
9274 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); 9264 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
9275 goto _play_sound; 9265 goto _play_sound;
9276 } 9266 }
9277 if ( var != VAR_ReputationInCurrentLocation ) 9267 if ( var_type != VAR_ReputationInCurrentLocation )
9278 { 9268 {
9279 if ( var <= VAR_ReputationInCurrentLocation 9269 if ( var_type <= VAR_ReputationInCurrentLocation
9280 || var > VAR_History_28 9270 || var_type > VAR_History_28
9281 || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) 9271 || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25])
9282 || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), 9272 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed),
9283 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, 9273 v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0,
9284 pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), 9274 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed),
9285 v26) ) 9275 v26) )
9286 return; 9276 return;
9287 bFlashHistoryBook = 1; 9277 bFlashHistoryBook = 1;
9288 _play_sound: 9278 _play_sound:
9289 v28 = 8 * uPlayerIdx + 400; 9279 v28 = 8 * uPlayerIdx + 400;