Skip to content

Commit 594be87

Browse files
committed
Merge branch 'master' of github.com:gta-reversed/gta-reversed-modern into reverse/CAECollisionAudioEntity
2 parents cc144a5 + 81da58a commit 594be87

File tree

217 files changed

+7070
-6173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+7070
-6173
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Since this project is done as a hobby, and worked on at irregular intervals, **t
3939
1. To install all the necessary files (after building the project!), run `contrib/install.py` with **__administrator privileges__** [Necessary to create symlinks on Windows] in the root directory.
4040
Alternatively, you can install them by yourself:
4141
* [ASI Loader](https://gtaforums.com/topic/523982-relopensrc-silents-asi-loader/)
42-
* [III.VC.SA.WindowedMode.asi](https://github.com/ThirteenAG/III.VC.SA.WindowedMode)
4342
* Mouse Fix (**dinput8.dll**) [Can be found in the zip in the `contrib` folder]
4443

4544
You can download them in a single [archive](https://github.com/gta-reversed/gta-reversed-modern/blob/master/contrib/plugins.zip).

contrib/plugins.zip

-123 KB
Binary file not shown.

source/InjectHooksMain.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ void InjectHooksMain() {
537537
#ifdef NOTSA_WINDOWED_MODE
538538
notsa::InjectWindowedModeHooks();
539539
#endif
540+
CDoor::InjectHooks();
540541
CControllerConfigManager::InjectHooks();
541542
CFormation::InjectHooks();
542543
CHandShaker::InjectHooks();
@@ -623,9 +624,14 @@ void InjectHooksMain() {
623624
CKeyboardState::InjectHooks();
624625
CMouseControllerState::InjectHooks();
625626
CRect::InjectHooks();
626-
CVector2D::InjectHooks();
627-
CQuaternion::InjectHooks();
628-
CMatrix::InjectHooks();
627+
628+
/******* Don't hook these, performance is bad ********
629+
/* CVector::InjectHooks();
630+
/* CVector2D::InjectHooks();
631+
/* CQuaternion::InjectHooks();
632+
/* CMatrix::InjectHooks();
633+
/****************************************************/
634+
629635
CMatrixLink::InjectHooks();
630636
CMatrixLinkList::InjectHooks();
631637
CEntryInfoNode::InjectHooks();
@@ -733,6 +739,7 @@ void InjectHooksMain() {
733739
CGangWars::InjectHooks();
734740
CPlayerPedData::InjectHooks();
735741
CTimeCycle::InjectHooks();
742+
CColourSet::InjectHooks();
736743
CSkidmarks::InjectHooks();
737744
CMovingThings::InjectHooks();
738745
CRoadBlocks::InjectHooks();

source/app/app_game.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ void Idle(void* param) {
313313
return;
314314
}
315315

316-
auto& cc = CTimeCycle::m_CurrentColours;
317316
if (FrontEndMenuManager.m_bMenuActive || TheCamera.GetScreenFadeStatus() == eNameState::NAME_FADE_IN) {
318317
CDraw::CalculateAspectRatio();
319318
CameraSize(Scene.m_pRwCamera, nullptr, SCREEN_VIEW_WINDOW, SCREEN_ASPECT_RATIO);
@@ -341,19 +340,23 @@ void Idle(void* param) {
341340

342341
bool started;
343342
if (CWeather::LightningFlash) {
344-
cc.m_nSkyBottomRed = 255;
345-
cc.m_nSkyBottomGreen = 255;
346-
cc.m_nSkyBottomBlue = 255;
343+
CTimeCycle::SetFogRed(255);
344+
CTimeCycle::SetFogGreen(255);
345+
CTimeCycle::SetFogBlue(255);
347346
started = DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255);
348347
} else {
349-
started = DoRWStuffStartOfFrame_Horizon(cc.m_nSkyTopRed, cc.m_nSkyTopGreen, cc.m_nSkyTopBlue, cc.m_nSkyBottomRed, cc.m_nSkyBottomGreen, cc.m_nSkyBottomBlue, 255);
348+
started = DoRWStuffStartOfFrame_Horizon(
349+
CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
350+
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
351+
255
352+
);
350353
}
351354
if (!started)
352355
return;
353356

354357
DefinedState();
355-
RwCameraSetFarClipPlane(Scene.m_pRwCamera, cc.m_fFarClip);
356-
Scene.m_pRwCamera->fogPlane = cc.m_fFogStart;
358+
RwCameraSetFarClipPlane(Scene.m_pRwCamera, CTimeCycle::GetFarClip());
359+
Scene.m_pRwCamera->fogPlane = CTimeCycle::GetFogStart();
357360
CMirrors::RenderMirrorBuffer();
358361
RenderScene();
359362
CVisibilityPlugins::RenderWeaponPedsForPC();

source/app/app_input.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ RsEventStatus KeyboardHandler(RsEvent event, void* param) {
172172
}
173173

174174
// 0x7448B0
175-
static RsEventStatus HandlePadButtonDown(RsPadButtonStatus* padButtonStatus) {
175+
RsEventStatus HandlePadButtonDown(RsPadButtonStatus* padButtonStatus) {
176176
bool bPadTwo = false;
177177
int32 padNumber = padButtonStatus->padID;
178178

@@ -188,24 +188,23 @@ static RsEventStatus HandlePadButtonDown(RsPadButtonStatus* padButtonStatus) {
188188

189189
ControlsManager.UpdateJoyButtonState(padNumber);
190190

191-
for (int32 i = 1; i < JOYBUTTON_COUNT; i++)
192-
{
191+
for (int32 i = 1; i < JOYBUTTON_COUNT; i++) {
193192
RsPadButtons btn = RsPadButtons(0);
194193
if (ControlsManager.m_ButtonStates[i - 1] == true) {
195194
btn = RsPadButtons(i);
196195

197196
if (FrontEndMenuManager.m_bMenuActive || bPadTwo) {
198197
ControlsManager.UpdateJoyInConfigMenus_ButtonDown(btn, padNumber);
199198
} else {
200-
ControlsManager.AffectControllerStateOn_ButtonDown((KeyCode)btn, eControllerType::JOY_STICK);
199+
ControlsManager.UpdateJoy_ButtonDown(btn, eControllerType::JOY_STICK);
201200
}
202201
}
203202
}
204203
return rsEVENTPROCESSED;
205204
}
206205

207206
// 0x744930
208-
static RsEventStatus HandlePadButtonUp(RsPadButtonStatus* padButtonStatus) {
207+
RsEventStatus HandlePadButtonUp(RsPadButtonStatus* padButtonStatus) {
209208
bool bPadTwo = false;
210209
int32 padNumber = padButtonStatus->padID;
211210

@@ -227,6 +226,7 @@ static RsEventStatus HandlePadButtonUp(RsPadButtonStatus* padButtonStatus) {
227226

228227
ControlsManager.UpdateJoyButtonState(padNumber);
229228

229+
// NOTE: Why 2?
230230
for (int32 i = 2; i < JOYBUTTON_COUNT; i++) {
231231
RsPadButtons btn = RsPadButtons(0);
232232
if (ControlsManager.m_ButtonStates[i - 1] == false) {

source/app/app_input.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ RsEventStatus HandleKeyDown(RsKeyStatus* param);
1010
RsEventStatus HandleKeyUp(RsKeyStatus* param);
1111
RsEventStatus KeyboardHandler(RsEvent event, void* param);
1212

13-
RsEventStatus HandlePadButtonDown(RsKeyStatus* param);
14-
RsEventStatus HandlePadButtonUp(RsKeyStatus* param);
13+
RsEventStatus HandlePadButtonDown(RsPadButtonStatus* param);
14+
RsEventStatus HandlePadButtonUp(RsPadButtonStatus* param);
1515
RsEventStatus PadHandler(RsEvent event, void* param);

source/extensions/utility.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ constexpr inline auto find_value(auto&& mapping, auto&& needle) {
8686
NOTSA_UNREACHABLE("Needle not in the mapping!");
8787
}
8888

89+
/*!
90+
* @brief Find the index of the first occurrence of a value in a range, returning a default index if not found.
91+
*/
8992
template<rng::input_range R>
9093
ptrdiff_t indexof(R&& r, const rng::range_value_t<R>& v, ptrdiff_t defaultIdx = -1) {
9194
const auto it = rng::find(r, v);

source/game_sa/Audio/AEAudioUtility.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ CVehicle* CAEAudioUtility::FindVehicleOfPlayer() {
168168
return vehicle;
169169

170170
auto* attach = player->m_pAttachedTo->AsAutomobile();
171-
if (attach && attach->IsVehicle())
171+
if (attach && attach->GetIsTypeVehicle())
172172
return attach;
173173

174174
return vehicle;

source/game_sa/Audio/AESound.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ float CAESound::GetSlowMoFrequencyScalingFactor() const {
195195

196196
// 0x4EF7A0
197197
void CAESound::NewVPSLEntry() {
198-
m_IsPhysicallyPlaying = true;
198+
m_IsPhysicallyPlaying = false;
199199
m_HasRequestedStopped = false;
200200
m_IsAudioHardwareAware = false;
201201
m_IsInUse = true;

source/game_sa/Audio/entities/AECollisionAudioEntity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ void CAECollisionAudioEntity::ReportBulletHit(CEntity* entity, eSurfaceType surf
598598
if (!AEAudioHardware.IsSoundBankLoaded(SND_BANK_GENRL_BULLET_HITS, SND_BANK_SLOT_BULLET_HITS)) {
599599
return;
600600
}
601-
if (entity && entity->IsVehicle()) {
601+
if (entity && entity->GetIsTypeVehicle()) {
602602
surface = entity->AsVehicle()->IsSubBMX()
603603
? (eSurfaceType)(188) // todo: C* Surface
604604
: SURFACE_CAR;

0 commit comments

Comments
 (0)