Merge branch 'master' into master

This commit is contained in:
Fire_Head 2020-03-29 18:39:47 +03:00 committed by GitHub
commit a0b077574e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 782 additions and 557 deletions

View File

@ -68,6 +68,7 @@ const int molotovVolume = 50;
const int rainOnVehicleIntensity = 22;
const int reverseGearIntensity = 30;
const int engineDamageIntensity = 40;
const bool hornPatternsArray[8][44] = {
@ -417,7 +418,7 @@ cAudioManager::AddReleasingSounds()
}
sample.field_56 = 0;
}
memcpy(&m_sQueueSample, &sample, sizeof(sample));
memcpy(&m_sQueueSample, &sample, sizeof(tSound));
AddSampleToRequestedQueue();
}
}
@ -2743,11 +2744,215 @@ cAudioManager::PreTerminateGameSpecificShutdown()
}
}
WRAPPER
void
cAudioManager::ProcessActiveQueues()
{
EAXJMP(0x57BA60);
bool flag;
float position2;
float position1;
uint32 v28;
uint32 v29;
float x;
float usedX;
float usedY;
float usedZ;
uint8 vol;
uint8 emittingVol;
CVector position;
for (int32 i = 0; i < m_bActiveSamples; i++) {
m_asSamples[m_bActiveSampleQueue][i].m_bIsProcessed = 0;
m_asActiveSamples[i].m_bIsProcessed = 0;
}
for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
if (sample.m_nSampleIndex != NO_SAMPLE) {
for (int32 j = 0; j < m_bActiveSamples; ++j) {
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
sample.m_counter == m_asActiveSamples[j].m_counter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
if (sample.m_nLoopCount) {
if (m_FrameCounter & 1) {
flag = !!(j & 1);
}
else {
flag = !(j & 1);
}
if (flag && !SampleManager.GetChannelUsedFlag(j)) {
sample.m_bLoopEnded = 1;
m_asActiveSamples[j].m_bLoopEnded = 1;
m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE;
continue;
}
}
sample.m_bIsProcessed = 1;
m_asActiveSamples[j].m_bIsProcessed = 1;
sample.field_88 = -1;
if (!sample.field_56) {
if (sample.m_bIsDistant) {
if (field_4) {
emittingVol = 2 * min(63, sample.m_bEmittingVolume);
}
else {
emittingVol = sample.m_bEmittingVolume;
}
SampleManager.SetChannelFrequency(j, sample.m_nFrequency);
SampleManager.SetChannelEmittingVolume(j, emittingVol);
}
else {
m_asActiveSamples[j].m_fDistance = sample.m_fDistance;
position2 = sample.m_fDistance;
position1 = m_asActiveSamples[j].m_fDistance;
sample.m_nFrequency = ComputeDopplerEffectedFrequency(
sample.m_nFrequency, position1, position2, sample.field_48);
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
int32 freq;
if (sample.m_nFrequency <=
m_asActiveSamples[j].m_nFrequency) {
freq = max(sample.m_nFrequency,
m_asActiveSamples[j].m_nFrequency -
6000);
}
else {
freq = min(sample.m_nFrequency,
m_asActiveSamples[j].m_nFrequency +
6000);
}
m_asActiveSamples[j].m_nFrequency = freq;
SampleManager.SetChannelFrequency(j, freq);
}
if (sample.m_bEmittingVolume !=
m_asActiveSamples[j].m_bEmittingVolume) {
if (sample.m_bEmittingVolume <=
m_asActiveSamples[j].m_bEmittingVolume) {
vol = max(
m_asActiveSamples[j].m_bEmittingVolume - 10,
sample.m_bEmittingVolume);
}
else {
vol = min(
m_asActiveSamples[j].m_bEmittingVolume + 10,
sample.m_bEmittingVolume);
}
uint8 emittingVol;
if (field_4) {
emittingVol = 2 * min(63, vol);
}
else {
emittingVol = vol;
}
SampleManager.SetChannelEmittingVolume(j, emittingVol);
m_asActiveSamples[j].m_bEmittingVolume = vol;
}
TranslateEntity(&sample.m_vecPos, &position);
SampleManager.SetChannel3DPosition(j, position.x, position.y,
position.z);
SampleManager.SetChannel3DDistances(
j, sample.m_fSoundIntensity,
0.25f * sample.m_fSoundIntensity);
}
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
continue;
}
sample.m_bIsProcessed = 0;
m_asActiveSamples[j].m_bIsProcessed = 0;
break;
}
}
}
}
for (int32 i = 0; i < m_bActiveSamples; i++) {
if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsProcessed) {
SampleManager.StopChannel(i);
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nEntityIndex = -5;
}
}
for (int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; ++i) {
tSound& sample = m_asSamples[m_bActiveSampleQueue][m_abSampleQueueIndexTable[m_bActiveSampleQueue][i]];
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
if (sample.m_counter > 255 && sample.m_nLoopCount && sample.m_bLoopsRemaining) {
--sample.m_bLoopsRemaining;
sample.field_76 = 1;
}
else {
for (int32 j = 0; j < m_bActiveSamples; ++j) {
if (!m_asActiveSamples[j].m_bIsProcessed) {
if (sample.m_nLoopCount) {
v28 = sample.m_nFrequency / field_19192;
v29 = sample.m_nLoopCount *
SampleManager.GetSampleLength(sample.m_nSampleIndex);
if (v28 == 0) continue;
sample.field_76 = v29 / v28 + 1;
}
memcpy(&m_asActiveSamples[j], &sample, sizeof(tSound));
if (!m_asActiveSamples[j].m_bIsDistant)
TranslateEntity(&m_asActiveSamples[j].m_vecPos, &position);
if (field_4) {
emittingVol =
2 * min(63, m_asActiveSamples[j].m_bEmittingVolume);
}
else {
emittingVol = m_asActiveSamples[j].m_bEmittingVolume;
}
if (SampleManager.InitialiseChannel(j,
m_asActiveSamples[j].m_nSampleIndex,
m_asActiveSamples[j].m_bBankIndex)) {
SampleManager.SetChannelFrequency(
j, m_asActiveSamples[j].m_nFrequency);
SampleManager.SetChannelEmittingVolume(j, emittingVol);
SampleManager.SetChannelLoopPoints(
j, m_asActiveSamples[j].m_nLoopStart,
m_asActiveSamples[j].m_nLoopEnd);
SampleManager.SetChannelLoopCount(
j, m_asActiveSamples[j].m_nLoopCount);
SampleManager.SetChannelReverbFlag(
j, m_asActiveSamples[j].m_bReverbFlag);
if (m_asActiveSamples[j].m_bIsDistant) {
uint8 offset = m_asActiveSamples[j].m_bOffset;
if (offset == 63) {
x = 0.f;
}
else if (offset >= 63) {
x = (offset - 63) * 1000.f / 63;
}
else {
x = -(63 - offset) * 1000.f / 63;
}
usedX = x;
usedY = 0.f;
usedZ = 0.f;
m_asActiveSamples[j].m_fSoundIntensity = 100000.0f;
}
else {
usedX = position.x;
usedY = position.y;
usedZ = position.z;
}
SampleManager.SetChannel3DPosition(j, usedX, usedY, usedZ);
SampleManager.SetChannel3DDistances(
j, m_asActiveSamples[j].m_fSoundIntensity,
0.25f * m_asActiveSamples[j].m_fSoundIntensity);
SampleManager.StartChannel(j);
}
m_asActiveSamples[j].m_bIsProcessed = 1;
sample.m_bIsProcessed = 1;
sample.field_88 = -1;
break;
}
}
}
}
}
}
bool
@ -3057,7 +3262,7 @@ cAudioManager::ProcessBridgeMotor()
m_sQueueSample.m_bVolume = ComputeVolume(maxVolume, bridgeIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_counter = 1;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE;
m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 1;
@ -3128,7 +3333,7 @@ cAudioManager::ProcessBridgeWarning()
m_sQueueSample.m_bVolume = ComputeVolume(100, 450.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_counter = 0;
m_sQueueSample.m_nSampleIndex = 457;
m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 1;
@ -3154,7 +3359,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams *params)
{
CAutomobile *automobile;
if(params->m_fDistance >= 1600.f) return false;
if(params->m_fDistance >= SQR(40.f)) return false;
automobile = (CAutomobile *)params->m_pVehicle;
if(automobile->bEngineOn && automobile->m_bombType == CARBOMB_TIMEDACTIVE) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
@ -3411,11 +3616,11 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
uint8 engineStatus;
uint8 emittingVolume;
if(params->m_fDistance >= 1600.f) return false;
if(params->m_fDistance >= SQR(engineDamageIntensity)) return false;
veh = (CAutomobile *)params->m_pVehicle;
if(veh->bEngineOn) {
engineStatus = veh->Damage.GetEngineStatus();
if(engineStatus > 250u || engineStatus < 100) return true;
if(engineStatus > 250 || engineStatus < 100) return true;
if(engineStatus < 225) {
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
emittingVolume = 6;
@ -3428,7 +3633,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE);
}
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, 40.f, m_sQueueSample.m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(emittingVolume, engineDamageIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_counter = 28;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@ -3439,7 +3644,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams *params)
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 2.0f;
m_sQueueSample.m_fSoundIntensity = 40.0f;
m_sQueueSample.m_fSoundIntensity = engineDamageIntensity;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_76 = 3;
m_sQueueSample.m_bReverbFlag = true;
@ -3535,7 +3740,7 @@ cAudioManager::ProcessExplosions(int32 explosion)
CVector *pos;
float distSquared;
for(uint8 i = 0; i < 48; i++) {
for(uint8 i = 0; i < ARRAY_SIZE(gaExplosion); i++) {
if(CExplosion::GetExplosionActiveCounter(i) == 1) {
CExplosion::ResetExplosionActiveCounter(i);
type = CExplosion::GetExplosionType(i);
@ -3906,7 +4111,7 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_bEmittingVolume = 60; \
m_sQueueSample.field_48 = 0.0f; \
m_sQueueSample.m_fSoundIntensity = 80.0f; \
m_sQueueSample.field_16 = 4; \
/*m_sQueueSample.field_16 = 4;*/ \
m_sQueueSample.m_bReverbFlag = true; \
/*m_sQueueSample.m_bReverbFlag = true;*/ \
m_sQueueSample.m_bIsDistant = false; \
@ -3916,7 +4121,7 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nLoopEnd = -1; \
m_sQueueSample.m_counter = iSound++; \
if(iSound < 32) iSound = 32; \
m_sQueueSample.m_bRequireReflection = 1; \
m_sQueueSample.m_bRequireReflection = true; \
AddSampleToRequestedQueue(); \
} \
} \
@ -3936,7 +4141,7 @@ cAudioManager::ProcessGarages()
state = CGarages::Garages[i].m_eGarageState;
if(state == GS_OPENING || state == GS_CLOSING || state == GS_AFTERDROPOFF) {
CalculateDistance(distCalculated, distSquared);
m_sQueueSample.m_bVolume = ComputeVolume(90u, 80.f, m_sQueueSample.m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(90, 80.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
if(CGarages::Garages[i].m_eGarageType == GARAGE_CRUSHER) {
if(CGarages::Garages[i].m_eGarageState == GS_AFTERDROPOFF) {
@ -3956,11 +4161,11 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_nSampleIndex) >>
1;
m_sQueueSample.m_nFrequency +=
RandomDisplacement((int32)m_sQueueSample.m_nFrequency >> 4);
RandomDisplacement(m_sQueueSample.m_nFrequency >> 4);
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.field_56 = 1;
m_sQueueSample.m_counter = iSound++;
if(iSound < 32u) iSound = 32;
if(iSound < 32) iSound = 32;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 3;
@ -4002,9 +4207,9 @@ cAudioManager::ProcessGarages()
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
LOOP_HELPER
}
}
LOOP_HELPER
}
}
#undef LOOP_HELPER
@ -4184,11 +4389,8 @@ cAudioManager::ProcessJumboAccel(CPlane *plane)
void
cAudioManager::ProcessJumboDecel(CPlane *plane)
{
float modificator;
if(SetupJumboFlySound(20) && SetupJumboTaxiSound(75)) {
modificator = (plane->m_fSpeed - 0.10334f) * 1.676f;
if(modificator > 1.0f) modificator = 1.0f;
const float modificator = min(1.f, (plane->m_fSpeed - 0.10334f) * 1.676f);
SetupJumboEngineSound(maxVolume * modificator, 6050.f * modificator + 16000);
SetupJumboWhineSound(18, 29500);
}
@ -4203,7 +4405,7 @@ cAudioManager::ProcessJumboFlying()
void
cAudioManager::ProcessJumboLanding(CPlane *plane)
{
float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f;
const float modificator = (LandingPoint - PlanePathPosition[plane->m_nPlaneId]) / 350.f;
if(SetupJumboFlySound(107.f * modificator + 20)) {
if(SetupJumboTaxiSound(75.f * (1.f - modificator))) {
SetupJumboEngineSound(maxVolume, 22050);
@ -4215,7 +4417,7 @@ cAudioManager::ProcessJumboLanding(CPlane *plane)
void
cAudioManager::ProcessJumboTakeOff(CPlane *plane)
{
float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f;
const float modificator = (PlanePathPosition[plane->m_nPlaneId] - TakeOffPoint) / 300.f;
if(SetupJumboFlySound((107.f * modificator) + 20) && SetupJumboRumbleSound(maxVolume * (1.f - modificator))) {
if(SetupJumboEngineSound(maxVolume, 22050)) SetupJumboWhineSound(18.f * (1.f - modificator), 44100);
@ -5004,13 +5206,11 @@ cAudioManager::ProcessMissionAudio()
void
cAudioManager::ProcessModelCarEngine(cVehicleParams *params)
{
cAudioManager *v2;
CAutomobile *automobile;
float allowedVelocity;
int32 emittingVol;
float velocityChange;
v2 = this;
if(params->m_fDistance < 900.f) {
automobile = (CAutomobile *)params->m_pVehicle;
if(automobile->bEngineOn) {
@ -5312,13 +5512,13 @@ cAudioManager::ProcessPed(CPhysical *ped)
{
cPedParams params;
params.m_pPed = 0;
params.m_bDistanceCalculated = 0;
params.m_pPed = nil;
params.m_bDistanceCalculated = false;
params.m_fDistance = 0.0f;
m_sQueueSample.m_vecPos = ped->GetPosition();
params.m_bDistanceCalculated = 0;
//params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(ped->m_modelIndex == MI_FATMALE02) ProcessPedHeadphones(&params);
@ -5329,7 +5529,7 @@ void
cAudioManager::ProcessPedHeadphones(cPedParams *params)
{
CPed *ped;
CVehicle *veh;
CAutomobile *veh;
uint8 emittingVol;
if(params->m_fDistance < 49.f) {
@ -5338,9 +5538,9 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
if(ped->bInVehicle && ped->m_nPedState == PED_DRIVING) {
emittingVol = 10;
veh = ped->m_pMyVehicle;
veh = (CAutomobile*)ped->m_pMyVehicle;
if(veh && veh->IsCar()) {
for(int32 i = 2; i < 6; i++) {
for(int32 i = 2; i < ARRAYSIZE(veh->Doors); i++) {
if(!veh->IsDoorClosed((eDoors)i) || veh->IsDoorMissing((eDoors)i)) {
emittingVol = 42;
break;
@ -7235,11 +7435,224 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams *params)
return true;
}
WRAPPER
bool
cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
void
cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
{
EAXJMP(0x56A610);
CVehicle* playerVeh;
CVehicle* veh;
CAutomobile* automobile;
float relativeGearChange;
float relativeChange;
float reverseRelativechange;
uint8 volume;
eSfxSample accelerationSample;
int32 freq;
uint8 emittingVol;
cTransmission* transmission;
uint8 currentGear;
float modificator;
float traction = 0.f;
if (params->m_fDistance < SQR(50.f)) {
playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle;
if (playerVeh == veh && veh->m_status == STATUS_WRECKED) {
SampleManager.StopChannel(m_bActiveSamples);
return;
}
if (veh->bEngineOn) {
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
automobile = (CAutomobile*)params->m_pVehicle;
if (params->m_nIndex == DODO) {
ProcessCesna(params);
return;
}
if (FindPlayerVehicle() == veh) {
ProcessPlayersVehicleEngine(params, automobile);
return;
}
transmission = params->m_pTransmission;
if (transmission) {
currentGear = params->m_pVehicle->m_nCurrentGear;
if (automobile->m_nWheelsOnGround) {
if (automobile->bIsHandbrakeOn) {
if (0.f == params->m_fVelocityChange) traction = 0.9f;
}
else if (params->m_pVehicle->m_status == STATUS_SIMPLE) {
traction = 0.f;
}
else {
switch (transmission->nDriveType) {
case '4':
for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING)
traction += 0.05f;
}
break;
case 'F':
if (automobile->m_aWheelState[0] == WHEEL_STATE_SPINNING)
traction += 0.1f;
if (automobile->m_aWheelState[2] == WHEEL_STATE_SPINNING)
traction += 0.1f;
break;
case 'R':
if (automobile->m_aWheelState[1] == WHEEL_STATE_SPINNING)
traction += 0.1f;
if (automobile->m_aWheelState[3] == WHEEL_STATE_SPINNING)
traction += 0.1f;
break;
}
}
if (transmission->fMaxVelocity <= 0.f) {
relativeChange = 0.f;
}
else if (currentGear) {
if ((params->m_fVelocityChange -
transmission->Gears[currentGear].fShiftDownVelocity) /
transmission->fMaxVelocity * 2.5f <=
1.f)
relativeGearChange =
(params->m_fVelocityChange -
transmission->Gears[currentGear].fShiftDownVelocity) /
transmission->fMaxVelocity * 2.5f;
else
relativeGearChange = 1.f;
if (0.f == traction && automobile->m_status != STATUS_SIMPLE &&
params->m_fVelocityChange >=
transmission->Gears[1].fShiftUpVelocity) {
traction = 0.7f;
}
relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f +
(1.f - traction) * relativeGearChange;
}
else {
reverseRelativechange =
Abs((params->m_fVelocityChange -
transmission->Gears[0].fShiftDownVelocity) /
transmission->fMaxReverseVelocity);
if (1.f - reverseRelativechange <= 1.f) {
relativeChange = 1.f - reverseRelativechange;
}
else {
relativeChange = 1.f;
}
}
}
else {
if (automobile->m_nDriveWheelsOnGround)
automobile->m_fGasPedalAudio = automobile->m_fGasPedalAudio * 0.4f;
relativeChange = automobile->m_fGasPedalAudio;
}
modificator = relativeChange;
if (currentGear || !automobile->m_nWheelsOnGround)
freq = 1200 * currentGear + 18000.f * modificator + 14000;
else
freq = 13000.f * modificator + 14000;
if (modificator >= 0.75f) {
emittingVol = 120;
volume = ComputeVolume(120, 50.f, m_sQueueSample.m_fDistance);
}
else {
emittingVol = modificator * 4 / 3 * 40.f + 80.f;
volume = ComputeVolume(emittingVol, 50.f, m_sQueueSample.m_fDistance);
}
}
else {
modificator = 0.f;
emittingVol = 80;
volume = ComputeVolume(80, 50.f, m_sQueueSample.m_fDistance);
}
m_sQueueSample.m_bVolume = volume;
if (m_sQueueSample.m_bVolume) {
if (automobile->m_status == STATUS_SIMPLE) {
if (modificator < 0.02f) {
m_sQueueSample.m_nSampleIndex =
CarSounds[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10;
freq = 10000.f * modificator + 22050;
m_sQueueSample.m_counter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.field_16 = 3;
m_sQueueSample.m_nFrequency =
freq + 100 * m_sQueueSample.m_nEntityIndex % 1000;
if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 ||
m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6)
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_76 = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
return;
}
accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
}
else {
if (automobile->m_fGasPedal < 0.05f) {
m_sQueueSample.m_nSampleIndex =
CarSounds[params->m_nIndex].m_bEngineSoundType +
SFX_CAR_REV_10; // to recheck idle sounds start 1 postion later
freq = 10000.f * modificator + 22050;
m_sQueueSample.m_counter = 52;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.field_16 = 3;
m_sQueueSample.m_nFrequency =
freq + 100 * m_sQueueSample.m_nEntityIndex % 1000;
if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 ||
m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6)
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(
m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_76 = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
return;
}
accelerationSample = CarSounds[params->m_nIndex].m_nAccelerationSampleIndex;
}
m_sQueueSample.m_nSampleIndex = accelerationSample;
m_sQueueSample.m_counter = 2;
m_sQueueSample.m_bBankIndex = 0;
m_sQueueSample.m_bIsDistant = 0;
m_sQueueSample.field_16 = 3;
m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nEntityIndex % 1000;
if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_6 ||
m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_6)
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency >> 1;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_bEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart =
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_nLoopEnd =
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.field_48 = 6.0f;
m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.field_56 = 0;
m_sQueueSample.field_76 = 8;
m_sQueueSample.m_bReverbFlag = 1;
m_sQueueSample.m_bRequireReflection = 0;
AddSampleToRequestedQueue();
return;
}
}
}
}
void
@ -7359,7 +7772,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
freq = 6050 * emittingVol / 30 + 16000;
} else {
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
modificator = m_sQueueSample.m_fDistance * 1.f / 95.f * 0.5f;
modificator = m_sQueueSample.m_fDistance / 190.f;
sampleFreq = SampleManager.GetSampleBaseFrequency(
SFX_ROAD_NOISE);
freq = (sampleFreq * modificator) + ((3 * sampleFreq) >> 2);
@ -7648,7 +8061,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIsDistant = false;
m_sQueueSample.field_16 = 3;
modificator = m_sQueueSample.m_fDistance * 1.f / 3.f * 0.5f;
modificator = m_sQueueSample.m_fDistance / 6.f;
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
m_sQueueSample.m_nFrequency = freq + freq * modificator;
m_sQueueSample.m_nLoopCount = 0;

View File

@ -489,7 +489,7 @@ public:
void PreloadMissionAudio(const char *name); /// ok
void PreTerminateGameSpecificShutdown(); /// ok
/// processX - main logic of adding new sounds
void ProcessActiveQueues(); // todo
void ProcessActiveQueues(); /// ok
bool ProcessAirBrakes(cVehicleParams *params); /// ok
void ProcessAirportScriptObject(uint8 sound); /// ok
bool ProcessBoatEngine(cVehicleParams *params); /// ok
@ -544,7 +544,7 @@ public:
bool ProcessTrainNoise(cVehicleParams *params); /// ok
void ProcessVehicle(CVehicle *vehicle); /// ok
bool ProcessVehicleDoors(cVehicleParams *params); /// ok
bool ProcessVehicleEngine(cVehicleParams *params); // todo
void ProcessVehicleEngine(cVehicleParams *params); /// ok
void ProcessVehicleHorn(cVehicleParams *params); /// ok
void ProcessVehicleOneShots(void *); // todo
bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok

View File

@ -6,9 +6,6 @@
#include "Curves.h"
#include "PathFind.h"
#if 0
WRAPPER void CAutoPilot::ModifySpeed(float) { EAXJMP(0x4137B0); }
#else
void CAutoPilot::ModifySpeed(float speed)
{
m_fMaxTrafficSpeed = max(0.01f, speed);
@ -41,7 +38,6 @@ void CAutoPilot::ModifySpeed(float speed)
m_nTimeEnteredCurve = CTimer::GetTimeInMilliseconds() - positionBetweenNodes * m_nSpeedScaleFactor;
#endif
}
#endif
void CAutoPilot::RemoveOnePathNode()
{

View File

@ -881,9 +881,7 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
}
}
#if 0
WRAPPER void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float) { EAXJMP(0x419300); }
#else
void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed)
{
float frontOffset = pVehicle->GetModelInfo()->GetColModel()->boundingBox.max.y;
@ -991,7 +989,6 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
}
}
}
#endif
void CCarCtrl::SlowCarDownForCarsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed)
{
@ -1055,9 +1052,6 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
}
}
#if 0
WRAPPER float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle* pVehicleB, float projectionX, float projectionY, CVector* pForwardA, CVector* pForwardB, uint8 id) { EAXJMP(0x41A020); }
#else
float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle* pVehicleB, float projectionX, float projectionY, CVector* pForwardA, CVector* pForwardB, uint8 id)
{
CVector2D vecBToA = pVehicleA->GetPosition() - pVehicleB->GetPosition();
@ -1180,7 +1174,6 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
}
return proximity;
}
#endif
float CCarCtrl::FindAngleToWeaveThroughTraffic(CVehicle* pVehicle, CPhysical* pTarget, float angleToTarget, float angleForward)
{

View File

@ -2,9 +2,6 @@
#include "patcher.h"
#include "Curves.h"
#if 0
WRAPPER float CCurves::CalcSpeedScaleFactor(CVector*, CVector*, float, float, float, float) { EAXJMP(0x420410); }
#else
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
{
CVector2D dir1(dir1X, dir1Y);
@ -16,11 +13,7 @@ float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float di
else
return ((1.0f - dp) * 0.2f + 1.0f) * distance;
}
#endif
#if 0
WRAPPER void CCurves::CalcCurvePoint(CVector*, CVector*, CVector*, CVector*, float, int32, CVector*, CVector*) { EAXJMP(0x4204D0); }
#else
void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVector* pDir2, float between, int32 timeOnCurve, CVector* pOutPos, CVector* pOutDir)
{
float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y);
@ -36,4 +29,3 @@ void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVe
(dir1.y * (1.0f - curveCoef) + dir2.y * curveCoef) / (timeOnCurve * 0.001f),
0.0f);
}
#endif

View File

@ -162,9 +162,6 @@ CDarkel::ReadStatus()
return Status;
}
#if 0
WRAPPER void CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) { EAXJMP(0x421070); }
#else
void
CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
{
@ -178,11 +175,7 @@ CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
RegisteredKills[vehicle->GetModelIndex()]++;
CStats::CarsExploded++;
}
#endif
#if 0
WRAPPER void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) { EAXJMP(0x420F60); }
#else
void
CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot)
{
@ -207,7 +200,6 @@ CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot)
CStats::HeadsPopped++;
CStats::KillsSinceLastCheckpoint++;
}
#endif
void
CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
@ -222,9 +214,6 @@ CDarkel::ResetModelsKilledByPlayer()
RegisteredKills[i] = 0;
}
#if 0
WRAPPER void CDarkel::ResetOnPlayerDeath() { EAXJMP(0x420E70); }
#else
void
CDarkel::ResetOnPlayerDeath()
{
@ -253,11 +242,7 @@ CDarkel::ResetOnPlayerDeath()
player->MakeChangesForNewWeapon(player->m_currentWeapon);
}
}
#endif
#if 0
WRAPPER void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot) { EAXJMP(0x4210E0); }
#else
void
CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot)
{
@ -306,7 +291,6 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
if (CDarkel::bStandardSoundAndMessages)
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_START, 0);
}
#endif
void
CDarkel::Update()

View File

@ -113,9 +113,6 @@ static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
&CPed::PedLandCB, &FinishFuckUCB, &CPed::RestoreHeadingRateCB, &CPed::PedSetQuickDraggedOutCarPositionCB, &CPed::PedSetDraggedOutCarPositionCB
};
#if 0
WRAPPER uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) { EAXJMP(0x584E70); }
#else
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
{
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
@ -128,16 +125,12 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
}
return 0;
}
#endif
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
{
return CBArray_RE3[id];
}
#if 0
WRAPPER static void ApplyPanelDamageToCar(uint32, CAutomobile*, bool) { EAXJMP(0x584EA0); }
#else
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
{
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
@ -169,7 +162,6 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi
vehicle->SetPanelDamage(CAR_BUMP_REAR, VEHBUMPER_REAR, flying);
}
}
#endif
void PrintElementsInPtrList(void)
{
@ -262,9 +254,6 @@ void CReplay::Update(void)
}
}
#if 0
WRAPPER void CReplay::RecordThisFrame(void) { EAXJMP(0x5932B0); }
#else
void CReplay::RecordThisFrame(void)
{
#ifdef FIX_REPLAY_BUGS
@ -377,11 +366,7 @@ void CReplay::RecordThisFrame(void)
MarkEverythingAsNew();
#endif
}
#endif
#if 0
WRAPPER void CReplay::StorePedUpdate(CPed *ped, int id) { EAXJMP(0x5935B0); }
#else
void CReplay::StorePedUpdate(CPed *ped, int id)
{
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
@ -399,11 +384,7 @@ void CReplay::StorePedUpdate(CPed *ped, int id)
StorePedAnimation(ped, &pp->anim_state);
Record.m_nOffset += sizeof(tPedUpdatePacket);
}
#endif
#if 0
WRAPPER void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x593670); }
#else
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
{
CAnimBlendAssociation* second;
@ -442,11 +423,7 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
state->partBlendAmount = 0;
}
}
#endif
#if 0
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
#else
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
{
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
@ -503,10 +480,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
}
#endif
#if 0
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
#else
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
{
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
@ -543,11 +517,7 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
CWorld::Add(ped);
buffer->m_nOffset += sizeof(tPedUpdatePacket);
}
#endif
#if 0
WRAPPER void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x5942A0); }
#else
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
{
CAnimBlendAssociation* anim1 = CAnimManager::BlendAnimation(
@ -585,11 +555,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
}
}
}
#endif
#if 0
WRAPPER void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x5944B0); }
#else
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
{
#ifdef FIX_REPLAY_BUGS
@ -658,11 +624,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
}
#endif
#if 0
WRAPPER void CReplay::PlaybackThisFrame(void) { EAXJMP(0x5946B0); }
#else
void CReplay::PlaybackThisFrame(void)
{
static int FrameSloMo = 0;
@ -687,7 +649,6 @@ void CReplay::PlaybackThisFrame(void)
DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0);
}
#endif
// next two functions are only found in mobile version
// most likely they were optimized out for being unused
@ -712,9 +673,6 @@ bool CReplay::FastForwardToTime(uint32 start)
return true;
}
#if 0
WRAPPER void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) { EAXJMP(0x5947F0); }
#else
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
{
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
@ -750,11 +708,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
}
Record.m_nOffset += sizeof(tVehicleUpdatePacket);
}
#endif
#if 0
WRAPPER void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594D10); }
#else
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
{
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
@ -824,11 +778,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
((CBoat*)vehicle)->m_bIsAnchored = false;
}
}
#endif
#if 0
WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { EAXJMP(0x595240); }
#else
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer){
/* Mistake. Not even sure what this is even doing here...
* PlayerWanted is a backup to restore at the end of replay.
@ -1028,10 +978,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
ProcessReplayCamera();
return false;
}
#endif
#if 0
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
#else
void CReplay::FinishPlayback(void)
{
if (Mode != MODE_PLAYBACK)
@ -1053,11 +1000,7 @@ void CReplay::FinishPlayback(void)
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
}
#endif
#if 0
WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); }
#else
void CReplay::EmptyReplayBuffer(void)
{
if (Mode == MODE_PLAYBACK)
@ -1072,11 +1015,7 @@ void CReplay::EmptyReplayBuffer(void)
Record.m_pBase[Record.m_nOffset] = 0;
MarkEverythingAsNew();
}
#endif
#if 0
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
#else
void CReplay::ProcessReplayCamera(void)
{
switch (CameraMode) {
@ -1120,11 +1059,7 @@ void CReplay::ProcessReplayCamera(void)
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
}
#endif
#if 0
WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); }
#else
void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene)
{
if (Mode != MODE_RECORD)
@ -1174,11 +1109,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
if (cam_mode == REPLAYCAMMODE_ASSTORED)
TheCamera.CarZoomIndicator = 5.0f;
}
#endif
#if 0
WRAPPER void CReplay::StoreStuffInMem(void) { EAXJMP(0x5961F0); }
#else
void CReplay::StoreStuffInMem(void)
{
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
@ -1223,11 +1154,7 @@ void CReplay::StoreStuffInMem(void)
StoreDetailedPedAnimation(ped, &pPedAnims[i]);
}
}
#endif
#if 0
WRAPPER void CReplay::RestoreStuffFromMem(void) { EAXJMP(0x5966E0); }
#else
void CReplay::RestoreStuffFromMem(void)
{
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
@ -1388,11 +1315,7 @@ void CReplay::RestoreStuffFromMem(void)
DMAudio.SetRadioInCar(OldRadioStation);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
#endif
#if 0
WRAPPER void CReplay::EmptyPedsAndVehiclePools(void) { EAXJMP(0x5970E0); }
#else
void CReplay::EmptyPedsAndVehiclePools(void)
{
int i = CPools::GetVehiclePool()->GetSize();
@ -1412,11 +1335,7 @@ void CReplay::EmptyPedsAndVehiclePools(void)
delete p;
}
}
#endif
#if 0
WRAPPER void CReplay::EmptyAllPools(void) { EAXJMP(0x5971B0); }
#else
void CReplay::EmptyAllPools(void)
{
EmptyPedsAndVehiclePools();
@ -1437,11 +1356,7 @@ void CReplay::EmptyAllPools(void)
delete d;
}
}
#endif
#if 0
WRAPPER void CReplay::MarkEverythingAsNew(void) { EAXJMP(0x597280); }
#else
void CReplay::MarkEverythingAsNew(void)
{
int i = CPools::GetVehiclePool()->GetSize();
@ -1459,11 +1374,7 @@ void CReplay::MarkEverythingAsNew(void)
p->bHasAlreadyBeenRecorded = false;
}
}
#endif
#if 0
WRAPPER void CReplay::SaveReplayToHD(void) { EAXJMP(0x597330); }
#else
void CReplay::SaveReplayToHD(void)
{
CFileMgr::SetDirMyDocuments();
@ -1494,11 +1405,7 @@ void CReplay::SaveReplayToHD(void)
CFileMgr::CloseFile(fw);
CFileMgr::SetDir("");
}
#endif
#if 0
WRAPPER void PlayReplayFromHD(void) { EAXJMP(0x597420); }
#else
void PlayReplayFromHD(void)
{
CFileMgr::SetDirMyDocuments();
@ -1530,11 +1437,7 @@ void PlayReplayFromHD(void)
CReplay::bAllowLookAroundCam = true;
CReplay::StreamAllNecessaryCarsAndPeds();
}
#endif
#if 0
WRAPPER void CReplay::StreamAllNecessaryCarsAndPeds(void) { EAXJMP(0x597560); }
#else
void CReplay::StreamAllNecessaryCarsAndPeds(void)
{
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
@ -1555,11 +1458,7 @@ void CReplay::StreamAllNecessaryCarsAndPeds(void)
}
CStreaming::LoadAllRequestedModels(false);
}
#endif
#if 0
WRAPPER void CReplay::FindFirstFocusCoordinate(CVector *coord) { EAXJMP(0x5975E0); }
#else
void CReplay::FindFirstFocusCoordinate(CVector *coord)
{
*coord = CVector(0.0f, 0.0f, 0.0f);
@ -1574,11 +1473,7 @@ void CReplay::FindFirstFocusCoordinate(CVector *coord)
}
}
}
#endif
#if 0
WRAPPER bool CReplay::ShouldStandardCameraBeProcessed(void) { EAXJMP(0x597680); }
#else
bool CReplay::ShouldStandardCameraBeProcessed(void)
{
if (Mode != MODE_PLAYBACK)
@ -1587,11 +1482,7 @@ bool CReplay::ShouldStandardCameraBeProcessed(void)
return false;
return FindPlayerVehicle() != nil;
}
#endif
#if 0
WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); }
#else
void CReplay::ProcessLookAroundCam(void)
{
if (!bAllowLookAroundCam)
@ -1647,11 +1538,7 @@ void CReplay::ProcessLookAroundCam(void)
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
}
#endif
#if 0
WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); }
#else
size_t CReplay::FindSizeOfPacket(uint8 type)
{
switch (type) {
@ -1669,11 +1556,7 @@ size_t CReplay::FindSizeOfPacket(uint8 type)
}
return 0;
}
#endif
#if 0
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
#else
void CReplay::Display()
{
static int TimeCount = 0;
@ -1691,7 +1574,6 @@ void CReplay::Display()
if (Mode == MODE_PLAYBACK)
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
}
#endif
STARTPATCHES
InjectHook(0x592FE0, &CReplay::Init, PATCH_JUMP);

View File

@ -2842,9 +2842,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1;
}
#if 0
WRAPPER int8 CRunningScript::ProcessCommand300To399(int32 command) { EAXJMP(0x43ED30); }
#else
int8 CRunningScript::ProcessCommands300To399(int32 command)
{
switch (command) {
@ -3576,11 +3573,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands400To499(int32 command) { EAXJMP(0x440CB0); }
#else
int8 CRunningScript::ProcessCommands400To499(int32 command)
{
switch (command) {
@ -4370,11 +4363,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands500To599(int32 command) { EAXJMP(0x4429C0); }
#else
int8 CRunningScript::ProcessCommands500To599(int32 command)
{
switch (command) {
@ -5201,11 +5190,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands600To699(int32 command) { EAXJMP(0x444B20); }
#else
int8 CRunningScript::ProcessCommands600To699(int32 command)
{
switch (command){
@ -5559,11 +5544,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands700To799(int32 command) { EAXJMP(0x4458A0); }
#else
int8 CRunningScript::ProcessCommands700To799(int32 command)
{
switch (command){
@ -6429,11 +6410,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands800To899(int32 command) { EAXJMP(0x448240); }
#else
int8 CRunningScript::ProcessCommands800To899(int32 command)
{
CMatrix tmp_matrix;
@ -7515,11 +7491,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}
return -1;
}
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands900To999(int32 command) { EAXJMP(0x44CB80); }
#else
int8 CRunningScript::ProcessCommands900To999(int32 command)
{
char str[52];
@ -8420,7 +8392,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
}
return -1;
}
#endif
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{

View File

@ -28,6 +28,7 @@ const float DefaultFOV = 70.0f; // beta: 80.0f
bool PrintDebugCode = false;
int16 &DebugCamMode = *(int16*)0x95CCF2;
bool bFreeCam = false;
void
CCam::Init(void)
@ -138,6 +139,11 @@ CCam::Process(void)
if(CCamera::m_bUseMouse3rdPerson)
Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#ifdef FREE_CAM
if(bFreeCam)
Process_FollowPed_Rotation(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
Process_FollowPed(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
// case MODE_AIMING:
@ -4369,7 +4375,209 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri
GetVectorsReadyForRW();
}
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
{
FOV = DefaultFOV;
const float MinDist = 2.0f;
const float MaxDist = 2.0f + TheCamera.m_fPedZoomValueSmooth;
const float BaseOffset = 0.75f; // base height of camera above target
CVector TargetCoors = CameraTarget;
TargetCoors.z += m_fSyphonModeTargetZOffSet;
TargetCoors = DoAverageOnVector(TargetCoors);
TargetCoors.z += BaseOffset; // add offset so alpha evens out to 0
// TargetCoors.z += m_fRoadOffSet;
CVector Dist = Source - TargetCoors;
CVector ToCam;
bool Shooting = false;
if(((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED)
if(CPad::GetPad(0)->GetWeapon())
Shooting = true;
if(((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType == WEAPONTYPE_DETONATOR ||
((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType == WEAPONTYPE_BASEBALLBAT)
Shooting = false;
if(ResetStatics){
// Coming out of top down here probably
// so keep Beta, reset alpha and calculate vectors
Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Alpha = 0.0f;
Dist = MaxDist*CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha));
Source = TargetCoors + Dist;
ResetStatics = false;
}
// Drag the camera along at the look-down offset
float CamDist = Dist.Magnitude();
if(CamDist == 0.0f)
Dist = CVector(1.0f, 1.0f, 0.0f);
else if(CamDist < MinDist)
Dist *= MinDist/CamDist;
else if(CamDist > MaxDist)
Dist *= MaxDist/CamDist;
CamDist = Dist.Magnitude();
// Beta = 0 is looking east, HALFPI is north, &c.
// Alpha positive is looking up
float GroundDist = Dist.Magnitude2D();
Beta = CGeneral::GetATanOfXY(-Dist.x, -Dist.y);
Alpha = CGeneral::GetATanOfXY(GroundDist, -Dist.z);
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
while(Alpha >= PI) Alpha -= 2.0f*PI;
while(Alpha < -PI) Alpha += 2.0f*PI;
// Look around
bool UseMouse = false;
float MouseX = CPad::GetPad(0)->GetMouseX();
float MouseY = CPad::GetPad(0)->GetMouseY();
float LookLeftRight, LookUpDown;
if((MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
UseMouse = true;
LookLeftRight = -2.5f*MouseX;
LookUpDown = 4.0f*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
}
float AlphaOffset, BetaOffset;
if(UseMouse){
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
if(BetaOffset)
Rotating = false;
Beta += BetaOffset;
Alpha += AlphaOffset;
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta;
while(BetaDiff >= PI) BetaDiff -= 2.0f*PI;
while(BetaDiff < -PI) BetaDiff += 2.0f*PI;
float TargetAlpha = Alpha;
// 12deg to account for our little height offset. we're not working on the true alpha here
const float AlphaLimitUp = DEGTORAD(15.0f) + DEGTORAD(12.0f);
const float AlphaLimitDown = -DEGTORAD(15.0f) + DEGTORAD(12.0f);
if(Abs(BetaDiff) < DEGTORAD(25.0f) && ((CPed*)CamTargetEntity)->GetMoveSpeed().Magnitude2D() > 0.01f){
// Limit alpha when player is walking towards camera
if(TargetAlpha > AlphaLimitUp) TargetAlpha = AlphaLimitUp;
if(TargetAlpha < AlphaLimitDown) TargetAlpha = AlphaLimitDown;
}
WellBufferMe(TargetAlpha, &Alpha, &AlphaSpeed, 0.2f, 0.1f, true);
if(CPad::GetPad(0)->ForceCameraBehindPlayer() || Shooting){
m_fTargetBeta = TargetOrientation;
Rotating = true;
}
if(Rotating){
WellBufferMe(m_fTargetBeta, &Beta, &BetaSpeed, 0.1f, 0.06f, true);
float DeltaBeta = m_fTargetBeta - Beta;
while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
while(DeltaBeta < -PI) DeltaBeta += 2*PI;
if(Abs(DeltaBeta) < 0.06f)
Rotating = false;
}
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
m_cvecTargetCoorsForFudgeInter = TargetCoors;
Front = TargetCoors - Source;
Front.Normalise();
/*
* Handle collisions - taken from FollowPedWithMouse
*/
CEntity *entity;
CColPoint colPoint;
// Clip Source and fix near clip
CWorld::pIgnoreEntity = CamTargetEntity;
entity = nil;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}else{
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, 0.9f));
}
}else{
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}
}
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
int i = 0;
while(entity){
CVector CamToCol = gaTempSphereColPoints[0].point - Source;
float frontDist = DotProduct(CamToCol, Front);
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
// Try to decrease near clip
dist = max(min(Near, dist), 0.1f);
if(dist < Near)
RwCameraSetNearClipPlane(Scene.camera, dist);
// Move forward a bit
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;
if(i > 5)
entity = nil;
}
GetVectorsReadyForRW();
}
#endif
STARTPATCHES
#ifdef FREE_CAM
Nop(0x468E7B, 0x468E90-0x468E7B); // disable first person
#endif
InjectHook(0x456F40, WellBufferMe, PATCH_JUMP);
InjectHook(0x458410, &CCam::Init, PATCH_JUMP);
InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP);

View File

@ -221,6 +221,9 @@ struct CCam
// CCam::Process_Blood_On_The_Tracks
// CCam::Process_Cam_Running_Side_Train
// CCam::Process_Cam_On_Train_Roof
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
};
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");

View File

@ -113,7 +113,7 @@ CFire::ProcessFire(void)
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.0125f, 0.1f) * m_fStrength),
0, m_fStrength, 0, 0, 0, 0);
rand(); rand(); rand(); /* unsure why these three rands are called */
CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); /* unsure why these three rands are called */
CParticle::AddParticle(PARTICLE_CARFLAME_SMOKE, firePos,
CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
@ -129,8 +129,10 @@ CFire::ProcessFire(void)
if (!m_pEntity) {
CShadows::StoreStaticShadow((uint32)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos,
7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2, nRandNumber / 2,
0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
7.0f, 0.0f, 0.0f, -7.0f,
255, // this is 0 on PC which results in no shadow
nRandNumber / 2, nRandNumber / 2, 0,
10.0f, 1.0f, 40.0f, 0, 0.0f);
}
fGreen = nRandNumber / 128;
fRed = nRandNumber / 128;

View File

@ -1694,9 +1694,6 @@ int CMenuManager::GetStartOptionsCntrlConfigScreens()
}
#endif
#if DONT_USE_SUSPICIOUS_FUNCS
WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); }
#else
void CMenuManager::InitialiseChangedLanguageSettings()
{
if (m_bFrontEnd_ReloadObrTxtGxt) {
@ -1719,7 +1716,6 @@ void CMenuManager::InitialiseChangedLanguageSettings()
}
}
}
#endif
void CMenuManager::LoadAllTextures()
{

View File

@ -75,9 +75,6 @@ static_assert(RADAR_TILE_SIZE == (WORLD_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
#define RADAR_MIN_SPEED (0.3f)
#define RADAR_MAX_SPEED (0.9f)
#if 0
WRAPPER void CRadar::CalculateBlipAlpha(float) { EAXJMP(0x4A4F90); }
#else
uint8 CRadar::CalculateBlipAlpha(float dist)
{
if (dist <= 1.0f)
@ -88,55 +85,35 @@ uint8 CRadar::CalculateBlipAlpha(float dist)
return 128;
}
#endif
#if 0
WRAPPER void CRadar::ChangeBlipBrightness(int32, int32) { EAXJMP(0x4A57A0); }
#else
void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
{
int index = GetActualBlipArrayIndex(i);
if (index != -1)
ms_RadarTrace[index].m_bDim = bright != 1;
}
#endif
#if 0
WRAPPER void CRadar::ChangeBlipColour(int32, int32) { EAXJMP(0x4A5770); }
#else
void CRadar::ChangeBlipColour(int32 i, int32 color)
{
int index = GetActualBlipArrayIndex(i);
if (index != -1)
ms_RadarTrace[index].m_nColor = color;
}
#endif
#if 0
WRAPPER void CRadar::ChangeBlipDisplay(int32, eBlipDisplay) { EAXJMP(0x4A5810); }
#else
void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
{
int index = GetActualBlipArrayIndex(i);
if (index != -1)
ms_RadarTrace[index].m_eBlipDisplay = display;
}
#endif
#if 0
WRAPPER void CRadar::ChangeBlipScale(int32, int32) { EAXJMP(0x4A57E0); }
#else
void CRadar::ChangeBlipScale(int32 i, int32 scale)
{
int index = GetActualBlipArrayIndex(i);
if (index != -1)
ms_RadarTrace[index].m_wScale = scale;
}
#endif
#if 0
WRAPPER void CRadar::ClearBlip(int32) { EAXJMP(0x4A5720); }
#else
void CRadar::ClearBlip(int32 i)
{
int index = GetActualBlipArrayIndex(i);
@ -148,11 +125,7 @@ void CRadar::ClearBlip(int32 i)
ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE;
}
}
#endif
#if 0
WRAPPER void CRadar::ClearBlipForEntity(eBlipType, int32) { EAXJMP(0x4A56C0); }
#else
void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
{
for (int i = 0; i < NUMRADARBLIPS; i++) {
@ -165,11 +138,7 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
}
};
}
#endif
#if 0
WRAPPER int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *in) { EAXJMP(0x4A64A0); }
#else
// Why not a proper clipping algorithm?
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{
@ -249,7 +218,6 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
return n;
}
#endif
bool CRadar::DisplayThisBlip(int32 counter)
{
@ -263,9 +231,6 @@ bool CRadar::DisplayThisBlip(int32 counter)
}
}
#if 0
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
#else
void CRadar::Draw3dMarkers()
{
for (int i = 0; i < NUMRADARBLIPS; i++) {
@ -317,12 +282,7 @@ void CRadar::Draw3dMarkers()
}
}
}
#endif
#if 0
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
#else
void CRadar::DrawBlips()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -580,12 +540,7 @@ void CRadar::DrawBlips()
}
}
}
#endif
#if 0
WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
#else
void CRadar::DrawMap()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -605,11 +560,7 @@ void CRadar::DrawMap()
DrawRadarMap();
}
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
#else
void CRadar::DrawRadarMap()
{
// Game calculates an unused CRect here
@ -642,11 +593,7 @@ void CRadar::DrawRadarMap()
DrawRadarSection(x, y + 1);
DrawRadarSection(x + 1, y + 1);
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarMask() { EAXJMP(0x4A69C0); }
#else
void CRadar::DrawRadarMask()
{
CVector2D corners[4] = {
@ -690,11 +637,7 @@ void CRadar::DrawRadarMask()
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER);
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarSection(int32, int32) { EAXJMP(0x4A67E0); }
#else
void CRadar::DrawRadarSection(int32 x, int32 y)
{
int i;
@ -738,20 +681,12 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
// if(numVertices > 2)
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices);
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha) { EAXJMP(0x4A5EF0); }
#else
void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
}
#endif
#if 0
WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha) { EAXJMP(0x4A5D10); }
#else
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
{
CVector curPosn[4];
@ -778,11 +713,7 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
#endif
#if 0
WRAPPER int32 CRadar::GetActualBlipArrayIndex(int32) { EAXJMP(0x4A41C0); }
#else
int32 CRadar::GetActualBlipArrayIndex(int32 i)
{
if (i == -1)
@ -792,11 +723,7 @@ int32 CRadar::GetActualBlipArrayIndex(int32 i)
else
return (uint16)i;
}
#endif
#if 0
WRAPPER int32 CRadar::GetNewUniqueBlipIndex(int32) { EAXJMP(0x4A4180); }
#else
int32 CRadar::GetNewUniqueBlipIndex(int32 i)
{
if (ms_RadarTrace[i].m_BlipIndex >= UINT16_MAX - 1)
@ -805,11 +732,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i)
ms_RadarTrace[i].m_BlipIndex++;
return i | (ms_RadarTrace[i].m_BlipIndex << 16);
}
#endif
#if 0
WRAPPER uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright) { EAXJMP(0x4A5BB0); }
#else
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{
int32 c;
@ -862,7 +785,6 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
};
return c;
}
#endif
const char* gRadarTexNames[] = {
"radar00", "radar01", "radar02", "radar03", "radar04", "radar05", "radar06", "radar07",
@ -875,9 +797,6 @@ const char* gRadarTexNames[] = {
"radar56", "radar57", "radar58", "radar59", "radar60", "radar61", "radar62", "radar63",
};
#if 0
WRAPPER void CRadar::Initialise() { EAXJMP(0x4A3EF0); }
#else
void
CRadar::Initialise()
{
@ -894,11 +813,7 @@ CRadar::Initialise()
for (int i = 0; i < 64; i++)
gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]);
}
#endif
#if 0
WRAPPER float CRadar::LimitRadarPoint(CVector2D &point) { EAXJMP(0x4A4F30); }
#else
float CRadar::LimitRadarPoint(CVector2D &point)
{
float dist, invdist;
@ -911,11 +826,7 @@ float CRadar::LimitRadarPoint(CVector2D &point)
}
return dist;
}
#endif
#if 0
WRAPPER void CRadar::LoadAllRadarBlips(int32) { EAXJMP(0x4A6F30); }
#else
void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size)
{
Initialise();
@ -927,11 +838,7 @@ INITSAVEBUF
VALIDATESAVEBUF(size);
}
#endif
#if 0
WRAPPER void CRadar::LoadTextures() { EAXJMP(0x4A4030); }
#else
void
CRadar::LoadTextures()
{
@ -959,42 +866,26 @@ CRadar::LoadTextures()
WeaponSprite.SetTexture("radar_weapon");
CTxdStore::PopCurrentTxd();
}
#endif
#if 0
WRAPPER void RemoveMapSection(int32, int32) { EAXJMP(0x00); }
#else
void RemoveMapSection(int32 x, int32 y)
{
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
#endif
#if 0
WRAPPER void CRadar::RemoveRadarSections() { EAXJMP(0x4A60E0); }
#else
void CRadar::RemoveRadarSections()
{
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
RemoveMapSection(i, j);
}
#endif
#if 0
WRAPPER void CRadar::RequestMapSection(int32, int32) { EAXJMP(0x00); }
#else
void CRadar::RequestMapSection(int32 x, int32 y)
{
ClipRadarTileCoords(x, y);
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
}
#endif
#if 0
WRAPPER void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size) { EAXJMP(0x4A6E30); }
#else
void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
{
*size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
@ -1006,11 +897,7 @@ INITSAVEBUF
VALIDATESAVEBUF(*size);
}
#endif
#if 0
WRAPPER void CRadar::SetBlipSprite(int32, int32) { EAXJMP(0x4A5840); }
#else
void CRadar::SetBlipSprite(int32 i, int32 icon)
{
int index = CRadar::GetActualBlipArrayIndex(i);
@ -1018,11 +905,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
ms_RadarTrace[index].m_IconID = icon;
}
}
#endif
#if 0
WRAPPER int32 CRadar::SetCoordBlip(eBlipType, CVector, int32, eBlipDisplay display) { EAXJMP(0x4A5590); }
#else
int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
{
int nextBlip;
@ -1043,11 +926,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
return CRadar::GetNewUniqueBlipIndex(nextBlip);
}
#endif
#if 0
WRAPPER int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay) { EAXJMP(0x4A5640); }
#else
int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
{
int nextBlip;
@ -1066,11 +945,7 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
return GetNewUniqueBlipIndex(nextBlip);
}
#endif
#if 0
WRAPPER void CRadar::SetRadarMarkerState(int32, bool) { EAXJMP(0x4A5C60); }
#else
void CRadar::SetRadarMarkerState(int32 counter, bool flag)
{
CEntity *e;
@ -1091,11 +966,7 @@ void CRadar::SetRadarMarkerState(int32 counter, bool flag)
if (e)
e->bHasBlip = flag;
}
#endif
#if 0
WRAPPER void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { EAXJMP(0x4A59C0); }
#else
void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
float f1 = radius * 1.4f;
float f2 = radius * 0.5f;
@ -1117,11 +988,7 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
p2 = pos - TheCamera.GetRight()*f2;
CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
}
#endif
#if 0
WRAPPER void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha) { EAXJMP(0x4A5870); }
#else
void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
{
if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
@ -1130,7 +997,6 @@ void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 gree
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
}
#endif
void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
{
@ -1156,9 +1022,6 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
}
}
#if 0
WRAPPER void CRadar::Shutdown() { EAXJMP(0x4A3F60); }
#else
void CRadar::Shutdown()
{
AsukaSprite.Delete();
@ -1183,20 +1046,12 @@ void CRadar::Shutdown()
WeaponSprite.Delete();
RemoveRadarSections();
}
#endif
#if 0
WRAPPER void CRadar::StreamRadarSections(const CVector &posn) { EAXJMP(0x4A6B60); }
#else
void CRadar::StreamRadarSections(const CVector &posn)
{
StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
}
#endif
#if 0
WRAPPER void CRadar::StreamRadarSections(int32 x, int32 y) { EAXJMP(0x4A6100); }
#else
void CRadar::StreamRadarSections(int32 x, int32 y)
{
for (int i = 0; i < RADAR_NUM_TILES; ++i) {
@ -1208,11 +1063,7 @@ void CRadar::StreamRadarSections(int32 x, int32 y)
};
};
}
#endif
#if 0
WRAPPER void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y) { EAXJMP(0x4A5530); }
#else
void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y)
{
out.x = in.x - (x * RADAR_TILE_SIZE + WORLD_MIN_X);
@ -1220,11 +1071,7 @@ void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &
out.x /= RADAR_TILE_SIZE;
out.y /= RADAR_TILE_SIZE;
}
#endif
#if 0
WRAPPER void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in) { EAXJMP(0x4A5300); }
#else
void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in)
{
float s, c;
@ -1255,7 +1102,6 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
out = out * m_radarRange + vec2DRadarOrigin;
}
#endif
// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
@ -1265,9 +1111,6 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i
out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
}
#if 0
WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in) { EAXJMP(0x4A50D0); }
#else
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
{
float s, c;
@ -1299,11 +1142,7 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
out.x = s * y + c * x;
out.y = c * y - s * x;
}
#endif
#if 0
WRAPPER void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out) { EAXJMP(0x4A61C0); };
#else
// Transform from section indices to world coordinates
void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
{
@ -1326,11 +1165,7 @@ void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
out[3].x = RADAR_TILE_SIZE * (x);
out[3].y = RADAR_TILE_SIZE * (y);
}
#endif
#if 0
WRAPPER void CRadar::ClipRadarTileCoords(int32 &, int32 &) { EAXJMP(0x00); };
#else
void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
{
if (x < 0)
@ -1342,24 +1177,16 @@ void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
if (y > RADAR_NUM_TILES-1)
y = RADAR_NUM_TILES-1;
}
#endif
#if 0
WRAPPER bool CRadar::IsPointInsideRadar(const CVector2D &) { EAXJMP(0x4A6160); }
#else
bool CRadar::IsPointInsideRadar(const CVector2D &point)
{
if (point.x < -1.0f || point.x > 1.0f) return false;
if (point.y < -1.0f || point.y > 1.0f) return false;
return true;
}
#endif
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
#if 0
WRAPPER int CRadar::LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &) { EAXJMP(0x4A6250); }
#else
int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
{
float d1, d2;
@ -1430,7 +1257,6 @@ int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVe
return edge;
}
#endif
STARTPATCHES
InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP);

View File

@ -75,9 +75,6 @@ void CTimer::Shutdown(void)
;
}
#if 0
WRAPPER void CTimer::Update(void) { EAXJMP(0x4ACF70); }
#else
void CTimer::Update(void)
{
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
@ -149,7 +146,6 @@ void CTimer::Update(void)
m_FrameCounter++;
}
#endif
void CTimer::Suspend(void)
{

View File

@ -206,4 +206,6 @@ enum Config {
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
//#define FREE_CAM // Rotating cam

View File

@ -1,6 +1,11 @@
#include "common.h"
#include "patcher.h"
#include <algorithm>
#include <vector>
#include <Windows.h>
StaticPatcher *StaticPatcher::ms_head;
StaticPatcher::StaticPatcher(Patcher func)
@ -20,3 +25,55 @@ StaticPatcher::Apply()
}
ms_head = nil;
}
std::vector<uint32> usedAddresses;
static DWORD protect[2];
static uint32 protect_address;
static uint32 protect_size;
void
Protect_internal(uint32 address, uint32 size)
{
protect_address = address;
protect_size = size;
VirtualProtect((void*)address, size, PAGE_EXECUTE_READWRITE, &protect[0]);
}
void
Unprotect_internal(void)
{
VirtualProtect((void*)protect_address, protect_size, protect[0], &protect[1]);
}
void
InjectHook_internal(uint32 address, uint32 hook, int type)
{
if(std::any_of(usedAddresses.begin(), usedAddresses.end(),
[address](uint32 value) { return value == address; })) {
debug("Used address %#06x twice when injecting hook\n", address);
}
usedAddresses.push_back(address);
switch(type){
case PATCH_JUMP:
VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
*(uint8*)address = 0xE9;
break;
case PATCH_CALL:
VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
*(uint8*)address = 0xE8;
break;
default:
VirtualProtect((void*)(address + 1), 4, PAGE_EXECUTE_READWRITE, &protect[0]);
break;
}
*(ptrdiff_t*)(address + 1) = hook - address - 5;
if(type == PATCH_NOTHING)
VirtualProtect((void*)(address + 1), 4, protect[0], &protect[1]);
else
VirtualProtect((void*)address, 5, protect[0], &protect[1]);
}

View File

@ -117,16 +117,10 @@ Nop(AT address, unsigned int nCount)
Unprotect_internal();
}
template<typename AT, typename HT> inline void
InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
template <typename T> inline void
InjectHook(uintptr_t address, T hook, unsigned int nType = PATCH_NOTHING)
{
uint32 uiHook;
_asm
{
mov eax, hook
mov uiHook, eax
}
InjectHook_internal((uint32)address, uiHook, nType);
InjectHook_internal(address, reinterpret_cast<uintptr_t>((void *&)hook), nType);
}
inline void ExtractCall(void *dst, uint32_t a)

View File

@ -22,62 +22,8 @@
#include "Console.h"
#include "Debug.h"
#include <algorithm>
#include <vector>
#include <list>
std::vector<int32> usedAddresses;
static DWORD protect[2];
static uint32 protect_address;
static uint32 protect_size;
void
Protect_internal(uint32 address, uint32 size)
{
protect_address = address;
protect_size = size;
VirtualProtect((void*)address, size, PAGE_EXECUTE_READWRITE, &protect[0]);
}
void
Unprotect_internal(void)
{
VirtualProtect((void*)protect_address, protect_size, protect[0], &protect[1]);
}
void
InjectHook_internal(uint32 address, uint32 hook, int type)
{
if(std::any_of(usedAddresses.begin(), usedAddresses.end(),
[address](uint32 value) { return (int32)value == address; })) {
debug("Used address %#06x twice when injecting hook\n", address);
}
usedAddresses.push_back((int32)address);
switch(type){
case PATCH_JUMP:
VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
*(uint8*)address = 0xE9;
break;
case PATCH_CALL:
VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &protect[0]);
*(uint8*)address = 0xE8;
break;
default:
VirtualProtect((void*)((uint32)address + 1), 4, PAGE_EXECUTE_READWRITE, &protect[0]);
break;
}
*(ptrdiff_t*)(address + 1) = hook - address - 5;
if(type == PATCH_NOTHING)
VirtualProtect((void*)(address + 1), 4, protect[0], &protect[1]);
else
VirtualProtect((void*)address, 5, protect[0], &protect[1]);
}
void **rwengine = *(void***)0x5A10E1;
DebugMenuAPI gDebugMenuAPI;
@ -426,6 +372,10 @@ DebugMenuPopulate(void)
extern bool PrintDebugCode;
extern int16 &DebugCamMode;
#ifdef FREE_CAM
extern bool bFreeCam;
DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&bFreeCam, nil);
#endif
DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });

View File

@ -59,9 +59,6 @@ int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30;
CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518;
//WRAPPER void CCoronas::Render(void) { EAXJMP(0x4F8FB0); }
//WRAPPER void CCoronas::RenderReflections(void) { EAXJMP(0x4F9B40); }
const char aCoronaSpriteNames[][32] = {
"coronastar",
"corona",

View File

@ -103,9 +103,6 @@ struct
RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
#if 0
WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else
void CHud::Draw()
{
// disable hud via second controller
@ -1004,12 +1001,7 @@ void CHud::Draw()
}
}
}
#endif
#if 0
WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
#else
void CHud::DrawAfterFade()
{
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
@ -1261,11 +1253,7 @@ void CHud::DrawAfterFade()
BigMessageInUse[1] = 0.0f;
}
}
#endif
#if 0
WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); }
#else
void CHud::GetRidOfAllHudMessages()
{
m_ZoneState = 0;
@ -1301,7 +1289,6 @@ void CHud::GetRidOfAllHudMessages()
m_BigMessage[i][j] = 0;
}
}
#endif
void CHud::Initialise()
{
@ -1343,9 +1330,6 @@ void CHud::Initialise()
CTxdStore::PopCurrentTxd();
}
#if 0
WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
#else
void CHud::ReInitialise() {
m_Wants_To_Draw_Hud = true;
m_Wants_To_Draw_3dMarkers = true;
@ -1367,12 +1351,9 @@ void CHud::ReInitialise() {
PagerSoundPlayed = 0;
PagerXOffset = 150.0f;
}
#endif
wchar LastBigMessage[6][128];
#if 0
WRAPPER void CHud::SetBigMessage(wchar *message, int16 style) { EAXJMP(0x50A250); }
#else
void CHud::SetBigMessage(wchar *message, int16 style)
{
int i = 0;
@ -1400,11 +1381,7 @@ void CHud::SetBigMessage(wchar *message, int16 style)
LastBigMessage[style][i] = 0;
m_BigMessage[style][i] = 0;
}
#endif
#if 0
WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); }
#else
void CHud::SetHelpMessage(wchar *message, bool quick)
{
if (!CReplay::IsPlayingBack()) {
@ -1419,11 +1396,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
m_HelpMessageQuick = quick;
}
}
#endif
#if 0
WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); }
#else
void CHud::SetMessage(wchar *message)
{
int i = 0;
@ -1435,11 +1408,7 @@ void CHud::SetMessage(wchar *message)
}
m_Message[i] = 0;
}
#endif
#if 0
WRAPPER void CHud::SetPagerMessage(wchar *message) { EAXJMP(0x50A320); }
#else
void CHud::SetPagerMessage(wchar *message)
{
int i = 0;
@ -1451,25 +1420,16 @@ void CHud::SetPagerMessage(wchar *message)
}
m_PagerMessage[i] = 0;
}
#endif
#if 0
WRAPPER void CHud::SetVehicleName(wchar *name) { EAXJMP(0x505290); }
#else
void CHud::SetVehicleName(wchar *name)
{
m_VehicleName = name;
}
#endif
#if 0
WRAPPER void CHud::SetZoneName(wchar *name) { EAXJMP(0x5051D0); }
#else
void CHud::SetZoneName(wchar *name)
{
m_pZoneName = name;
}
#endif
void CHud::Shutdown()
{

View File

@ -51,7 +51,6 @@ CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));
//WRAPPER bool GenericSave(int file) { EAXJMP(0x58F8D0); }
WRAPPER bool GenericLoad() { EAXJMP(0x590A00); }

View File

@ -2056,7 +2056,13 @@ _WinMain(HINSTANCE instance,
{
GetWindowPlacement(PSGLOBAL(window), &wp);
if ( wp.showCmd != SW_SHOWMINIMIZED )
// Famous transparent menu bug. Also see the fix in Frontend.cpp
#ifdef FIX_BUGS
float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
if ((1000.0f / 100.0f) < ms && wp.showCmd != SW_SHOWMINIMIZED)
#else
if (wp.showCmd != SW_SHOWMINIMIZED)
#endif
RsEventHandler(rsFRONTENDIDLE, nil);
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bLoadingSavedGame )

View File

@ -6,8 +6,6 @@
CExplosion(&gaExplosion)[48] = *(CExplosion(*)[48])*(uintptr*)0x64E208;
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
//WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
//WRAPPER bool CExplosion::TestForExplosionInArea(eExplosionType, float, float, float, float, float, float) { EAXJMP(0x55AC80); }
int AudioHandle = AEHANDLE_NONE;