comparison Player.cpp @ 492:0e27362ac1d9

guild
author Gloval
date Thu, 28 Feb 2013 01:38:46 +0400
parents 7887a9cf9e7b
children 59649750a054
comparison
equal deleted inserted replaced
487:d5da524ec901 492:0e27362ac1d9
8203 return *((int *)this + 2 * VarNum - 210); 8203 return *((int *)this + 2 * VarNum - 210);
8204 } 8204 }
8205 8205
8206 8206
8207 //----- (0044A5CB) -------------------------------------------------------- 8207 //----- (0044A5CB) --------------------------------------------------------
8208 void Player::SetVariable(enum VariableType var, signed int a3) 8208 void Player::SetVariable(enum VariableType var_type, signed int var_value)
8209 { 8209 {
8210 signed int v3; // ebx@1 8210 signed int currPlayerId; // ebx@1
8211 Player *v4; // esi@1 8211 Player *v4; // esi@1
8212 unsigned int v5; // edi@1 8212 unsigned int v5; // edi@1
8213 unsigned int v6; // esi@13 8213 unsigned int v6; // esi@13
8214 unsigned int v7; // esi@14 8214 unsigned int v7; // esi@14
8215 signed int v8; // eax@17 8215 signed int v8; // eax@17
8235 int v28; // [sp-4h] [bp-38h]@84 8235 int v28; // [sp-4h] [bp-38h]@84
8236 ItemGen item; // [sp+Ch] [bp-28h]@52 8236 ItemGen item; // [sp+Ch] [bp-28h]@52
8237 char v30; // [sp+32h] [bp-2h]@1 8237 char v30; // [sp+32h] [bp-2h]@1
8238 char v31; // [sp+33h] [bp-1h]@1 8238 char v31; // [sp+33h] [bp-1h]@1
8239 8239
8240 v3 = 0; 8240 currPlayerId = 0;
8241 v30 = 0; 8241 v30 = 0;
8242 v31 = 0; 8242 v31 = 0;
8243 v4 = this; 8243 v4 = this;
8244 v5 = 0; 8244 v5 = 0;
8245 if ( this == pPlayers[2] ) 8245 if ( this == pPlayers[2] )
8246 { 8246 currPlayerId = 1;
8247 v3 = 1; 8247 else if ( this == pPlayers[3] )
8248 goto LABEL_8; 8248 currPlayerId = 2;
8249 } 8249 else if ( this == pPlayers[4] );
8250 if ( this == pPlayers[3] ) 8250 currPlayerId = 3;
8251 { 8251 if ( var_type > VAR_AutoNotes )
8252 v27 = 2; 8252 {
8253 } 8253 if ( var_type <= VAR_GoldInBank )
8254 else 8254 {
8255 { 8255 if ( var_type == VAR_GoldInBank )
8256 if ( this != pPlayers[4] ) 8256 {
8257 goto LABEL_8; 8257 pParty->uNumGoldInBank = var_value;
8258 v27 = 3;
8259 }
8260 v3 = v27;
8261 LABEL_8:
8262 if ( var > VAR_AutoNotes )
8263 {
8264 if ( var <= VAR_GoldInBank )
8265 {
8266 if ( var == VAR_GoldInBank )
8267 {
8268 pParty->uNumGoldInBank = a3;
8269 return; 8258 return;
8270 } 8259 }
8271 if ( var <= VAR_Counter8 ) 8260 if ( var_type <= VAR_Counter8 )
8272 { 8261 {
8273 if ( (signed int)var >= 0xF5 ) 8262 if ( (signed int)var_type >= 0xF5 )
8274 { 8263 {
8275 *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); 8264 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);
8276 *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); 8265 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
8277 } 8266 }
8278 else 8267 else
8279 { 8268 {
8280 switch ( var ) 8269 switch ( var_type )
8281 { 8270 {
8282 case VAR_MonthEquals|VAR_CurrentSP: 8271 case VAR_MonthEquals|VAR_CurrentSP:
8283 _449B7E_toggle_bit((unsigned char *)field_1A50, a3, 1u); 8272 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
8284 break; 8273 break;
8285 case VAR_NPCs2: 8274 case VAR_NPCs2:
8286 pParty->field_709 = 0; 8275 pParty->field_709 = 0;
8287 LOBYTE(pNPCStats->pNewNPCData[a3].uFlags) |= 0x80u; 8276 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
8288 sub_44A56A(); 8277 sub_44A56A();
8289 viewparams->bRedrawGameUI = 1; 8278 viewparams->bRedrawGameUI = 1;
8290 break; 8279 break;
8291 case VAR_NumSkillPoints: 8280 case VAR_NumSkillPoints:
8292 this->uSkillPoints = a3; 8281 this->uSkillPoints = var_value;
8293 break; 8282 break;
8294 } 8283 }
8295 } 8284 }
8296 return; 8285 return;
8297 } 8286 }
8298 if ( var < VAR_Counter9 ) 8287 if ( var_type < VAR_Counter9 )
8299 return; 8288 return;
8300 if ( (signed int)var <= 0x112 ) 8289 if ( (signed int)var_type <= 0x112 )
8301 { 8290 {
8302 *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); 8291 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);
8303 *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); 8292 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
8304 } 8293 }
8305 else 8294 else
8306 { 8295 {
8307 if ( var == VAR_ReputationInCurrentLocation ) 8296 if ( var_type == VAR_ReputationInCurrentLocation )
8308 { 8297 {
8309 v24 = &pOutdoor->ddm; 8298 v24 = &pOutdoor->ddm;
8310 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) 8299 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
8311 v24 = &pIndoor->dlv; 8300 v24 = &pIndoor->dlv;
8312 v24->uReputation = a3; 8301 v24->uReputation = var_value;
8313 if ( a3 > 10000 ) 8302 if ( var_value > 10000 )
8314 v24->uReputation = 10000; 8303 v24->uReputation = 10000;
8315 return; 8304 return;
8316 } 8305 }
8317 if ( var <= VAR_ReputationInCurrentLocation 8306 if ( var_type <= VAR_ReputationInCurrentLocation
8318 || var > VAR_History_28 8307 || var_type > VAR_History_28
8319 || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) 8308 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22])
8320 || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), 8309 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed),
8321 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, 8310 v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0,
8322 pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), 8311 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed),
8323 v23) ) 8312 v23) )
8324 return; 8313 return;
8325 bFlashHistoryBook = 1; 8314 bFlashHistoryBook = 1;
8326 } 8315 }
8327 LABEL_172: 8316 LABEL_172:
8328 v25 = 8 * v3 + 400; 8317 v25 = 8 * currPlayerId + 400;
8329 LOBYTE(v25) = (8 * v3 - 112) | 4; 8318 LOBYTE(v25) = (8 * currPlayerId - 112) | 4;
8330 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); 8319 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5);
8331 return; 8320 return;
8332 } 8321 }
8333 if ( var != 307 ) 8322 if ( var_type != 307 )
8334 { 8323 {
8335 switch ( var ) 8324 switch ( var_type )
8336 { 8325 {
8337 case 308: 8326 case 308:
8338 pParty->uNumBountiesCollected = a3; 8327 pParty->uNumBountiesCollected = var_value;
8339 break; 8328 break;
8340 case 309: 8329 case 309:
8341 pParty->uNumPrisonTerms = a3; 8330 pParty->uNumPrisonTerms = var_value;
8342 break; 8331 break;
8343 case 310: 8332 case 310:
8344 pParty->uNumArenaPageWins = a3; 8333 pParty->uNumArenaPageWins = var_value;
8345 break; 8334 break;
8346 case 311: 8335 case 311:
8347 pParty->uNumArenaSquireWins = a3; 8336 pParty->uNumArenaSquireWins = var_value;
8348 break; 8337 break;
8349 case 312: 8338 case 312:
8350 pParty->uNumArenaKnightWins = a3; 8339 pParty->uNumArenaKnightWins = var_value;
8351 break; 8340 break;
8352 case 313: 8341 case 313:
8353 pParty->uNumArenaLordWins = a3; 8342 pParty->uNumArenaLordWins = var_value;
8354 break; 8343 break;
8355 } 8344 }
8356 return; 8345 return;
8357 } 8346 }
8358 pParty->uNumDeaths = a3; 8347 pParty->uNumDeaths = var_value;
8359 LABEL_168: 8348 LABEL_168:
8360 if ( v30 != 1 ) 8349 if ( v30 != 1 )
8361 { 8350 {
8362 LABEL_170: 8351 LABEL_170:
8363 if ( v31 != 1 ) 8352 if ( v31 != 1 )
8364 return; 8353 return;
8365 v5 = 0; 8354 v5 = 0;
8366 goto LABEL_172; 8355 goto LABEL_172;
8367 } 8356 }
8368 LABEL_169: 8357 LABEL_169:
8369 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, v3); 8358 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
8370 goto LABEL_170; 8359 goto LABEL_170;
8371 } 8360 }
8372 if ( var == VAR_AutoNotes ) 8361 if ( var_type == VAR_AutoNotes )
8373 { 8362 {
8374 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3]) 8363 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3])
8375 //&& (&dword_723718_autonote_related)[8 * a3] ) 8364 //&& (&dword_723718_autonote_related)[8 * a3] )
8376 && pAutonoteTxt[a3-1].pText ) 8365 && pAutonoteTxt[var_value-1].pText )
8377 { 8366 {
8378 v20 = pPlayers[v3 + 1]; 8367 v20 = pPlayers[currPlayerId + 1];
8379 v30 = 1; 8368 v30 = 1;
8380 v20->PlaySound(SPEECH_96, 0); 8369 v20->PlaySound(SPEECH_96, 0);
8381 v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; 8370 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
8382 bFlashAutonotesBook = 1; 8371 bFlashAutonotesBook = 1;
8383 dword_506568 = v21; 8372 dword_506568 = v21;
8384 } 8373 }
8385 _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); 8374 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
8386 v31 = 1; 8375 v31 = 1;
8387 goto LABEL_168; 8376 goto LABEL_168;
8388 } 8377 }
8389 if ( var <= VAR_ActualMight ) 8378 if ( var_type <= VAR_ActualMight )
8390 { 8379 {
8391 if ( var != VAR_ActualMight ) 8380 if ( var_type != VAR_ActualMight )
8392 { 8381 {
8393 switch ( var ) 8382 switch ( var_type )
8394 { 8383 {
8395 case VAR_RandomGold: 8384 case VAR_RandomGold:
8396 v6 = rand() % a3 + 1; 8385 v6 = rand() % var_value + 1;
8397 Party::SetGold(v6); 8386 Party::SetGold(v6);
8398 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold 8387 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
8399 ShowStatusBarString(pTmpBuf, 2u); 8388 ShowStatusBarString(pTmpBuf, 2u);
8400 GameUI_DrawFoodAndGold(); 8389 GameUI_DrawFoodAndGold();
8401 return; 8390 return;
8402 case VAR_RandomFood: 8391 case VAR_RandomFood:
8403 v7 = rand() % a3 + 1; 8392 v7 = rand() % var_value + 1;
8404 Party::SetFood(v7); 8393 Party::SetFood(v7);
8405 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food 8394 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
8406 ShowStatusBarString(pTmpBuf, 2u); 8395 ShowStatusBarString(pTmpBuf, 2u);
8407 GameUI_DrawFoodAndGold(); 8396 GameUI_DrawFoodAndGold();
8408 goto LABEL_124; 8397 goto LABEL_124;
8409 case VAR_Sex: 8398 case VAR_Sex:
8410 this->uSex = (PLAYER_SEX)a3; 8399 this->uSex = (PLAYER_SEX)var_value;
8411 goto LABEL_124; 8400 goto LABEL_124;
8412 case VAR_Class: 8401 case VAR_Class:
8413 this->classType = (PLAYER_CLASS_TYPE)a3; 8402 this->classType = (PLAYER_CLASS_TYPE)var_value;
8414 if ( (char)a3 != 35 ) 8403 if ( (char)var_value != 35 )
8415 goto LABEL_124; 8404 goto LABEL_124;
8416 v8 = 0; 8405 v8 = 0;
8417 v9 = this->pInventoryItems; 8406 v9 = this->pInventoryItems;
8418 break; 8407 break;
8419 case VAR_CurrentHP: 8408 case VAR_CurrentHP:
8420 this->sHealth = a3; 8409 this->sHealth = var_value;
8421 goto LABEL_124; 8410 goto LABEL_124;
8422 case VAR_MaxHP: 8411 case VAR_MaxHP:
8423 this->sHealth = GetMaxHealth(); 8412 this->sHealth = GetMaxHealth();
8424 return; 8413 return;
8425 case VAR_CurrentSP: 8414 case VAR_CurrentSP:
8426 this->sMana = a3; 8415 this->sMana = var_value;
8427 goto LABEL_124; 8416 goto LABEL_124;
8428 case VAR_MaxSP: 8417 case VAR_MaxSP:
8429 this->sMana = GetMaxMana(); 8418 this->sMana = GetMaxMana();
8430 return; 8419 return;
8431 case VAR_ACModifier: 8420 case VAR_ACModifier:
8432 this->sACModifier = (unsigned __int8)a3; 8421 this->sACModifier = (unsigned __int8)var_value;
8433 goto LABEL_124; 8422 goto LABEL_124;
8434 case VAR_BaseLevel: 8423 case VAR_BaseLevel:
8435 this->uLevel = (unsigned __int8)a3; 8424 this->uLevel = (unsigned __int8)var_value;
8436 goto LABEL_124; 8425 goto LABEL_124;
8437 case VAR_LevelModifier: 8426 case VAR_LevelModifier:
8438 this->sLevelModifier = (unsigned __int8)a3; 8427 this->sLevelModifier = (unsigned __int8)var_value;
8439 goto LABEL_124; 8428 goto LABEL_124;
8440 case VAR_Age: 8429 case VAR_Age:
8441 this->sAgeModifier = a3; 8430 this->sAgeModifier = var_value;
8442 return; 8431 return;
8443 case VAR_Award: 8432 case VAR_Award:
8444 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->_guilds_member_bits[((signed __int16)a3 - 1) >> 3]) 8433 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) &
8434 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8])
8445 //&& dword_723E80_award_related[2 * a3] ) 8435 //&& dword_723E80_award_related[2 * a3] )
8446 && pAwards[a3-1].pText ) 8436 && pAwards[var_value].pText )
8447 { 8437 {
8448 v12 = pPlayers[v3 + 1];
8449 v30 = 1; 8438 v30 = 1;
8450 v31 = 1; 8439 v31 = 1;
8451 v12->PlaySound(SPEECH_96, 0); 8440 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0);
8452 } 8441 }
8453 v13 = v4->_guilds_member_bits; 8442 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u);
8454 goto LABEL_51; 8443 goto LABEL_168;
8455 case VAR_Experience: 8444 case VAR_Experience:
8456 this->uExperience = a3; 8445 this->uExperience = var_value;
8457 goto LABEL_124; 8446 goto LABEL_124;
8458 case VAR_QBits_QuestsDone: 8447 case VAR_QBits_QuestsDone:
8459 if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_quest_bits[((signed __int16)a3 - 1) >> 3]) 8448 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])
8460 // && (&dword_722F10)[4 * a3] ) 8449 // && (&dword_722F10)[4 * a3] )
8461 && pQuestTable[a3-1] ) 8450 && pQuestTable[var_value-1] )
8462 { 8451 {
8463 v14 = pPlayers[v3 + 1]; 8452 v14 = pPlayers[currPlayerId + 1];
8464 bFlashQuestBook = 1; 8453 bFlashQuestBook = 1;
8465 v30 = 1; 8454 v30 = 1;
8466 v31 = 1; 8455 v31 = 1;
8467 v14->PlaySound(SPEECH_93, 0); 8456 v14->PlaySound(SPEECH_93, 0);
8468 } 8457 }
8469 v13 = (char *)pParty->_quest_bits; 8458 v13 = (char *)pParty->_quest_bits;
8470 LABEL_51: 8459 LABEL_51:
8471 _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); 8460 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u);
8472 goto LABEL_168; 8461 if (( v30 != 1 )&&( v31 != 1 ))
8462 return;
8463 else
8464 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
8465 if ( v31 != 1 )
8466 return;
8467 v25 = 8 * currPlayerId + 400;
8468 LOBYTE(v25) = (8 * currPlayerId - 112) | 4;
8469 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
8470 return;
8473 case VAR_PlayerItemInHands: 8471 case VAR_PlayerItemInHands:
8474 item.Reset(); 8472 item.Reset();
8475 item.Reset(); 8473 item.Reset();
8476 item.uItemID = a3; 8474 item.uItemID = var_value;
8477 item.uAttributes = 1; 8475 item.uAttributes = 1;
8478 pParty->SetHoldingItem(&item); 8476 pParty->SetHoldingItem(&item);
8479 if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER ) 8477 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER )
8480 pParty->pIsArtifactFound[a3-500] = 1; 8478 pParty->pIsArtifactFound[var_value-500] = 1;
8481 return; 8479 return;
8482 case VAR_FixedGold: 8480 case VAR_FixedGold:
8483 Party::SetGold(a3); 8481 Party::SetGold(var_value);
8484 return; 8482 return;
8485 case VAR_BaseMight: 8483 case VAR_BaseMight:
8486 this->uMight = (unsigned __int8)a3; 8484 this->uMight = (unsigned __int8)var_value;
8487 goto LABEL_84; 8485 goto LABEL_84;
8488 case VAR_BaseIntellect: 8486 case VAR_BaseIntellect:
8489 this->uIntelligence = (unsigned __int8)a3; 8487 this->uIntelligence = (unsigned __int8)var_value;
8490 goto LABEL_84; 8488 goto LABEL_84;
8491 case VAR_BasePersonality: 8489 case VAR_BasePersonality:
8492 this->uWillpower = (unsigned __int8)a3; 8490 this->uWillpower = (unsigned __int8)var_value;
8493 goto LABEL_84; 8491 goto LABEL_84;
8494 case VAR_BaseEndurance: 8492 case VAR_BaseEndurance:
8495 this->uEndurance = (unsigned __int8)a3; 8493 this->uEndurance = (unsigned __int8)var_value;
8496 goto LABEL_84; 8494 goto LABEL_84;
8497 case VAR_BaseSpeed: 8495 case VAR_BaseSpeed:
8498 this->uSpeed = (unsigned __int8)a3; 8496 this->uSpeed = (unsigned __int8)var_value;
8499 goto LABEL_84; 8497 goto LABEL_84;
8500 case VAR_BaseAccuracy: 8498 case VAR_BaseAccuracy:
8501 this->uAccuracy = (unsigned __int8)a3; 8499 this->uAccuracy = (unsigned __int8)var_value;
8502 goto LABEL_84; 8500 goto LABEL_84;
8503 case VAR_BaseLuck: 8501 case VAR_BaseLuck:
8504 this->uLuck = (unsigned __int8)a3; 8502 this->uLuck = (unsigned __int8)var_value;
8505 goto LABEL_84; 8503 goto LABEL_84;
8506 case VAR_FixedFood: 8504 case VAR_FixedFood:
8507 Party::SetFood(a3); 8505 Party::SetFood(var_value);
8508 goto LABEL_124; 8506 goto LABEL_124;
8509 case VAR_MightBonus: 8507 case VAR_MightBonus:
8510 goto LABEL_64; 8508 goto LABEL_64;
8511 case VAR_IntellectBonus: 8509 case VAR_IntellectBonus:
8512 goto LABEL_68; 8510 goto LABEL_68;
8530 if ( v8 >= 138 ) 8528 if ( v8 >= 138 )
8531 goto LABEL_22; 8529 goto LABEL_22;
8532 } 8530 }
8533 v10 = (int)((char *)v4 + 36 * v8); 8531 v10 = (int)((char *)v4 + 36 * v8);
8534 *(int *)(v10 + 532) = 601; 8532 *(int *)(v10 + 532) = 601;
8535 *(char *)(v10 + 558) = v3 + 1; 8533 *(char *)(v10 + 558) = currPlayerId + 1;
8536 LABEL_22: 8534 LABEL_22:
8537 if ( v4->sResFireBase < 20 ) 8535 if ( v4->sResFireBase < 20 )
8538 v4->sResFireBase = 20; 8536 v4->sResFireBase = 20;
8539 if ( v4->sResAirBase < 20 ) 8537 if ( v4->sResAirBase < 20 )
8540 v4->sResAirBase = 20; 8538 v4->sResAirBase = 20;
8555 else 8553 else
8556 { 8554 {
8557 v4->uFace = 20; 8555 v4->uFace = 20;
8558 v4->uVoiceID = 20; 8556 v4->uVoiceID = 20;
8559 } 8557 }
8560 ReloadPlayerPortraits(v3, v4->uFace); 8558 ReloadPlayerPortraits(currPlayerId, v4->uFace);
8561 goto LABEL_124; 8559 goto LABEL_124;
8562 } 8560 }
8563 LABEL_64: 8561 LABEL_64:
8564 this->uMightBonus = (unsigned __int8)a3; 8562 this->uMightBonus = (unsigned __int8)var_value;
8565 LABEL_111: 8563 LABEL_111:
8566 v28 = 0; 8564 v28 = 0;
8567 v26 = SPEECH_91; 8565 v26 = SPEECH_91;
8568 LABEL_112: 8566 LABEL_112:
8569 v19 = pPlayers[v3 + 1]; 8567 v19 = pPlayers[currPlayerId + 1];
8570 v31 = 1; 8568 v31 = 1;
8571 v19->PlaySound((PlayerSpeech)v26, v28); 8569 v19->PlaySound((PlayerSpeech)v26, v28);
8572 goto LABEL_169; 8570 goto LABEL_169;
8573 } 8571 }
8574 if ( var <= VAR_FireResistanceBonus ) 8572 if ( var_type <= VAR_FireResistanceBonus )
8575 { 8573 {
8576 if ( var == VAR_FireResistanceBonus ) 8574 if ( var_type == VAR_FireResistanceBonus )
8577 { 8575 {
8578 this->sResFireBonus = (unsigned __int8)a3; 8576 this->sResFireBonus = (unsigned __int8)var_value;
8579 goto LABEL_111; 8577 goto LABEL_111;
8580 } 8578 }
8581 switch ( var ) 8579 switch ( var_type )
8582 { 8580 {
8583 case VAR_ActualIntellect: 8581 case VAR_ActualIntellect:
8584 LABEL_68: 8582 LABEL_68:
8585 this->uIntelligenceBonus = (unsigned __int8)a3; 8583 this->uIntelligenceBonus = (unsigned __int8)var_value;
8586 goto LABEL_111; 8584 goto LABEL_111;
8587 case VAR_ActualPersonality: 8585 case VAR_ActualPersonality:
8588 LABEL_69: 8586 LABEL_69:
8589 this->uWillpowerBonus = (unsigned __int8)a3; 8587 this->uWillpowerBonus = (unsigned __int8)var_value;
8590 goto LABEL_111; 8588 goto LABEL_111;
8591 case VAR_ActualEndurance: 8589 case VAR_ActualEndurance:
8592 LABEL_70: 8590 LABEL_70:
8593 this->uEnduranceBonus = (unsigned __int8)a3; 8591 this->uEnduranceBonus = (unsigned __int8)var_value;
8594 goto LABEL_111; 8592 goto LABEL_111;
8595 case VAR_ActualSpeed: 8593 case VAR_ActualSpeed:
8596 LABEL_71: 8594 LABEL_71:
8597 this->uSpeedBonus = (unsigned __int8)a3; 8595 this->uSpeedBonus = (unsigned __int8)var_value;
8598 goto LABEL_111; 8596 goto LABEL_111;
8599 case VAR_ActualAccuracy: 8597 case VAR_ActualAccuracy:
8600 LABEL_72: 8598 LABEL_72:
8601 this->uAccuracyBonus = (unsigned __int8)a3; 8599 this->uAccuracyBonus = (unsigned __int8)var_value;
8602 goto LABEL_111; 8600 goto LABEL_111;
8603 case VAR_ActualLuck: 8601 case VAR_ActualLuck:
8604 LABEL_73: 8602 LABEL_73:
8605 this->uLuckBonus = (unsigned __int8)a3; 8603 this->uLuckBonus = (unsigned __int8)var_value;
8606 goto LABEL_111; 8604 goto LABEL_111;
8607 case VAR_FireResistance: 8605 case VAR_FireResistance:
8608 this->sResFireBase = (unsigned __int8)a3; 8606 this->sResFireBase = (unsigned __int8)var_value;
8609 goto LABEL_84; 8607 goto LABEL_84;
8610 case VAR_AirResistance: 8608 case VAR_AirResistance:
8611 this->sResAirBase = (unsigned __int8)a3; 8609 this->sResAirBase = (unsigned __int8)var_value;
8612 goto LABEL_84; 8610 goto LABEL_84;
8613 case VAR_WaterResistance: 8611 case VAR_WaterResistance:
8614 this->sResWaterBase = (unsigned __int8)a3; 8612 this->sResWaterBase = (unsigned __int8)var_value;
8615 goto LABEL_84; 8613 goto LABEL_84;
8616 case VAR_EarthResistance: 8614 case VAR_EarthResistance:
8617 this->sResEarthBase = (unsigned __int8)a3; 8615 this->sResEarthBase = (unsigned __int8)var_value;
8618 goto LABEL_84; 8616 goto LABEL_84;
8619 case VAR_SpiritResistance: 8617 case VAR_SpiritResistance:
8620 this->sResSpiritBase = (unsigned __int8)a3; 8618 this->sResSpiritBase = (unsigned __int8)var_value;
8621 goto LABEL_84; 8619 goto LABEL_84;
8622 case VAR_MindResistance: 8620 case VAR_MindResistance:
8623 this->sResMindBase = (unsigned __int8)a3; 8621 this->sResMindBase = (unsigned __int8)var_value;
8624 goto LABEL_84; 8622 goto LABEL_84;
8625 case VAR_BodyResistance: 8623 case VAR_BodyResistance:
8626 this->sResBodyBase = (unsigned __int8)a3; 8624 this->sResBodyBase = (unsigned __int8)var_value;
8627 goto LABEL_84; 8625 goto LABEL_84;
8628 case VAR_LightResistance: 8626 case VAR_LightResistance:
8629 this->sResLightBase = (unsigned __int8)a3; 8627 this->sResLightBase = (unsigned __int8)var_value;
8630 goto LABEL_84; 8628 goto LABEL_84;
8631 case VAR_DarkResistance: 8629 case VAR_DarkResistance:
8632 this->sResDarkBase = (unsigned __int8)a3; 8630 this->sResDarkBase = (unsigned __int8)var_value;
8633 goto LABEL_84; 8631 goto LABEL_84;
8634 case VAR_MagicResistance: 8632 case VAR_MagicResistance:
8635 this->sResMagicBase = (unsigned __int8)a3; 8633 this->sResMagicBase = (unsigned __int8)var_value;
8636 LABEL_84: 8634 LABEL_84:
8637 v28 = 0; 8635 v28 = 0;
8638 v26 = 92; 8636 v26 = 92;
8639 goto LABEL_112; 8637 goto LABEL_112;
8640 default: 8638 default:
8641 return; 8639 return;
8642 } 8640 }
8643 return; 8641 return;
8644 } 8642 }
8645 HIWORD(v15) = 0; 8643 HIWORD(v15) = 0;
8646 if ( var > VAR_DisarmTrapSkill ) 8644 if ( var_type > VAR_DisarmTrapSkill )
8647 { 8645 {
8648 if ( var != VAR_LearningSkill ) 8646 if ( var_type != VAR_LearningSkill )
8649 { 8647 {
8650 if ( var <= VAR_LearningSkill ) 8648 if ( var_type <= VAR_LearningSkill )
8651 return; 8649 return;
8652 if ( var <= VAR_Eradicated ) 8650 if ( var_type <= VAR_Eradicated )
8653 { 8651 {
8654 v4->SetCondition(var - 105, 1); 8652 v4->SetCondition(var_type - 105, 1);
8655 } 8653 }
8656 else 8654 else
8657 { 8655 {
8658 if ( var != VAR_MajorCondition ) 8656 if ( var_type != VAR_MajorCondition )
8659 { 8657 {
8660 if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) 8658 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells )
8661 byte_5E4C15[var] = a3; 8659 byte_5E4C15[var_type] = var_value;
8662 return; 8660 return;
8663 } 8661 }
8664 memset(v4, 0, 0xA0u); 8662 memset(v4, 0, 0xA0u);
8665 } 8663 }
8666 LABEL_124: 8664 LABEL_124:
8667 v31 = 1; 8665 v31 = 1;
8668 goto LABEL_169; 8666 goto LABEL_169;
8669 } 8667 }
8670 LABEL_106: 8668 LABEL_106:
8671 v16 = (int)((char *)&v4->pConditions[16] + 2 * var); 8669 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type);
8672 v17 = *(char *)v16; 8670 v17 = *(char *)v16;
8673 if ( a3 <= VAR_BodyResistanceBonus ) 8671 if ( var_value <= VAR_BodyResistanceBonus )
8674 { 8672 {
8675 LOWORD(v15) = (unsigned __int8)a3; 8673 LOWORD(v15) = (unsigned __int8)var_value;
8676 v18 = v15 | v17 & VAR_BodyResistanceBonus; 8674 v18 = v15 | v17 & VAR_BodyResistanceBonus;
8677 } 8675 }
8678 else 8676 else
8679 { 8677 {
8680 LOWORD(v18) = (unsigned __int8)(a3 | v17 & 0xC0); 8678 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0);
8681 } 8679 }
8682 *(short *)v16 = v18; 8680 *(short *)v16 = v18;
8683 goto LABEL_124; 8681 goto LABEL_124;
8684 } 8682 }
8685 if ( var == VAR_DisarmTrapSkill ) 8683 if ( var_type == VAR_DisarmTrapSkill )
8686 goto LABEL_106; 8684 if ( v30 != 1 )
8687 if ( var <= VAR_BodyResistanceBonus ) 8685 {
8688 { 8686 if ( v31 != 1 )
8689 switch ( var ) 8687 return;
8688 v5 = 0;
8689 goto LABEL_172;
8690 }
8691 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
8692 goto LABEL_170;
8693 if ( var_type <= VAR_BodyResistanceBonus )
8694 {
8695 switch ( var_type )
8690 { 8696 {
8691 case VAR_BodyResistanceBonus: 8697 case VAR_BodyResistanceBonus:
8692 v4->sResBodyBonus = (unsigned __int8)a3; 8698 v4->sResBodyBonus = (unsigned __int8)var_value;
8693 break; 8699 break;
8694 case VAR_AirResistanceBonus: 8700 case VAR_AirResistanceBonus:
8695 v4->sResAirBonus = (unsigned __int8)a3; 8701 v4->sResAirBonus = (unsigned __int8)var_value;
8696 break; 8702 break;
8697 case VAR_WaterResistanceBonus: 8703 case VAR_WaterResistanceBonus:
8698 v4->sResWaterBonus = (unsigned __int8)a3; 8704 v4->sResWaterBonus = (unsigned __int8)var_value;
8699 break; 8705 break;
8700 case VAR_EarthResistanceBonus: 8706 case VAR_EarthResistanceBonus:
8701 v4->sResEarthBonus = (unsigned __int8)a3; 8707 v4->sResEarthBonus = (unsigned __int8)var_value;
8702 break; 8708 break;
8703 case VAR_SpiritResistanceBonus: 8709 case VAR_SpiritResistanceBonus:
8704 v4->sResSpiritBonus = (unsigned __int8)a3; 8710 v4->sResSpiritBonus = (unsigned __int8)var_value;
8705 break; 8711 break;
8706 default: 8712 default:
8707 if ( var != 62 ) 8713 if ( var_type != 62 )
8708 return; 8714 return;
8709 v4->sResMindBonus = (unsigned __int8)a3; 8715 v4->sResMindBonus = (unsigned __int8)var_value;
8710 break; 8716 break;
8711 } 8717 }
8712 goto LABEL_111; 8718 goto LABEL_111;
8713 } 8719 }
8714 if ( var == VAR_LightResistanceBonus ) 8720 if ( var_type == VAR_LightResistanceBonus )
8715 { 8721 {
8716 v4->sResLightBonus = (unsigned __int8)a3; 8722 v4->sResLightBonus = (unsigned __int8)var_value;
8717 goto LABEL_111; 8723 goto LABEL_111;
8718 } 8724 }
8719 if ( var == VAR_DarkResistanceBonus ) 8725 if ( var_type == VAR_DarkResistanceBonus )
8720 { 8726 {
8721 v4->sResDarkBonus = (unsigned __int8)a3; 8727 v4->sResDarkBonus = (unsigned __int8)var_value;
8722 goto LABEL_111; 8728 goto LABEL_111;
8723 } 8729 }
8724 if ( var == VAR_MagicResistanceBonus ) 8730 if ( var_type == VAR_MagicResistanceBonus )
8725 { 8731 {
8726 v4->sResMagicBonus = (unsigned __int8)a3; 8732 v4->sResMagicBonus = (unsigned __int8)var_value;
8727 goto LABEL_111; 8733 goto LABEL_111;
8728 } 8734 }
8729 if ( var > VAR_MagicResistanceBonus && var <= VAR_DiplomacySkill ) 8735 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill )
8730 goto LABEL_106; 8736 if ( v30 != 1 )
8737 {
8738 if ( v31 != 1 )
8739 return;
8740 v5 = 0;
8741 v25 = 8 * currPlayerId + 400;
8742 LOBYTE(v25) = (8 * currPlayerId - 112) | 4;
8743 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
8744 return;
8745 }
8746 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
8747 goto LABEL_170;
8731 } 8748 }
8732 8749
8733 8750
8734 8751
8735 //----- (0044AFFB) -------------------------------------------------------- 8752 //----- (0044AFFB) --------------------------------------------------------
8860 case VAR_Award: 8877 case VAR_Award:
8861 v13 = pPlayers[uPlayerIdx + 1]; 8878 v13 = pPlayers[uPlayerIdx + 1];
8862 v33 = 0x80u >> ((signed __int16)val - 1) % 8; 8879 v33 = 0x80u >> ((signed __int16)val - 1) % 8;
8863 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3]) 8880 if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3])
8864 //&& dword_723E80_award_related[2 * val] ) 8881 //&& dword_723E80_award_related[2 * val] )
8865 && pAwards[val-1].pText ) 8882 && pAwards[val].pText )
8866 { 8883 {
8867 v14 = pPlayers[uPlayerIdx + 1]; 8884 v14 = pPlayers[uPlayerIdx + 1];
8868 v34 = 1; 8885 v34 = 1;
8869 v3 = 1; 8886 v3 = 1;
8870 v14->PlaySound(SPEECH_96, 0); 8887 v14->PlaySound(SPEECH_96, 0);