Mercurial > mm7
comparison mm7_3.cpp @ 1435:94e4c3ef9b8e
Слияние
author | Ritor1 |
---|---|
date | Fri, 05 Jul 2013 21:16:12 +0600 |
parents | 8bfdc44cebfd |
children | 22cb507446a4 65379a50e4eb 883fea17dd9a |
comparison
equal
deleted
inserted
replaced
1434:03d6ea33a8c9 | 1435:94e4c3ef9b8e |
---|---|
2 #define _CRT_SECURE_NO_WARNINGS | 2 #define _CRT_SECURE_NO_WARNINGS |
3 #endif | 3 #endif |
4 | 4 |
5 #include <assert.h> | 5 #include <assert.h> |
6 | 6 |
7 | 7 #include "Weather.h" |
8 #include "Texture.h" | 8 #include "Texture.h" |
9 #include "mm7_data.h" | 9 #include "mm7_data.h" |
10 #include "Sprites.h" | 10 #include "Sprites.h" |
11 #include "BSPModel.h" | 11 #include "BSPModel.h" |
12 #include "OutdoorCamera.h" | 12 #include "OutdoorCamera.h" |
7450 } | 7450 } |
7451 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); | 7451 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); |
7452 } | 7452 } |
7453 | 7453 |
7454 //----- (004811A3) -------------------------------------------------------- | 7454 //----- (004811A3) -------------------------------------------------------- |
7455 void stru148::_4811A3() | 7455 void stru148::DrawBorderTiles() |
7456 { | 7456 { |
7457 __debugbreak(); | 7457 //__debugbreak(); |
7458 | 7458 |
7459 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 0)); | 7459 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); |
7460 pRenderer->DrawTerrainPolygon(uNumVertices, this, | 7460 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
7461 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_tile_id]], | 7461 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
7462 0, 0); | 7462 |
7463 | 7463 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); |
7464 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, 1)); | 7464 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); |
7465 pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], 1, 1); | |
7466 } | 7465 } |
7467 | 7466 |
7468 //----- (00481DB2) -------------------------------------------------------- | 7467 //----- (00481DB2) -------------------------------------------------------- |
7469 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, stru148 *a3) | 7468 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, stru148 *a3) |
7470 { | 7469 { |
12416 return -pCosTable[uIntegerPi - v2]; | 12415 return -pCosTable[uIntegerPi - v2]; |
12417 else | 12416 else |
12418 return pCosTable[v2]; | 12417 return pCosTable[v2]; |
12419 } | 12418 } |
12420 | 12419 |
12421 //----- (00404544) -------------------------------------------------------- | |
12422 signed int stru262_TurnBased::_404544() | |
12423 { | |
12424 stru262_TurnBased *v1; // ebx@1 | |
12425 TurnBased_QueueElem *v2; // esi@2 | |
12426 Actor *v3; // edi@4 | |
12427 Actor *v4; // ecx@4 | |
12428 Player *v5; // eax@7 | |
12429 int v6; // ecx@15 | |
12430 TurnBased_QueueElem *v7; // eax@16 | |
12431 TurnBased_QueueElem *v8; // ecx@18 | |
12432 int v9; // edx@19 | |
12433 int v10; // esi@19 | |
12434 int v11; // esi@21 | |
12435 int v12; // ST0C_4@25 | |
12436 int v13; // ST10_4@25 | |
12437 int v14; // ST14_4@25 | |
12438 int v15; // ST18_4@25 | |
12439 signed int result; // eax@28 | |
12440 TurnBased_QueueElem *v17; // edi@32 | |
12441 int v18; // [sp+20h] [bp-Ch]@17 | |
12442 int v19; // [sp+24h] [bp-8h]@1 | |
12443 int v20; // [sp+28h] [bp-4h]@1 | |
12444 signed int v21; // [sp+28h] [bp-4h]@16 | |
12445 int v22; // [sp+28h] [bp-4h]@31 | |
12446 | |
12447 v20 = 0; | |
12448 v1 = this; | |
12449 v19 = this->uActorQueueSize; | |
12450 if ( this->uActorQueueSize > 0 ) | |
12451 { | |
12452 v2 = this->pQueue; | |
12453 do | |
12454 { | |
12455 if ( PID_TYPE(v2->uPackedID) == OBJECT_Actor ) | |
12456 { | |
12457 v3 = &pActors[PID_ID(v2->uPackedID)]; | |
12458 v4 = &pActors[PID_ID(v2->uPackedID)]; | |
12459 LOBYTE(v4->uAttributes) |= 0x80u; | |
12460 if ( !v4->CanAct() ) | |
12461 { | |
12462 --v19; | |
12463 v2->field_4 = 1001; | |
12464 LOBYTE(v3->uAttributes) &= 0x7Fu; | |
12465 } | |
12466 } | |
12467 if ( PID_TYPE(v2->uPackedID) == OBJECT_Player) | |
12468 { | |
12469 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; | |
12470 if ( v5->pConditions[14] | |
12471 || v5->pConditions[16] | |
12472 || v5->pConditions[15] | |
12473 || v5->pConditions[13] | |
12474 || v5->pConditions[12] | |
12475 || v5->pConditions[2] ) | |
12476 { | |
12477 --v19; | |
12478 v2->field_4 = 1001; | |
12479 } | |
12480 } | |
12481 ++v20; | |
12482 ++v2; | |
12483 } | |
12484 while ( v20 < v1->uActorQueueSize ); | |
12485 } | |
12486 v6 = v1->uActorQueueSize; | |
12487 if ( v6 > 0 ) | |
12488 { | |
12489 v21 = 1; | |
12490 v7 = v1->pQueue; | |
12491 do | |
12492 { | |
12493 v18 = v21; | |
12494 if ( v21 < v6 ) | |
12495 { | |
12496 v8 = v7 + 1; | |
12497 do | |
12498 { | |
12499 v9 = v8->field_4; | |
12500 v10 = v7->field_4; | |
12501 if ( v9 < v10 | |
12502 || v9 == v10 | |
12503 && ((v11 = PID_TYPE(v8->uPackedID), v11 == OBJECT_Player) && PID_TYPE(v7->uPackedID) == OBJECT_Actor | |
12504 || v11 == PID_TYPE(v7->uPackedID) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) | |
12505 { | |
12506 v12 = v7->uPackedID; | |
12507 v13 = v7->field_4; | |
12508 v14 = v7->uActionLength; | |
12509 v15 = v7->field_C; | |
12510 v7->uPackedID = v8->uPackedID; | |
12511 v7->field_4 = v8->field_4; | |
12512 v7->uActionLength = v8->uActionLength; | |
12513 v7->field_C = v8->field_C; | |
12514 v8->uPackedID = v12; | |
12515 v8->field_4 = v13; | |
12516 v8->uActionLength = v14; | |
12517 v8->field_C = v15; | |
12518 } | |
12519 ++v18; | |
12520 ++v8; | |
12521 } | |
12522 while ( v18 < v1->uActorQueueSize ); | |
12523 } | |
12524 ++v21; | |
12525 v6 = v1->uActorQueueSize; | |
12526 ++v7; | |
12527 } | |
12528 while ( v21 - 1 < v6 ); | |
12529 } | |
12530 v1->uActorQueueSize = v19; | |
12531 result = v1->pQueue[0].uPackedID; | |
12532 if ( PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) | |
12533 { | |
12534 result = PID_ID(result) + 1; | |
12535 uActiveCharacter = result; | |
12536 v1->field_18 |= 4u; | |
12537 } | |
12538 else | |
12539 { | |
12540 uActiveCharacter = 0; | |
12541 v1->field_18 &= 0xFFFFFFFBu; | |
12542 } | |
12543 v22 = 0; | |
12544 if ( v1->uActorQueueSize > 0 ) | |
12545 { | |
12546 v17 = v1->pQueue; | |
12547 do | |
12548 { | |
12549 if ( PID_TYPE(v17->uPackedID) == OBJECT_Player) | |
12550 pParty->pPlayers[PID_ID(v17->uPackedID)].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875); | |
12551 ++v22; | |
12552 ++v17; | |
12553 result = v22; | |
12554 } | |
12555 while ( v22 < v1->uActorQueueSize ); | |
12556 } | |
12557 return result; | |
12558 } | |
12559 | |
12560 //----- (0040471C) -------------------------------------------------------- | |
12561 void stru262_TurnBased::_40471C() | |
12562 { | |
12563 if ( pParty->bTurnBasedModeOn == 1 ) | |
12564 { | |
12565 if ( pTurnEngine->field_4 == 2 ) | |
12566 _406457(0); | |
12567 } | |
12568 } | |
12569 | |
12570 //----- (004059DB) -------------------------------------------------------- | |
12571 signed int stru262_TurnBased::Start() | |
12572 { | |
12573 //stru262_TurnBased *v1; // ebx@1 | |
12574 unsigned int v2; // edi@1 | |
12575 int v3; // esi@1 | |
12576 int v4; // eax@5 | |
12577 unsigned int v5; // esi@7 | |
12578 Actor *pActor; // edi@7 | |
12579 unsigned int v7; // eax@9 | |
12580 unsigned int v8; // edx@10 | |
12581 unsigned __int8 v9; // zf@14 | |
12582 unsigned __int8 v10; // sf@14 | |
12583 unsigned __int8 v11; // of@14 | |
12584 char *v12; // esi@15 | |
12585 int v13; // ecx@16 | |
12586 unsigned __int16 v14; // ax@17 | |
12587 int v15; // ecx@18 | |
12588 signed __int64 v16; // qax@19 | |
12589 int v17; // edx@22 | |
12590 unsigned int v18; // esi@27 | |
12591 char *v19; // esi@32 | |
12592 int v20; // edx@33 | |
12593 char *v21; // eax@33 | |
12594 int v22; // ecx@33 | |
12595 int v23; // eax@34 | |
12596 char *v24; // eax@34 | |
12597 char *v25; // ecx@34 | |
12598 int v26; // edx@34 | |
12599 int v27; // eax@38 | |
12600 int v28; // ecx@38 | |
12601 AIDirection v30; // [sp+Ch] [bp-68h]@10 | |
12602 AIDirection v31; // [sp+28h] [bp-4Ch]@10 | |
12603 AIDirection a3; // [sp+44h] [bp-30h]@10 | |
12604 int v33; // [sp+60h] [bp-14h]@10 | |
12605 int *v34; // [sp+64h] [bp-10h]@6 | |
12606 int v35; // [sp+68h] [bp-Ch]@5 | |
12607 Player *pPlayer; // [sp+6Ch] [bp-8h]@1 | |
12608 int v40b; | |
12609 unsigned int v37; // [sp+70h] [bp-4h]@7 | |
12610 | |
12611 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
12612 //v1 = this; | |
12613 pEventTimer->TrackGameTime(); | |
12614 pAudioPlayer->StopChannels(-1, -1); | |
12615 v2 = 0; | |
12616 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); | |
12617 pPlayer = pParty->pPlayers; | |
12618 dword_50C998_turnbased_icon_1A = 8 * pIconsFrameTable->pIcons[uIconID_TurnStart].uAnimLength; | |
12619 dword_50C994 = 0; | |
12620 this->field_10 = 100; | |
12621 this->field_0 = 0; | |
12622 this->field_8 = 64; | |
12623 this->field_4 = 1; | |
12624 this->uActorQueueSize = 0; | |
12625 v3 = 0; | |
12626 do | |
12627 { | |
12628 if ( pPlayer->CanAct() ) | |
12629 { | |
12630 *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = PID(OBJECT_Player,v3); | |
12631 this->pQueue[this->uActorQueueSize].field_C = 2; | |
12632 this->pQueue[this->uActorQueueSize].uActionLength = 0; | |
12633 pParty->pTurnBasedPlayerRecoveryTimes[this->uActorQueueSize++] = 0; | |
12634 } | |
12635 ++pPlayer; | |
12636 ++v3; | |
12637 } | |
12638 while ( pPlayer <= &pParty->pPlayers[3] ); | |
12639 v35 = this->uActorQueueSize; | |
12640 v4 = v35; | |
12641 v40b = v35; | |
12642 if ( v40b < v40b + ai_arrays_size ) | |
12643 { | |
12644 v34 = (int *)ai_near_actors_ids.data(); | |
12645 do | |
12646 { | |
12647 v37 = *v34; | |
12648 v5 = v37; | |
12649 pActor = &pActors[v37]; | |
12650 if ( v37 != 10 ) | |
12651 { | |
12652 if ( pActors[v37].CanAct() ) | |
12653 { | |
12654 v7 = pActor->uAttributes; | |
12655 if ( v7 & 0x8000 ) | |
12656 { | |
12657 v8 = ai_near_actors_targets_pid[v5]; | |
12658 LOBYTE(v7) = v7 | 0x80; | |
12659 pActor->uAttributes = v7; | |
12660 v33 = PID(OBJECT_Actor,v5); | |
12661 memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31)); | |
12662 memcpy(&v30, &v31, sizeof(v30)); | |
12663 Actor::AI_StandOrBored(v37, 4, 32, &v30); | |
12664 *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = v33; | |
12665 this->pQueue[this->uActorQueueSize].field_C = 2; | |
12666 this->pQueue[this->uActorQueueSize++].uActionLength = 0; | |
12667 } | |
12668 } | |
12669 v4 = v35; | |
12670 } | |
12671 ++v40b; | |
12672 ++v34; | |
12673 } | |
12674 while ( v40b < v4 + ai_arrays_size ); | |
12675 v2 = 0; | |
12676 } | |
12677 v11 = __OFSUB__(this->uActorQueueSize, v2); | |
12678 v9 = this->uActorQueueSize == v2; | |
12679 v10 = ((this->uActorQueueSize - v2) & 0x80000000u) != 0; | |
12680 v37 = v2; | |
12681 v40b = v2; | |
12682 if ( !((unsigned __int8)(v10 ^ v11) | v9) ) | |
12683 { | |
12684 v12 = (char *)&this->pQueue[0].field_4; | |
12685 while ( 1 ) | |
12686 { | |
12687 v13 = PID_TYPE(*((int *)v12 - 1)); | |
12688 if ( v13 != OBJECT_Player ) | |
12689 break; | |
12690 v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery; | |
12691 if ( v14 != (short)v2 ) | |
12692 { | |
12693 v33 = v14; | |
12694 v16 = (signed __int64)((double)v14 * 0.46875); | |
12695 *(int *)v12 = v16; | |
12696 goto LABEL_26; | |
12697 } | |
12698 v15 = v37++; | |
12699 *(&a3.uDistance + v15) = v40b; | |
12700 LABEL_26: | |
12701 ++v40b; | |
12702 v12 += 16; | |
12703 if ( v40b >= this->uActorQueueSize ) | |
12704 goto LABEL_27; | |
12705 } | |
12706 if ( v13 != 3 ) | |
12707 { | |
12708 *(int *)v12 = 666; | |
12709 goto LABEL_26; | |
12710 } | |
12711 v17 = rand() % 99; | |
12712 if ( v17 < 33 ) | |
12713 { | |
12714 *(int *)v12 = 1; | |
12715 goto LABEL_26; | |
12716 } | |
12717 LODWORD(v16) = SHIDWORD(v16) < 66; | |
12718 LOBYTE(v16) = SHIDWORD(v16) >= 66; | |
12719 LODWORD(v16) = 2 * v16 + 3; | |
12720 *(int *)v12 = v16; | |
12721 goto LABEL_26; | |
12722 } | |
12723 LABEL_27: | |
12724 v18 = 0; | |
12725 if ( (signed int)v37 > (signed int)v2 ) | |
12726 { | |
12727 do | |
12728 { | |
12729 __debugbreak(); | |
12730 *(&v31.uDistance + v18) = pParty->pPlayers[*(&this->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime(v2); | |
12731 ++v18; | |
12732 } | |
12733 while ( (signed int)v18 < (signed int)v37 ); | |
12734 if ( (signed int)v37 > (signed int)v2 ) | |
12735 { | |
12736 v35 = v2; | |
12737 v34 = (int *)1; | |
12738 do | |
12739 { | |
12740 v40b = (int)v34; | |
12741 if ( (signed int)v34 < (signed int)v37 ) | |
12742 { | |
12743 v19 = (char *)&v31.uDistance + v35; | |
12744 do | |
12745 { | |
12746 v20 = *(int *)v19; | |
12747 v33 = 4 * v40b; | |
12748 v21 = (char *)(&v31.uDistance + v40b); | |
12749 v22 = *(int *)v21; | |
12750 if ( *(int *)v21 < v20 ) | |
12751 { | |
12752 *(int *)v21 = v20; | |
12753 v23 = v33; | |
12754 *(int *)v19 = v22; | |
12755 v24 = (char *)&a3.uDistance + v23; | |
12756 v25 = (char *)&a3.uDistance + v35; | |
12757 v26 = *(int *)v24; | |
12758 *(int *)v24 = *(unsigned int *)((char *)&a3.uDistance + v35); | |
12759 *(int *)v25 = v26; | |
12760 v2 = 0; | |
12761 } | |
12762 ++v40b; | |
12763 } | |
12764 while ( v40b < (signed int)v37 ); | |
12765 } | |
12766 v34 = (int *)((char *)v34 + 1); | |
12767 v35 += 4; | |
12768 } | |
12769 while ( (signed int)((char *)v34 - 1) < (signed int)v37 ); | |
12770 if ( (signed int)v37 > (signed int)v2 ) | |
12771 { | |
12772 do | |
12773 { | |
12774 v27 = v2 + 2; | |
12775 v28 = *(&a3.uDistance + v2++); | |
12776 v11 = __OFSUB__(v2, v37); | |
12777 v10 = ((v2 - v37) & 0x80000000u) != 0; | |
12778 this->pQueue[v28].field_4 = v27; | |
12779 } | |
12780 while ( v10 ^ v11 ); | |
12781 } | |
12782 } | |
12783 } | |
12784 return this->_404544(); | |
12785 } |