Mercurial > mm7
comparison Player.cpp @ 1251:7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
author | Grumpy7 |
---|---|
date | Tue, 11 Jun 2013 15:24:05 +0200 |
parents | 8192b25d356c |
children | eb1a22f7dfef |
comparison
equal
deleted
inserted
replaced
1250:c515e406df4a | 1251:7ef8ae7ce42a |
---|---|
7869 | 7869 |
7870 //----- (0044A5CB) -------------------------------------------------------- | 7870 //----- (0044A5CB) -------------------------------------------------------- |
7871 void Player::SetVariable(enum VariableType var_type, signed int var_value) | 7871 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
7872 { | 7872 { |
7873 signed int currPlayerId; // ebx@1 | 7873 signed int currPlayerId; // ebx@1 |
7874 Player *v4; // esi@1 | 7874 Player *unused4; // esi@1 |
7875 unsigned int v5; // edi@1 | 7875 unsigned int v5; // edi@1 |
7876 unsigned int v6; // esi@13 | 7876 unsigned int v6; // esi@13 |
7877 unsigned int v7; // esi@14 | 7877 unsigned int v7; // esi@14 |
7878 signed int v8; // eax@17 | 7878 signed int v8; // eax@17 |
7879 ItemGen *v9; // ecx@17 | 7879 ItemGen *v9; // ecx@17 |
7880 int v10; // eax@21 | 7880 int v10; // eax@21 |
7881 signed int v11; // eax@30 | 7881 signed int v11; // eax@30 |
7882 Player *v12; // ecx@44 | 7882 Player *unused12; // ecx@44 |
7883 char *v13; // ecx@45 | 7883 char *v13; // ecx@45 |
7884 Player *v14; // ecx@49 | 7884 Player *v14; // ecx@49 |
7885 int v15; // ecx@86 | 7885 int v15; // ecx@86 |
7886 int v16; // esi@106 | 7886 int v16; // esi@106 |
7887 char v17; // al@106 | 7887 char v17; // al@106 |
7892 int v22; // eax@145 | 7892 int v22; // eax@145 |
7893 char v23; // zf@146 | 7893 char v23; // zf@146 |
7894 DDM_DLV_Header *v24; // ecx@148 | 7894 DDM_DLV_Header *v24; // ecx@148 |
7895 signed int v25; // eax@172 | 7895 signed int v25; // eax@172 |
7896 int v26; // [sp-8h] [bp-3Ch]@84 | 7896 int v26; // [sp-8h] [bp-3Ch]@84 |
7897 signed int v27; // [sp-4h] [bp-38h]@4 | 7897 signed int unused27; // [sp-4h] [bp-38h]@4 |
7898 int v28; // [sp-4h] [bp-38h]@84 | 7898 int v28; // [sp-4h] [bp-38h]@84 |
7899 ItemGen item; // [sp+Ch] [bp-28h]@52 | 7899 ItemGen item; // [sp+Ch] [bp-28h]@52 |
7900 char v30; // [sp+32h] [bp-2h]@1 | 7900 char v30; // [sp+32h] [bp-2h]@1 |
7901 char v31; // [sp+33h] [bp-1h]@1 | 7901 char v31; // [sp+33h] [bp-1h]@1 |
7902 | 7902 |
7903 currPlayerId = 0; | |
7904 v30 = 0; | 7903 v30 = 0; |
7905 v31 = 0; | 7904 v31 = 0; |
7906 v4 = this; | |
7907 v5 = 0; | 7905 v5 = 0; |
7908 if ( this == pPlayers[2] ) | 7906 |
7909 currPlayerId = 1; | 7907 currPlayerId = -1; |
7910 else if ( this == pPlayers[3] ) | 7908 for (int i = 1; i <= 4; i++) //TODO: add a member variable for playerid in the future |
7911 currPlayerId = 2; | 7909 { |
7912 else if ( this == pPlayers[4] ) | 7910 if ( this == pPlayers[i] ) |
7913 currPlayerId = 3; | 7911 { |
7912 currPlayerId = i - 1; | |
7913 break; | |
7914 } | |
7915 } | |
7916 assert(currPlayerId != -1); | |
7914 if ( var_type > VAR_AutoNotes ) | 7917 if ( var_type > VAR_AutoNotes ) |
7915 { | 7918 { |
7916 if ( var_type <= VAR_GoldInBank ) | 7919 if ( var_type <= VAR_GoldInBank ) |
7917 { | 7920 { |
7918 if ( var_type == VAR_GoldInBank ) | 7921 if ( var_type == VAR_GoldInBank ) |
7980 v25 = 8 * currPlayerId + 400; | 7983 v25 = 8 * currPlayerId + 400; |
7981 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | 7984 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
7982 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); | 7985 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
7983 return; | 7986 return; |
7984 } | 7987 } |
7985 if ( var_type != 307 ) | 7988 if ( var_type != VAR_NumDeaths ) |
7986 { | 7989 { |
7987 switch ( var_type ) | 7990 switch ( var_type ) |
7988 { | 7991 { |
7989 case 308: | 7992 case VAR_NumBounties: |
7990 pParty->uNumBountiesCollected = var_value; | 7993 pParty->uNumBountiesCollected = var_value; |
7991 break; | 7994 break; |
7992 case 309: | 7995 case VAR_PrisonTerms: |
7993 pParty->uNumPrisonTerms = var_value; | 7996 pParty->uNumPrisonTerms = var_value; |
7994 break; | 7997 break; |
7995 case 310: | 7998 case VAR_ArenaWinsPage: |
7996 pParty->uNumArenaPageWins = var_value; | 7999 pParty->uNumArenaPageWins = var_value; |
7997 break; | 8000 break; |
7998 case 311: | 8001 case VAR_ArenaWinsSquire: |
7999 pParty->uNumArenaSquireWins = var_value; | 8002 pParty->uNumArenaSquireWins = var_value; |
8000 break; | 8003 break; |
8001 case 312: | 8004 case VAR_ArenaWinsKnight: |
8002 pParty->uNumArenaKnightWins = var_value; | 8005 pParty->uNumArenaKnightWins = var_value; |
8003 break; | 8006 break; |
8004 case 313: | 8007 case VAR_ArenaWinsLord: |
8005 pParty->uNumArenaLordWins = var_value; | 8008 pParty->uNumArenaLordWins = var_value; |
8006 break; | 8009 break; |
8007 } | 8010 } |
8008 return; | 8011 return; |
8009 } | 8012 } |
8010 pParty->uNumDeaths = var_value; | 8013 pParty->uNumDeaths = var_value; |
8011 LABEL_168: | 8014 LABEL_168: |
8012 if ( v30 != 1 ) | 8015 if (v30 == 1) |
8013 { | 8016 { |
8017 LABEL_169: | |
8018 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8019 } | |
8014 LABEL_170: | 8020 LABEL_170: |
8015 if ( v31 != 1 ) | 8021 if ( v31 != 1 ) |
8016 return; | 8022 return; |
8017 v5 = 0; | 8023 v5 = 0; |
8018 goto LABEL_172; | 8024 goto LABEL_172; |
8019 } | |
8020 LABEL_169: | |
8021 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
8022 goto LABEL_170; | |
8023 } | 8025 } |
8024 if ( var_type == VAR_AutoNotes ) | 8026 if ( var_type == VAR_AutoNotes ) |
8025 { | 8027 { |
8026 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) | 8028 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) |
8027 //&& (&dword_723718_autonote_related)[8 * a3] ) | 8029 //&& (&dword_723718_autonote_related)[8 * a3] ) |
8036 } | 8038 } |
8037 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); | 8039 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
8038 v31 = 1; | 8040 v31 = 1; |
8039 goto LABEL_168; | 8041 goto LABEL_168; |
8040 } | 8042 } |
8041 if ( var_type <= VAR_ActualMight ) | 8043 if ( var_type <= VAR_BaseLuck ) |
8042 { | 8044 { |
8043 if ( var_type != VAR_ActualMight ) | 8045 switch ( var_type ) |
8044 { | 8046 { |
8045 switch ( var_type ) | 8047 case VAR_Sex: |
8046 { | 8048 this->uSex = (PLAYER_SEX)var_value; |
8047 case VAR_RandomGold: | 8049 goto LABEL_124; |
8048 v6 = rand() % var_value + 1; | 8050 case VAR_Class: |
8049 Party::SetGold(v6); | 8051 this->classType = (PLAYER_CLASS_TYPE)var_value; |
8050 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | 8052 if ( (char)var_value == PLAYER_CLASS_LICH ) |
8051 ShowStatusBarString(pTmpBuf.data(), 2u); | 8053 { |
8052 GameUI_DrawFoodAndGold(); | |
8053 return; | |
8054 case VAR_RandomFood: | |
8055 v7 = rand() % var_value + 1; | |
8056 Party::SetFood(v7); | |
8057 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
8058 ShowStatusBarString(pTmpBuf.data(), 2u); | |
8059 GameUI_DrawFoodAndGold(); | |
8060 goto LABEL_124; | |
8061 case VAR_Sex: | |
8062 this->uSex = (PLAYER_SEX)var_value; | |
8063 goto LABEL_124; | |
8064 case VAR_Class: | |
8065 this->classType = (PLAYER_CLASS_TYPE)var_value; | |
8066 if ( (char)var_value != 35 ) | |
8067 goto LABEL_124; | |
8068 v8 = 0; | 8054 v8 = 0; |
8069 v9 = this->pInventoryItems; | 8055 v9 = this->pInventoryItems; |
8070 break; | 8056 while ( v9->uItemID != 615 ) |
8071 case VAR_CurrentHP: | 8057 { |
8072 this->sHealth = var_value; | 8058 ++v8; |
8073 goto LABEL_124; | 8059 ++v9; |
8074 case VAR_MaxHP: | 8060 if ( v8 >= 138 ) |
8075 this->sHealth = GetMaxHealth(); | 8061 goto LABEL_22; |
8062 } | |
8063 v10 = (int)((char *)this + 36 * v8); | |
8064 *(int *)(v10 + 532) = 601; | |
8065 *(char *)(v10 + 558) = currPlayerId + 1; | |
8066 LABEL_22: | |
8067 if ( this->sResFireBase < 20 ) | |
8068 this->sResFireBase = 20; | |
8069 if ( this->sResAirBase < 20 ) | |
8070 this->sResAirBase = 20; | |
8071 if ( this->sResWaterBase < 20 ) | |
8072 this->sResWaterBase = 20; | |
8073 if ( this->sResEarthBase < 20 ) | |
8074 this->sResEarthBase = 20; | |
8075 this->sResMindBase = 200; | |
8076 this->sResBodyBase = 200; | |
8077 v11 = this->GetSexByVoice(); | |
8078 this->uPrevVoiceID = this->uVoiceID; | |
8079 this->uPrevFace = this->uCurrentFace; | |
8080 if ( v11 ) | |
8081 { | |
8082 this->uCurrentFace = 21; | |
8083 this->uVoiceID = 21; | |
8084 } | |
8085 else | |
8086 { | |
8087 this->uCurrentFace = 20; | |
8088 this->uVoiceID = 20; | |
8089 } | |
8090 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); | |
8091 } | |
8092 goto LABEL_124; | |
8093 case VAR_CurrentHP: | |
8094 this->sHealth = var_value; | |
8095 goto LABEL_124; | |
8096 case VAR_MaxHP: | |
8097 this->sHealth = GetMaxHealth(); | |
8098 return; | |
8099 case VAR_CurrentSP: | |
8100 this->sMana = var_value; | |
8101 goto LABEL_124; | |
8102 case VAR_MaxSP: | |
8103 this->sMana = GetMaxMana(); | |
8104 return; | |
8105 case VAR_ACModifier: | |
8106 this->sACModifier = (unsigned __int8)var_value; | |
8107 goto LABEL_124; | |
8108 case VAR_BaseLevel: | |
8109 this->uLevel = (unsigned __int8)var_value; | |
8110 goto LABEL_124; | |
8111 case VAR_LevelModifier: | |
8112 this->sLevelModifier = (unsigned __int8)var_value; | |
8113 goto LABEL_124; | |
8114 case VAR_Age: | |
8115 this->sAgeModifier = var_value; | |
8116 return; | |
8117 case VAR_Award: | |
8118 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & | |
8119 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) | |
8120 //&& dword_723E80_award_related[2 * a3] ) | |
8121 && pAwards[var_value].pText ) | |
8122 { | |
8123 v30 = 1; | |
8124 v31 = 1; | |
8125 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); | |
8126 } | |
8127 _449B7E_toggle_bit((unsigned char *)this->_guilds_member_bits, var_value, 1u); | |
8128 goto LABEL_168; | |
8129 case VAR_Experience: | |
8130 this->uExperience = var_value; | |
8131 goto LABEL_124; | |
8132 case VAR_QBits_QuestsDone: | |
8133 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) | |
8134 // && (&dword_722F10)[4 * a3] ) | |
8135 && pQuestTable[var_value-1] ) | |
8136 { | |
8137 v14 = pPlayers[currPlayerId + 1]; | |
8138 bFlashQuestBook = 1; | |
8139 v30 = 1; | |
8140 v31 = 1; | |
8141 v14->PlaySound(SPEECH_93, 0); | |
8142 } | |
8143 v13 = (char *)pParty->_quest_bits; | |
8144 LABEL_51: | |
8145 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); | |
8146 if (( v30 != 1 )&&( v31 != 1 )) | |
8076 return; | 8147 return; |
8077 case VAR_CurrentSP: | 8148 else |
8078 this->sMana = var_value; | 8149 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
8079 goto LABEL_124; | 8150 if ( v31 != 1 ) |
8080 case VAR_MaxSP: | |
8081 this->sMana = GetMaxMana(); | |
8082 return; | 8151 return; |
8083 case VAR_ACModifier: | 8152 v25 = 8 * currPlayerId + 400; |
8084 this->sACModifier = (unsigned __int8)var_value; | 8153 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
8085 goto LABEL_124; | 8154 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
8086 case VAR_BaseLevel: | 8155 return; |
8087 this->uLevel = (unsigned __int8)var_value; | 8156 case VAR_PlayerItemInHands: |
8088 goto LABEL_124; | 8157 item.Reset(); |
8089 case VAR_LevelModifier: | 8158 item.Reset(); |
8090 this->sLevelModifier = (unsigned __int8)var_value; | 8159 item.uItemID = var_value; |
8091 goto LABEL_124; | 8160 item.uAttributes = 1; |
8092 case VAR_Age: | 8161 pParty->SetHoldingItem(&item); |
8093 this->sAgeModifier = var_value; | 8162 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
8094 return; | 8163 pParty->pIsArtifactFound[var_value-500] = 1; |
8095 case VAR_Award: | 8164 return; |
8096 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & | 8165 case VAR_FixedGold: |
8097 pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) | 8166 Party::SetGold(var_value); |
8098 //&& dword_723E80_award_related[2 * a3] ) | 8167 return; |
8099 && pAwards[var_value].pText ) | 8168 case VAR_RandomGold: |
8100 { | 8169 v6 = rand() % var_value + 1; |
8101 v30 = 1; | 8170 Party::SetGold(v6); |
8102 v31 = 1; | 8171 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold |
8103 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); | 8172 ShowStatusBarString(pTmpBuf.data(), 2u); |
8104 } | 8173 GameUI_DrawFoodAndGold(); |
8105 _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); | 8174 return; |
8106 goto LABEL_168; | 8175 case VAR_FixedFood: |
8107 case VAR_Experience: | 8176 Party::SetFood(var_value); |
8108 this->uExperience = var_value; | 8177 goto LABEL_124; |
8109 goto LABEL_124; | 8178 case VAR_RandomFood: |
8110 case VAR_QBits_QuestsDone: | 8179 v7 = rand() % var_value + 1; |
8111 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) | 8180 Party::SetFood(v7); |
8112 // && (&dword_722F10)[4 * a3] ) | 8181 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food |
8113 && pQuestTable[var_value-1] ) | 8182 ShowStatusBarString(pTmpBuf.data(), 2u); |
8114 { | 8183 GameUI_DrawFoodAndGold(); |
8115 v14 = pPlayers[currPlayerId + 1]; | 8184 goto LABEL_124; |
8116 bFlashQuestBook = 1; | 8185 case VAR_MightBonus: |
8117 v30 = 1; | 8186 goto LABEL_64; |
8118 v31 = 1; | 8187 case VAR_IntellectBonus: |
8119 v14->PlaySound(SPEECH_93, 0); | 8188 goto LABEL_68; |
8120 } | 8189 case VAR_PersonalityBonus: |
8121 v13 = (char *)pParty->_quest_bits; | 8190 goto LABEL_69; |
8122 LABEL_51: | 8191 case VAR_EnduranceBonus: |
8123 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); | 8192 goto LABEL_70; |
8124 if (( v30 != 1 )&&( v31 != 1 )) | 8193 case VAR_SpeedBonus: |
8125 return; | 8194 goto LABEL_71; |
8126 else | 8195 case VAR_AccuracyBonus: |
8127 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 8196 goto LABEL_72; |
8128 if ( v31 != 1 ) | 8197 case VAR_LuckBonus: |
8129 return; | 8198 goto LABEL_73; |
8130 v25 = 8 * currPlayerId + 400; | 8199 case VAR_BaseMight: |
8131 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | 8200 this->uMight = (unsigned __int8)var_value; |
8132 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | 8201 goto LABEL_84; |
8133 return; | 8202 case VAR_BaseIntellect: |
8134 case VAR_PlayerItemInHands: | 8203 this->uIntelligence = (unsigned __int8)var_value; |
8135 item.Reset(); | 8204 goto LABEL_84; |
8136 item.Reset(); | 8205 case VAR_BasePersonality: |
8137 item.uItemID = var_value; | 8206 this->uWillpower = (unsigned __int8)var_value; |
8138 item.uAttributes = 1; | 8207 goto LABEL_84; |
8139 pParty->SetHoldingItem(&item); | 8208 case VAR_BaseEndurance: |
8140 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) | 8209 this->uEndurance = (unsigned __int8)var_value; |
8141 pParty->pIsArtifactFound[var_value-500] = 1; | 8210 goto LABEL_84; |
8142 return; | 8211 case VAR_BaseSpeed: |
8143 case VAR_FixedGold: | 8212 this->uSpeed = (unsigned __int8)var_value; |
8144 Party::SetGold(var_value); | 8213 goto LABEL_84; |
8145 return; | 8214 case VAR_BaseAccuracy: |
8146 case VAR_BaseMight: | 8215 this->uAccuracy = (unsigned __int8)var_value; |
8147 this->uMight = (unsigned __int8)var_value; | 8216 goto LABEL_84; |
8148 goto LABEL_84; | 8217 case VAR_BaseLuck: |
8149 case VAR_BaseIntellect: | 8218 this->uLuck = (unsigned __int8)var_value; |
8150 this->uIntelligence = (unsigned __int8)var_value; | 8219 goto LABEL_84; |
8151 goto LABEL_84; | 8220 default: |
8152 case VAR_BasePersonality: | 8221 return; |
8153 this->uWillpower = (unsigned __int8)var_value; | 8222 } |
8154 goto LABEL_84; | |
8155 case VAR_BaseEndurance: | |
8156 this->uEndurance = (unsigned __int8)var_value; | |
8157 goto LABEL_84; | |
8158 case VAR_BaseSpeed: | |
8159 this->uSpeed = (unsigned __int8)var_value; | |
8160 goto LABEL_84; | |
8161 case VAR_BaseAccuracy: | |
8162 this->uAccuracy = (unsigned __int8)var_value; | |
8163 goto LABEL_84; | |
8164 case VAR_BaseLuck: | |
8165 this->uLuck = (unsigned __int8)var_value; | |
8166 goto LABEL_84; | |
8167 case VAR_FixedFood: | |
8168 Party::SetFood(var_value); | |
8169 goto LABEL_124; | |
8170 case VAR_MightBonus: | |
8171 goto LABEL_64; | |
8172 case VAR_IntellectBonus: | |
8173 goto LABEL_68; | |
8174 case VAR_PersonalityBonus: | |
8175 goto LABEL_69; | |
8176 case VAR_EnduranceBonus: | |
8177 goto LABEL_70; | |
8178 case VAR_SpeedBonus: | |
8179 goto LABEL_71; | |
8180 case VAR_AccuracyBonus: | |
8181 goto LABEL_72; | |
8182 case VAR_LuckBonus: | |
8183 goto LABEL_73; | |
8184 default: | |
8185 return; | |
8186 } | |
8187 while ( v9->uItemID != 615 ) | |
8188 { | |
8189 ++v8; | |
8190 ++v9; | |
8191 if ( v8 >= 138 ) | |
8192 goto LABEL_22; | |
8193 } | |
8194 v10 = (int)((char *)v4 + 36 * v8); | |
8195 *(int *)(v10 + 532) = 601; | |
8196 *(char *)(v10 + 558) = currPlayerId + 1; | |
8197 LABEL_22: | |
8198 if ( v4->sResFireBase < 20 ) | |
8199 v4->sResFireBase = 20; | |
8200 if ( v4->sResAirBase < 20 ) | |
8201 v4->sResAirBase = 20; | |
8202 if ( v4->sResWaterBase < 20 ) | |
8203 v4->sResWaterBase = 20; | |
8204 if ( v4->sResEarthBase < 20 ) | |
8205 v4->sResEarthBase = 20; | |
8206 v4->sResMindBase = 200; | |
8207 v4->sResBodyBase = 200; | |
8208 v11 = v4->GetSexByVoice(); | |
8209 v4->uPrevVoiceID = v4->uVoiceID; | |
8210 v4->uPrevFace = v4->uCurrentFace; | |
8211 if ( v11 ) | |
8212 { | |
8213 v4->uCurrentFace = 21; | |
8214 v4->uVoiceID = 21; | |
8215 } | |
8216 else | |
8217 { | |
8218 v4->uCurrentFace = 20; | |
8219 v4->uVoiceID = 20; | |
8220 } | |
8221 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); | |
8222 goto LABEL_124; | |
8223 } | |
8224 LABEL_64: | |
8225 this->uMightBonus = (unsigned __int8)var_value; | |
8226 LABEL_111: | 8223 LABEL_111: |
8227 v28 = 0; | 8224 v28 = 0; |
8228 v26 = SPEECH_91; | 8225 v26 = SPEECH_91; |
8229 LABEL_112: | 8226 LABEL_112: |
8230 v19 = pPlayers[currPlayerId + 1]; | 8227 v19 = pPlayers[currPlayerId + 1]; |
8231 v31 = 1; | 8228 v31 = 1; |
8232 v19->PlaySound((PlayerSpeech)v26, v28); | 8229 v19->PlaySound((PlayerSpeech)v26, v28); |
8233 goto LABEL_169; | 8230 goto LABEL_169; |
8234 } | 8231 } |
8235 if ( var_type <= VAR_FireResistanceBonus ) | 8232 if ( var_type <= VAR_MagicResistance ) |
8236 { | 8233 { |
8237 if ( var_type == VAR_FireResistanceBonus ) | |
8238 { | |
8239 this->sResFireBonus = (unsigned __int8)var_value; | |
8240 goto LABEL_111; | |
8241 } | |
8242 switch ( var_type ) | 8234 switch ( var_type ) |
8243 { | 8235 { |
8236 case VAR_ActualMight: | |
8237 LABEL_64: | |
8238 this->uMightBonus = (unsigned __int8)var_value; | |
8239 goto LABEL_111; | |
8244 case VAR_ActualIntellect: | 8240 case VAR_ActualIntellect: |
8245 LABEL_68: | 8241 LABEL_68: |
8246 this->uIntelligenceBonus = (unsigned __int8)var_value; | 8242 this->uIntelligenceBonus = (unsigned __int8)var_value; |
8247 goto LABEL_111; | 8243 goto LABEL_111; |
8248 case VAR_ActualPersonality: | 8244 case VAR_ActualPersonality: |
8310 { | 8306 { |
8311 if ( var_type <= VAR_LearningSkill ) | 8307 if ( var_type <= VAR_LearningSkill ) |
8312 return; | 8308 return; |
8313 if ( var_type <= VAR_Eradicated ) | 8309 if ( var_type <= VAR_Eradicated ) |
8314 { | 8310 { |
8315 v4->SetCondition(var_type - 105, 1); | 8311 this->SetCondition(var_type - 105, 1); |
8316 } | 8312 } |
8317 else | 8313 else |
8318 { | 8314 { |
8319 if ( var_type != VAR_MajorCondition ) | 8315 if ( var_type != VAR_MajorCondition ) |
8320 { | 8316 { |
8321 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) | 8317 if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) |
8322 byte_5E4C15[var_type] = var_value; | 8318 byte_5E4C15[var_type] = var_value; |
8323 return; | 8319 return; |
8324 } | 8320 } |
8325 memset(v4, 0, 0xA0u); | 8321 memset(this, 0, 0xA0u); |
8326 } | 8322 } |
8327 LABEL_124: | 8323 LABEL_124: |
8328 v31 = 1; | 8324 v31 = 1; |
8329 goto LABEL_169; | 8325 goto LABEL_169; |
8330 } | 8326 } |
8331 LABEL_106: | 8327 LABEL_106: |
8332 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); | 8328 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); |
8333 v17 = *(char *)v16; | 8329 v17 = *(char *)v16; |
8334 if ( var_value <= VAR_BodyResistanceBonus ) | 8330 if ( var_value <= VAR_BodyResistanceBonus ) |
8335 { | 8331 { |
8336 LOWORD(v15) = (unsigned __int8)var_value; | 8332 LOWORD(v15) = (unsigned __int8)var_value; |
8337 v18 = v15 | v17 & VAR_BodyResistanceBonus; | 8333 v18 = v15 | v17 & VAR_BodyResistanceBonus; |
8351 v5 = 0; | 8347 v5 = 0; |
8352 goto LABEL_172; | 8348 goto LABEL_172; |
8353 } | 8349 } |
8354 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | 8350 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
8355 goto LABEL_170; | 8351 goto LABEL_170; |
8356 if ( var_type <= VAR_BodyResistanceBonus ) | 8352 if ( var_type <= VAR_MagicResistanceBonus ) |
8357 { | 8353 { |
8358 switch ( var_type ) | 8354 switch ( var_type ) |
8359 { | 8355 { |
8360 case VAR_BodyResistanceBonus: | 8356 case VAR_FireResistanceBonus: |
8361 v4->sResBodyBonus = (unsigned __int8)var_value; | 8357 this->sResFireBonus = (unsigned __int8)var_value; |
8362 break; | 8358 break; |
8363 case VAR_AirResistanceBonus: | 8359 case VAR_AirResistanceBonus: |
8364 v4->sResAirBonus = (unsigned __int8)var_value; | 8360 this->sResAirBonus = (unsigned __int8)var_value; |
8365 break; | 8361 break; |
8366 case VAR_WaterResistanceBonus: | 8362 case VAR_WaterResistanceBonus: |
8367 v4->sResWaterBonus = (unsigned __int8)var_value; | 8363 this->sResWaterBonus = (unsigned __int8)var_value; |
8368 break; | 8364 break; |
8369 case VAR_EarthResistanceBonus: | 8365 case VAR_EarthResistanceBonus: |
8370 v4->sResEarthBonus = (unsigned __int8)var_value; | 8366 this->sResEarthBonus = (unsigned __int8)var_value; |
8371 break; | 8367 break; |
8372 case VAR_SpiritResistanceBonus: | 8368 case VAR_SpiritResistanceBonus: |
8373 v4->sResSpiritBonus = (unsigned __int8)var_value; | 8369 this->sResSpiritBonus = (unsigned __int8)var_value; |
8370 break; | |
8371 case VAR_MindResistanceBonus: | |
8372 this->sResMindBonus = (unsigned __int8)var_value; | |
8373 break; | |
8374 case VAR_BodyResistanceBonus: | |
8375 this->sResBodyBonus = (unsigned __int8)var_value; | |
8376 break; | |
8377 case VAR_LightResistanceBonus: | |
8378 this->sResLightBonus = (unsigned __int8)var_value; | |
8379 break; | |
8380 case VAR_DarkResistanceBonus: | |
8381 this->sResDarkBonus = (unsigned __int8)var_value; | |
8382 break; | |
8383 case VAR_PhysicalResistanceBonus: | |
8384 assert("VAR_PhysicalResistanceBonus variable unsupported" && false); | |
8385 return; | |
8386 break; | |
8387 case VAR_MagicResistanceBonus: | |
8388 this->sResMagicBonus = (unsigned __int8)var_value; | |
8374 break; | 8389 break; |
8375 default: | 8390 default: |
8376 if ( var_type != 62 ) | 8391 assert("Unexpected var_type" && false); |
8377 return; | 8392 return; |
8378 v4->sResMindBonus = (unsigned __int8)var_value; | |
8379 break; | 8393 break; |
8380 } | 8394 } |
8381 goto LABEL_111; | |
8382 } | |
8383 if ( var_type == VAR_LightResistanceBonus ) | |
8384 { | |
8385 v4->sResLightBonus = (unsigned __int8)var_value; | |
8386 goto LABEL_111; | |
8387 } | |
8388 if ( var_type == VAR_DarkResistanceBonus ) | |
8389 { | |
8390 v4->sResDarkBonus = (unsigned __int8)var_value; | |
8391 goto LABEL_111; | |
8392 } | |
8393 if ( var_type == VAR_MagicResistanceBonus ) | |
8394 { | |
8395 v4->sResMagicBonus = (unsigned __int8)var_value; | |
8396 goto LABEL_111; | 8395 goto LABEL_111; |
8397 } | 8396 } |
8398 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) | 8397 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) |
8399 if ( v30 != 1 ) | 8398 if ( v30 != 1 ) |
8400 { | 8399 { |