comparison Party.cpp @ 1439:468f434a8d8a

Слияние
author Ritor1
date Mon, 22 Jul 2013 18:00:58 +0600
parents c0b273d33338
children 16a24dc103e7
comparison
equal deleted inserted replaced
1438:bc99e1a48bea 1439:468f434a8d8a
24 #include "Texture.h" 24 #include "Texture.h"
25 #include "LOD.h" 25 #include "LOD.h"
26 #include "Sprites.h" 26 #include "Sprites.h"
27 #include "SpriteObject.h" 27 #include "SpriteObject.h"
28 #include "ObjectList.h" 28 #include "ObjectList.h"
29 #include "Conditions.h"
29 30
30 Party *pParty; // idb 31 Party *pParty; // idb
31 32
32 struct ActionQueue *pPartyActionQueue = new ActionQueue; 33 struct ActionQueue *pPartyActionQueue = new ActionQueue;
33 34
249 250
250 v2 = pParty->pPlayers;//[0].pInventoryItems; 251 v2 = pParty->pPlayers;//[0].pInventoryItems;
251 while ( v2 <= &pParty->pPlayers[3] ) 252 while ( v2 <= &pParty->pPlayers[3] )
252 { 253 {
253 v3 = 0; 254 v3 = 0;
254 v4 = v2->pInventoryItems; 255 v4 = v2->pInventoryItemList;
255 do 256 do
256 { 257 {
257 if ( v4->uItemID == uItemID ) 258 if ( v4->uItemID == uItemID )
258 return 1; 259 return 1;
259 ++v3; 260 ++v3;
559 //v11 = uSkillIdx > 36; 560 //v11 = uSkillIdx > 36;
560 //v9 = v18 == 35; 561 //v9 = v18 == 35;
561 //v10 = uSkillIdx - 35 < 0; 562 //v10 = uSkillIdx - 35 < 0;
562 } 563 }
563 //while (uSkillIdx < 36); 564 //while (uSkillIdx < 36);
564 pItems = pCharacter->pInventoryItems; 565 pItems = pCharacter->pInventoryItemList;
565 //v13 = 138; 566 //v13 = 138;
566 for (int i = 0; i < 138; i++) 567 for (int i = 0; i < 138; i++)
567 { 568 {
568 if ( pItems->uItemID ) 569 if ( pItems->uItemID )
569 pItems->uAttributes |= 1; 570 pItems->uAttributes |= 1;
947 auto player = pPlayers + i; 948 auto player = pPlayers + i;
948 player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed; 949 player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed;
949 950
950 951
951 auto condition = player->GetMajorConditionIdx(); 952 auto condition = player->GetMajorConditionIdx();
952 if (condition == Player::Condition_Good || condition == Player::Condition_Zombie) 953 if (condition == Condition_Good || condition == Condition_Zombie)
953 { 954 {
954 if (player->uExpressionTimePassed < player->uExpressionTimeLength) 955 if (player->uExpressionTimePassed < player->uExpressionTimeLength)
955 continue; 956 continue;
956 957
957 player->uExpressionTimePassed = 0; 958 player->uExpressionTimePassed = 0;
997 player->uExpressionTimeLength = 0; 998 player->uExpressionTimeLength = 0;
998 player->uExpressionTimePassed = 0; 999 player->uExpressionTimePassed = 0;
999 1000
1000 switch (condition) 1001 switch (condition)
1001 { 1002 {
1002 case Player::Condition_Dead: player->expression = CHARACTER_EXPRESSION_DEAD; break; 1003 case Condition_Dead: player->expression = CHARACTER_EXPRESSION_DEAD; break;
1003 case Player::Condition_Pertified: player->expression = CHARACTER_EXPRESSION_PERTIFIED; break; 1004 case Condition_Pertified: player->expression = CHARACTER_EXPRESSION_PERTIFIED; break;
1004 case Player::Condition_Eradicated: player->expression = CHARACTER_EXPRESSION_ERADICATED; break; 1005 case Condition_Eradicated: player->expression = CHARACTER_EXPRESSION_ERADICATED; break;
1005 case Player::Condition_Cursed: player->expression = CHARACTER_EXPRESSION_CURSED; break; 1006 case Condition_Cursed: player->expression = CHARACTER_EXPRESSION_CURSED; break;
1006 case Player::Condition_Weak: player->expression = CHARACTER_EXPRESSION_WEAK; break; 1007 case Condition_Weak: player->expression = CHARACTER_EXPRESSION_WEAK; break;
1007 case Player::Condition_Sleep: player->expression = CHARACTER_EXPRESSION_SLEEP; break; 1008 case Condition_Sleep: player->expression = CHARACTER_EXPRESSION_SLEEP; break;
1008 case Player::Condition_Fear: player->expression = CHARACTER_EXPRESSION_FEAR; break; 1009 case Condition_Fear: player->expression = CHARACTER_EXPRESSION_FEAR; break;
1009 case Player::Condition_Drunk: player->expression = CHARACTER_EXPRESSION_DRUNK; break; 1010 case Condition_Drunk: player->expression = CHARACTER_EXPRESSION_DRUNK; break;
1010 case Player::Condition_Insane: player->expression = CHARACTER_EXPRESSION_INSANE; break; 1011 case Condition_Insane: player->expression = CHARACTER_EXPRESSION_INSANE; break;
1011 case Player::Condition_Poison1: 1012 case Condition_Poison1:
1012 case Player::Condition_Poison2: 1013 case Condition_Poison2:
1013 case Player::Condition_Poison3: player->expression = CHARACTER_EXPRESSION_POISONED; break; 1014 case Condition_Poison3: player->expression = CHARACTER_EXPRESSION_POISONED; break;
1014 case Player::Condition_Disease1: 1015 case Condition_Disease1:
1015 case Player::Condition_Disease2: 1016 case Condition_Disease2:
1016 case Player::Condition_Disease3: player->expression = CHARACTER_EXPRESSION_DISEASED; break; 1017 case Condition_Disease3: player->expression = CHARACTER_EXPRESSION_DISEASED; break;
1017 case Player::Condition_Paralyzed: player->expression = CHARACTER_EXPRESSION_PARALYZED; break; 1018 case Condition_Paralyzed: player->expression = CHARACTER_EXPRESSION_PARALYZED; break;
1018 case Player::Condition_Unconcious: player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break; 1019 case Condition_Unconcious: player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break;
1019 default: 1020 default:
1020 assert(false); 1021 assert(false);
1021 } 1022 }
1022 } 1023 }
1023 } 1024 }
1095 pPlayer->sHealth = pPlayer->GetMaxHealth(); 1096 pPlayer->sHealth = pPlayer->GetMaxHealth();
1096 pPlayer->sMana = pPlayer->GetMaxMana(); 1097 pPlayer->sMana = pPlayer->GetMaxMana();
1097 if ( pPlayer->classType == PLAYER_CLASS_LICH ) 1098 if ( pPlayer->classType == PLAYER_CLASS_LICH )
1098 { 1099 {
1099 have_vessels_soul = false; 1100 have_vessels_soul = false;
1100 v7 = pPlayer->pInventoryItems;//[0].field_1A; 1101 v7 = pPlayer->pInventoryItemList;//[0].field_1A;
1101 for ( uint i = 138; i; --i ) 1102 for ( uint i = 138; i; --i )
1102 { 1103 {
1103 if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer == pPlayerID + 1 ) 1104 if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer == pPlayerID + 1 )
1104 have_vessels_soul = true; 1105 have_vessels_soul = true;
1105 ++v7; 1106 ++v7;
1151 pPlayer->sMana = 0; 1152 pPlayer->sMana = 0;
1152 UpdatePlayersAndHirelingsEmotions(); 1153 UpdatePlayersAndHirelingsEmotions();
1153 } 1154 }
1154 pParty->days_played_without_rest = 0; 1155 pParty->days_played_without_rest = 0;
1155 } 1156 }
1157
1156 //----- (004938D1) -------------------------------------------------------- 1158 //----- (004938D1) --------------------------------------------------------
1157 void __fastcall Rest(unsigned int uHoursToSleep) 1159 void __fastcall Rest(unsigned int uHoursToSleep)
1158 { 1160 {
1159 unsigned int v1; // esi@1 1161 unsigned int v1; // esi@1
1160 double v2; // st7@3 1162 double v2; // st7@3
1212 pParty->UpdatePlayersAndHirelingsEmotions(); 1214 pParty->UpdatePlayersAndHirelingsEmotions();
1213 } 1215 }
1214 //----- (0041F5BE) -------------------------------------------------------- 1216 //----- (0041F5BE) --------------------------------------------------------
1215 void __cdecl Sleep6Hours() 1217 void __cdecl Sleep6Hours()
1216 { 1218 {
1217 if ( _506F18_num_hours_to_sleep < 6 ) 1219 if ( _506F18_num_minutes_to_sleep < 6 )
1218 { 1220 {
1219 pParty->pPlayers[3].SetAsleep(false); 1221 pParty->pPlayers[3].SetAsleep(false);
1220 pParty->pPlayers[2].SetAsleep(false); 1222 pParty->pPlayers[2].SetAsleep(false);
1221 pParty->pPlayers[1].SetAsleep(false); 1223 pParty->pPlayers[1].SetAsleep(false);
1222 pParty->pPlayers[0].SetAsleep(false); 1224 pParty->pPlayers[0].SetAsleep(false);
1223 if ( _506F18_num_hours_to_sleep ) 1225 if ( _506F18_num_minutes_to_sleep )
1224 { 1226 {
1225 Rest(_506F18_num_hours_to_sleep); 1227 Rest(_506F18_num_minutes_to_sleep);
1226 _506F18_num_hours_to_sleep = 0; 1228 _506F18_num_minutes_to_sleep = 0;
1227 LoadActualSkyFrame(); 1229 LoadActualSkyFrame();
1228 } 1230 }
1229 if ( dword_506F14 == 2 ) 1231 if ( dword_506F14 == 2 )
1230 { 1232 {
1231 pGUIWindow_CurrentMenu->Release(); 1233 pGUIWindow_CurrentMenu->Release();
1234 pTexture_RestUI_CurrentSkyFrame->Release(); 1236 pTexture_RestUI_CurrentSkyFrame->Release();
1235 if ( pTexture_RestUI_CurrentHourglassFrame ) 1237 if ( pTexture_RestUI_CurrentHourglassFrame )
1236 pTexture_RestUI_CurrentHourglassFrame->Release(); 1238 pTexture_RestUI_CurrentHourglassFrame->Release();
1237 pTexture_RestUI_CurrentHourglassFrame = 0; 1239 pTexture_RestUI_CurrentHourglassFrame = 0;
1238 pTexture_RestUI_CurrentSkyFrame = 0; 1240 pTexture_RestUI_CurrentSkyFrame = 0;
1239 pIcons_LOD->_4114F2(); 1241 pIcons_LOD->RemoveTexturesPackFromTextureList();
1240 pIcons_LOD->SyncLoadedFilesCount(); 1242 pIcons_LOD->SyncLoadedFilesCount();
1241 pCurrentScreen = SCREEN_GAME; 1243 pCurrentScreen = SCREEN_GAME;
1242 viewparams->bRedrawGameUI = 1; 1244 viewparams->bRedrawGameUI = 1;
1243 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 1245 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
1244 { 1246 {
1249 dword_506F14 = 0; 1251 dword_506F14 = 0;
1250 } 1252 }
1251 else 1253 else
1252 { 1254 {
1253 Rest(6u); 1255 Rest(6u);
1254 _506F18_num_hours_to_sleep -= 6; 1256 _506F18_num_minutes_to_sleep -= 6;
1255 LoadActualSkyFrame(); 1257 LoadActualSkyFrame();
1256 } 1258 }
1257 viewparams->bRedrawGameUI = 1; 1259 viewparams->bRedrawGameUI = 1;
1258 } 1260 }
1259 1261
1444 v1 = pIcons_LOD->GetTexture(v0); 1446 v1 = pIcons_LOD->GetTexture(v0);
1445 v11 = areWeLoadingTexture; 1447 v11 = areWeLoadingTexture;
1446 if ( uActiveCharacter 1448 if ( uActiveCharacter
1447 && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) 1449 && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 )
1448 { 1450 {
1449 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u); 1451 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u);
1450 pMouse->RemoveHoldingItem(); 1452 pMouse->RemoveHoldingItem();
1451 } 1453 }
1452 else 1454 else
1453 { 1455 {
1454 v12 = 0; 1456 v12 = 0;
1456 while ( v3 <= &pParty->pPlayers[3] ) 1458 while ( v3 <= &pParty->pPlayers[3] )
1457 { 1459 {
1458 v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID); 1460 v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID);
1459 if ( v4 ) 1461 if ( v4 )
1460 { 1462 {
1461 memcpy(&pParty->pPlayers[v12].pInventoryItems[v4], &pParty->pPickedItem, 0x24u); 1463 memcpy(&pParty->pPlayers[v12].pInventoryItemList[v4 - 1], &pParty->pPickedItem, 0x24u);
1462 pMouse->RemoveHoldingItem(); 1464 pMouse->RemoveHoldingItem();
1463 break; 1465 break;
1464 } 1466 }
1465 ++v12; 1467 ++v12;
1466 ++v3; 1468 ++v3;
1512 v1->Release(); 1514 v1->Release();
1513 pIcons_LOD->SyncLoadedFilesCount(); 1515 pIcons_LOD->SyncLoadedFilesCount();
1514 } 1516 }
1515 return 1; 1517 return 1;
1516 } 1518 }
1519
1520
1521 bool Party::IsPartyEvil()
1522 {
1523 return _449B57_test_bit(_quest_bits, 100);
1524 }
1525
1526 bool Party::IsPartyGood()
1527 {
1528 return _449B57_test_bit(_quest_bits, 99);
1529 }