Mercurial > mm7
comparison mm7_3.cpp @ 140:f4d7a9a8c363
Walk/run and other actions
author | Nomad |
---|---|
date | Tue, 12 Feb 2013 02:02:26 +0200 |
parents | 7eeea515f5ff |
children | cca78efb377e |
comparison
equal
deleted
inserted
replaced
139:7eeea515f5ff | 140:f4d7a9a8c363 |
---|---|
3009 //int v12; // ecx@77 | 3009 //int v12; // ecx@77 |
3010 //int v13; // eax@84 | 3010 //int v13; // eax@84 |
3011 //double v14; // st7@84 | 3011 //double v14; // st7@84 |
3012 //int v15; // eax@87 | 3012 //int v15; // eax@87 |
3013 //double v16; // st7@87 | 3013 //double v16; // st7@87 |
3014 int v17; // eax@88 | 3014 //int v17; // eax@88 |
3015 double v18; // st7@88 | 3015 //double v18; // st7@88 |
3016 int v19; // eax@89 | 3016 //int v19; // eax@89 |
3017 double v20; // st7@89 | 3017 //double v20; // st7@89 |
3018 int v21; // eax@92 | 3018 //int v21; // eax@92 |
3019 double v22; // st7@92 | 3019 //double v22; // st7@92 |
3020 int v23; // eax@96 | 3020 //int v23; // eax@96 |
3021 double v24; // st7@96 | 3021 //double v24; // st7@96 |
3022 int v25; // eax@97 | 3022 //int v25; // eax@97 |
3023 double v26; // st7@97 | 3023 //double v26; // st7@97 |
3024 int v27; // eax@98 | 3024 //int v27; // eax@98 |
3025 double v28; // st7@98 | 3025 //double v28; // st7@98 |
3026 signed __int64 v29; // qax@98 | 3026 //signed __int64 v29; // qax@98 |
3027 unsigned int v30; // eax@103 | 3027 //unsigned int v30; // eax@103 |
3028 int v31; // eax@130 | 3028 int v31; // eax@130 |
3029 int v32; // ecx@141 | 3029 int v32; // ecx@141 |
3030 signed int v33; // eax@143 | 3030 signed int v33; // eax@143 |
3031 int v34; // esi@143 | 3031 int v34; // esi@143 |
3032 unsigned int v35; // esi@147 | 3032 unsigned int v35; // esi@147 |
3085 signed int v88; // [sp-1Ch] [bp-B0h]@246 | 3085 signed int v88; // [sp-1Ch] [bp-B0h]@246 |
3086 unsigned int v89; // [sp-18h] [bp-ACh]@246 | 3086 unsigned int v89; // [sp-18h] [bp-ACh]@246 |
3087 signed int v90; // [sp-14h] [bp-A8h]@246 | 3087 signed int v90; // [sp-14h] [bp-A8h]@246 |
3088 signed int v91; // [sp-10h] [bp-A4h]@246 | 3088 signed int v91; // [sp-10h] [bp-A4h]@246 |
3089 int v92; // [sp-Ch] [bp-A0h]@246 | 3089 int v92; // [sp-Ch] [bp-A0h]@246 |
3090 int v93; // [sp-8h] [bp-9Ch]@104 | 3090 //int v93; // [sp-8h] [bp-9Ch]@104 |
3091 unsigned int v94; // [sp-8h] [bp-9Ch]@246 | 3091 unsigned int v94; // [sp-8h] [bp-9Ch]@246 |
3092 int v95; // [sp-4h] [bp-98h]@104 | 3092 //int v95; // [sp-4h] [bp-98h]@104 |
3093 int v96; // [sp-4h] [bp-98h]@246 | 3093 int v96; // [sp-4h] [bp-98h]@246 |
3094 int v97; // [sp+Ch] [bp-88h]@180 | 3094 int v97; // [sp+Ch] [bp-88h]@180 |
3095 Vec3_int_ v98; | 3095 Vec3_int_ v98; |
3096 //int v98; // [sp+10h] [bp-84h]@147 | 3096 //int v98; // [sp+10h] [bp-84h]@147 |
3097 //int v99; // [sp+14h] [bp-80h]@147 | 3097 //int v99; // [sp+14h] [bp-80h]@147 |
3260 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format | 3260 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format |
3261 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed | 3261 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed |
3262 * stru_5C6E00->uIntegerPi) | 3262 * stru_5C6E00->uIntegerPi) |
3263 / 180)) >> 16);*/ | 3263 / 180)) >> 16);*/ |
3264 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; | 3264 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; |
3265 LABEL_118: | 3265 while (pPartyActionQueue->uNumActions) |
3266 while ( pPartyActionQueue->uNumActions ) | 3266 { |
3267 { | 3267 switch (pPartyActionQueue->Next()) |
3268 switch ( pPartyActionQueue->Next() ) | |
3269 { | 3268 { |
3270 case PARTY_FlyUp: | 3269 case PARTY_FlyUp: |
3271 { | 3270 { |
3272 if (!pParty->FlyActive() && !bUnderwater) | 3271 if (!pParty->FlyActive() && !bUnderwater) |
3273 break; | 3272 break; |
3369 _angle_y &= stru_5C6E00->uDoublePiMask; | 3368 _angle_y &= stru_5C6E00->uDoublePiMask; |
3370 break; | 3369 break; |
3371 | 3370 |
3372 case PARTY_StrafeLeft: | 3371 case PARTY_StrafeLeft: |
3373 { | 3372 { |
3374 //v13 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3375 //v14 = (double)_walk_speed; | |
3376 *(float *)&v128 = pParty->uWalkSpeed; | 3373 *(float *)&v128 = pParty->uWalkSpeed; |
3377 | 3374 |
3378 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); | 3375 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
3379 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | 3376 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
3380 v2 -= 3 * dx / 4; | 3377 v2 -= 3 * dx / 4; |
3388 } | 3385 } |
3389 break; | 3386 break; |
3390 | 3387 |
3391 case PARTY_StrafeRight: | 3388 case PARTY_StrafeRight: |
3392 { | 3389 { |
3393 //v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3394 *(float *)&v128 = pParty->uWalkSpeed; | 3390 *(float *)&v128 = pParty->uWalkSpeed; |
3395 /*v124 = (unsigned __int64)(v126 * (signed __int64)((signed int)(signed __int64)(pParty->uWalkSpeed * fWalkSpeedMultiplier) >> 1)) >> 16; | 3391 |
3396 v2 += v124; | |
3397 v126 = stru_5C6E00->SinCos(_angle_y); | |
3398 v124 = (unsigned __int64)(v126 | |
3399 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16; | |
3400 v1 -= v124;*/ | |
3401 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); | 3392 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
3402 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | 3393 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
3403 v2 += 3 * dx / 4; | 3394 v2 += 3 * dx / 4; |
3404 | 3395 |
3405 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | 3396 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
3410 v124 = 1; | 3401 v124 = 1; |
3411 } | 3402 } |
3412 break; | 3403 break; |
3413 | 3404 |
3414 case PARTY_WalkForward: | 3405 case PARTY_WalkForward: |
3415 v17 = stru_5C6E00->SinCos(_angle_y); | 3406 { |
3416 v18 = (double)_walk_speed; | 3407 *(float *)&v128 = _walk_speed; |
3417 v126 = v17; | 3408 |
3418 *(float *)&v128 = v18; | 3409 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
3419 v124 = (unsigned __int64)(v17 * (signed __int64)(signed int)(signed __int64)(v18 * fWalkSpeedMultiplier)) >> 16; | 3410 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
3420 v2 += v124; | 3411 |
3421 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | 3412 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
3422 v124 = (unsigned __int64)(v126 | 3413 v2 += dx; |
3423 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16; | 3414 |
3424 v1 += v124; | 3415 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
3416 v1 += dy; | |
3417 | |
3425 v128 = v1; | 3418 v128 = v1; |
3426 v124 = 1; | 3419 v124 = 1; |
3420 } | |
3427 break; | 3421 break; |
3428 | 3422 |
3423 case PARTY_RunForward: | |
3424 { | |
3425 *(float *)&v128 = _walk_speed; | |
3426 | |
3427 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
3428 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
3429 | |
3430 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
3431 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
3432 | |
3433 if (pParty->bFlying) | |
3434 { | |
3435 v2 += 4 * dx; | |
3436 v1 += 4 * dy; | |
3437 | |
3438 v128 = v1; | |
3439 } | |
3440 else if (partyAtHighSlope && !v108) | |
3441 { | |
3442 v2 += dx; | |
3443 v1 += dy; | |
3444 | |
3445 v128 = v1; | |
3446 v124 = 1; | |
3447 } | |
3448 else | |
3449 { | |
3450 v2 += 2 * dx; | |
3451 v1 += 2 * dy; | |
3452 | |
3453 v128 = v1; | |
3454 v114 = 1; | |
3455 } | |
3456 } | |
3457 break; | |
3458 | |
3459 | |
3429 case PARTY_WalkBackward: | 3460 case PARTY_WalkBackward: |
3430 v19 = stru_5C6E00->SinCos(_angle_y); | 3461 { |
3431 v20 = (double)_walk_speed; | 3462 *(float *)&v128 = _walk_speed; |
3432 v126 = v19; | 3463 |
3433 *(float *)&v128 = v20; | 3464 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
3434 v124 = (unsigned __int64)(v19 | 3465 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
3435 * (signed __int64)(signed int)(signed __int64)(v20 * fBackwardWalkSpeedMultiplier)) >> 16; | 3466 |
3436 v2 -= v124; | 3467 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
3437 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | 3468 v2 -= dx; |
3438 v124 = (unsigned __int64)(v126 | 3469 |
3439 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 | 3470 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
3440 * fBackwardWalkSpeedMultiplier)) >> 16; | 3471 v1 -= dy; |
3441 v1 -= v124; | 3472 |
3442 v128 = v1; | 3473 v128 = v1; |
3443 v124 = 1; | 3474 v124 = 1; |
3475 } | |
3444 break; | 3476 break; |
3445 | 3477 |
3446 case PARTY_RunForward: | 3478 |
3447 if ( pParty->bFlying ) | 3479 case PARTY_RunBackward: |
3448 { | 3480 { |
3449 v21 = stru_5C6E00->SinCos(_angle_y); | 3481 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
3450 v22 = (double)_walk_speed; | 3482 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
3451 v126 = v21; | 3483 |
3452 *(float *)&v128 = v22; | 3484 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
3453 v129 = (unsigned __int64)(v21 | 3485 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
3454 * (signed __int64)(signed int)(4 | 3486 |
3455 * (unsigned __int64)(signed __int64)(v22 | 3487 if (pParty->bFlying) |
3456 * fWalkSpeedMultiplier))) >> 16; | 3488 { |
3457 v2 += v129; | 3489 v2 -= 4 * dx; |
3458 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | 3490 v1 -= 4 * dy; |
3459 v129 = (unsigned __int64)(v126 | 3491 v128 = v1; |
3460 * (signed __int64)(signed int)(4 | 3492 } |
3461 * (unsigned __int64)(signed __int64)(*(float *)&v128 | 3493 else |
3462 * fWalkSpeedMultiplier))) >> 16; | 3494 { |
3463 v1 += v129; | 3495 v2 -= dx; |
3464 goto LABEL_93; | 3496 v1 -= dy; |
3465 } | 3497 |
3466 if ( partyAtHighSlope && !v108 ) | |
3467 { | |
3468 v23 = stru_5C6E00->SinCos(_angle_y); | |
3469 v24 = (double)_walk_speed; | |
3470 v126 = v23; | |
3471 *(float *)&v128 = v24; | |
3472 v129 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; | |
3473 v2 += v129; | |
3474 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3475 v129 = (unsigned __int64)(v126 | |
3476 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16; | |
3477 v1 += v129; | |
3478 v128 = v1; | 3498 v128 = v1; |
3479 v124 = 1; | 3499 v124 = 1; |
3480 break; | 3500 } |
3481 } | 3501 } |
3482 v25 = stru_5C6E00->SinCos(_angle_y); | 3502 break; |
3483 v26 = (double)_walk_speed; | 3503 |
3484 v114 = v25; | 3504 |
3485 *(float *)&v128 = v26; | 3505 case PARTY_CenterView: |
3486 v129 = (unsigned __int64)(v25 | 3506 _angle_x = 0; |
3487 * (signed __int64)(signed int)(2 | 3507 break; |
3488 * (unsigned __int64)(signed __int64)(v26 | 3508 |
3489 * fWalkSpeedMultiplier))) >> 16; | |
3490 v2 += v129; | |
3491 v114 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3492 v129 = (unsigned __int64)((signed int)v114 | |
3493 * (signed __int64)(signed int)(2 | |
3494 * (unsigned __int64)(signed __int64)(*(float *)&v128 | |
3495 * fWalkSpeedMultiplier))) >> 16; | |
3496 v1 += v129; | |
3497 v114 = 1; | |
3498 v128 = v1; | |
3499 break; | |
3500 | |
3501 case PARTY_RunBackward: | |
3502 v27 = stru_5C6E00->SinCos(_angle_y); | |
3503 v28 = (double)_walk_speed; | |
3504 v126 = v27; | |
3505 *(float *)&v128 = v28; | |
3506 v29 = (signed __int64)(v28 * fBackwardWalkSpeedMultiplier); | |
3507 if ( pParty->bFlying ) | |
3508 { | |
3509 v129 = (unsigned __int64)(v126 * (signed __int64)(4 * (signed int)v29)) >> 16; | |
3510 v2 -= v129; | |
3511 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3512 v129 = (unsigned __int64)(v126 | |
3513 * (signed __int64)(signed int)(4 | |
3514 * (unsigned __int64)(signed __int64)(*(float *)&v128 | |
3515 * fBackwardWalkSpeedMultiplier))) >> 16; | |
3516 v1 -= v129; | |
3517 LABEL_93: | |
3518 v128 = v1; | |
3519 } | |
3520 else | |
3521 { | |
3522 v129 = (unsigned __int64)(v126 * (signed __int64)(signed int)v29) >> 16; | |
3523 v2 -= v129; | |
3524 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); | |
3525 v129 = (unsigned __int64)(v126 | |
3526 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 | |
3527 * fBackwardWalkSpeedMultiplier)) >> 16; | |
3528 v1 -= v129; | |
3529 //LABEL_86: | |
3530 v128 = v1; | |
3531 v124 = 1; | |
3532 } | |
3533 break; | |
3534 case PARTY_LookUp: | 3509 case PARTY_LookUp: |
3535 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | 3510 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); |
3536 if ( _angle_x > 128 ) | 3511 if ( _angle_x > 128 ) |
3537 _angle_x = 128; | 3512 _angle_x = 128; |
3538 v30 = uActiveCharacter; | 3513 if (uActiveCharacter) |
3539 if ( !uActiveCharacter ) | 3514 pPlayers[uActiveCharacter]->PlaySound(63, 0); |
3540 goto LABEL_118; | 3515 break; |
3541 v95 = 0; | 3516 |
3542 v93 = 63; | |
3543 goto _play_player_sound; | |
3544 case PARTY_LookDown: | 3517 case PARTY_LookDown: |
3545 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | 3518 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); |
3546 if ( _angle_x < -128 ) | 3519 if ( _angle_x < -128 ) |
3547 _angle_x = -128; | 3520 _angle_x = -128; |
3548 v30 = uActiveCharacter; | 3521 if (uActiveCharacter) |
3549 if ( uActiveCharacter ) | 3522 pPlayers[uActiveCharacter]->PlaySound(64, 0); |
3550 { | 3523 break; |
3551 v95 = 0; | 3524 |
3552 v93 = 64; | |
3553 _play_player_sound: | |
3554 pPlayers[v30]->PlaySound(v93, v95); | |
3555 } | |
3556 goto LABEL_118; | |
3557 case PARTY_CenterView: | |
3558 _angle_x = 0; | |
3559 goto LABEL_118; | |
3560 case PARTY_Jump: | 3525 case PARTY_Jump: |
3561 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) | 3526 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) |
3562 { | 3527 { |
3563 v126 = pParty->field_24 << 6; | 3528 v126 = pParty->field_24 << 6; |
3564 bJumping = 1; | 3529 bJumping = 1; |
3565 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); | 3530 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); |
3566 } | 3531 } |
3567 goto LABEL_118; | 3532 break; |
3533 | |
3568 default: | 3534 default: |
3569 goto LABEL_118; | 3535 assert(false); |
3536 | |
3570 case PARTY_Land: | 3537 case PARTY_Land: |
3571 if ( pParty->bFlying ) | 3538 if (pParty->bFlying) |
3572 { | 3539 { |
3573 BYTE1(pParty->uFlags) |= 1u; | 3540 BYTE1(pParty->uFlags) |= 1u; |
3574 pParty->uFallSpeed = 0; | 3541 pParty->uFallSpeed = 0; |
3575 } | 3542 } |
3576 pParty->bFlying = 0; | 3543 pParty->bFlying = false; |
3577 pPartyActionQueue->uNumActions = 0; | 3544 pPartyActionQueue->uNumActions = 0; |
3578 goto LABEL_123; | 3545 break; |
3579 } | 3546 } |
3580 } | 3547 } |
3548 | |
3581 LABEL_123: | 3549 LABEL_123: |
3582 pParty->sRotationY = _angle_y; | 3550 pParty->sRotationY = _angle_y; |
3583 pParty->sRotationX = _angle_x; | 3551 pParty->sRotationX = _angle_x; |
3584 if ( v123 < v111 ) | 3552 if ( v123 < v111 ) |
3585 { | 3553 { |