Mercurial > mm7
comparison SpriteObject.cpp @ 838:d061180f2b42
Merge
author | Gloval |
---|---|
date | Thu, 28 Mar 2013 00:37:58 +0400 |
parents | bebc19f3d2af 0f56abdcce94 |
children | c45d51b3f4f4 |
comparison
equal
deleted
inserted
replaced
837:bebc19f3d2af | 838:d061180f2b42 |
---|---|
12 #include "Time.h" | 12 #include "Time.h" |
13 #include "Game.h" | 13 #include "Game.h" |
14 #include "LOD.h" | 14 #include "LOD.h" |
15 #include "Actor.h" | 15 #include "Actor.h" |
16 #include "Events.h" | 16 #include "Events.h" |
17 | |
17 #include "mm7_data.h" | 18 #include "mm7_data.h" |
19 #include "MM7.h" | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
18 | 27 |
19 size_t uNumSpriteObjects; | 28 size_t uNumSpriteObjects; |
20 SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS]; | 29 SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS]; |
21 | 30 |
22 //----- (00404828) -------------------------------------------------------- | 31 //----- (00404828) -------------------------------------------------------- |
32 uObjectDescID = 0; | 41 uObjectDescID = 0; |
33 field_61 = 0; | 42 field_61 = 0; |
34 field_60_distance_related_prolly_lod = 0; | 43 field_60_distance_related_prolly_lod = 0; |
35 field_20 = 0; | 44 field_20 = 0; |
36 uSpriteFrameID = 0; | 45 uSpriteFrameID = 0; |
37 field_50 = 0; | 46 spell_skill = 0; |
38 field_4C = 0; | 47 spell_level = 0; |
39 field_48 = 0; | 48 spell_id = 0; |
40 field_54 = 0; | 49 field_54 = 0; |
41 } | 50 } |
42 | 51 |
43 //----- (0042F5ED) -------------------------------------------------------- | 52 //----- (0042F5ED) -------------------------------------------------------- |
44 int SpriteObject::Create(int yaw, int pitch, int a4, int a5) | 53 int SpriteObject::Create(int yaw, int pitch, int a4, int a5) |
406 v16 = WorldPosToGridCellZ(v1->vPosition.y); | 415 v16 = WorldPosToGridCellZ(v1->vPosition.y); |
407 v17 = v1->vPosition.x; | 416 v17 = v1->vPosition.x; |
408 v58 = v16; | 417 v58 = v16; |
409 v18 = WorldPosToGridCellX(v17); | 418 v18 = WorldPosToGridCellX(v17); |
410 _46E26D_collide_against_sprites(v18, v58); | 419 _46E26D_collide_against_sprites(v18, v58); |
411 if ( (v1->field_58_pid & 7) != OBJECT_Player) | 420 if (PID_TYPE(v1->spell_caster_pid) != OBJECT_Player) |
412 _46EF01_collision_chech_player(0); | 421 _46EF01_collision_chech_player(0); |
413 if ( (v1->field_58_pid & 7) == OBJECT_Actor) | 422 if (PID_TYPE(v1->spell_caster_pid) == OBJECT_Actor) |
414 { | 423 { |
415 v19 = v1->field_58_pid >> 3; | 424 v19 = PID_ID(v1->spell_caster_pid); |
416 if ( v19 >= 0 ) | 425 if ( v19 >= 0 ) |
417 { | 426 { |
418 if ( v19 < (signed int)(uNumActors - 1) ) | 427 if ( v19 < (signed int)(uNumActors - 1) ) |
419 { | 428 { |
420 v56 = 0; | 429 v56 = 0; |
512 if ( v29 < v54 ) | 521 if ( v29 < v54 ) |
513 v1->vPosition.z = v54 + 1; | 522 v1->vPosition.z = v54 + 1; |
514 if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) | 523 if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) |
515 return; | 524 return; |
516 } | 525 } |
517 v30 = (signed int)stru_721530.uFaceID >> 3; | 526 v30 = (signed int)PID_ID(stru_721530.uFaceID); |
518 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) | 527 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
519 break; | 528 break; |
520 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel) | 529 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
521 { | 530 { |
522 v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | 531 v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; |
523 v32 = &v31->pFaces[v30 & 0x3F]; | 532 v32 = &v31->pFaces[v30 & 0x3F]; |
524 if ( v32->uPolygonType != 3 ) | 533 if ( v32->uPolygonType != 3 ) |
525 { | 534 { |
696 v40 = v8; | 705 v40 = v8; |
697 do | 706 do |
698 { | 707 { |
699 _46E44E_collide_against_faces_and_portals(0); | 708 _46E44E_collide_against_faces_and_portals(0); |
700 _46E0B2_collide_against_decorations(); | 709 _46E0B2_collide_against_decorations(); |
701 if ( (pSpriteObject->field_58_pid & 7) != OBJECT_Player) | 710 if (PID_TYPE(pSpriteObject->spell_caster_pid) != OBJECT_Player) |
702 _46EF01_collision_chech_player(1); | 711 _46EF01_collision_chech_player(1); |
703 v13 = pSpriteObject->field_58_pid; | 712 v13 = pSpriteObject->spell_caster_pid; |
704 v42 = v8; | 713 v42 = v8; |
705 if ( (v13 & 7) == OBJECT_Actor) | 714 if (PID_TYPE(v13) == OBJECT_Actor) |
706 { | 715 { |
707 if ( (signed int)uNumActors > v8 ) | 716 if ( (signed int)uNumActors > v8 ) |
708 { | 717 { |
709 v39b = pActors;//[0].word_000086_some_monster_id; | 718 v39b = pActors;//[0].word_000086_some_monster_id; |
710 do | 719 do |
711 { | 720 { |
712 //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; | 721 //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; |
713 //v14 = (signed __int64)((double)v41 * 0.3333333333333333); | 722 //v14 = (signed __int64)((double)v41 * 0.3333333333333333); |
714 //v41 = *(short *)(v39 - 38) - 1; | 723 //v41 = *(short *)(v39 - 38) - 1; |
715 //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) | 724 //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) |
716 if( pActors[pSpriteObject->field_58_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) | 725 if( pActors[pSpriteObject->spell_caster_pid >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) |
717 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius | 726 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius |
718 _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); | 727 _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); |
719 ++v42; | 728 ++v42; |
720 ++v39b;// += 836; | 729 ++v39b;// += 836; |
721 } | 730 } |
798 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); | 807 pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID); |
799 stru_721530.field_70 += stru_721530.field_7C; | 808 stru_721530.field_70 += stru_721530.field_7C; |
800 if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) | 809 if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) ) |
801 return; | 810 return; |
802 v15 = (signed int)stru_721530.uFaceID >> 3; | 811 v15 = (signed int)stru_721530.uFaceID >> 3; |
803 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) | 812 if (PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
804 { | 813 { |
805 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); | 814 v40 = integer_sqrt(pSpriteObject->vVelocity.x * pSpriteObject->vVelocity.x + pSpriteObject->vVelocity.y * pSpriteObject->vVelocity.y); |
806 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, | 815 v23 = stru_5C6E00->Atan2(pSpriteObject->vPosition.x - pLevelDecorations[v15].vPosition.x, |
807 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); | 816 pSpriteObject->vPosition.y - pLevelDecorations[v15].vPosition.y); |
808 v42 = stru_5C6E00->Cos(v23); | 817 v42 = stru_5C6E00->Cos(v23); |
815 v41 = v26 >> 16; | 824 v41 = v26 >> 16; |
816 pSpriteObject->vVelocity.y = WORD1(v26); | 825 pSpriteObject->vVelocity.y = WORD1(v26); |
817 } | 826 } |
818 else | 827 else |
819 { | 828 { |
820 if ( (stru_721530.uFaceID & 7) != OBJECT_BModel) | 829 if (PID_TYPE(stru_721530.uFaceID) != OBJECT_BModel) |
821 goto LABEL_64; | 830 goto LABEL_64; |
822 stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3; | 831 stru_721530.field_84 = (signed int)PID_ID(stru_721530.uFaceID); |
823 v16 = &pIndoor->pFaces[v15]; | 832 v16 = &pIndoor->pFaces[v15]; |
824 if ( v16->uPolygonType != 3 ) | 833 if ( v16->uPolygonType != 3 ) |
825 { | 834 { |
826 v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z | 835 v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z |
827 + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; | 836 + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16; |