comparison mm7_4.cpp @ 766:a464d28566a6

days_played_without_rest
author Nomad
date Sat, 23 Mar 2013 20:22:51 +0200
parents a84db04439a4
children 45615cacad31
comparison
equal deleted inserted replaced
763:a84db04439a4 766:a464d28566a6
2419 unsigned int v4; // edi@1 2419 unsigned int v4; // edi@1
2420 //signed int v5; // eax@4 2420 //signed int v5; // eax@4
2421 //char *v6; // ecx@5 2421 //char *v6; // ecx@5
2422 //Player *v7; // esi@8 2422 //Player *v7; // esi@8
2423 //char *v8; // ecx@12 2423 //char *v8; // ecx@12
2424 Player *pPlayer; // esi@15 2424 //Player *pPlayer; // esi@15
2425 //void *v10; // esi@25 2425 //void *v10; // esi@25
2426 unsigned int v11; // ecx@27 2426 unsigned int v11; // ecx@27
2427 signed int v12; // edi@29 2427 signed int v12; // edi@29
2428 Player *v13; // ecx@30 2428 Player *v13; // ecx@30
2429 Player *v14; // esi@35 2429 Player *v14; // esi@35
2465 //char *v50; // esi@122 2465 //char *v50; // esi@122
2466 signed int v51; // edx@128 2466 signed int v51; // edx@128
2467 signed int v52; // ecx@130 2467 signed int v52; // ecx@130
2468 int v53; // eax@131 2468 int v53; // eax@131
2469 Player *v54; // eax@141 2469 Player *v54; // eax@141
2470 unsigned int v55; // [sp-8h] [bp-38h]@18 2470 //unsigned int v55; // [sp-8h] [bp-38h]@18
2471 unsigned int v56; // [sp-8h] [bp-38h]@55 2471 unsigned int v56; // [sp-8h] [bp-38h]@55
2472 int v57; // [sp-4h] [bp-34h]@18 2472 //int v57; // [sp-4h] [bp-34h]@18
2473 int v58; // [sp-4h] [bp-34h]@33 2473 int v58; // [sp-4h] [bp-34h]@33
2474 int v59; // [sp-4h] [bp-34h]@55 2474 int v59; // [sp-4h] [bp-34h]@55
2475 unsigned int v60; // [sp+10h] [bp-20h]@1 2475 unsigned int v60; // [sp+10h] [bp-20h]@1
2476 unsigned int v61; // [sp+14h] [bp-1Ch]@1 2476 unsigned int v61; // [sp+14h] [bp-1Ch]@1
2477 Player **v62; // [sp+14h] [bp-1Ch]@50 2477 Player **v62; // [sp+14h] [bp-1Ch]@50
2478 unsigned int a2; // [sp+18h] [bp-18h]@1 2478 //unsigned int a2; // [sp+18h] [bp-18h]@1
2479 signed int a2a; // [sp+18h] [bp-18h]@47 2479 signed int a2a; // [sp+18h] [bp-18h]@47
2480 signed int v65; // [sp+1Ch] [bp-14h]@47 2480 signed int v65; // [sp+1Ch] [bp-14h]@47
2481 2481
2482 a2 = pParty->uCurrentHour; 2482 //a2 = pParty->uCurrentHour;
2483 v61 = pParty->uDaysPlayed; 2483 v61 = pParty->uDaysPlayed;
2484 v60 = pEventTimer->uTimeElapsed; 2484 v60 = pEventTimer->uTimeElapsed;
2485 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; 2485 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
2486 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; 2486 v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60;
2487 v1 = v0; 2487 v1 = v0;
2488 v0 /= 60i64; 2488 v0 /= 60i64;
2489 v2 = v0; 2489 v2 = v0;
2490 v3 = (unsigned int)v0 / 24; 2490 v3 = (unsigned int)v0 / 24;
2491 v4 = (unsigned int)(v3 / 7) >> 2; 2491 v4 = (unsigned int)(v3 / 7) >> 2;
2494 pParty->uCurrentMonthWeek = v3 / 7 & 3; 2494 pParty->uCurrentMonthWeek = v3 / 7 & 3;
2495 pParty->uCurrentHour = v2 % 24; 2495 pParty->uCurrentHour = v2 % 24;
2496 pParty->uDaysPlayed = (unsigned int)v3 % 28; 2496 pParty->uDaysPlayed = (unsigned int)v3 % 28;
2497 pParty->uCurrentMonth = v4 % 12; 2497 pParty->uCurrentMonth = v4 % 12;
2498 pParty->uCurrentYear = v4 / 0xC + game_starting_year; 2498 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
2499 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) 2499 if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns
2500 { 2500 {
2501 pParty->pHirelings[0].bHasUsedTheAbility = false; 2501 pParty->pHirelings[0].bHasUsedTheAbility = false;
2502 pParty->pHirelings[1].bHasUsedTheAbility = false; 2502 pParty->pHirelings[1].bHasUsedTheAbility = false;
2503 2503
2504 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) 2504 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
2505 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; 2505 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
2506 2506
2507 ++pParty->field_764; 2507 ++pParty->days_played_without_rest;
2508 if ( pParty->field_764 > 1u ) 2508 if (pParty->days_played_without_rest > 1)
2509 { 2509 {
2510 for (uint i = 0; i < 4; ++i) 2510 for (uint i = 0; i < 4; ++i)
2511 pParty->pPlayers[i].SetCondition(1, 0); 2511 pParty->pPlayers[i].SetCondition(Player::Condition_Weak, 0);
2512 2512
2513 if ( pParty->uNumFoodRations ) 2513 if (pParty->uNumFoodRations)
2514 { 2514 Party::TakeFood(1);
2515 Party::TakeFood(1u);
2516 }
2517 else 2515 else
2518 {
2519 for (uint i = 0; i < 4; ++i) 2516 for (uint i = 0; i < 4; ++i)
2520 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; 2517 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1;
2521 } 2518
2522 if ( pParty->field_764 > 3u ) 2519 if (pParty->days_played_without_rest > 3)
2523 { 2520 for (uint i = 0; i < 4; ++i)
2524 pPlayer = pParty->pPlayers;
2525 do
2526 { 2521 {
2527 pPlayer->Zero(); 2522 auto player = pParty->pPlayers + i;
2528 if ( !(pPlayer->pConditions[15] | pPlayer->pConditions[16] | pPlayer->pConditions[14]) ) 2523
2524 player->Zero();
2525
2526 if (!player->Pertified() && !player->Eradicated() && !player->Dead())
2529 { 2527 {
2530 if ( rand() % 100 < 5 * (unsigned __int8)pParty->field_764 ) 2528 if (rand() % 100 < 5 * pParty->days_played_without_rest )
2531 { 2529 player->SetCondition(Player::Condition_Dead, 0);
2532 v57 = 0; 2530 if (rand() % 100 < 10 * pParty->days_played_without_rest )
2533 v55 = 14; 2531 player->SetCondition(Player::Condition_Insane, 0);
2534 LABEL_21:
2535 pPlayer->SetCondition(v55, v57);
2536 goto LABEL_22;
2537 }
2538 if ( rand() % 100 < 10 * (unsigned __int8)pParty->field_764 )
2539 {
2540 v57 = 0;
2541 v55 = 5;
2542 goto LABEL_21;
2543 }
2544 } 2532 }
2545 LABEL_22:
2546 ++pPlayer;
2547 } 2533 }
2548 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); 2534 }
2549 } 2535 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
2550 }
2551 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
2552 pOutdoor->SetFog(); 2536 pOutdoor->SetFog();
2553 2537
2554 for (uint i = 0; i < 4; ++i) 2538 for (uint i = 0; i < 4; ++i)
2555 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; 2539 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
2556 } 2540 }
2541
2557 v11 = LODWORD(pParty->uTimePlayed); 2542 v11 = LODWORD(pParty->uTimePlayed);
2558 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) 2543 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )
2559 { 2544 {
2560 v12 = 1; 2545 v12 = 1;
2561 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; 2546 pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128;