Merge branch 'master' of github.com:Fire-Head/re3

This commit is contained in:
Fire-Head
2019-08-02 23:23:05 +03:00
71 changed files with 4953 additions and 487 deletions

View File

@ -1304,6 +1304,17 @@ CCam::GetWeaponFirstPersonOn()
return false;
}
float
CCamera::Find3rdPersonQuickAimPitch(void)
{
float clampedFrontZ = clamp(Cams[ActiveCam].Front.z, -1.0f, 1.0f);
// float rot = atan2(clampedFrontZ, sqrt(1.0f - sq(clampedFrontZ)));
float rot = Asin(clampedFrontZ);
return -(DEGTORAD(((0.5f - m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV)) + rot);
}
STARTPATCHES
InjectHook(0x42C760, (bool (CCamera::*)(const CVector &center, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);

View File

@ -469,6 +469,8 @@ int m_iModeObbeCamIsInForCar;
void Restore(void);
void SetWidescreenOff(void);
float Find3rdPersonQuickAimPitch(void);
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");

View File

@ -2023,11 +2023,11 @@ CColModel::operator=(const CColModel &other)
numVerts = 0;
for(i = 0; i < other.numTriangles; i++){
if(other.triangles[i].a > numVerts)
other.triangles[i].a = numVerts;
numVerts = other.triangles[i].a;
if(other.triangles[i].b > numVerts)
other.triangles[i].b = numVerts;
numVerts = other.triangles[i].b;
if(other.triangles[i].c > numVerts)
other.triangles[i].c = numVerts;
numVerts = other.triangles[i].c;
}
numVerts++;
if(vertices)

View File

@ -22,7 +22,7 @@ public:
int32 m_ContSetOrder;
};
bool field_0;
bool firstCapture;
char _pad0[3];
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;

View File

@ -4,8 +4,16 @@ class CEntity;
enum eExplosionType
{
EXPLOSION_3 = 3,
EXPLOSION_4
EXPLOSION_GRENADE,
EXPLOSION_MOLOTOV,
EXPLOSION_ROCKET,
EXPLOSION_CAR,
EXPLOSION_CAR_QUICK,
EXPLOSION_HELI,
EXPLOSION_MINE,
EXPLOSION_BARREL,
EXPLOSION_TANK_GRENADE,
EXPLOSION_HELI_BOMB
};
class CExplosion

View File

@ -7,3 +7,4 @@ CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }

View File

@ -4,6 +4,7 @@ class CEntity;
class CFire
{
public:
bool m_bIsOngoing;
bool m_bExists;
bool m_bPropogationFlag;
@ -18,7 +19,6 @@ class CFire
int field_28;
float field_2C;
public:
void Extinguish(void);
};
@ -26,5 +26,6 @@ class CFireManager
{
public:
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float);
};
extern CFireManager &gFireManager;

View File

@ -1,7 +1,9 @@
#include "common.h"
#include "patcher.h"
#include "PlayerPed.h"
#include "PlayerInfo.h"
#include "Frontend.h"
#include "Vehicle.h"
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
WRAPPER void CPlayerInfo::LoadPlayerSkin() { EAXJMP(0x4A1700); }
@ -12,3 +14,10 @@ void CPlayerInfo::SetPlayerSkin(char *skin)
strncpy(m_aSkinName, skin, 32);
LoadPlayerSkin();
}
CVector& CPlayerInfo::GetPos()
{
if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle)
return m_pPed->m_pMyVehicle->GetPosition();
return m_pPed->GetPosition();
}

View File

@ -20,7 +20,7 @@ public:
CPlayerPed *m_pPed;
CVehicle *m_pRemoteVehicle;
CColModel m_ColModel;
CVehicle *m_pVehicleEx;
CVehicle *m_pVehicleEx; // vehicle using the col model above
char m_aPlayerName[70];
int32 m_nMoney;
int32 m_nVisibleMoney;
@ -45,10 +45,10 @@ public:
int8 field_225;
int8 field_226;
int8 field_227;
int32 m_nTimeLostRemoteCar;
int32 m_nTimeLastHealthLoss;
int32 m_nTimeLastArmourLoss;
int32 field_240;
uint32 m_nTimeLostRemoteCar;
uint32 m_nTimeLastHealthLoss;
uint32 m_nTimeLastArmourLoss;
uint32 m_nTimeTankShotGun;
int32 m_nUpsideDownCounter;
int32 field_248;
int16 m_nTrafficMultiplier;
@ -70,6 +70,7 @@ public:
void LoadPlayerSkin();
void AwardMoneyForExplosion(CVehicle *vehicle);
void SetPlayerSkin(char* skin);
CVector& GetPos();
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");

View File

@ -13,6 +13,8 @@ COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238;
CPager& CUserDisplay::Pager = *(CPager*)0x8F2744;
CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8;
WRAPPER void CPager::AddMessage(wchar*, uint16, uint16, uint16) { EAXJMP(0x52B940); }
void COnscreenTimer::Init() {
m_bDisabled = false;
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {

View File

@ -52,6 +52,8 @@ class CCurrentVehicle
class CPager
{
public:
void AddMessage(wchar*, uint16, uint16, uint16);
};
class CUserDisplay

View File

@ -40,19 +40,19 @@ CWanted::Initialise()
bool
CWanted::AreSwatRequired()
{
return m_nWantedLevel >= 4;
return m_nWantedLevel == 4 || m_bSwatRequired;
}
bool
CWanted::AreFbiRequired()
{
return m_nWantedLevel >= 5;
return m_nWantedLevel == 5 || m_bFbiRequired;
}
bool
CWanted::AreArmyRequired()
{
return m_nWantedLevel >= 6;
return m_nWantedLevel == 6 || m_bArmyRequired;
}
int32
@ -77,6 +77,8 @@ void
CWanted::SetWantedLevel(int32 level)
{
ClearQdCrimes();
if (level > MaximumWantedLevel)
level = MaximumWantedLevel;
switch (level) {
case 0:
m_nChaos = 0;
@ -100,8 +102,6 @@ CWanted::SetWantedLevel(int32 level)
m_nChaos = 3220;
break;
default:
if (level > MaximumWantedLevel)
m_nChaos = MaximumWantedLevel;
break;
}
UpdateWantedLevel();
@ -275,6 +275,9 @@ CWanted::UpdateWantedLevel()
{
int32 CurrWantedLevel = m_nWantedLevel;
if (m_nChaos > nMaximumWantedLevel)
m_nChaos = nMaximumWantedLevel;
if (m_nChaos >= 0 && m_nChaos < 40) {
m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0;

View File

@ -29,6 +29,7 @@ bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); }
void
CWorld::Add(CEntity *ent)

View File

@ -103,6 +103,7 @@ public:
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
static void RemoveReferencesToDeletedObject(CEntity*);
static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }

View File

@ -64,6 +64,8 @@ enum Config {
NUMRADARBLIPS = 32,
NUMPICKUPS = 336,
NUMEVENTS = 64,
NUM_CARGENS = 160
};
// We'll use this once we're ready to become independent of the game
@ -117,7 +119,7 @@ enum Config {
# define CHATTYSPLASH // print what the game is loading
#endif
//#define FIX_BUGS // fix bugs in the game, TODO: use this more
#define FIX_BUGS // fix bugs in the game, TODO: use this more
#define KANGAROO_CHEAT
#define ASPECT_RATIO_SCALE
#define USE_DEBUG_SCRIPT_LOADER
#define USE_DEBUG_SCRIPT_LOADER

View File

@ -150,6 +150,18 @@ FixCar(void)
((CAutomobile*)veh)->Fix();
}
static int engineStatus;
static void
SetEngineStatus(void)
{
CVehicle *veh = FindPlayerVehicle();
if(veh == nil)
return;
if(!veh->IsCar())
return;
((CAutomobile*)veh)->Damage.SetEngineStatus(engineStatus);
}
static void
ToggleComedy(void)
{
@ -295,9 +307,13 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); });
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
DebugMenuAddCmd("Debug", "Toggle Comedy Controls", ToggleComedy);
DebugMenuAddCmd("Debug", "Place Car on Road", PlaceOnRoad);