diff options
-rw-r--r-- | premake5.lua | 4 | ||||
-rw-r--r-- | src/animation/FrameUpdate.cpp | 42 | ||||
-rw-r--r-- | src/animation/RpAnimBlend.cpp | 8 | ||||
-rw-r--r-- | src/core/Cam.cpp | 3 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 2 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.cpp | 4 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 30 | ||||
-rw-r--r-- | src/rw/VisibilityPlugins.cpp | 14 | ||||
-rw-r--r-- | src/vehicles/Plane.h | 7 |
9 files changed, 80 insertions, 34 deletions
diff --git a/premake5.lua b/premake5.lua index f295c3d9..f34e9d63 100644 --- a/premake5.lua +++ b/premake5.lua @@ -112,7 +112,7 @@ project "librw" end local function addSrcFiles( prefix ) - return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.aps", prefix .. "/*.rc" + return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" end project "re3" @@ -215,7 +215,7 @@ project "re3" filter "platforms:win*gl3_glfw*" libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } - libdirs { path.join(_OPTIONS["glfwdir"], "lib-" .. string.gsub(_ACTION, "vs", "vc")) } + libdirs { path.join(_OPTIONS["glfwdir"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) } links { "opengl32", "glew32s", "glfw3" } filter "platforms:linux*gl3_glfw*" diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp index a1121282..8697e7c6 100644 --- a/src/animation/FrameUpdate.cpp +++ b/src/animation/FrameUpdate.cpp @@ -47,7 +47,12 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg) (*node)->Update(vec, q, 1.0f-totalBlendAmount); if((*node)->sequence->HasTranslation()) pos += vec; - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; } ++*node; } @@ -101,7 +106,12 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v for(node = updateData->nodes; *node; node++){ if((*node)->sequence){ bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount); - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; if((*node)->sequence->HasTranslation()){ pos += vec; if((*node)->association->HasTranslation()){ @@ -179,7 +189,12 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, for(node = updateData->nodes; *node; node++){ if((*node)->sequence){ bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount); - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; if((*node)->sequence->HasTranslation()){ pos += vec; if((*node)->association->HasTranslation()){ @@ -243,7 +258,12 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg) (*node)->Update(vec, q, 1.0f-totalBlendAmount); if((*node)->sequence->HasTranslation()) pos += vec; - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; } ++*node; } @@ -298,7 +318,12 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void for(node = updateData->nodes; *node; node++){ if((*node)->sequence){ bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount); - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; if((*node)->sequence->HasTranslation()){ pos += vec; if((*node)->association->HasTranslation()){ @@ -376,7 +401,12 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo for(node = updateData->nodes; *node; node++){ if((*node)->sequence){ bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount); - rot += q; +#ifdef FIX_BUGS + if(DotProduct(rot, q) < 0.0f) + rot -= q; + else +#endif + rot += q; if((*node)->sequence->HasTranslation()){ pos += vec; if((*node)->association->HasTranslation()){ diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index d3e10889..be70ad66 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -348,9 +348,11 @@ CAnimBlendAssociation* RpAnimBlendClumpGetFirstAssociation(RpClump *clump) { CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump); - if(clumpData == nil) return nil; - if(clumpData->link.next == nil) return nil; - return CAnimBlendAssociation::FromLink(clumpData->link.next); + if(!RpAnimBlendClumpIsInitialized(clump)) + return nil; + if(clumpData->link.next) + return CAnimBlendAssociation::FromLink(clumpData->link.next); + return nil; } // FillFrameArrayCallBack on PS2 diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 20b262c8..21569647 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4540,6 +4540,9 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient } + if(TheCamera.m_bUseTransitionBeta) + Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta)); + Front = CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha)); Source = TargetCoors - Front*CamDist; TargetCoors.z -= BaseOffset; // now get back to the real target coors again diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index ed3892a6..a2e6048b 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -262,7 +262,7 @@ CStreaming::Init(void) } } #else - CStreaming::Init(); + CStreaming::Init2(); #endif } diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 767dbdd6..74285c19 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -111,8 +111,8 @@ RwObjectNameIdAssocation heliIds[] = { }; RwObjectNameIdAssocation planeIds[] = { - { "wheel_front_dummy", 2, 0 }, - { "wheel_rear_dummy", 3, 0 }, + { "wheel_front_dummy", PLANE_WHEEL_FRONT, 0 }, + { "wheel_rear_dummy", PLANE_WHEEL_READ, 0 }, { "light_tailplane", PLANE_POS_LIGHT_TAIL, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_left", PLANE_POS_LIGHT_LEFT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "light_right", PLANE_POS_LIGHT_RIGHT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 714ff6e6..1f1e3b50 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -362,21 +362,19 @@ CRenderer::SetupEntityVisibility(CEntity *ent) ent->bNoBrightHeadLights = false; } return VIS_OFFSCREEN; - }else{ - // All sorts of Clumps - if(ent->m_rwObject == nil || !ent->bIsVisible) - return VIS_INVISIBLE; - if(!ent->GetIsOnScreen()) - return VIS_OFFSCREEN; - if(ent->bDrawLast){ - dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude(); - CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); - ent->bDistanceFade = false; - return VIS_INVISIBLE; - }else - return VIS_VISIBLE; } - return VIS_INVISIBLE; + // All sorts of Clumps + if(ent->m_rwObject == nil || !ent->bIsVisible) + return VIS_INVISIBLE; + if(!ent->GetIsOnScreen()) + return VIS_OFFSCREEN; + if(ent->bDrawLast){ + dist = (ent->GetPosition() - ms_vecCameraPosition).Magnitude(); + CVisibilityPlugins::InsertEntityIntoSortedList(ent, dist); + ent->bDistanceFade = false; + return VIS_INVISIBLE; + } + return VIS_VISIBLE; } if(ent->IsObject() && ((CObject*)ent)->ObjectCreatedBy == TEMP_OBJECT){ @@ -1196,8 +1194,10 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent) void CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset) { - if(ent->bRenderScorched) + if(ent->bRenderScorched){ WorldReplaceScorchedLightsWithNormal(Scene.world); + return; + } CPointLights::RemoveLightsAffectingObject(); if(reset) ReSetAmbientAndDirectionalColours(); diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index cb514f07..d034391c 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -557,12 +557,16 @@ RpAtomic* CVisibilityPlugins::RenderPedCB(RpAtomic *atomic) { int32 alpha; + RwV3d cam2atm; - alpha = GetClumpAlpha(RpAtomicGetClump(atomic)); - if(alpha == 255) - AtomicDefaultRenderCallBack(atomic); - else - RenderAlphaAtomic(atomic, alpha); + RwV3dSub(&cam2atm, &RwFrameGetLTM(RpAtomicGetFrame(atomic))->pos, ms_pCameraPosn); + if(RwV3dDotProduct(&cam2atm, &cam2atm) < ms_pedLod1Dist){ + alpha = GetClumpAlpha(RpAtomicGetClump(atomic)); + if(alpha == 255) + AtomicDefaultRenderCallBack(atomic); + else + RenderAlphaAtomic(atomic, alpha); + } return atomic; } diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index 7e822d64..a6f6e1d9 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -2,6 +2,13 @@ #include "Vehicle.h" +enum ePlaneNodes +{ + PLANE_WHEEL_FRONT = 2, + PLANE_WHEEL_READ, + NUM_PLANE_NODES +}; + enum ePlanePositions { PLANE_POS_LIGHT_LEFT, |