# HG changeset patch # User Nomad # Date 1361341392 -7200 # Node ID d720a13e2273cfe604c5df1692335e67d9a8c54e # Parent ce39b96acf5caa478df5c6ab57529965986342af Very basic picking & entering houses diff -r ce39b96acf5c -r d720a13e2273 Actor.cpp --- a/Actor.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Actor.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -3346,12 +3346,11 @@ v18 = 16; if ( arg0 % 2 ) v18 = -16; - v12 = ((unsigned __int64)(stru_5C6E00->SinCos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) - * (signed __int64)v10->uDistanceXZ) >> 16) + v12 = ((unsigned __int64)(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) * (signed __int64)v10->uDistanceXZ) >> 16) + pParty->vPosition.x; v13 = stru_5C6E00->uIntegerPi + v10->uYawAngle; v17 = v12; - v19 = stru_5C6E00->SinCos(v18 + v13 - stru_5C6E00->uIntegerHalfPi); + v19 = stru_5C6E00->Sin(v18 + v13); v7->uYawAngle = stru_5C6E00->Atan2( v17 - v7->vPosition.x, pParty->vPosition.y @@ -4128,10 +4127,10 @@ v8->uMovementSpeed = v11; v12 = rand(); v13 = v12 % 2048; - v14 = stru_5C6E00->SinCos(v12 % 2048); + v14 = stru_5C6E00->Cos(v12 % 2048); v26 = v14; v15 = ((unsigned __int64)(v14 * (signed __int64)v27) >> 16) + v30->vPosition.x; - v16 = stru_5C6E00->SinCos(v13 - stru_5C6E00->uIntegerHalfPi); + v16 = stru_5C6E00->Sin(v13); v26 = v16; v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16; LOWORD(v16) = uFaceID; diff -r ce39b96acf5c -r d720a13e2273 Game.cpp --- a/Game.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Game.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -624,7 +624,7 @@ } //depth = v2; - PickMouse(depth, y, x, true, v10, v11); + PickMouse(depth, y, x, false, v10, v11); pLightmapBuilder->std__vector_000004_size = 0; pLightmapBuilder->std__vector_183808_size = 0; pDecalBuilder->std__vector_pDecals_size = 0; @@ -1114,6 +1114,7 @@ } else assert(false); } + break; default: { diff -r ce39b96acf5c -r d720a13e2273 Indoor.cpp --- a/Indoor.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Indoor.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -192,10 +192,10 @@ } if ( pRenderer->pRenderD3D ) { - v3->sCosineY = stru_5C6E00->SinCos(v3->sPartyRotY); - v3->sSineY = stru_5C6E00->SinCos(v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); - v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v3->sCosineY = stru_5C6E00->Cos(v3->sPartyRotY); + v3->sSineY = stru_5C6E00->Sin(v3->sPartyRotY); + v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); + v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); v3->fCosineY = cos((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)v3->sPartyRotY * 0.00048828125); v3->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-v3->sPartyRotX * 0.00048828125); @@ -214,10 +214,10 @@ } else { - v3->sCosineY = stru_5C6E00->SinCos(-v3->sPartyRotY); - v3->sSineY = stru_5C6E00->SinCos(-v3->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v3->sCosineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX); - v3->sSineNegX = stru_5C6E00->SinCos(-v3->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v3->sCosineY = stru_5C6E00->Cos(-v3->sPartyRotY); + v3->sSineY = stru_5C6E00->Sin(-v3->sPartyRotY); + v3->sCosineNegX = stru_5C6E00->Cos(-v3->sPartyRotX); + v3->sSineNegX = stru_5C6E00->Sin(-v3->sPartyRotX); v17 = cos((double)-v3->sPartyRotY * 0.0030664064); v18 = v3->sPartyRotY; v3->fCosineY = v17; @@ -372,10 +372,8 @@ _this.uFlags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; _this.field_0_timer = pEventTimer->uTotalGameTimeElapsed; - _this.vPosition.x = pParty->vPosition.x - - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) - * (signed __int64)pParty->y_rotation_granularity) >> 16); - v2 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); + _this.vPosition.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + v2 = stru_5C6E00->Sin(pParty->sRotationY); v3 = (unsigned __int64)(v2 * (signed __int64)pParty->y_rotation_granularity) >> 16; _this.field_1C_mb_fov = 65; _this.vPosition.y = pParty->vPosition.y - v3; @@ -4030,18 +4028,18 @@ v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6); if ( v6 > 1000 ) v6 = 1000; - v12 = stru_5C6E00->SinCos(v0->uYawAngle); + v12 = stru_5C6E00->Cos(v0->uYawAngle); uSectorID = v12; v13 = v12 * (signed __int64)v6; v61 = v13 >> 16; v0->vVelocity.x = WORD1(v13); - uSectorID = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); + uSectorID = stru_5C6E00->Sin(v0->uYawAngle); v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; v7 = v62 == 0; v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; if ( !v7 ) { - v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi); + v14 = stru_5C6E00->Sin(v0->uPitchAngle); uSectorID = v14; v15 = v14 * (signed __int64)v6; v61 = v15 >> 16; @@ -4229,11 +4227,11 @@ v45 = stru_5C6E00->Atan2( v0->vPosition.x - pLevelDecorations[v37].vPosition.x, v0->vPosition.y - pLevelDecorations[v37].vPosition.y); - v54 = stru_5C6E00->SinCos(v45); + v54 = stru_5C6E00->Cos(v45); v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16; v46 = v45 - stru_5C6E00->uIntegerHalfPi; v0->vVelocity.x = v54 * _this >> 16; - v47 = stru_5C6E00->SinCos(v46); + v47 = stru_5C6E00->Sin(v45); v54 = v47; v48 = v47 * (signed __int64)(signed int)_this; v56 = v48 >> 16; diff -r ce39b96acf5c -r d720a13e2273 IndoorCamera.cpp --- a/IndoorCamera.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/IndoorCamera.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -102,11 +102,11 @@ fRotationXCosine = cos(v2 * 0.00048828125); //v5 = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi); //v6 = sRotationY; - _int_sine = stru_5C6E00->SinCos(sRotationY - stru_5C6E00->uIntegerHalfPi); - _int_cosine = stru_5C6E00->SinCos(sRotationY); + _int_sine = stru_5C6E00->Sin(sRotationY); + _int_cosine = stru_5C6E00->Cos(sRotationY); //v7 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi); //v8 = sRotationX; - _int_sine_2 = stru_5C6E00->SinCos(sRotationX - stru_5C6E00->uIntegerHalfPi); - _int_cosine_2 = stru_5C6E00->SinCos(sRotationX); + _int_sine_2 = stru_5C6E00->Sin(sRotationX); + _int_cosine_2 = stru_5C6E00->Cos(sRotationX); } // 4D864C: using guessed type char byte_4D864C; \ No newline at end of file diff -r ce39b96acf5c -r d720a13e2273 Keyboard.cpp --- a/Keyboard.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Keyboard.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -37,6 +37,7 @@ { uLastKeyPressed = 0; field_204 = 0; + pWindow = nullptr; SetDefaultMapping(); ReadMappings(); diff -r ce39b96acf5c -r d720a13e2273 Math.h --- a/Math.h Wed Feb 20 04:36:14 2013 +0200 +++ b/Math.h Wed Feb 20 08:23:12 2013 +0200 @@ -7,9 +7,9 @@ struct stru193_math { stru193_math(); - int SinCos(int angle); + int Cos(int angle); unsigned int Atan2(int x, int y); - int _42EBDB(int angle); + int Sin(int angle); int pTanTable[520]; int pCosTable[520]; diff -r ce39b96acf5c -r d720a13e2273 Outdoor.cpp --- a/Outdoor.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Outdoor.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -57,10 +57,8 @@ pIndoorCamera->sRotationX = pParty->sRotationX; pIndoorCamera->sRotationY = pParty->sRotationY; - pIndoorCamera->pos.x = pParty->vPosition.x - - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) - * (signed __int64)pParty->y_rotation_granularity) >> 16); - pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); + pIndoorCamera->pos.x = pParty->vPosition.x - ((stru_5C6E00->Cos(pParty->sRotationY) * (signed __int64)pParty->y_rotation_granularity) >> 16); + pIndoorCamera->pos.y = pParty->vPosition.y - pParty->y_rotation_granularity * (stru_5C6E00->Sin(pParty->sRotationY) >> 16); pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; if (bRedraw || pRenderer->pRenderD3D) { @@ -470,10 +468,10 @@ { v3 = pParty->uCurrentMinute + 60 * (pParty->uCurrentHour - 5); v4 = (signed int)(v3 * stru_5C6E00->uIntegerPi) / 960; - v5 = stru_5C6E00->SinCos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); + v5 = stru_5C6E00->Cos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); v2->field_D1C = 0; v2->field_D18 = v5; - v6 = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); + v6 = stru_5C6E00->Sin(v4); v7 = v2->field_D18; v2->field_D20 = v6; v2->vSunlight.x = -v7; diff -r ce39b96acf5c -r d720a13e2273 ParticleEngine.cpp --- a/ParticleEngine.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/ParticleEngine.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -468,10 +468,10 @@ int uIDb; // [sp+58h] [bp+8h]@9 v2 = this; - v3 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); - v44 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); - v4 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - v5 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v3 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); + v44 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); + v4 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + v5 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v6 = &v2->pParticles[uID]; if ( v6->uType ) { diff -r ce39b96acf5c -r d720a13e2273 Render.cpp --- a/Render.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Render.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -610,10 +610,10 @@ array_77EC08[1999].field_58 = 23 - (-20 * pOutdoor->vSunlight.z >> 16); if ( array_77EC08[1999].field_58 > 20 ) array_77EC08[1999].field_58 = 20; - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); + v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); array_77EC08[1999].v_18.y = 0; array_77EC08[1999].v_18.x = v10; - array_77EC08[1999].v_18.z = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); + array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX); array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16); a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pOutdoorCamera->int_fov_rad) / ((double)pOutdoorCamera->int_fov_rad + 8192.0) @@ -627,10 +627,10 @@ if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) ) return (signed __int16)v2; array_77EC08[1999].field_58 = 0; - v11 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16 - stru_5C6E00->uIntegerHalfPi); + v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); array_77EC08[1999].v_18.y = 0; array_77EC08[1999].v_18.x = -v11; - array_77EC08[1999].v_18.z = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16); + array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); LOWORD(v2) = 224 * LOWORD(pMiscTimer->uTotalGameTimeElapsed); array_77EC08[1999].field_24 = 0x2000000u; array_77EC08[1999].sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; @@ -729,13 +729,6 @@ } return (signed __int16)v2; } -// 6BE030: using guessed type int day_attrib; -// 6BE3C4: using guessed type char bUnderwater; -// 80AA10: using guessed type char byte_80AA10; -// 80AA14: using guessed type int dword_80AA14; -// 80AA18: using guessed type int dword_80AA18; -// 80AA1C: using guessed type int dword_80AA1C; -// 80AA20: using guessed type int dword_80AA20; //----- (00485044) -------------------------------------------------------- int Render::DrawSkySW(Span *a1, stru148 *a2, int a3) @@ -1034,8 +1027,8 @@ v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 - v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->SinCos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; - v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->SinCos(pDirectionIndicator2 - stru_5C6E00->uIntegerHalfPi)) >> 16; + v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; + v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16; v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; v2 = pOutdoorCamera->uCameraFovInDegrees + 15; @@ -1047,10 +1040,10 @@ v3 = (v2 << 11) / 720; v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1); - v106 = stru_5C6E00->SinCos(v4); - uEndZ = stru_5C6E00->SinCos(v4 - stru_5C6E00->uIntegerHalfPi); - v111 = stru_5C6E00->SinCos(v5); - v6 = stru_5C6E00->SinCos(v5 - stru_5C6E00->uIntegerHalfPi); + v106 = stru_5C6E00->Cos(v4); + uEndZ = stru_5C6E00->Sin(v4); + v111 = stru_5C6E00->Cos(v5); + v6 = stru_5C6E00->Sin(v5); v7 = v4 & stru_5C6E00->uPiMask; if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) @@ -3042,7 +3035,7 @@ billboard.pPalette = pPaletteManager->field_261600[*((short *)v1 - 7)]; if ( !(billboard.uFlags & 0x40) && billboard.uFlags & 0x80 ) { - v12 = stru_5C6E00->SinCos(i * 5 + GetTickCount()); + v12 = stru_5C6E00->Cos(i * 5 + GetTickCount()); v15 = abs(v12); v18 = (unsigned __int64)(15i64 * v15) >> 16; billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(*((short *)v1 - 7), 15 - v18, 1); @@ -4437,7 +4430,7 @@ { if ( !v54 || byte_4D864C && pGame->uFlags & 2 ) { - ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));//Режимы визуализации точечных спрайтов + ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW)); if (bUsingSpecular) { @@ -4479,6 +4472,18 @@ } while ( !v18 ); } + + if (a4->uAttributes & FACE_OUTLINED) + { + int color; + if (GetTickCount() % 300 >= 150) + color = 0xFFFF2020; + else color = 0xFF901010; + + for (uint i = 0; i < uNumVertices; ++i) + d3d_vertex_buffer[i].diffuse = color; + } + pRenderD3D->pDevice->SetTexture(0, pTexture); pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, @@ -8171,10 +8176,10 @@ v15 = v14; v16 = (double)(v9 - 12) - v12; v17 = (double)(v10 - 25) - v14; - v18 = stru_5C6E00->SinCos(angle); - v19 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v21 = stru_5C6E00->SinCos(angle); + v18 = stru_5C6E00->Cos(angle); + v19 = stru_5C6E00->Sin(angle); + v20 = stru_5C6E00->Sin(angle); + v21 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 @@ -8196,10 +8201,10 @@ pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; v31 = (double)(a2->uScreenSpaceX + 12) - v13; v32 = (double)a2->uScreenSpaceY - v15; - v25 = stru_5C6E00->SinCos(angle); - v26 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v27 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v28 = stru_5C6E00->SinCos(angle); + v25 = stru_5C6E00->Cos(angle); + v26 = stru_5C6E00->Sin(angle); + v27 = stru_5C6E00->Sin(angle); + v28 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + (double)(v25 >> 16)) * v23 @@ -8222,10 +8227,10 @@ pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; v23 = (double)(a2->uScreenSpaceX - 12) - v13; v24 = (double)a2->uScreenSpaceY - v15; - v33 = stru_5C6E00->SinCos(angle); - v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v35 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v36 = stru_5C6E00->SinCos(angle); + v33 = stru_5C6E00->Cos(angle); + v34 = stru_5C6E00->Sin(angle); + v35 = stru_5C6E00->Sin(angle); + v36 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + (double)(v33 >> 16)) * v31 @@ -8248,10 +8253,10 @@ pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; v39 = (double)(a2->uScreenSpaceX + 12) - v13; v40 = (double)(a2->uScreenSpaceY - 25) - v15; - v41 = stru_5C6E00->SinCos(angle); - v42 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v43 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v44 = stru_5C6E00->SinCos(angle); + v41 = stru_5C6E00->Cos(angle); + v42 = stru_5C6E00->Sin(angle); + v43 = stru_5C6E00->Sin(angle); + v44 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v41 * 0.000015259022 + (double)(v41 >> 16)) * v39 @@ -8345,11 +8350,11 @@ v15 = v14; v16 = (double)(v9 - 12) - v12; v17 = (double)(v10 - 25) - v14; - v18 = stru_5C6E00->SinCos(angle); + v18 = stru_5C6E00->Cos(angle); v19 = angle - stru_5C6E00->uIntegerHalfPi; - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v21 = stru_5C6E00->SinCos(v19); - v22 = stru_5C6E00->SinCos(angle); + v20 = stru_5C6E00->Sin(angle); + v21 = stru_5C6E00->Sin(angle); + v22 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[0].pos.x = (((double)(unsigned __int16)v18 * 0.000015259022 + (double)(v18 >> 16)) * v16 @@ -8373,10 +8378,10 @@ pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; v26 = (double)(a2->uScreenSpaceX - 12) - v13; v27 = (double)a2->uScreenSpaceY - v15; - v28 = stru_5C6E00->SinCos(angle); - v29 = stru_5C6E00->SinCos(v19); - v30 = stru_5C6E00->SinCos(v19); - v31 = stru_5C6E00->SinCos(angle); + v28 = stru_5C6E00->Cos(angle); + v29 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v30 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v31 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v26 @@ -8398,10 +8403,10 @@ pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; v33 = (double)(a2->uScreenSpaceX + 12) - v13; v34 = (double)a2->uScreenSpaceY - v15; - v35 = stru_5C6E00->SinCos(angle); - v36 = stru_5C6E00->SinCos(v19); - v37 = stru_5C6E00->SinCos(v19); - v38 = stru_5C6E00->SinCos(angle); + v35 = stru_5C6E00->Cos(angle); + v36 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v37 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v38 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v33 @@ -8423,10 +8428,10 @@ pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; v40 = (double)(a2->uScreenSpaceX + 12) - v13; v41 = (double)(a2->uScreenSpaceY - 25) - v15; - v42 = stru_5C6E00->SinCos(angle); - v43 = stru_5C6E00->SinCos(v19); - v44 = stru_5C6E00->SinCos(v19); - v45 = stru_5C6E00->SinCos(angle); + v42 = stru_5C6E00->Cos(angle); + v43 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v44 = stru_5C6E00->Sin(v19 + stru_5C6E00->uIntegerHalfPi); + v45 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[3].pos.x = (((double)(unsigned __int16)v42 * 0.000015259022 + (double)(v42 >> 16)) * v40 diff -r ce39b96acf5c -r d720a13e2273 VideoPlayer.cpp --- a/VideoPlayer.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/VideoPlayer.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -952,8 +952,7 @@ { Prepare(); v3->bLoopPlaying = a3_1; - __debugbreak(); // VideoPlayer is larger than this - if ( v3[1].pVideoFrame.pName[0] == 1 ) + if ( LOBYTE(v3->field_104) == 1 ) { v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; v12 = "Unsupported Bink playback!"; diff -r ce39b96acf5c -r d720a13e2273 VideoPlayer.h --- a/VideoPlayer.h Wed Feb 20 04:36:14 2013 +0200 +++ b/VideoPlayer.h Wed Feb 20 08:23:12 2013 +0200 @@ -185,6 +185,7 @@ int dword_0000A0; char pCurrentMovieName[64]; char pVideoFrameTextureFilename[32]; + int field_104; }; #pragma pack(pop) diff -r ce39b96acf5c -r d720a13e2273 Vis.cpp --- a/Vis.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/Vis.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -386,21 +386,20 @@ } //----- (004C17CF) -------------------------------------------------------- -void Vis::PickOutdoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool one_sided) +void Vis::PickOutdoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable) { if (!pOutdoor) return; for (uint i = 0; i < pOutdoor->uNumBModels; ++i) { - int v24; - if (!IsBModelVisible(i, &v24)) + int reachable; + if (!IsBModelVisible(i, &reachable)) continue; - if (one_sided && !v24) + if (!reachable && only_reachable) continue; auto bmodel = &pOutdoor->pBModels[i]; - for (uint j = 0; j < bmodel->uNumFaces; ++j) { auto face = bmodel->pFaces + j; @@ -414,10 +413,15 @@ { pGame->pIndoorCameraD3D->ViewTransform(&intersection, 1u); int v13 = _48B561_mess_with_scaling_along_z(/*v12, */intersection.vWorldViewPosition.x); - LOWORD(v13) = (8 * (j | (i << 6)) | OBJECT_BModel) + v13; + v13 += (8 * (j | (i << 6)) | OBJECT_BModel); list->AddObject(face, VisObjectType_Face, v13); } + + if (blv_face.uAttributes & 0x80000000) + face->uAttributes |= FACE_OUTLINED; + else + face->uAttributes &= ~FACE_OUTLINED; } } } @@ -575,62 +579,118 @@ //----- (004C1C0C) -------------------------------------------------------- bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *a4, BLVFace *a5, unsigned int a6) { - BLVFace *v7; // ebx@1 - bool result; // eax@1 + //BLVFace *v7; // ebx@1 + //bool result; // eax@1 double v9; // st7@3 - __int16 v10; // fps@3 - char v11; // c0@3 - char v12; // c2@3 - char v13; // c3@3 - __int16 v14; // fps@5 - char v15; // c0@5 - char v16; // c2@5 - char v17; // c3@5 + //__int16 v10; // fps@3 + //char v11; // c0@3 + //char v12; // c2@3 + //char v13; // c3@3 + //__int16 v14; // fps@5 + //char v15; // c0@5 + //char v16; // c2@5 + //char v17; // c3@5 double v18; // st5@6 - __int16 v19; // fps@6 - char v20; // c0@6 - char v21; // c2@6 - char v22; // c3@6 - unsigned __int8 v23; // c0@6 - char v24; // c2@6 - unsigned __int8 v25; // c3@6 - char v26; // zf@6 + //__int16 v19; // fps@6 + //char v20; // c0@6 + //char v21; // c2@6 + //char v22; // c3@6 + //unsigned __int8 v23; // c0@6 + //char v24; // c2@6 + //unsigned __int8 v25; // c3@6 + //char v26; // zf@6 double v27; // st6@10 - __int16 v28; // fps@10 - unsigned __int8 v29; // c0@10 - char v30; // c2@10 - unsigned __int8 v31; // c3@10 - double v32; // st7@11 + //__int16 v28; // fps@10 + //unsigned __int8 v29; // c0@10 + //char v30; // c2@10 + //unsigned __int8 v31; // c3@10 + //double v32; // st7@11 Vec2_short_ v33; // ST1E_4@11 Vec3_short_ v34; // ST04_6@11 - float a5a; // [sp+30h] [bp+18h]@10 - float a5b; // [sp+30h] [bp+18h]@13 + //float a5a; // [sp+30h] [bp+18h]@10 + //float a5b; // [sp+30h] [bp+18h]@13 + + if (a5->TwoSided() || a5->Invisible()) + return false; + + + int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x, + ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y, + ray_dir_z = pRayEnd->vWorldPosition.z - pRayStart->vWorldPosition.z; + + v9 = ray_dir_z * a5->pFacePlane.vNormal.z + + ray_dir_y * a5->pFacePlane.vNormal.y + + ray_dir_x * a5->pFacePlane.vNormal.x; + if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) + return false; + +//ray = t dir + start +//plane = (p - vertex) normal = -d +// +// +//(t dir + start - vertex) normal = -d +// +// -d - (start - vertex) norm +//t = -------------------- +// dir norm + + + float dir_mag = sqrtf(ray_dir_x * ray_dir_x + ray_dir_y * ray_dir_y + ray_dir_z * ray_dir_z); + float ndir_x = ray_dir_x / dir_mag, + ndir_y = ray_dir_y / dir_mag, + ndir_z = ray_dir_z / dir_mag; + + int face_center_x = (a5->pBounding.x1 + a5->pBounding.x2) / 2, + face_center_y = (a5->pBounding.y1 + a5->pBounding.y2) / 2, + face_center_z = (a5->pBounding.z1 + a5->pBounding.z2) / 2; - v7 = a5; - result = a5->uAttributes; - if ( result & 1 - || BYTE1(result) & 0x20 - || (v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z - + a5->pFacePlane.vNormal.y * pRayEnd->vWorldPosition.y - + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x, - //UNDEF(v10), - v11 = v9 < 0.0, - v12 = 0, - v13 = v9 == 0.0, - BYTE1(result) = HIBYTE(v10), - v9 == 0.0) - || (/*UNDEF(v14),*/ v15 = v9 < 0.0, v16 = 0, v17 = v9 == 0.0, BYTE1(result) = HIBYTE(v14), v9 > 0.0) )// ray's away (>) from face surface or parallel (==) - goto LABEL_12; - v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y// ray-plane intersection + int to_plane_x = pRayStart->vWorldPosition.x - face_center_x, + to_plane_y = pRayStart->vWorldPosition.y - face_center_y, + to_plane_z = pRayStart->vWorldPosition.z - face_center_z; + + float t = /*-a5->pFacePlane.dist*/ - (to_plane_x * a5->pFacePlane.vNormal.x + to_plane_y * a5->pFacePlane.vNormal.y + to_plane_y * a5->pFacePlane.vNormal.z) / + (ndir_x * a5->pFacePlane.vNormal.x + ndir_y * a5->pFacePlane.vNormal.y + ndir_z * a5->pFacePlane.vNormal.z); + if (t <= *pDepth) + { + int intersection_x = pRayStart->vWorldPosition.x + ndir_x * t, + intersection_y = pRayStart->vWorldPosition.y + ndir_y * t, + intersection_z = pRayStart->vWorldPosition.z + ndir_z * t; + + if (intersection_x < a5->pBounding.x1 || intersection_x > a5->pBounding.x2 || + intersection_y < a5->pBounding.y1 || intersection_y > a5->pBounding.y2 || + intersection_z < a5->pBounding.z1 || intersection_z > a5->pBounding.z2) + return false; + + a5->uAttributes |= 0x80000000; + return true; + } + + + return false; + +// v7 = a5; + //result = a5->uAttributes; + v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z + + pRayEnd->vWorldPosition.y * a5->pFacePlane.vNormal.y + + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x; + if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) + return false; + + a5->uAttributes |= 0x80000000; + return false; + + v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y + pRayStart->vWorldPosition.x * a5->pFacePlane.vNormal.x + pRayStart->vWorldPosition.z * a5->pFacePlane.vNormal.z + a5->pFacePlane.dist); + if (v18 > 0) + return false; //UNDEF(v19); - v20 = v9 < 0.0; - v21 = 0; - v22 = v9 == 0.0; - BYTE1(result) = HIBYTE(v19); - v23 = v18 < 0.0; + //v20 = v9 < 0.0; + //v21 = 0; + //v22 = v9 == 0.0; + //BYTE1(result) = HIBYTE(v19); + /*v23 = v18 < 0.0; v24 = 0; v25 = v18 == 0.0; v26 = (BYTE1(result) & 0x41) == 0; @@ -648,32 +708,37 @@ LOBYTE(result) = 0; return result; } - } - a5a = v18; - v27 = a5a / v9; - HIWORD(result) = HIWORD(pDepth); + }*/ + + //a5a = v18; + v27 = v18 / v9; + //HIWORD(result) = HIWORD(pDepth); //UNDEF(v28); - v29 = v27 < *pDepth; - v30 = 0; - v31 = v27 == *pDepth; - BYTE1(result) = HIBYTE(v28); - if ( !(v29 | v31) - || (a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x, - a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y, - v32 = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z, - a4->vWorldPosition.z = v32, - v33.x = (signed __int64)a4->vWorldPosition.x, - v33.y = (signed __int64)a4->vWorldPosition.y, - *(int *)&v34.x = v33.x, - v34.z = (signed __int64)v32, - result = _4C1D2B(v7, v34, a6), - *(float *)&result == 0.0) ) - goto LABEL_12; - *(float *)&result = v27; - a5b = v27; - *(int *)pDepth = LODWORD(a5b); - LOBYTE(result) = 1; - return result; + //v29 = v27 < *pDepth; + //v30 = 0; + //v31 = v27 == *pDepth; + //BYTE1(result) = HIBYTE(v28); + + if (v27 > *pDepth) + return false; + + a5->uAttributes |= 0x80000000; + + a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x; + a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y; + a4->vWorldPosition.z = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z; + v33.x = (signed __int64)a4->vWorldPosition.x; + v33.y = (signed __int64)a4->vWorldPosition.y; + v34.x = v33.x; + v34.y = 0; + v34.z = (signed __int64)a4->vWorldPosition.z; + + if ( _4C1D2B(a5, v34, a6) == 0.0) + return false; + + //a5b = v27; + *pDepth = v27; + return true; } //----- (004C1D2B) -------------------------------------------------------- @@ -694,63 +759,54 @@ signed int v16; // [sp+18h] [bp-4h]@10 v4 = pFace; - if ( a2.z < pFace->pBounding.z1 - || a2.z > pFace->pBounding.z2 - || a2.x < pFace->pBounding.x1 - || a2.x > pFace->pBounding.x2 - || a2.y < pFace->pBounding.y1 - || a2.y > pFace->pBounding.y2 - || (uModelID != -1 ? _4C2186_BLV_IntersectBModel( - (int *)&pFace, - (int *)&uModelID, - &word_F8BC48_displaced_face_intersect_plane_coords_a, - &word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, - pFace, - uModelID) : _4C1EE5_BLV_IntersectBModel_2( - (int *)&pFace, - (int *)&uModelID, - &word_F8BC48_displaced_face_intersect_plane_coords_a, - &word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, - pFace), - v5 = 2 * v4->uNumVertices, - v16 = 0, - *(&word_F8BC48_displaced_face_intersect_plane_coords_a + v5) = word_F8BC48_displaced_face_intersect_plane_coords_a, - *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v5) = word_F8BD18_displaced_face_intersect_plane_coords_b, - v15 = 0, - v6 = word_F8BD18_displaced_face_intersect_plane_coords_b >= (signed int)uModelID, - v5 <= 0) ) - goto LABEL_25; + if (a2.z < pFace->pBounding.z1 || a2.z > pFace->pBounding.z2 || + a2.x < pFace->pBounding.x1 || a2.x > pFace->pBounding.x2 || + a2.y < pFace->pBounding.y1 || a2.y > pFace->pBounding.y2) + return false; + + if (uModelID != -1) + _4C2186_BLV_IntersectBModel((int *)&pFace, (int *)&uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace, uModelID); + else + _4C1EE5_BLV_IntersectBModel_2((int *)&pFace, (int *)&uModelID, + word_F8BC48_displaced_face_intersect_plane_coords_a, + word_F8BD18_displaced_face_intersect_plane_coords_b, + &a2, pFace); + + v5 = 2 * v4->uNumVertices; + v16 = 0; + word_F8BC48_displaced_face_intersect_plane_coords_a[v5] = word_F8BC48_displaced_face_intersect_plane_coords_a[0]; + word_F8BD18_displaced_face_intersect_plane_coords_b[v5] = word_F8BD18_displaced_face_intersect_plane_coords_b[0]; + v15 = 0; + v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[0] >= (signed int)uModelID; + if (v5 <= 0) + return false; + do { if ( v16 >= 2 ) break; v7 = 2 * v15; - v8 = *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v15 + 1); + v8 = word_F8BD18_displaced_face_intersect_plane_coords_b[ + v15 + 1]; if ( v6 ^ v8 >= (signed int)uModelID ) { - v9 = *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7 + 2); + v9 = word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2 + 1]; if ( v9 >= (signed int)pFace ) v10 = 0; else v10 = 2; - v11 = v10 | *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) < (signed int)pFace; + v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] < (signed int)pFace; if ( v11 != 3 ) { if ( !v11 - || (v12 = v9 - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7), + || (v12 = v9 - word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2], LODWORD(v13) = v12 << 16, HIDWORD(v13) = v12 >> 16, - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) - + ((signed int)(((unsigned __int64)(v13 - / (v8 - - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b - + v7)) - * (signed int)((uModelID - - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b - + v7)) << 16)) >> 16) - + 32768) >> 16) >= (signed int)pFace) ) + word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] + + ((signed int)(((unsigned __int64)(v13 / (v8 - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) + * (signed int)((uModelID - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) << 16)) >> 16) + 32768) >> 16) >= (signed int)pFace) ) ++v16; } } @@ -1484,7 +1540,7 @@ PickOutdoorFaces_Mouse(fDepth, pMouseRay, &default_list, face_filter, false); else { - Log::Warning(L"Picking mouse in undefined level"); // picking in main menu is default (buggy) game behavious. should've returned false in Game::PickMouse + Log::Warning(L"Picking mouse in undefined level"); // picking in main menu is default (buggy) game behaviour. should've returned false in Game::PickMouse return false; } default_list.create_object_pointers(Vis_SelectionList::All); diff -r ce39b96acf5c -r d720a13e2273 Vis.h --- a/Vis.h Wed Feb 20 04:36:14 2013 +0200 +++ b/Vis.h Wed Feb 20 08:23:12 2013 +0200 @@ -96,7 +96,7 @@ bool PickMouse(float fDepth, float fMouseX, float fMouseY, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter); void PickBillboards_Mouse(float fPickDepth, float fX, float fY, Vis_SelectionList *list, Vis_SelectionFilter *filter); void PickIndoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter); - void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool one_sided); + void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable); bool is_part_of_selection(void *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, Vis_SelectionFilter *filter); bool DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx); diff -r ce39b96acf5c -r d720a13e2273 mm7_1.cpp --- a/mm7_1.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_1.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -4877,7 +4877,7 @@ pMouse->GetClickPos(&pX, &pY); if ( pX < 0 || (signed int)pX > 639 || pY < 0 || (signed int)pY > 479 )//( (pX & 0x80000000u) != 0 || (signed int)pX > 639 || (pY & 0x80000000u) != 0 || (signed int)pY > 479 ) return; - if ( !pCurrentScreen ) + if (pCurrentScreen == SCREEN_GAME) { if ( (signed int)pX > 467 || (signed int)pY > 351 ) goto _click_on_game_ui; diff -r ce39b96acf5c -r d720a13e2273 mm7_2.cpp --- a/mm7_2.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_2.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -7726,11 +7726,11 @@ pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v32 = rand(); v33 = v32 % 2048; - v34 = stru_5C6E00->SinCos(v32 % 2048); + v34 = stru_5C6E00->Cos(v32 % 2048); a4 = v34; a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; pPosX = a3 + spawn->vPosition.x; - v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); + v35 = stru_5C6E00->Sin(v33); a4 = v35; a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; a4 = a3 + spawn->vPosition.y; @@ -7844,8 +7844,8 @@ v6->pMonsterInfo.uExp = 0; v6->uMovementSpeed = v9; v10 = rand() % 2048; - v11 = ((unsigned __int64)(stru_5C6E00->SinCos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; - uFaceID = stru_5C6E00->SinCos(v10 - stru_5C6E00->uIntegerHalfPi); + v11 = ((unsigned __int64)(stru_5C6E00->Cos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; + uFaceID = stru_5C6E00->Sin(v10); v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; v12 = pParty->vPosition.y; v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; @@ -8375,10 +8375,10 @@ ++uFaceID; v6 = rand() % 1024 + 512; v7 = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; - v20 = stru_5C6E00->SinCos(v7); + v20 = stru_5C6E00->Cos(v7); v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; v19.vPosition.x = pParty->vPosition.x + v23; - v20 = stru_5C6E00->SinCos(v7 - stru_5C6E00->uIntegerHalfPi); + v20 = stru_5C6E00->Sin(v7); v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; v8 = 0; v19.uIndex = v24; @@ -8431,11 +8431,11 @@ v12 = rand() % 512 + 256; v13 = rand(); v14 = v13 % (signed int)stru_5C6E00->uIntegerDoublePi; - v15 = stru_5C6E00->SinCos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); + v15 = stru_5C6E00->Cos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); v20 = v15; v23 = (unsigned __int64)(v15 * (signed __int64)v12) >> 16; v19.vPosition.x = pParty->vPosition.x + v23; - v16 = stru_5C6E00->SinCos(v14 - stru_5C6E00->uIntegerHalfPi); + v16 = stru_5C6E00->Sin(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); v20 = v16; v23 = (unsigned __int64)(v16 * (signed __int64)v12) >> 16; v19.vPosition.y = v23 + pParty->vPosition.y; diff -r ce39b96acf5c -r d720a13e2273 mm7_3.cpp --- a/mm7_3.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_3.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -1038,18 +1038,18 @@ v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); if ( v8 > 1000 ) v8 = 1000; - v12 = stru_5C6E00->SinCos(v0->uYawAngle); + v12 = stru_5C6E00->Cos(v0->uYawAngle); v69 = v12; v13 = v12 * (signed __int64)v8; v73 = v13 >> 16; v0->vVelocity.x = WORD1(v13); - v69 = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); + v69 = stru_5C6E00->Sin(v0->uYawAngle); v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; v9 = v74 == 0; v0->vVelocity.y = v69 * v8 >> 16; if ( !v9 ) { - v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi); + v14 = stru_5C6E00->Sin(v0->uPitchAngle); v69 = v14; v15 = v14 * (signed __int64)v8; v73 = v15 >> 16; @@ -1264,11 +1264,11 @@ v48 = stru_5C6E00->Atan2( v0->vPosition.x - pLevelDecorations[v39].vPosition.x, v0->vPosition.y - pLevelDecorations[v39].vPosition.y); - v71 = stru_5C6E00->SinCos(v48); + v71 = stru_5C6E00->Cos(v48); v70 = (unsigned __int64)(v71 * (signed __int64)v47) >> 16; - v49 = v48 - stru_5C6E00->uIntegerHalfPi; + v49 = v48; v0->vVelocity.x = (unsigned int)(v71 * v47) >> 16; - v50 = stru_5C6E00->SinCos(v49); + v50 = stru_5C6E00->Sin(v48); v71 = v50; v51 = v50 * (signed __int64)v47; v70 = v51 >> 16; @@ -1582,11 +1582,11 @@ v23 = stru_5C6E00->Atan2( v1->vPosition.x - pLevelDecorations[v15].vPosition.x, v1->vPosition.y - pLevelDecorations[v15].vPosition.y); - v42 = stru_5C6E00->SinCos(v23); + v42 = stru_5C6E00->Cos(v23); v41 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16; - v24 = v23 - stru_5C6E00->uIntegerHalfPi; + v24 = v23; v1->vVelocity.x = (unsigned int)(v42 * v40) >> 16; - v25 = stru_5C6E00->SinCos(v24); + v25 = stru_5C6E00->Sin(v23); v42 = v25; v26 = v25 * (signed __int64)v40; v41 = v26 >> 16; @@ -2166,12 +2166,12 @@ v1->vPosition.x - pLevelDecorations[v30].vPosition.x, v1->vPosition.y - pLevelDecorations[v30].vPosition.y); v56 = v38; - v39 = stru_5C6E00->SinCos(v38); + v39 = stru_5C6E00->Cos(v38); v60 = (Actor *)v39; v40 = v39 * (signed __int64)v57; v58 = v40 >> 16; v1->vVelocity.x = WORD1(v40); - v41 = stru_5C6E00->SinCos(v56 - stru_5C6E00->uIntegerHalfPi); + v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi); v60 = (Actor *)v41; v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16; v58 = v35; @@ -2603,45 +2603,45 @@ goto LABEL_87; case PARTY_StrafeLeft: __debugbreak(); - v17 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v17 = stru_5C6E00->Sin(angle); v18 = (double)v81; //v88 = v18; v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; v2 -= v78; - v19 = stru_5C6E00->SinCos(angle); + v19 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; goto LABEL_63; case PARTY_StrafeRight: __debugbreak(); - v20 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v20 = stru_5C6E00->Sin(angle); v21 = (double)v81; //v88 = v21; v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; v2 += v78; - v22 = stru_5C6E00->SinCos(angle); + v22 = stru_5C6E00->Cos(angle); v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; goto LABEL_68; case PARTY_WalkForward: __debugbreak(); - v23 = stru_5C6E00->SinCos(angle); + v23 = stru_5C6E00->Cos(angle); v24 = (double)v81; //v88 = v24; v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; v2 += v78; - v25 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v25 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; LABEL_63: v1 += v78; goto LABEL_64; case PARTY_WalkBackward: __debugbreak(); - v26 = stru_5C6E00->SinCos(angle); + v26 = stru_5C6E00->Cos(angle); v27 = (double)v81; //v88 = v27; v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; v2 -= v78; - v28 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + v28 = stru_5C6E00->Sin(angle); v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; LABEL_68: @@ -2650,21 +2650,21 @@ v78 = 1; goto LABEL_87; case PARTY_RunForward: - //v29 = stru_5C6E00->SinCos(angle); + //v29 = stru_5C6E00->Cos(angle); //v30 = (double)v81; //v88 = (double)v81; - v2 += (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; + v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; //v31 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v1 += (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; + v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; v72 = 1; goto LABEL_87; case PARTY_RunBackward: //v32 = stru_5C6E00->SinCos(angle); //v33 = (double)v81; //v88 = (double)v81; - v2 -= (unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; + v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - v1 -= (unsigned __int64)(stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; + v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; //LABEL_70: v72 = 1; goto LABEL_87; @@ -2830,8 +2830,8 @@ v54 = stru_5C6E00->Atan2( new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); - v2 = (unsigned __int64)(stru_5C6E00->SinCos(v54) * (signed __int64)v53) >> 16; - v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi); + v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; + v55 = stru_5C6E00->Sin(v54); v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; } else @@ -3552,7 +3552,7 @@ { LABEL_130: v31 = GetTickCount(); - v126 = stru_5C6E00->SinCos(v31); + v126 = stru_5C6E00->Cos(v31); v129 = (unsigned __int64)(4i64 * v126) >> 16; v123 = v113 + v129; if ( v127 ) @@ -3762,12 +3762,12 @@ _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); v129 = v57; - v58 = (BSPModel *)stru_5C6E00->SinCos(v57); + v58 = (BSPModel *)stru_5C6E00->Cos(v57); v127 = v58; v59 = (signed int)v58 * (signed __int64)v56; v122 = v59 >> 16; v2 = v59 >> 16; - v60 = (BSPModel *)stru_5C6E00->SinCos(v129 - stru_5C6E00->uIntegerHalfPi); + v60 = (BSPModel *)stru_5C6E00->Sin(v129); v127 = v60; v61 = (signed int)v60 * (signed __int64)v118; v122 = v61 >> 16; @@ -5140,11 +5140,10 @@ v31 = 3; do { - v40 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationX) * 0.0000152587890625; - v32 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi) - * 0.0000152587890625; - v34 = (double)stru_5C6E00->SinCos(pIndoorCamera->sRotationY) * 0.0000152587890625; - v16 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v40 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationX) * 0.0000152587890625; + v32 = (double)stru_5C6E00->Sin(pIndoorCamera->sRotationX) * 0.0000152587890625; + v34 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationY) * 0.0000152587890625; + v16 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); LODWORD(v38) = *(int *)v15; v33 = (double)v16 * 0.0000152587890625; //UNDEF(v17); @@ -6190,7 +6189,7 @@ // 73C830: using guessed type char static_sub_004789DE_byte_73C830__init_flag; //----- (00479089) -------------------------------------------------------- -bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused) +bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) { BSPModel *v2; // eax@1 int v3; // edi@1 @@ -6200,30 +6199,30 @@ int v7; // ebx@3 int v8; // eax@3 int v9; // eax@3 - int v10; // ebx@3 + //int v10; // ebx@3 signed int v11; // esi@6 int v12; // esi@8 bool result; // eax@9 - unsigned int v14; // [sp+Ch] [bp-20h]@1 + //unsigned int v14; // [sp+Ch] [bp-20h]@1 int v15; // [sp+Ch] [bp-20h]@5 - int *v16; // [sp+10h] [bp-1Ch]@1 + //int *v16; // [sp+10h] [bp-1Ch]@1 int v17; // [sp+1Ch] [bp-10h]@1 int v18; // [sp+20h] [bp-Ch]@1 int v19; // [sp+20h] [bp-Ch]@3 int angle; // [sp+24h] [bp-8h]@1 int v21; // [sp+28h] [bp-4h]@1 - int v22; // [sp+28h] [bp-4h]@3 - - v16 = unused; + //int v22; // [sp+28h] [bp-4h]@3 + + //v16 = unused; angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1; - v14 = uModelID; + //v14 = uModelID; v2 = &pOutdoor->pBModels[uModelID]; v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x; v4 = v2->vBoundingCenter.y - pIndoorCamera->pos.y; - v5 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - v21 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v18 = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); - stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); + v5 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + v21 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v18 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); + stru_5C6E00->Sin(pIndoorCamera->sRotationX); v6 = v5; v17 = v3 * v5 + v4 * v21; if ( pIndoorCamera->sRotationX ) @@ -6232,37 +6231,30 @@ v7 = abs(v4); v8 = abs(v3); v9 = int_get_vector_length(v8, v7, 0); - v10 = v14 * 188; - v22 = v9; - *v16 = 0; - if ( v9 < pOutdoor->pBModels[v14].sBoundingRadius + 256 ) - *v16 = 1; - v15 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); + //v10 = v14 * 188; + //v22 = v9; + *reachable = false; + if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) + *reachable = true; + v15 = stru_5C6E00->Sin(angle); if ( v19 >= 0 ) - v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - - ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16); - else - v11 = ((unsigned __int64)(stru_5C6E00->SinCos(angle) * (signed __int64)v19) >> 16) - + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); + v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); + else + v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); v12 = v11 >> 16; - if ( v22 <= pOutdoorCamera->shading_dist_mist + 2048 ) + if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 ) { //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) - if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels[v14].sBoundingRadius) + 512 ) + if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) { result = v12 < 0; LOBYTE(result) = v12 >= 0; - } - else - { - result = 1; - } - } - else - { - result = 0; - } - return result; + return result; + } + else + return true; + } + return false; } @@ -6947,9 +6939,9 @@ _this.field_58 = 0; _this.uNumVertices = 4; - _this.v_18.x = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi + 16); + _this.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); _this.v_18.y = 0; - _this.v_18.z = -stru_5C6E00->SinCos(pIndoorCamera->sRotationX + 16); + _this.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); _this.field_24 = 0x2000000; _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; @@ -7205,10 +7197,10 @@ v8 = pBLVRenderParams->sPartyRotX; v62.field_58 = 0; v62.uNumVertices = v3; - v9 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX - stru_5C6E00->uIntegerHalfPi + 16); + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX + 16); v62.v_18.y = 0; v62.v_18.x = -v9; - v62.v_18.z = -stru_5C6E00->SinCos(v8 + 16); + v62.v_18.z = -stru_5C6E00->Cos(v8 + 16); v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX; memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3])); LODWORD(v80) = v10; @@ -9795,8 +9787,8 @@ v79 = (signed int)(v63 + ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v5->ptr_38->field_28) >> v76; a1.field_4 = (v43 - v30) >> 4; a1.field_0 = (v79 - v68) >> 4; - a1.field_30 = v30 + 4 * stru_5C6E00->SinCos(v81 + (v68 >> v66)); - v44 = stru_5C6E00->SinCos(v81 + (v30 >> v66) - stru_5C6E00->uIntegerHalfPi); + a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v68 >> v66)); + v44 = stru_5C6E00->Sin(v81 + (v30 >> v66)); a1.field_2C = v68 + 4 * v44; if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1, (stru315 *)&a2); @@ -9815,8 +9807,8 @@ if ( !v72 ) return 1; v66 = 12 - v75; - a1.field_30 = v30 + 4 * stru_5C6E00->SinCos(v81 + (v31 >> (12 - v75))); - v46 = stru_5C6E00->SinCos(v81 + (v30 >> v66) - stru_5C6E00->uIntegerHalfPi); + a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v31 >> (12 - v75))); + v46 = stru_5C6E00->Sin(v81 + (v30 >> v66)); a1.field_2C = v68 + 4 * v46; v79 = v5->v_18.y; v80 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; @@ -9943,8 +9935,8 @@ v42 = v3->v_18.z; v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; v9 = v44 + v3->v_18.x; - v35 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v11 = v2->field_8; v36 = v10; a1.field_28 = v2->field_C; @@ -10121,8 +10113,8 @@ v39 = v3->v_18.z; v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; v9 = v40 + v3->v_18.x; - v32 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - v10 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v32 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v11 = v2->field_8; v33 = v10; v35.field_28 = v2->field_C; @@ -10764,11 +10756,11 @@ a1a.field_C = v32 - 1; i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; v47 = (Span *)(i >> v44); - v35 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); + v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v36 = (signed int)v47 * (signed __int64)v35; i = v36 >> 16; a1a.field_4 = v36 >> 16; - v37 = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); + v37 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v38 = (signed int)v47 * (signed __int64)v37; i = v38 >> 16; a1a.field_0 = v38 >> 16; @@ -10778,8 +10770,8 @@ v39 = 12 - v49; for ( i = 12 - v49; ; v39 = i ) { - a1a.field_30 = v30 + 4 * stru_5C6E00->SinCos(X + (v31 >> v39)); - a1a.field_2C = v31 + 4 * stru_5C6E00->SinCos(X + (v30 >> i) - stru_5C6E00->uIntegerHalfPi); + a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> v39)); + a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1a, (stru315 *)&a2); else @@ -10795,8 +10787,8 @@ if ( v48 ) { i = 12 - v49; - a1a.field_30 = v30 + 4 * stru_5C6E00->SinCos(X + (v31 >> (12 - v49))); - a1a.field_2C = v31 + 4 * stru_5C6E00->SinCos(X + (v30 >> i) - stru_5C6E00->uIntegerHalfPi); + a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> (12 - v49))); + a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); a1a.field_28 = v48; if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) sr_sub_485975(&a1a, (stru315 *)&a2); @@ -11388,10 +11380,10 @@ //----- (0048600E) -------------------------------------------------------- void OutdoorCamera::RotationToInts() { - camera_rotation_y_int_sine = stru_5C6E00->SinCos(pIndoorCamera->sRotationY - stru_5C6E00->uIntegerHalfPi); - camera_rotation_y_int_cosine = stru_5C6E00->SinCos(pIndoorCamera->sRotationY); - camera_rotation_x_int_sine = stru_5C6E00->SinCos(pIndoorCamera->sRotationX - stru_5C6E00->uIntegerHalfPi); - camera_rotation_x_int_cosine = stru_5C6E00->SinCos(pIndoorCamera->sRotationX); + camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); + camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); + camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); + camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); } @@ -11589,10 +11581,10 @@ int v31; // [sp+3Ch] [bp+14h]@10 v7 = this; - v8 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotY); - v29 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotY - stru_5C6E00->uIntegerHalfPi); - v28 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX); - v9 = stru_5C6E00->SinCos(pBLVRenderParams->sPartyRotX - stru_5C6E00->uIntegerHalfPi); + v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); + v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); + v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); + v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); v11 = -pBLVRenderParams->vPartyPos.y; v26 = -pBLVRenderParams->vPartyPos.x; v27 = v9; @@ -18436,7 +18428,7 @@ //----- (00402CAE) -------------------------------------------------------- -int stru193_math::SinCos(int angle) +int stru193_math::Cos(int angle) { int v2; // eax@1 diff -r ce39b96acf5c -r d720a13e2273 mm7_4.cpp --- a/mm7_4.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_4.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -7460,8 +7460,8 @@ v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); v22 = stru_5C6E00; v122 = (unsigned __int16 *)v20; - v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->SinCos(v104 + v21); - v23 = stru_5C6E00->SinCos(v104 + (v19 >> (char)v122) - stru_5C6E00->uIntegerHalfPi); + v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); + v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); v120 = v116 + 4 * v23; if ( v123 < v117 ) { @@ -7489,8 +7489,8 @@ v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); v31 = *v114 >> i; v122 = (unsigned __int16 *)(11 - v27); - v116 = v30 + 4 * stru_5C6E00->SinCos(v104 + (v31 >> (11 - v27))); - v90 = v31 + 4 * stru_5C6E00->SinCos(v104 + (v30 >> (char)v122) - stru_5C6E00->uIntegerHalfPi); + v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); + v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); v108 = (signed int)(v116 - v121) >> 4; v103 = (v90 - v120) >> 4; v32 = v123 + 32; diff -r ce39b96acf5c -r d720a13e2273 mm7_6.cpp --- a/mm7_6.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_6.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -4513,9 +4513,9 @@ } else { - v155 = stru_5C6E00->SinCos(pParty->sRotationY); + v155 = stru_5C6E00->Cos(pParty->sRotationY); uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); - v156 = stru_5C6E00->_42EBDB(pParty->sRotationY); + v156 = stru_5C6E00->Sin(pParty->sRotationY); LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); v154 = pParty->vPosition.z; } @@ -4917,9 +4917,9 @@ } else { - v212 = stru_5C6E00->SinCos(pParty->sRotationY); + v212 = stru_5C6E00->Cos(pParty->sRotationY); LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212); - v213 = stru_5C6E00->_42EBDB(pParty->sRotationY); + v213 = stru_5C6E00->Sin(pParty->sRotationY); v214 = sub_42EBBE(2048, v213); v211 = pParty->vPosition.z; v713 = pParty->vPosition.y + v214; @@ -7817,9 +7817,9 @@ // 42EBBE: using guessed type int __fastcall sub_42EBBE(int, int); //----- (0042EBDB) -------------------------------------------------------- -int stru193_math::_42EBDB(int angle) +int stru193_math::Sin(int angle) { - return SinCos(angle - this->uIntegerHalfPi); + return Cos(angle - this->uIntegerHalfPi); } //----- (0042ECB5) -------------------------------------------------------- @@ -8400,11 +8400,11 @@ v12 = 0; if ( a4 ) { - a4a = stru_5C6E00->SinCos(angle); - v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->SinCos(pitch)) >> 16; - a4b = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); - a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->SinCos(pitch)) >> 16; - v14 = stru_5C6E00->SinCos(pitch - stru_5C6E00->uIntegerHalfPi); + a4a = stru_5C6E00->Cos(angle); + v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + a4b = stru_5C6E00->Sin(angle); + a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16; + v14 = stru_5C6E00->Sin(pitch); v9->vVelocity.x = (unsigned int)(v13 * v11) >> 16; v9->vVelocity.y = (unsigned int)(a5a * v11) >> 16; v12 = (unsigned int)(v14 * v11) >> 16; diff -r ce39b96acf5c -r d720a13e2273 mm7_data.cpp --- a/mm7_data.cpp Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_data.cpp Wed Feb 20 08:23:12 2013 +0200 @@ -2092,8 +2092,8 @@ //_UNKNOWN unk_F8BA50; // weak char byte_F8BC0C; // weak int bGameoverLoop = 0; // weak -__int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb -__int16 word_F8BD18_displaced_face_intersect_plane_coords_b; // idb +__int16 word_F8BC48_displaced_face_intersect_plane_coords_a[104]; // idb +__int16 word_F8BD18_displaced_face_intersect_plane_coords_b[104]; // idb int dword_F93F20; // weak int dword_F93F70; // weak diff -r ce39b96acf5c -r d720a13e2273 mm7_data.h --- a/mm7_data.h Wed Feb 20 04:36:14 2013 +0200 +++ b/mm7_data.h Wed Feb 20 08:23:12 2013 +0200 @@ -1712,8 +1712,8 @@ //extern _UNKNOWN unk_F8BA50; // weak extern char byte_F8BC0C; // weak extern int bGameoverLoop; // weak -extern __int16 word_F8BC48_displaced_face_intersect_plane_coords_a; // idb -extern __int16 word_F8BD18_displaced_face_intersect_plane_coords_b; // idb +extern __int16 word_F8BC48_displaced_face_intersect_plane_coords_a[]; // idb +extern __int16 word_F8BD18_displaced_face_intersect_plane_coords_b[]; // idb //extern _UNKNOWN unk_F8EA04; // weak //extern _UNKNOWN unk_F8F8F8; // weak extern int dword_F93F20; // weak