BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hinstDLL); GameBase = (DWORD)LoadLibrary(TEXT("game.dll")); FreeLibrary((HMODULE)GameBase); GetWar3Ver(); if (!GameVersion) return 1; char ch[256]; GetModuleFileNameA(hinstDLL, ch, 256); InitIpDatabase(ch); InitializeOffset(); InitializeCriticalSection(&OverlapSection); InitializeCriticalSection(&ClickSection); SetupDetour(); SetupClickDetect(); } else if (fdwReason == DLL_PROCESS_DETACH) { UnloadDetour(); DeleteCriticalSection(&OverlapSection); DeleteCriticalSection(&ClickSection); } return TRUE; }
FCameraShakeInstance UCameraModifier_CameraShake::InitializeShake(TSubclassOf<class UCameraShake> NewShake, float Scale, ECameraAnimPlaySpace PlaySpace, FRotator UserPlaySpaceRot) { FCameraShakeInstance Inst; Inst.SourceShakeName = NewShake->GetFName(); // Create a camera shake object of class NewShake Inst.SourceShake = Cast<UCameraShake>(StaticConstructObject(NewShake, this)); Inst.Scale = Scale; if (GEngine->IsSplitScreen(CameraOwner->GetWorld())) { Scale *= SplitScreenShakeScale; } // init oscillations if ( Inst.SourceShake->OscillationDuration != 0.f ) { Inst.RotSinOffset.X = InitializeOffset( Inst.SourceShake->RotOscillation.Pitch ); Inst.RotSinOffset.Y = InitializeOffset( Inst.SourceShake->RotOscillation.Yaw ); Inst.RotSinOffset.Z = InitializeOffset( Inst.SourceShake->RotOscillation.Roll ); Inst.LocSinOffset.X = InitializeOffset( Inst.SourceShake->LocOscillation.X ); Inst.LocSinOffset.Y = InitializeOffset( Inst.SourceShake->LocOscillation.Y ); Inst.LocSinOffset.Z = InitializeOffset( Inst.SourceShake->LocOscillation.Z ); Inst.FOVSinOffset = InitializeOffset( Inst.SourceShake->FOVOscillation ); Inst.OscillatorTimeRemaining = Inst.SourceShake->OscillationDuration; if (Inst.SourceShake->OscillationBlendInTime > 0.f) { Inst.bBlendingIn = true; Inst.CurrentBlendInTime = 0.f; } } // init anims if (Inst.SourceShake->Anim != NULL) { bool bLoop = false; bool bRandomStart = false; float Duration = 0.f; if (Inst.SourceShake->bRandomAnimSegment) { bLoop = true; bRandomStart = true; Duration = Inst.SourceShake->RandomAnimSegmentDuration; } if (Scale > 0.f) { Inst.AnimInst = CameraOwner->PlayCameraAnim(Inst.SourceShake->Anim, Inst.SourceShake->AnimPlayRate, Scale, Inst.SourceShake->AnimBlendInTime, Inst.SourceShake->AnimBlendOutTime, bLoop, bRandomStart, Duration, Inst.SourceShake->bSingleInstance); if (PlaySpace != CAPS_CameraLocal && Inst.AnimInst != NULL) { Inst.AnimInst->SetPlaySpace(PlaySpace, UserPlaySpaceRot); } } } Inst.PlaySpace = PlaySpace; if (Inst.PlaySpace == CAPS_UserDefined) { Inst.UserPlaySpaceMatrix = FRotationMatrix(UserPlaySpaceRot); } return Inst; }