mirror of
https://github.com/halpz/re3.git
synced 2025-07-04 21:00:48 +00:00
Merge branch 'master' into master
This commit is contained in:
@ -24,6 +24,16 @@ WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
|
||||
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
|
||||
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
|
||||
WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); }
|
||||
WRAPPER void CCamera::TakeControl(CEntity*, int16, int16, int32) { EAXJMP(0x471500); }
|
||||
WRAPPER void CCamera::TakeControlNoEntity(const CVector&, int16, int32) { EAXJMP(0x4715B0); }
|
||||
WRAPPER void CCamera::SetCamPositionForFixedMode(const CVector&, const CVector&) { EAXJMP(0x46FCC0); }
|
||||
|
||||
|
||||
bool
|
||||
CCamera::GetFading()
|
||||
{
|
||||
return m_bFading;
|
||||
}
|
||||
|
||||
bool
|
||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||
|
@ -471,6 +471,11 @@ int m_iModeObbeCamIsInForCar;
|
||||
|
||||
float Find3rdPersonQuickAimPitch(void);
|
||||
|
||||
void TakeControl(CEntity*, int16, int16, int32);
|
||||
void TakeControlNoEntity(const CVector&, int16, int32);
|
||||
void SetCamPositionForFixedMode(const CVector&, const CVector&);
|
||||
bool GetFading();
|
||||
|
||||
void dtor(void) { this->CCamera::~CCamera(); }
|
||||
};
|
||||
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
|
||||
|
@ -144,7 +144,7 @@ CCollision::LoadCollisionWhenINeedIt(bool forceChange)
|
||||
if(veh && veh->IsTrain()){
|
||||
if(((CTrain*)veh)->m_nDoorState != TRAIN_DOOR_OPEN)
|
||||
return;
|
||||
}else if(playerCoors.z < 4.0f && !CCullZones::DoINeedToLoadCollision())
|
||||
}else if(playerCoors.z < -4.0f && !CCullZones::DoINeedToLoadCollision())
|
||||
return;
|
||||
|
||||
// Figure out whose level's collisions we're most likely to be interested in
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns an angle such that x2/y2 looks at x1/y1 with its forward vector if rotated by that angle
|
||||
static float GetRadianAngleBetweenPoints(float x1, float y1, float x2, float y2)
|
||||
{
|
||||
float x = x2 - x1;
|
||||
@ -95,9 +96,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// should return direction in 0-8 range. fits perfectly to peds' path directions.
|
||||
static int CGeneral::GetNodeHeadingFromVector(float x, float y)
|
||||
{
|
||||
float angle = CGeneral::GetRadianAngleBetweenPoints(x, y, 0.0f, 0.0f);
|
||||
if (angle < 0.0f)
|
||||
angle += TWOPI;
|
||||
|
||||
angle = DEGTORAD(22.5f) + TWOPI - angle;
|
||||
|
||||
if (angle >= TWOPI)
|
||||
angle -= TWOPI;
|
||||
|
||||
return (int)floorf(angle / DEGTORAD(45.0f));
|
||||
}
|
||||
|
||||
// not too sure about all these...
|
||||
static uint16 GetRandomNumber(void)
|
||||
{ return myrand() & MYRAND_MAX; }
|
||||
static bool GetRandomTrueFalse(void)
|
||||
{ return GetRandomNumber() < MYRAND_MAX / 2; }
|
||||
// Probably don't want to ever reach high
|
||||
static float GetRandomNumberInRange(float low, float high)
|
||||
{ return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); }
|
||||
|
28
src/core/IniFile.cpp
Normal file
28
src/core/IniFile.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "IniFile.h"
|
||||
|
||||
#include "CarCtrl.h"
|
||||
#include "FileMgr.h"
|
||||
#include "main.h"
|
||||
#include "Population.h"
|
||||
|
||||
float &CIniFile::PedNumberMultiplier = *(float*)0x6182F4;
|
||||
float &CIniFile::CarNumberMultiplier = *(float*)0x6182F8;
|
||||
|
||||
void CIniFile::LoadIniFile()
|
||||
{
|
||||
CFileMgr::SetDir("");
|
||||
int f = CFileMgr::OpenFile("gta3.ini", "r");
|
||||
if (f){
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
sscanf(gString, "%f", &PedNumberMultiplier);
|
||||
PedNumberMultiplier = min(3.0f, max(0.5f, PedNumberMultiplier));
|
||||
CFileMgr::ReadLine(f, gString, 200);
|
||||
sscanf(gString, "%f", &CarNumberMultiplier);
|
||||
CarNumberMultiplier = min(3.0f, max(0.5f, CarNumberMultiplier));
|
||||
CFileMgr::CloseFile(f);
|
||||
}
|
||||
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
||||
CCarCtrl::MaxNumberOfCarsInUse = 12.0f * CarNumberMultiplier;
|
||||
}
|
10
src/core/IniFile.h
Normal file
10
src/core/IniFile.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
class CIniFile
|
||||
{
|
||||
public:
|
||||
static void LoadIniFile();
|
||||
|
||||
static float& PedNumberMultiplier;
|
||||
static float& CarNumberMultiplier;
|
||||
};
|
@ -100,9 +100,9 @@ void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
WRAPPER void CRadar::ChangeBlipColour(int32) { EAXJMP(0x4A5770); }
|
||||
WRAPPER void CRadar::ChangeBlipColour(int32, int32) { EAXJMP(0x4A5770); }
|
||||
#else
|
||||
void CRadar::ChangeBlipColour(int32 i)
|
||||
void CRadar::ChangeBlipColour(int32 i, int32)
|
||||
{
|
||||
|
||||
}
|
||||
@ -571,9 +571,9 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
WRAPPER int32 CRadar::GetActualBlipArray(int32) { EAXJMP(0x4A41C0); }
|
||||
WRAPPER int32 CRadar::GetActualBlipArrayIndex(int32) { EAXJMP(0x4A41C0); }
|
||||
#else
|
||||
int32 CRadar::GetActualBlipArray(int32 i)
|
||||
int32 CRadar::GetActualBlipArrayIndex(int32 i)
|
||||
{
|
||||
return int32();
|
||||
}
|
||||
@ -737,18 +737,18 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
WRAPPER int CRadar::SetCoordBlip(int32, CVector, int32) { EAXJMP(0x4A5590); }
|
||||
WRAPPER int32 CRadar::SetCoordBlip(eBlipType, CVector, int32, eBlipDisplay) { EAXJMP(0x4A5590); }
|
||||
#else
|
||||
int CRadar::SetCoordBlip(int32 type, CVector pos, int32 flag)
|
||||
int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 flag, eBlipDisplay)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
WRAPPER int CRadar::SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag) { EAXJMP(0x4A5640); }
|
||||
WRAPPER int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay) { EAXJMP(0x4A5640); }
|
||||
#else
|
||||
int CRadar::SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag)
|
||||
int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
public:
|
||||
static int CalculateBlipAlpha(float dist);
|
||||
static void ChangeBlipBrightness(int32 i, int32 bright);
|
||||
static void ChangeBlipColour(int32 i);
|
||||
static void ChangeBlipColour(int32 i, int32);
|
||||
static void ChangeBlipDisplay(int32 i, int16 flag);
|
||||
static void ChangeBlipScale(int32 i, int16 scale);
|
||||
static void ClearBlip(int32 i);
|
||||
@ -113,7 +113,7 @@ public:
|
||||
static void DrawRadarSection(int32 x, int32 y);
|
||||
static void DrawRadarSprite(int32 sprite, float x, float y, int32 alpha);
|
||||
static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha);
|
||||
static int32 GetActualBlipArray(int32 i);
|
||||
static int32 GetActualBlipArrayIndex(int32 i);
|
||||
static int32 GetNewUniqueBlipIndex(int32 i);
|
||||
static int32 GetRadarTraceColour(int32 color, bool bright);
|
||||
static void Initialise();
|
||||
@ -125,8 +125,8 @@ public:
|
||||
static void RequestMapSection(int32 x, int32 y);
|
||||
static void SaveAllRadarBlips(int32);
|
||||
static void SetBlipSprite(int32 i, int32 icon);
|
||||
static int SetCoordBlip(int32 type, CVector pos, int32 flag);
|
||||
static int SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag);
|
||||
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay flag);
|
||||
static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
|
||||
static void SetRadarMarkerState(int32 i, int32 flag);
|
||||
static void ShowRadarMarker(CVector pos, int16 color, float radius);
|
||||
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
|
||||
|
@ -7,8 +7,10 @@ bool& CStats::CommercialPassed = *(bool*)0x8F4334;
|
||||
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
|
||||
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
||||
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
|
||||
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
|
||||
int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
|
||||
|
||||
void CStats::AnotherKillFrenzyPassed()
|
||||
{
|
||||
++NumberKillFrenziesPassed;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public:
|
||||
static bool& IndustrialPassed;
|
||||
static int32 &NumberKillFrenziesPassed;
|
||||
static int32 &PeopleKilledByOthers;
|
||||
static int32 &HelisDestroyed;
|
||||
static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
|
||||
|
||||
public:
|
||||
static void AnotherKillFrenzyPassed();
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
void ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesntCare);
|
||||
void UpdateWantedLevel();
|
||||
|
||||
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }
|
||||
|
||||
static int32 WorkOutPolicePresence(CVector posn, float radius);
|
||||
static void SetMaximumWantedLevel(int32 level);
|
||||
};
|
||||
|
@ -646,7 +646,7 @@ CWorld::FindObjectsInRange(CVector ¢re, float distance, bool ignoreZ, short
|
||||
}
|
||||
|
||||
CEntity*
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
{
|
||||
CEntity* foundE = nil;
|
||||
|
||||
|
@ -95,8 +95,8 @@ public:
|
||||
static bool GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
|
||||
static CEntity* TestSphereAgainstWorld(CVector, float, CEntity*, bool, bool, bool, bool, bool, bool);
|
||||
static CEntity* TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
|
||||
static CEntity *TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
|
||||
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
|
||||
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
|
||||
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
|
||||
static float FindGroundZForCoord(float x, float y);
|
||||
|
@ -197,7 +197,7 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define ABS(a) (((a) < 0) ? (-a) : (a))
|
||||
#define ABS(a) (((a) < 0) ? (-(a)) : (a))
|
||||
#define norm(value, min, max) (((value) < (min)) ? 0 : (((value) > (max)) ? 1 : (((value) - (min)) / ((max) - (min)))))
|
||||
|
||||
|
||||
|
@ -33,6 +33,12 @@ enum Config {
|
||||
|
||||
NUMTEMPOBJECTS = 30,
|
||||
|
||||
// Path data
|
||||
NUM_PATHNODES = 4930,
|
||||
NUM_CARPATHLINKS = 2076,
|
||||
NUM_MAPOBJECTS = 1250,
|
||||
NUM_PATHCONNECTIONS = 10260,
|
||||
|
||||
// Link list lengths
|
||||
// TODO: alpha list
|
||||
NUMCOLCACHELINKS = 200,
|
||||
|
@ -14,7 +14,9 @@
|
||||
#include "Streaming.h"
|
||||
#include "PathFind.h"
|
||||
#include "Boat.h"
|
||||
#include "Heli.h"
|
||||
#include "Automobile.h"
|
||||
#include "Ped.h"
|
||||
#include "debugmenu_public.h"
|
||||
|
||||
#include <vector>
|
||||
@ -137,6 +139,20 @@ SpawnCar(int id)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
LetThemFollowYou(void) {
|
||||
CPed* player = (CPed*) FindPlayerPed();
|
||||
for (int i = 0; i < player->m_numNearPeds; i++) {
|
||||
|
||||
CPed* nearPed = player->m_nearPeds[i];
|
||||
if (nearPed && !nearPed->IsPlayer()) {
|
||||
nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
|
||||
nearPed->m_pedFormation = rand() & 7;
|
||||
nearPed->bScriptObjectiveCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FixCar(void)
|
||||
{
|
||||
@ -318,6 +334,12 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
|
||||
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Catalina Heli On", (int8*)&CHeli::CatalinaHeliOn, nil);
|
||||
DebugMenuAddCmd("Debug", "Catalina Fly By", CHeli::StartCatalinaFlyBy);
|
||||
DebugMenuAddCmd("Debug", "Catalina Take Off", CHeli::CatalinaTakeOff);
|
||||
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
|
||||
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
|
||||
@ -328,6 +350,11 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
|
||||
|
||||
DebugMenuAddCmd("Debug", "Make peds around you follow you", LetThemFollowYou);
|
||||
#ifndef FINAL
|
||||
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
|
||||
#endif
|
||||
|
||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
||||
|
||||
@ -347,29 +374,6 @@ delayedPatches10(int a, int b)
|
||||
}
|
||||
*/
|
||||
|
||||
void __declspec(naked) HeadlightsFix()
|
||||
{
|
||||
static const float fMinusOne = -1.0f;
|
||||
_asm
|
||||
{
|
||||
fld [esp+708h-690h]
|
||||
fcomp fMinusOne
|
||||
fnstsw ax
|
||||
and ah, 5
|
||||
cmp ah, 1
|
||||
jnz HeadlightsFix_DontLimit
|
||||
fld fMinusOne
|
||||
fstp [esp+708h-690h]
|
||||
|
||||
HeadlightsFix_DontLimit:
|
||||
fld [esp+708h-690h]
|
||||
fabs
|
||||
fld st
|
||||
push 0x5382F2
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
const int re3_buffsize = 1024;
|
||||
static char re3_buff[re3_buffsize];
|
||||
|
||||
@ -454,10 +458,6 @@ patch()
|
||||
InjectHook(0x475E00, printf, PATCH_JUMP); // _Error
|
||||
|
||||
|
||||
// stolen from silentpatch (sorry)
|
||||
Patch<WORD>(0x5382BF, 0x0EEB);
|
||||
InjectHook(0x5382EC, HeadlightsFix, PATCH_JUMP);
|
||||
|
||||
// InterceptCall(&open_script_orig, open_script, 0x438869);
|
||||
|
||||
// InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);
|
||||
|
Reference in New Issue
Block a user