comparison Indoor.cpp @ 1546:9a6567c6c76c

stru141 & misc cleaning
author Nomad
date Sat, 07 Sep 2013 21:55:02 +0200
parents c4ab816fcc5e
children e668660457dc 30db6d265ceb
comparison
equal deleted inserted replaced
1545:c4ab816fcc5e 1546:9a6567c6c76c
60 60
61 stru320 stru_F8AD28; // idb 61 stru320 stru_F8AD28; // idb
62 stru337 stru_F81018; 62 stru337 stru_F81018;
63 BspRenderer_PortalViewportData stru_F8A590; 63 BspRenderer_PortalViewportData stru_F8A590;
64 BspRenderer *pBspRenderer = new BspRenderer; // idb 64 BspRenderer *pBspRenderer = new BspRenderer; // idb
65 stru141 stru_721530; 65 stru141_actor_collision_object stru_721530;
66 std::array<stru352, 480> stru_F83B80; 66 std::array<stru352, 480> stru_F83B80;
67 67
68 68
69 69
70 unsigned __int16 pDoorSoundIDsByLocationID[78] = 70 unsigned __int16 pDoorSoundIDsByLocationID[78] =
3181 int v16; // ecx@33 3181 int v16; // ecx@33
3182 BLVFace *v17; // edx@33 3182 BLVFace *v17; // edx@33
3183 int v18; // ecx@33 3183 int v18; // ecx@33
3184 BLVFace *v19; // eax@34 3184 BLVFace *v19; // eax@34
3185 int v20; // ecx@46 3185 int v20; // ecx@46
3186 int v21; // eax@46 3186 //int v21; // eax@46
3187 int v22; // edi@46 3187 int v22; // edi@46
3188 int v23; // eax@48 3188 int v23; // eax@48
3189 unsigned int v24; // eax@51 3189 unsigned int v24; // eax@51
3190 int v25; // eax@52 3190 int v25; // eax@52
3191 int v26; // ebx@54 3191 int v26; // ebx@54
3206 PolygonType v41; // al@94 3206 PolygonType v41; // al@94
3207 int v42; // eax@96 3207 int v42; // eax@96
3208 __int16 v43; // dx@96 3208 __int16 v43; // dx@96
3209 int v44; // ecx@96 3209 int v44; // ecx@96
3210 int v45; // edi@101 3210 int v45; // edi@101
3211 int v46; // edi@101 3211 //int v46; // edi@101
3212 int v47; // eax@101 3212 //int v47; // eax@101
3213 unsigned __int64 v48; // qax@101 3213 //unsigned __int64 v48; // qax@101
3214 unsigned __int8 v49; // zf@103 3214 unsigned __int8 v49; // zf@103
3215 unsigned __int8 v50; // sf@103 3215 unsigned __int8 v50; // sf@103
3216 unsigned __int8 v51; // of@103 3216 unsigned __int8 v51; // of@103
3217 AIDirection v52; // [sp+0h] [bp-60h]@75 3217 AIDirection v52; // [sp+0h] [bp-60h]@75
3218 AIDirection v53; // [sp+1Ch] [bp-44h]@116 3218 AIDirection v53; // [sp+1Ch] [bp-44h]@116
3357 ++v63; 3357 ++v63;
3358 if ( (signed int)v63 >= (signed int)uNumActors ) 3358 if ( (signed int)v63 >= (signed int)uNumActors )
3359 return; 3359 return;
3360 } 3360 }
3361 v20 = v0->uActorRadius; 3361 v20 = v0->uActorRadius;
3362 v21 = v0->uActorHeight;
3363 stru_721530.field_84 = -1; 3362 stru_721530.field_84 = -1;
3364 stru_721530.field_70 = 0; 3363 stru_721530.field_70 = 0;
3365 uSectorID = 0; 3364 uSectorID = 0;
3366 stru_721530.field_0 = 1; 3365 stru_721530.field_0 = 1;
3367 stru_721530.field_8 = v20; 3366 stru_721530.field_8_radius = v20;
3368 stru_721530.prolly_normal_d = v20; 3367 stru_721530.prolly_normal_d = v20;
3369 stru_721530.field_C = v21; 3368 stru_721530.height = v0->uActorHeight;
3370 v22 = 0; 3369 v22 = 0;
3371 while ( 1 ) 3370 while ( 1 )
3372 { 3371 {
3373 stru_721530.field_34.x = v0->vPosition.x; 3372 stru_721530.position.x = v0->vPosition.x;
3374 stru_721530.normal.x = stru_721530.field_34.x; 3373 stru_721530.normal.x = stru_721530.position.x;
3375 stru_721530.field_34.y = v0->vPosition.y; 3374 stru_721530.position.y = v0->vPosition.y;
3376 stru_721530.normal.y = stru_721530.field_34.y; 3375 stru_721530.normal.y = stru_721530.position.y;
3377 v23 = v0->vPosition.z; 3376 v23 = v0->vPosition.z;
3378 stru_721530.normal.z = v23 + v20 + 1; 3377 stru_721530.normal.z = v23 + v20 + 1;
3379 stru_721530.field_34.z = v23 - v20 + stru_721530.field_C - 1; 3378 stru_721530.position.z = v23 - v20 + stru_721530.height - 1;
3380 if ( stru_721530.field_34.z < stru_721530.normal.z ) 3379 if ( stru_721530.position.z < stru_721530.normal.z )
3381 stru_721530.field_34.z = v23 + v20 + 1; 3380 stru_721530.position.z = v23 + v20 + 1;
3382 stru_721530.field_1C = v0->vVelocity.x; 3381 stru_721530.velocity.x = v0->vVelocity.x;
3383 stru_721530.field_20 = v0->vVelocity.y; 3382 stru_721530.velocity.y = v0->vVelocity.y;
3384 stru_721530.field_24 = v0->vVelocity.z; 3383 stru_721530.velocity.z = v0->vVelocity.z;
3385 stru_721530.uSectorID = v0->uSectorID; 3384 stru_721530.uSectorID = v0->uSectorID;
3386 if ( !stru_721530._47050A(v22) ) 3385 if ( !stru_721530._47050A(v22) )
3387 { 3386 {
3388 v58 = v22; 3387 v58 = v22;
3389 v24 = 8 * v63; 3388 v24 = 8 * v63;
3430 v31 = stru_721530.normal2.y; 3429 v31 = stru_721530.normal2.y;
3431 v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; 3430 v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
3432 } 3431 }
3433 else 3432 else
3434 { 3433 {
3435 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 3434 v30 = v0->vPosition.x + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
3436 v30 = v58 + v0->vPosition.x; 3435 v31 = v0->vPosition.y + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
3437 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 3436 v32 = v0->vPosition.z + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
3438 v31 = v58 + v0->vPosition.y;
3439 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
3440 v32 = v58 + v0->vPosition.z;
3441 } 3437 }
3442 v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); 3438 v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID);
3443 v34 = pIndoor->pFaces[uFaceID].uAttributes; 3439 v34 = pIndoor->pFaces[uFaceID].uAttributes;
3444 v35 = v34 & 0x400000; 3440 v35 = v34 & 0x400000;
3445 if (v35 && v0->uAIState == Dead) 3441 if (v35 && v0->uAIState == Dead)
3459 v0->vPosition.y = LOWORD(stru_721530.normal2.y); 3455 v0->vPosition.y = LOWORD(stru_721530.normal2.y);
3460 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; 3456 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
3461 v0->uSectorID = LOWORD(stru_721530.uSectorID); 3457 v0->uSectorID = LOWORD(stru_721530.uSectorID);
3462 goto LABEL_123; 3458 goto LABEL_123;
3463 } 3459 }
3464 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; 3460 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
3465 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16; 3461 v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
3466 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 3462 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
3467 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16; 3463 v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
3468 v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; 3464 //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
3469 v36 = stru_721530.uFaceID; 3465 v36 = stru_721530.uFaceID;
3470 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; 3466 v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
3471 v0->uSectorID = LOWORD(stru_721530.uSectorID); 3467 v0->uSectorID = LOWORD(stru_721530.uSectorID);
3472 stru_721530.field_70 += stru_721530.field_7C; 3468 stru_721530.field_70 += stru_721530.field_7C;
3473 v37 = PID_ID(v36); 3469 v37 = PID_ID(v36);
3474 if ( PID_TYPE(v36) != OBJECT_Actor) 3470 if ( PID_TYPE(v36) != OBJECT_Actor)
3475 { 3471 {
3479 { 3475 {
3480 _this = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); 3476 _this = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
3481 v45 = stru_5C6E00->Atan2( 3477 v45 = stru_5C6E00->Atan2(
3482 v0->vPosition.x - pLevelDecorations[v37].vPosition.x, 3478 v0->vPosition.x - pLevelDecorations[v37].vPosition.x,
3483 v0->vPosition.y - pLevelDecorations[v37].vPosition.y); 3479 v0->vPosition.y - pLevelDecorations[v37].vPosition.y);
3484 v54 = stru_5C6E00->Cos(v45); 3480 v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v45), _this);
3485 v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16; 3481 v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v45), _this);
3486 v46 = v45 - stru_5C6E00->uIntegerHalfPi;
3487 v0->vVelocity.x = v54 * _this >> 16;
3488 v47 = stru_5C6E00->Sin(v45);
3489 v54 = v47;
3490 v48 = v47 * (signed __int64)(signed int)_this;
3491 v56 = v48 >> 16;
3492 v0->vVelocity.y = WORD1(v48);
3493 goto LABEL_119; 3482 goto LABEL_119;
3494 } 3483 }
3495 if ( PID_TYPE(v36) == OBJECT_BModel) 3484 if ( PID_TYPE(v36) == OBJECT_BModel)
3496 { 3485 {
3497 stru_721530.field_84 = v36 >> 3; 3486 stru_721530.field_84 = v36 >> 3;
3513 { 3502 {
3514 v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y 3503 v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y
3515 * v0->vVelocity.y 3504 * v0->vVelocity.y
3516 + v38->pFacePlane_old.vNormal.z 3505 + v38->pFacePlane_old.vNormal.z
3517 * v0->vVelocity.z) >> 16; 3506 * v0->vVelocity.z) >> 16;
3518 if ( stru_721530.field_64 >> 3 > v61 ) 3507 if ( (stru_721530.speed >> 3) > v61 )
3519 v61 = stru_721530.field_64 >> 3; 3508 v61 = stru_721530.speed >> 3;
3520 v58 = v38->pFacePlane_old.vNormal.x; 3509
3521 v58 = (unsigned __int64)(v61 * (signed __int64)v58) >> 16; 3510 v0->vVelocity.x += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.x);
3522 _this = v38->pFacePlane_old.vNormal.y; 3511 v0->vVelocity.y += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.y);
3523 _this = (unsigned __int64)(v61 * (signed __int64)(signed int)_this) >> 16; 3512 v0->vVelocity.z += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.z);
3524 v56 = v38->pFacePlane_old.vNormal.z;
3525 v56 = (unsigned __int64)(v61 * (signed __int64)v56) >> 16;
3526 v0->vVelocity.x += v58;
3527 v0->vVelocity.y += _this;
3528 v0->vVelocity.z += v56;
3529 v41 = v38->uPolygonType; 3513 v41 = v38->uPolygonType;
3530 if ( v41 != 4 && v41 != 3 ) 3514 if ( v41 != 4 && v41 != 3 )
3531 { 3515 {
3532 v42 = v38->pFacePlane_old.vNormal.x; 3516 v42 = v38->pFacePlane_old.vNormal.x;
3533 v43 = v0->vPosition.z; 3517 v43 = v0->vPosition.z;
3547 } 3531 }
3548 if ( BYTE3(v38->uAttributes) & 8 ) 3532 if ( BYTE3(v38->uAttributes) & 8 )
3549 EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1); 3533 EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1);
3550 } 3534 }
3551 LABEL_119: 3535 LABEL_119:
3552 v56 = v0->vVelocity.x; 3536 v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x);
3553 v54 = 58500; 3537 v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y);
3554 v56 = (unsigned __int64)(58500i64 * v56) >> 16; 3538 v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z);
3555 v0->vVelocity.x = v56;
3556 v56 = v0->vVelocity.y;
3557 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16;
3558 v54 = 58500;
3559 v0->vVelocity.y = v56;
3560 v56 = v0->vVelocity.z;
3561 v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16;
3562 v22 = 0; 3539 v22 = 0;
3563 v0->vVelocity.z = v56;
3564 goto LABEL_120; 3540 goto LABEL_120;
3565 } 3541 }
3566 if ( v0->GetActorsRelation(0) ) 3542 if ( v0->GetActorsRelation(0) )
3567 { 3543 {
3568 v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime), v22); 3544 v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime), v22);