diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/AnimViewer.cpp | 5 | ||||
-rw-r--r-- | src/core/Cam.cpp | 4 | ||||
-rw-r--r-- | src/core/Collision.cpp | 19 | ||||
-rw-r--r-- | src/core/Collision.h | 4 | ||||
-rw-r--r-- | src/core/CutsceneMgr.cpp | 2 | ||||
-rw-r--r-- | src/core/EventList.cpp | 2 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 21 | ||||
-rw-r--r-- | src/core/Game.cpp | 2 | ||||
-rw-r--r-- | src/core/Pad.cpp | 24 | ||||
-rw-r--r-- | src/core/Placeable.cpp | 2 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 3 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 1 | ||||
-rw-r--r-- | src/core/common.h | 2 |
13 files changed, 66 insertions, 25 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index a2d7b94a..20a0098d 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -33,6 +33,7 @@ #include "Clock.h" #include "Timecycle.h" #include "RpAnimBlend.h" +#include "AnimBlendAssociation.h" #include "Shadows.h" #include "Radar.h" #include "Hud.h" @@ -207,6 +208,7 @@ PlayAnimation(RpClump *clump, AssocGroupId animGroup, AnimationId anim) animAssoc->SetRun(); } +extern void (*DebugMenuProcess)(void); void CAnimViewer::Update(void) { @@ -246,6 +248,9 @@ CAnimViewer::Update(void) } CPad::UpdatePads(); CPad* pad = CPad::GetPad(0); + + DebugMenuProcess(); + CStreaming::UpdateForAnimViewer(); CStreaming::RequestModel(modelId, 0); if (CStreaming::HasModelLoaded(modelId)) { diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 12c72993..546dfde0 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -1530,7 +1530,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient CamDist = fBaseDist + Cos(Alpha)*fAngleDist; if(TheCamera.m_bUseTransitionBeta) - Beta = -CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta)); + Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta)); if(TheCamera.m_bCamDirectlyBehind) Beta = TheCamera.m_PedOrientForBehindOrInFront; @@ -1601,7 +1601,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient entity = nil; } - if(CamTargetEntity->GetClump()){ + if(CamTargetEntity->m_rwObject){ // what's going on here? if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_PUMP) || RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROW) || diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index fc8428be..94ef769e 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -2061,6 +2061,19 @@ CColModel::operator=(const CColModel &other) return *this; } +#include <new> +struct CColLine_ : public CColLine +{ + CColLine *ctor(CVector *p0, CVector *p1) { return ::new (this) CColLine(*p0, *p1); } +}; + +struct CColModel_ : public CColModel +{ + CColModel *ctor(void) { return ::new (this) CColModel(); } + void dtor(void) { this->CColModel::~CColModel(); } +}; + + STARTPATCHES InjectHook(0x4B9C30, (CMatrix& (*)(const CMatrix &src, CMatrix &dst))Invert, PATCH_JUMP); @@ -2099,15 +2112,15 @@ STARTPATCHES InjectHook(0x411E40, (void (CColSphere::*)(float, const CVector&, uint8, uint8))&CColSphere::Set, PATCH_JUMP); InjectHook(0x40B2A0, &CColBox::Set, PATCH_JUMP); - InjectHook(0x40B320, &CColLine::ctor, PATCH_JUMP); + InjectHook(0x40B320, &CColLine_::ctor, PATCH_JUMP); InjectHook(0x40B350, &CColLine::Set, PATCH_JUMP); InjectHook(0x411E70, &CColTriangle::Set, PATCH_JUMP); InjectHook(0x411EA0, &CColTrianglePlane::Set, PATCH_JUMP); InjectHook(0x412140, &CColTrianglePlane::GetNormal, PATCH_JUMP); - InjectHook(0x411680, &CColModel::ctor, PATCH_JUMP); - InjectHook(0x4116E0, &CColModel::dtor, PATCH_JUMP); + InjectHook(0x411680, &CColModel_::ctor, PATCH_JUMP); + InjectHook(0x4116E0, &CColModel_::dtor, PATCH_JUMP); InjectHook(0x411D80, &CColModel::RemoveCollisionVolumes, PATCH_JUMP); InjectHook(0x411CB0, &CColModel::CalculateTrianglePlanes, PATCH_JUMP); InjectHook(0x411D10, &CColModel::RemoveTrianglePlanes, PATCH_JUMP); diff --git a/src/core/Collision.h b/src/core/Collision.h index 9597a181..429fc17f 100644 --- a/src/core/Collision.h +++ b/src/core/Collision.h @@ -35,8 +35,6 @@ struct CColLine CColLine(void) { }; CColLine(const CVector &p0, const CVector &p1) { this->p0 = p0; this->p1 = p1; }; void Set(const CVector &p0, const CVector &p1); - - CColLine *ctor(CVector *p0, CVector *p1) { return ::new (this) CColLine(*p0, *p1); } }; struct CColTriangle @@ -106,8 +104,6 @@ struct CColModel void SetLinkPtr(CLink<CColModel*>*); void GetTrianglePoint(CVector &v, int i) const; - CColModel *ctor(void) { return ::new (this) CColModel(); } - void dtor(void) { this->CColModel::~CColModel(); } CColModel& operator=(const CColModel& other); }; diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp index c13aa3a8..a3ff2fd0 100644 --- a/src/core/CutsceneMgr.cpp +++ b/src/core/CutsceneMgr.cpp @@ -9,12 +9,14 @@ #include "FileMgr.h" #include "main.h" #include "AnimManager.h" +#include "AnimBlendAssociation.h" #include "AnimBlendAssocGroup.h" #include "AnimBlendClumpData.h" #include "Pad.h" #include "DMAudio.h" #include "World.h" #include "PlayerPed.h" +#include "Wanted.h" #include "CutsceneHead.h" #include "RpAnimBlend.h" #include "ModelIndices.h" diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp index 4364359a..d72e32c4 100644 --- a/src/core/EventList.cpp +++ b/src/core/EventList.cpp @@ -212,7 +212,7 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar #ifdef VC_PED_PORTS if (crime == CRIME_HIT_PED && ((CPed*)crimeId)->IsPointerValid() && - FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->m_ped_flagE2) { + FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->bBeingChasedByPolice) { if(!((CPed*)crimeId)->DyingOrDead()) { sprintf(gString, "$50 Good Citizen Bonus!"); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index aff8a3ec..0bade6c7 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -94,7 +94,6 @@ int32 *&pControlEdit = *(int32**)0x628D08; bool &DisplayComboButtonErrMsg = *(bool*)0x628D14; int32 &MouseButtonJustClicked = *(int32*)0x628D0C; int32 &JoyButtonJustClicked = *(int32*)0x628D10; -uint32 &nTimeForSomething = *(uint32*)0x628D54; bool &holdingScrollBar = *(bool*)0x628D59; //int32 *pControlTemp = 0; @@ -2202,15 +2201,15 @@ CMenuManager::ProcessButtonPresses(void) field_535 = false; } - static int nTimeForSomething = 0; + static uint32 lastTimeClickedScrollButton = 0; - if (CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething >= 200) { + if (CTimer::GetTimeInMillisecondsPauseMode() - lastTimeClickedScrollButton >= 200) { m_bPressedPgUpOnList = false; m_bPressedPgDnOnList = false; m_bPressedUpOnList = false; m_bPressedDownOnList = false; m_bPressedScrollButton = false; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); } if (CPad::GetPad(0)->GetTabJustDown()) { @@ -2249,7 +2248,7 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrExLayer = 19; if (!m_bPressedUpOnList) { m_bPressedUpOnList = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); ScrollUpListByOne(); } @@ -2271,7 +2270,7 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrExLayer = 19; if (!m_bPressedDownOnList) { m_bPressedDownOnList = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); ScrollDownListByOne(); } @@ -2286,7 +2285,7 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrExLayer = 19; if (!m_bPressedPgUpOnList) { m_bPressedPgUpOnList = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); m_bShowMouse = false; DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); PageUpList(false); @@ -2298,7 +2297,7 @@ CMenuManager::ProcessButtonPresses(void) m_nCurrExLayer = 19; if (!m_bPressedPgDnOnList) { m_bPressedPgDnOnList = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); m_bShowMouse = false; DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0); PageDownList(false); @@ -2384,7 +2383,7 @@ CMenuManager::ProcessButtonPresses(void) case HOVEROPTION_CLICKED_SCROLL_UP: if (!m_bPressedScrollButton) { m_bPressedScrollButton = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); ScrollUpListByOne(); } break; @@ -2392,7 +2391,7 @@ CMenuManager::ProcessButtonPresses(void) case HOVEROPTION_CLICKED_SCROLL_DOWN: if (!m_bPressedScrollButton) { m_bPressedScrollButton = true; - nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode(); + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); ScrollDownListByOne(); } break; @@ -3593,7 +3592,7 @@ void CMenuManager::SwitchMenuOnAndOff() PcSaveHelper.PopulateSlotInfo(); m_nCurrOption = 0; } -/* // PS2 leftover? +/* // PS2 leftover if (m_nCurrScreen != MENUPAGE_SOUND_SETTINGS && gMusicPlaying) { DMAudio.StopFrontEndTrack(); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index e89d62a0..fce0c67f 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -41,6 +41,8 @@ #include "Record.h" #include "Renderer.h" #include "Replay.h" +#include "References.h" +#include "Radar.h" #include "Restart.h" #include "RoadBlocks.h" #include "PedRoutes.h" diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 9a911aa4..6bbe00f2 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -7,7 +7,7 @@ #include "common.h" #ifdef XINPUT #include <Xinput.h> -#pragma comment( lib, "Xinput.lib" ) +#pragma comment( lib, "Xinput9_1_0.lib" ) #endif #include "patcher.h" #include "Pad.h" @@ -574,8 +574,9 @@ void CPad::AffectFromXinput(uint32 pad) PCTempJoyState.RightShoulder2 = xstate.Gamepad.bRightTrigger; PCTempJoyState.Select = (xstate.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) ? 255 : 0; +#ifdef REGISTER_START_BUTTON PCTempJoyState.Start = (xstate.Gamepad.wButtons & XINPUT_GAMEPAD_START) ? 255 : 0; - +#endif float lx = (float)xstate.Gamepad.sThumbLX / (float)0x7FFF; float ly = (float)xstate.Gamepad.sThumbLY / (float)0x7FFF; float rx = (float)xstate.Gamepad.sThumbRX / (float)0x7FFF; @@ -590,6 +591,24 @@ void CPad::AffectFromXinput(uint32 pad) PCTempJoyState.RightStickX = (int32)(rx * 128.0f); PCTempJoyState.RightStickY = (int32)(ry * 128.0f); } + + XINPUT_VIBRATION VibrationState; + + memset(&VibrationState, 0, sizeof(XINPUT_VIBRATION)); + + uint16 iLeftMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff); + uint16 iRightMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff); + + if (ShakeDur < CTimer::GetTimeStepInMilliseconds()) + ShakeDur = 0; + else + ShakeDur -= CTimer::GetTimeStepInMilliseconds(); + if (ShakeDur == 0) ShakeFreq = 0; + + VibrationState.wLeftMotorSpeed = iLeftMotor; + VibrationState.wRightMotorSpeed = iRightMotor; + + XInputSetState(pad, &VibrationState); } } #endif @@ -617,6 +636,7 @@ void CPad::UpdatePads(void) if ( bUpdate ) { GetPad(0)->Update(0); + GetPad(1)->Update(0); } #if defined(MASTER) && !defined(XINPUT) diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp index d2cec82b..c882fc27 100644 --- a/src/core/Placeable.cpp +++ b/src/core/Placeable.cpp @@ -63,6 +63,8 @@ CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z1 <= GetPosition().z && GetPosition().z <= z2; } +#include <new> + class CPlaceable_ : public CPlaceable { public: diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index e0c0259e..ead32ee7 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -2,7 +2,9 @@ #include "patcher.h" #include "main.h" #include "PlayerPed.h" +#include "Wanted.h" #include "PlayerInfo.h" +#include "Fire.h" #include "Frontend.h" #include "PlayerSkin.h" #include "Darkel.h" @@ -12,6 +14,7 @@ #include "Remote.h" #include "World.h" #include "Replay.h" +#include "Camera.h" #include "Pad.h" #include "ProjectileInfo.h" #include "Explosion.h" diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 6106f3df..3dcb767a 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -10,6 +10,7 @@ #include "TxdStore.h" #include "ModelIndices.h" #include "Pools.h" +#include "Wanted.h" #include "Directory.h" #include "RwHelper.h" #include "World.h" diff --git a/src/core/common.h b/src/core/common.h index 0cdff871..7b4ff4a0 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -10,8 +10,6 @@ #include <stdint.h> #include <string.h> #include <math.h> -//#include <assert.h> -#include <new> #ifdef WITHWINDOWS #include <Windows.h> |