Mercurial > mm7
comparison mm7_3.cpp @ 112:909822c91d47
pointer fixes
author | zipi |
---|---|
date | Sat, 09 Feb 2013 18:46:06 +0000 |
parents | 98cd93e14777 |
children | be3c07c98861 |
comparison
equal
deleted
inserted
replaced
111:bf7ea4c330b3 | 112:909822c91d47 |
---|---|
1424 Particle_ Dst; // [sp+Ch] [bp-84h]@18 | 1424 Particle_ Dst; // [sp+Ch] [bp-84h]@18 |
1425 unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 | 1425 unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 |
1426 ObjectDesc *v37; // [sp+78h] [bp-18h]@1 | 1426 ObjectDesc *v37; // [sp+78h] [bp-18h]@1 |
1427 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 | 1427 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 |
1428 int v39; // [sp+80h] [bp-10h]@33 | 1428 int v39; // [sp+80h] [bp-10h]@33 |
1429 Actor *v39b; | |
1429 int v40; // [sp+84h] [bp-Ch]@28 | 1430 int v40; // [sp+84h] [bp-Ch]@28 |
1430 int v41; // [sp+88h] [bp-8h]@34 | 1431 int v41; // [sp+88h] [bp-8h]@34 |
1431 int v42; // [sp+8Ch] [bp-4h]@4 | 1432 int v42; // [sp+8Ch] [bp-4h]@4 |
1432 | 1433 |
1433 uLayingItemID_ = uLayingItemID; | 1434 uLayingItemID_ = uLayingItemID; |
1486 v42 = v8; | 1487 v42 = v8; |
1487 if ( (v13 & 7) == 3 ) | 1488 if ( (v13 & 7) == 3 ) |
1488 { | 1489 { |
1489 if ( (signed int)uNumActors > v8 ) | 1490 if ( (signed int)uNumActors > v8 ) |
1490 { | 1491 { |
1491 v39 = (int)&pActors[0].word_000086_some_monster_id; | 1492 v39b = pActors;//[0].word_000086_some_monster_id; |
1492 do | 1493 do |
1493 { | 1494 { |
1494 v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; | 1495 //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1; |
1495 v14 = (signed __int64)((double)v41 * 0.3333333333333333); | 1496 //v14 = (signed __int64)((double)v41 * 0.3333333333333333); |
1496 v41 = *(short *)(v39 - 38) - 1; | 1497 //v41 = *(short *)(v39 - 38) - 1; |
1497 if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) | 1498 //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) ) |
1498 _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[*(short *)v39] - 73)); | 1499 if( pActors[v1->field_58 >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID ) |
1500 //not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius | |
1501 _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73)); | |
1499 ++v42; | 1502 ++v42; |
1500 v39 += 836; | 1503 ++v39b;// += 836; |
1501 } | 1504 } |
1502 while ( v42 < (signed int)uNumActors ); | 1505 while ( v42 < (signed int)uNumActors ); |
1503 v8 = 0; | 1506 v8 = 0; |
1504 } | 1507 } |
1505 } | 1508 } |
1506 else | 1509 else |
1507 { | 1510 { |
1508 if ( (signed int)uNumActors > v8 ) | 1511 if ( (signed int)uNumActors > v8 ) |
1509 { | 1512 { |
1510 v39 = (int)&pActors[0].word_000086_some_monster_id; | 1513 v39b = pActors;//[0].word_000086_some_monster_id; |
1511 do | 1514 do |
1512 { | 1515 { |
1513 _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39] - 73)); | 1516 _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39b] - 73)); |
1514 v39 += 836; | 1517 ++v39b; |
1515 } | 1518 } |
1516 while ( v42 < (signed int)uNumActors ); | 1519 while ( v42 < (signed int)uNumActors ); |
1517 } | 1520 } |
1518 } | 1521 } |
1519 if ( _46F04E_collide_against_portals() ) | 1522 if ( _46F04E_collide_against_portals() ) |
3161 { | 3164 { |
3162 LOBYTE(pParty->uFlags) &= 0x7Fu; | 3165 LOBYTE(pParty->uFlags) &= 0x7Fu; |
3163 bWaterWalk = 1; | 3166 bWaterWalk = 1; |
3164 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; | 3167 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; |
3165 if ( !(pParty->pPartyBuffs[18].uFlags & 1) | 3168 if ( !(pParty->pPartyBuffs[18].uFlags & 1) |
3166 && *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) | 3169 && pParty->pPlayers[pParty->pPartyBuffs[18].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) |
3167 bWaterWalk = 0; | 3170 bWaterWalk = 0; |
3168 } | 3171 } |
3169 v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk); | 3172 v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk); |
3170 v111 = v3; | 3173 v111 = v3; |
3171 if ( bFeatherFall ) | 3174 if ( bFeatherFall ) |
3262 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) | 3265 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) |
3263 { | 3266 { |
3264 pParty->bFlying = 0; | 3267 pParty->bFlying = 0; |
3265 if ( bUnderwater | 3268 if ( bUnderwater |
3266 || pParty->pPartyBuffs[7].uFlags & 1 | 3269 || pParty->pPartyBuffs[7].uFlags & 1 |
3267 || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) | 3270 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) |
3268 { | 3271 { |
3269 if ( pParty->vPosition.z < 4000 || bJumping ) | 3272 if ( pParty->vPosition.z < 4000 || bJumping ) |
3270 { | 3273 { |
3271 v123 += 30; | 3274 v123 += 30; |
3272 v113 += 30; | 3275 v113 += 30; |
3302 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) | 3305 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) |
3303 { | 3306 { |
3304 pParty->bFlying = 0; | 3307 pParty->bFlying = 0; |
3305 if ( bUnderwater | 3308 if ( bUnderwater |
3306 || pParty->pPartyBuffs[7].uFlags & 1 | 3309 || pParty->pPartyBuffs[7].uFlags & 1 |
3307 || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) | 3310 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) |
3308 { | 3311 { |
3309 v123 -= 30; | 3312 v123 -= 30; |
3310 v113 -= 30; | 3313 v113 -= 30; |
3311 pParty->uFallSpeed = 0; | 3314 pParty->uFallSpeed = 0; |
3312 v121 = 0; | 3315 v121 = 0; |
13625 unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37 | 13628 unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37 |
13626 unsigned int uWd; // [sp+60h] [bp+Ch]@95 | 13629 unsigned int uWd; // [sp+60h] [bp+Ch]@95 |
13627 float uZooma; // [sp+64h] [bp+10h]@117 | 13630 float uZooma; // [sp+64h] [bp+10h]@117 |
13628 signed int flagsa; // [sp+68h] [bp+14h]@42 | 13631 signed int flagsa; // [sp+68h] [bp+14h]@42 |
13629 unsigned int flagsb; // [sp+68h] [bp+14h]@66 | 13632 unsigned int flagsb; // [sp+68h] [bp+14h]@66 |
13630 char *flagsc; // [sp+68h] [bp+14h]@86 | 13633 Actor *flagsc; // [sp+68h] [bp+14h]@86 |
13631 unsigned int flagsd; // [sp+68h] [bp+14h]@105 | 13634 unsigned int flagsd; // [sp+68h] [bp+14h]@105 |
13632 | 13635 |
13633 //a3 = uY; | 13636 //a3 = uY; |
13634 //a2 = uX; | 13637 //a2 = uX; |
13635 uCenterX = (uX + uZ) / 2; | 13638 uCenterX = (uX + uZ) / 2; |
13947 v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, v36, v33); | 13950 v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, v36, v33); |
13948 v65 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v36, v36, v33); | 13951 v65 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v36, v36, v33); |
13949 uZf = v33; | 13952 uZf = v33; |
13950 if ( (signed int)uNumActors > v33 ) | 13953 if ( (signed int)uNumActors > v33 ) |
13951 { | 13954 { |
13952 flagsc = (char *)&pActors[0].uAIState; | 13955 flagsc = pActors;//[0].uAIState; |
13953 do | 13956 do |
13954 { | 13957 { |
13955 v39 = *(short *)flagsc; | 13958 v39 = flagsc->uAIState; |
13956 if ( *(short *)flagsc != 11 && v39 != 19 && (v39 == 5 || *(flagsc - 139) & 0x80) ) | 13959 if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) ) |
13957 { | 13960 { |
13958 v40 = ((unsigned __int64)(((signed int)*((short *)flagsc - 17) - pParty->vPosition.x) | 13961 v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x) |
13959 * (signed __int64)(signed int)uZoom) >> 16) | 13962 * (signed __int64)(signed int)uZoom) >> 16) |
13960 + uCenterX; | 13963 + uCenterX; |
13961 v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.y) | 13964 v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y) |
13962 * (signed __int64)(signed int)uZoom) >> 16; | 13965 * (signed __int64)(signed int)uZoom) >> 16; |
13963 v41 = uCenterY - v76; | 13966 v41 = uCenterY - v76; |
13964 if ( v40 >= pRenderer->field_1C_clipx ) | 13967 if ( v40 >= pRenderer->field_1C_clipx ) |
13965 { | 13968 { |
13966 if ( v40 <= pRenderer->field_24_clipz && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_clipw ) | 13969 if ( v40 <= pRenderer->field_24_clipz && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_clipw ) |
13967 { | 13970 { |
13968 uWd = v61; | 13971 uWd = v61; |
13969 if ( *(flagsc - 137) & 1 ) | 13972 if ( BYTE3(flagsc->uAttributes) & 1 ) |
13970 uWd = v63; | 13973 uWd = v63; |
13971 if ( *(short *)flagsc == 5 ) | 13974 if ( flagsc->uAIState == 5 ) |
13972 uWd = v65; | 13975 uWd = v65; |
13973 if ( (signed int)uZoom > 1024 ) | 13976 if ( (signed int)uZoom > 1024 ) |
13974 { | 13977 { |
13975 pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); | 13978 pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); |
13976 pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd); | 13979 pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd); |
13996 pRenderer->Line2D(v40, v52, v54, v56, v59); | 13999 pRenderer->Line2D(v40, v52, v54, v56, v59); |
13997 } | 14000 } |
13998 } | 14001 } |
13999 } | 14002 } |
14000 ++uZf; | 14003 ++uZf; |
14001 flagsc += 836; | 14004 ++flagsc; |
14002 } | 14005 } |
14003 while ( uZf < (signed int)uNumActors ); | 14006 while ( uZf < (signed int)uNumActors ); |
14004 v36 = 255; | 14007 v36 = 255; |
14005 v33 = 0; | 14008 v33 = 0; |
14006 } | 14009 } |
16861 int v36; // esi@61 | 16864 int v36; // esi@61 |
16862 int v37; // esi@62 | 16865 int v37; // esi@62 |
16863 int v38; // eax@78 | 16866 int v38; // eax@78 |
16864 int v39; // ecx@78 | 16867 int v39; // ecx@78 |
16865 size_t v40; // edx@78 | 16868 size_t v40; // edx@78 |
16866 char *v41; // esi@79 | 16869 Actor *v41; // esi@79 |
16867 int v42; // eax@84 | 16870 int v42; // eax@84 |
16868 int v43; // ecx@84 | 16871 int v43; // ecx@84 |
16869 size_t v44; // edx@84 | 16872 size_t v44; // edx@84 |
16870 char *v45; // esi@85 | 16873 Actor *v45; // esi@85 |
16871 void *v46; // eax@91 | 16874 void *v46; // eax@91 |
16872 GUIWindow *v47; // eax@93 | 16875 GUIWindow *v47; // eax@93 |
16873 GUIButton *v48; // ecx@93 | 16876 GUIButton *v48; // ecx@93 |
16874 GUIButton *v49; // esi@94 | 16877 GUIButton *v49; // esi@94 |
16875 char v50; // al@100 | 16878 char v50; // al@100 |
17249 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | 17252 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); |
17250 v40 = uNumActors; | 17253 v40 = uNumActors; |
17251 __debugbreak(); | 17254 __debugbreak(); |
17252 if ( (signed int)uNumActors > 0 ) | 17255 if ( (signed int)uNumActors > 0 ) |
17253 { | 17256 { |
17254 v41 = (char *)&pActors[0].uGroup; | 17257 v41 = pActors;//[0].uGroup; |
17255 do | 17258 do |
17256 { | 17259 { |
17257 if ( *(int *)v41 == v38 ) | 17260 if ( v41->uGroup == v38 ) |
17258 *(int *)v41 = v39; | 17261 v41->uGroup = v39; |
17259 v41 += 836; | 17262 ++v41; |
17260 --v40; | 17263 --v40; |
17261 } | 17264 } |
17262 while ( v40 ); | 17265 while ( v40 ); |
17263 } | 17266 } |
17264 goto LABEL_291; | 17267 goto LABEL_291; |
17267 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | 17270 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); |
17268 v44 = uNumActors; | 17271 v44 = uNumActors; |
17269 __debugbreak(); | 17272 __debugbreak(); |
17270 if ( (signed int)uNumActors > 0 ) | 17273 if ( (signed int)uNumActors > 0 ) |
17271 { | 17274 { |
17272 v45 = (char *)&pActors[0].uAlly; | 17275 v45 = pActors;//[0].uAlly; |
17273 do | 17276 do |
17274 { | 17277 { |
17275 if ( *((int *)v45 - 1) == v42 ) | 17278 if ( v45->uGroup == v42 ) |
17276 *(int *)v45 = v43; | 17279 v45->uAlly = v43; |
17277 v45 += 836; | 17280 ++v45; |
17278 --v44; | 17281 --v44; |
17279 } | 17282 } |
17280 while ( v44 ); | 17283 while ( v44 ); |
17281 } | 17284 } |
17282 goto LABEL_291; | 17285 goto LABEL_291; |
19750 | 19753 |
19751 | 19754 |
19752 //----- (004014E6) -------------------------------------------------------- | 19755 //----- (004014E6) -------------------------------------------------------- |
19753 int __cdecl ODM_4014E6_AI() | 19756 int __cdecl ODM_4014E6_AI() |
19754 { | 19757 { |
19755 int v0; // esi@2 | 19758 Actor *v0; // esi@2 |
19756 int v1; // eax@4 | 19759 int v1; // eax@4 |
19757 int v2; // ebx@4 | 19760 int v2; // ebx@4 |
19758 unsigned int v3; // ecx@4 | 19761 unsigned int v3; // ecx@4 |
19759 int v4; // edx@5 | 19762 int v4; // edx@5 |
19760 int v5; // edx@7 | 19763 int v5; // edx@7 |
19784 pParty->uFlags &= 0xFFFFFFCFu; | 19787 pParty->uFlags &= 0xFFFFFFCFu; |
19785 v27 = 0; | 19788 v27 = 0; |
19786 v25 = 0; | 19789 v25 = 0; |
19787 if ( (signed int)uNumActors > 0 ) | 19790 if ( (signed int)uNumActors > 0 ) |
19788 { | 19791 { |
19789 v0 = (int)&pActors[0].uAttributes; | 19792 v0 = pActors;//[0].uAttributes; |
19790 do | 19793 do |
19791 { | 19794 { |
19792 *(char *)(v0 + 1) &= 0xFBu; | 19795 //*(char *)(v0 + 1) &= 0xFBu; |
19793 if ( ! ((Actor *)(v0 - offsetof(Actor, uAttributes)))->CanAct() ) | 19796 BYTE1(v0->uAttributes) &= 0xFBu; |
19797 if ( ! v0->CanAct() ) | |
19794 goto LABEL_37; | 19798 goto LABEL_37; |
19795 v22 = abs(pParty->vPosition.z - *(short *)(v0 + 110)); | 19799 v22 = abs(pParty->vPosition.z - v0->vPosition.z); |
19796 v21 = abs(pParty->vPosition.y - *(short *)(v0 + 108)); | 19800 v21 = abs(pParty->vPosition.y - v0->vPosition.y); |
19797 v1 = abs(pParty->vPosition.x - *(short *)(v0 + 106)); | 19801 v1 = abs(pParty->vPosition.x - v0->vPosition.x); |
19798 v2 = v21; | 19802 v2 = v21; |
19799 v3 = v22; | 19803 v3 = v22; |
19800 if ( v1 < v21 ) | 19804 if ( v1 < v21 ) |
19801 { | 19805 { |
19802 v4 = v1; | 19806 v4 = v1; |
19814 v6 = v3; | 19818 v6 = v3; |
19815 v3 = v2; | 19819 v3 = v2; |
19816 v2 = v6; | 19820 v2 = v6; |
19817 } | 19821 } |
19818 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | 19822 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; |
19819 v8 = *(short *)(v0 + 100); | 19823 v8 = v0->uActorRadius; |
19820 v9 = v7 - v8; | 19824 v9 = v7 - v8; |
19821 v23 = v7 - v8; | 19825 v23 = v7 - v8; |
19822 if ( v23 < 0 ) | 19826 if ( v23 < 0 ) |
19823 { | 19827 { |
19824 v9 = 0; | 19828 v9 = 0; |
19825 v23 = 0; | 19829 v23 = 0; |
19826 } | 19830 } |
19827 if ( v9 < 5632 ) | 19831 if ( v9 < 5632 ) |
19828 { | 19832 { |
19829 v10 = *(int *)v0 & 0xFEFFFFFF; | 19833 v10 = v0->uAttributes & 0xFEFFFFFF; |
19830 *(int *)v0 = v10; | 19834 v0->uAttributes = v10; |
19831 if ( v10 & 0x80000 || ((Actor *)(v0 - offsetof(Actor, uAttributes)))->GetActorsRelation(0) ) | 19835 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) |
19832 { | 19836 { |
19833 v11 = (pParty->uFlags & 0x10) == 0; | 19837 v11 = (pParty->uFlags & 0x10) == 0; |
19834 *(int *)v0 = v10 | 0x1000000; | 19838 v0->uAttributes = v10 | 0x1000000; |
19835 if ( v11 && (double)v23 < 307.2 ) | 19839 if ( v11 && (double)v23 < 307.2 ) |
19836 pParty->uFlags |= 0x10u; | 19840 pParty->uFlags |= 0x10u; |
19837 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | 19841 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) |
19838 pParty->uFlags |= 0x20u; | 19842 pParty->uFlags |= 0x20u; |
19839 } | 19843 } |
19840 *(char *)(v0 + 1) |= 0x40u; | 19844 BYTE1(v0->uAttributes) |= 0x40u; |
19841 v12 = v27++; | 19845 v12 = v27++; |
19842 ai_array_4F75E0[v12] = v9; | 19846 ai_array_4F75E0[v12] = v9; |
19843 ai_array_4F7DB0_actor_ids[v12] = v25; | 19847 ai_array_4F7DB0_actor_ids[v12] = v25; |
19844 } | 19848 } |
19845 else | 19849 else |
19846 { | 19850 { |
19847 LABEL_37: | 19851 LABEL_37: |
19848 *(char *)(v0 + 1) &= 0xBFu; | 19852 BYTE1(v0->uAttributes) &= 0xBFu; |
19849 } | 19853 } |
19850 ++v25; | 19854 ++v25; |
19851 v0 += 836; | 19855 ++v0; |
19852 } | 19856 } |
19853 while ( v25 < (signed int)uNumActors ); | 19857 while ( v25 < (signed int)uNumActors ); |
19854 } | 19858 } |
19855 result = v27; | 19859 result = v27; |
19856 if ( v27 > 0 ) | 19860 if ( v27 > 0 ) |