1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-05 14:35:54 +00:00

Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami

This commit is contained in:
eray orçunus 2020-06-01 18:35:04 +03:00
commit abef04c637
33 changed files with 1903 additions and 681 deletions

View file

@ -3778,7 +3778,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@ -3845,8 +3845,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors

View file

@ -382,6 +382,7 @@ public:
bool m_WideScreenOn;
bool m_1rstPersonRunCloseToAWall;
bool m_bHeadBob;
bool m_bVehicleSuspenHigh;
bool m_bFailedCullZoneTestPreviously;
bool m_FadeTargetIsSplashScreen;

View file

@ -321,6 +321,12 @@ void RenderWaterLayersCheat(void)
CWaterLevel::m_nRenderWaterLayers = 0;
}
void BackToTheFuture(void)
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CVehicle::bHoverCheat = !CVehicle::bHoverCheat;
}
//////////////////////////////////////////////////////////////////////////
@ -1080,7 +1086,11 @@ void CPad::AddToPCCheatString(char c)
if (!_CHEATCMP("TAEHCSREYALRETAW"))
RenderWaterLayersCheat();
#endif
// SEAWAYS
if (!_CHEATCMP("SYAWAES"))
BackToTheFuture();
#undef _CHEATCMP
}

View file

@ -49,6 +49,7 @@ public:
uint32 m_nTimeLastHealthLoss;
uint32 m_nTimeLastArmourLoss;
uint32 m_nTimeTankShotGun;
int32 m_nTimeNotFullyOnGround;
int32 m_nUpsideDownCounter;
int32 field_248;
int16 m_nTrafficMultiplier;

View file

@ -67,6 +67,7 @@ float CStats::AutoPaintingBudget;
int32 CStats::NoMoreHurricanes;
float CStats::FashionBudget;
int32 CStats::SafeHouseVisits;
int32 CStats::TyresPopped;
void CStats::Init()
{

View file

@ -71,6 +71,7 @@ public:
static int32 NoMoreHurricanes;
static float FashionBudget;
static int32 SafeHouseVisits;
static int32 TyresPopped;
public:
static void Init(void);

View file

@ -156,7 +156,7 @@ CTempColModels::Initialise(void)
}
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f));
ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f));
ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, 0.2f));
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);

View file

@ -29,14 +29,14 @@
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo)
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
#define HANIMFRAMES(anim) ((anim)->keyframes)
#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->keyframes + (i)*(anim)->interpInfo->animKeyFrameSize)
#else
#define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
#define HANIMFRAMES(anim) ((anim)->pFrames)
#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize)
#endif
#ifdef RWHALFPIXEL

View file

@ -41,7 +41,7 @@ enum Config {
NUMANIMBLOCKS = 35,
NUMANIMATIONS = 450,
NUMTEMPOBJECTS = 30,
NUMTEMPOBJECTS = 40,
// Path data
NUM_PATHNODES = 9650,
@ -218,7 +218,7 @@ enum Config {
// Water & Particle
#define PC_PARTICLE
//#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2
#define PC_WATER
// #define PC_WATER
#define WATER_CHEATS
// Pad

View file

@ -335,15 +335,18 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
DebugMenuAddCmd("Spawn", "Spawn Phoenix", [](){ SpawnCar(MI_PHEONIX); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); });
DebugMenuAddCmd("Spawn", "Spawn Washington", [](){ SpawnCar(MI_WASHING); });
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); });
DebugMenuAddCmd("Spawn", "Spawn BF injection", [](){ SpawnCar(MI_BFINJECT); });
DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); });
DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); });
DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); });

View file

@ -81,7 +81,7 @@ CEntity::CEntity(void)
m_flagE2 = false;
bOffscreen = false;
bIsStaticWaitingForCollision = false;
m_flagE10 = false;
bDontStream = false;
bUnderwater = false;
bHasPreRenderEffects = false;
@ -1083,7 +1083,7 @@ CEntity::SaveEntityFlags(uint8*& buf)
if (m_flagE2) tmp |= BIT(9);
if (bOffscreen) tmp |= BIT(10);
if (bIsStaticWaitingForCollision) tmp |= BIT(11);
if (m_flagE10) tmp |= BIT(12);
if (bDontStream) tmp |= BIT(12);
if (bUnderwater) tmp |= BIT(13);
if (bHasPreRenderEffects) tmp |= BIT(14);
@ -1139,7 +1139,7 @@ CEntity::LoadEntityFlags(uint8*& buf)
m_flagE2 = !!(tmp & BIT(9));
bOffscreen = !!(tmp & BIT(10));
bIsStaticWaitingForCollision = !!(tmp & BIT(11));
m_flagE10 = !!(tmp & BIT(12));
bDontStream = !!(tmp & BIT(12));
bUnderwater = !!(tmp & BIT(13));
bHasPreRenderEffects = !!(tmp & BIT(14));
}

View file

@ -87,7 +87,7 @@ public:
uint32 m_flagE2 : 1;
uint32 bOffscreen : 1; // offscreen flag. This can only be trusted when it is set to true
uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them
uint32 m_flagE10 : 1; // probably bDontStream
uint32 bDontStream : 1; // tell the streaming not to stream me
uint32 bUnderwater : 1; // this object is underwater change drawing order
uint32 bHasPreRenderEffects : 1; // Object has a prerender effects attached to it

View file

@ -478,7 +478,9 @@ CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVecto
if(DotProduct(springDir, forceDir) > 0.0f)
forceDir *= -1.0f;
float step = Min(CTimer::GetTimeStep(), 3.0f);
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
float impulse = GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
if(bIsHeavy)
impulse *= 0.75f;
ApplyMoveForce(forceDir*impulse);
ApplyTurnForce(forceDir*impulse, point);
}

View file

@ -130,13 +130,18 @@ public:
{
float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++)
#ifdef FIX_BUGS // BUGFIX from VC
for (int j = 0; j < 3; j++)
#else
for (int j = 0; j < 4; j++)
#endif
pFloatMatrix[i * 4 + j] *= scale;
}
void Scale(float sx, float sy, float sz)
{
float *pFloatMatrix = (float*)&m_matrix;
for (int i = 0; i < 3; i++){
pFloatMatrix[i * 4 + 0] *= sx;
pFloatMatrix[i * 4 + 1] *= sy;
pFloatMatrix[i * 4 + 2] *= sz;
}
}
void SetRotateXOnly(float angle){
@ -224,6 +229,7 @@ public:
void SetRotate(float xAngle, float yAngle, float zAngle);
void Rotate(float x, float y, float z);
void RotateX(float x);
void RotateY(float y);
void RotateZ(float z);
void Reorthogonalise(void);

View file

@ -46,6 +46,12 @@ CMatrix::RotateX(float x)
Rotate(x, 0.0f, 0.0f);
}
void
CMatrix::RotateY(float y)
{
Rotate(0.0f, y, 0.0f);
}
void
CMatrix::RotateZ(float z)
{

View file

@ -16601,6 +16601,8 @@ CPed::ScanForThreats(void)
CPed *shooter = nil;
if ((fearFlags & PED_FLAG_GUN) && (shooter = CheckForGunShots()) && (m_nPedType != shooter->m_nPedType || m_nPedType == PEDTYPE_CIVMALE || m_nPedType == PEDTYPE_CIVFEMALE)) {
//TODO(MIAMI): just a quick fix for heli weapons
if(shooter->IsPed()){
if (!IsGangMember()) {
m_threatEntity = shooter;
m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
@ -16612,6 +16614,7 @@ CPed::ScanForThreats(void)
m_threatEntity->RegisterReference((CEntity **) &m_threatEntity);
return CPedType::GetFlag(shooter->m_nPedType);
}
}
}
CPed *deadPed = nil;

View file

@ -1,6 +1,7 @@
#pragma once
class CEntity;
class CVehicle;
class CFallingGlassPane : public CMatrix
{
@ -49,4 +50,7 @@ public:
static void WindowRespondsToSoftCollision(CEntity *entity, float amount);
static void WasGlassHitByBullet(CEntity *entity, CVector point);
static void WindowRespondsToExplosion(CEntity *entity, CVector point);
//TODO(MIAMI)
static void CarWindscreenShatters(CVehicle *vehicle, bool unk) {}
};

View file

@ -269,10 +269,8 @@ CRenderer::RenderBoats(void)
for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head;
node = node->prev){
// only boats in this list
CVehicle *v = (CVehicle*)node->item.ent;
if(v->IsBoat())
RenderOneNonRoad(v);
RenderOneNonRoad(v);
}
}
@ -394,7 +392,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
}
return VIS_VISIBLE;
}
if(ent->m_flagE10){
if(ent->bDontStream){
if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE;
if(!ent->GetIsOnScreen() || ent->IsEntityOccluded())

View file

@ -114,11 +114,12 @@ CSkidmarks::Render(void)
continue;
CRGBA color(0, 0, 0, 255);
// TODO(MIAMI): we have a type field here actually (0-3)
if(aSkidmarks[i].m_isBloody) // TODO: type 3
color = CRGBA(132, 34, 11, 255);
else if(aSkidmarks[i].m_isMuddy) // TODO: type 1
color = CRGBA(90, 62, 9, 255);
switch(aSkidmarks[i].m_type){
case SKIDMARK_NORMAL: color = CRGBA(0, 0, 0, 255); break;
case SKIDMARK_MUDDY: color = CRGBA(90, 62, 9, 255); break;
case SKIDMARK_SANDY: color = CRGBA(108, 108, 96, 255); break;
case SKIDMARK_BLOODY: color = CRGBA(132, 34, 11, 255); break;
}
uint32 fade, alpha;
if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart)
@ -132,8 +133,12 @@ CSkidmarks::Render(void)
alpha = 0;
alpha = alpha*fade/256;
CVector p1 = aSkidmarks[i].m_pos[j] + aSkidmarks[i].m_side[j];
CVector p2 = aSkidmarks[i].m_pos[j] - aSkidmarks[i].m_side[j];
CVector p1 = aSkidmarks[i].m_pos[j];
p1.x += aSkidmarks[i].m_sideX[j];
p1.y += aSkidmarks[i].m_sideY[j];
CVector p2 = aSkidmarks[i].m_pos[j];
p2.x -= aSkidmarks[i].m_sideX[j];
p2.y -= aSkidmarks[i].m_sideY[j];
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha);
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f);
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha);
@ -153,7 +158,20 @@ CSkidmarks::Render(void)
}
void
CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody)
CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody)
{
eSkidmarkType type;
if(*isBloody)
type = SKIDMARK_BLOODY;
else if(*isMuddy)
type = SKIDMARK_MUDDY;
else
type = SKIDMARK_NORMAL;
RegisterOne(id, pos, fwdX, fwdY, type, isBloody);
}
void
CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody)
{
int i;
CVector2D fwd(fwdX, fwdY);
@ -169,7 +187,7 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
if(i < NUMSKIDMARKS){
// Continue this one
if(aSkidmarks[i].m_isBloody != *isBloody){
if((aSkidmarks[i].m_type==SKIDMARK_BLOODY) != *isBloody){
// Blood-status changed, end this one
aSkidmarks[i].m_state = 2;
aSkidmarks[i].m_fadeStart = CTimer::GetTimeInMilliseconds() + 10000;
@ -204,9 +222,12 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
CVector2D right(dist.y, -dist.x);
float turn = DotProduct2D(fwd, right);
turn = Abs(turn) + 1.0f;
aSkidmarks[i].m_side[aSkidmarks[i].m_last] = CVector(right.x, right.y, 0.0f) * turn * 0.125f;
if(aSkidmarks[i].m_last == 1)
aSkidmarks[i].m_side[0] = aSkidmarks[i].m_side[1];
aSkidmarks[i].m_sideX[aSkidmarks[i].m_last] = right.x * turn * 0.125f;
aSkidmarks[i].m_sideY[aSkidmarks[i].m_last] = right.y * turn * 0.125f;
if(aSkidmarks[i].m_last == 1){
aSkidmarks[i].m_sideX[0] = aSkidmarks[i].m_sideX[1];
aSkidmarks[i].m_sideY[0] = aSkidmarks[i].m_sideY[1];
}
if(aSkidmarks[i].m_last > 8)
*isBloody = false; // stop blood marks after 8
@ -222,12 +243,15 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
aSkidmarks[i].m_state = 1;
aSkidmarks[i].m_id = id;
aSkidmarks[i].m_pos[0] = pos;
aSkidmarks[i].m_side[0] = CVector(0.0f, 0.0f, 0.0f);
aSkidmarks[i].m_sideX[0] = 0.0f;
aSkidmarks[i].m_sideY[0] = 0.0f;
aSkidmarks[i].m_wasUpdated = true;
aSkidmarks[i].m_last = 0;
aSkidmarks[i].m_lastUpdate = CTimer::GetTimeInMilliseconds() - 1000;
aSkidmarks[i].m_isBloody = *isBloody;
aSkidmarks[i].m_isMuddy = *isMuddy;
if(*isBloody)
aSkidmarks[i].m_type = SKIDMARK_BLOODY;
else
aSkidmarks[i].m_type = type;
}else
*isBloody = false; // stop blood marks if no space
}

View file

@ -2,20 +2,28 @@
enum { SKIDMARK_LENGTH = 16 };
enum eSkidmarkType
{
SKIDMARK_NORMAL,
SKIDMARK_MUDDY,
SKIDMARK_SANDY,
SKIDMARK_BLOODY
};
class CSkidmark
{
public:
uint8 m_state;
bool m_wasUpdated;
bool m_isBloody;
bool m_isMuddy;
CVector m_pos[SKIDMARK_LENGTH];
float m_sideX[SKIDMARK_LENGTH];
float m_sideY[SKIDMARK_LENGTH];
uintptr m_id;
int16 m_last;
uint32 m_lastUpdate;;
uint32 m_lastUpdate;
uint32 m_fadeStart;
uint32 m_fadeEnd;
CVector m_pos[SKIDMARK_LENGTH];
CVector m_side[SKIDMARK_LENGTH];
uint32 m_type;
int16 m_last;
uint8 m_state;
bool m_wasUpdated;
};
class CSkidmarks
@ -28,5 +36,6 @@ public:
static void Clear(void);
static void Update(void);
static void Render(void);
static void RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody);
static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody);
static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody);
};

View file

@ -1,6 +1,11 @@
#include "common.h"
#include "WindModifiers.h"
void
CWindModifiers::RegisterOne(CVector pos, int32 unk)
{
}
int32
CWindModifiers::FindWindModifier(CVector pos, float *x, float *y)
{

View file

@ -3,5 +3,6 @@
class CWindModifiers
{
public:
static void RegisterOne(CVector pos, int32 unk);
static int32 FindWindModifier(CVector pos, float *x, float *y);
};

View file

@ -329,14 +329,20 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
RpHAnimAnimation *anim = RpHAnimAnimationCreate(rpHANIMSTDKEYFRAMETYPEID, numNodes, 0, 0.0f);
if(anim == nil)
return nil;
RpHAnimStdKeyFrame *frame = (RpHAnimStdKeyFrame*)HANIMFRAMES(anim);
RpHAnimStdKeyFrame *frame;
for(i = 0; i < numNodes; i++){
frame = (RpHAnimStdKeyFrame*)HANIMFRAME(anim, i); // games uses struct size here, not safe
frame->q.real = 1.0f;
frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f;
frame->t.x = frame->t.y = frame->t.z = 0.0f;
#ifdef FIX_BUGS
// times are subtracted and divided giving NaNs
// so they can't both be 0
frame->time = i/hier->numNodes;
#else
frame->time = 0.0f;
#endif
frame->prevFrame = nil;
frame++;
}
return anim;
}

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
#include "Vehicle.h"
#include "DamageManager.h"
#include "Door.h"
#include "Skidmarks.h"
class CObject;
@ -69,7 +70,6 @@ enum {
class CAutomobile : public CVehicle
{
public:
// 0x288
CDamageManager Damage;
CDoor Doors[6];
RwFrame *m_aCarNodes[NUM_CAR_NODES];
@ -77,23 +77,24 @@ public:
float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4];
float m_aWheelTimer[4]; // set to 4.0 when wheel is touching ground, then decremented
float field_49C;
bool m_aWheelSkidmarkMuddy[4];
float m_auto_unused1;
eSkidmarkType m_aWheelSkidmarkType[4];
bool m_aWheelSkidmarkBloody[4];
bool m_aWheelSkidmarkUnk[4];
float m_aWheelRotation[4];
float m_aWheelPosition[4];
float m_aWheelSpeed[4];
float m_fRotorSpeed;
uint8 field_4D8;
uint8 m_auto_unused2;
uint8 bTaxiLight : 1;
//uint8 bHadDriver : 1; // for bombs
uint8 bFixedColour : 1;
uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;
uint8 bTankDetonateCars : 1;
int16 field_4E0;
uint8 bStuckInSand : 1;
uint8 bHeliDestroyed : 1;
int16 m_doingBurnout;
uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd;
uint32 m_nBusDoorTimerStart;
@ -101,6 +102,9 @@ public:
float m_aSuspensionLineLength[4];
float m_fHeightAboveRoad;
float m_fTraction;
float m_fTireTemperature;
float m_fOrientation; // for heli and plane go-to
float m_auto_unk4; // related to the above
float m_fVelocityChangeForAudio;
float m_randomValues[6]; // used for what?
float m_fFireBlowUpTimer;
@ -111,6 +115,7 @@ public:
float m_weaponDoorTimerRight;
float m_fCarGunLR;
float m_fCarGunUD;
float m_fHeliOrientation;
float m_fPropellerRotation;
uint8 stuff4[4];
uint8 m_nWheelsOnGround;
@ -144,6 +149,9 @@ public:
bool IsDoorFullyOpen(eDoors door);
bool IsDoorClosed(eDoors door);
bool IsDoorMissing(eDoors door);
bool IsDoorReady(uint32 door);
bool IsDoorMissing(uint32 door);
bool IsOpenTopCar(void);
void RemoveRefsToVehicle(CEntity *ent);
void BlowUpCar(CEntity *ent);
bool SetUpWheelColModel(CColModel *colModel);
@ -158,6 +166,7 @@ public:
void VehicleDamage(float impulse, uint16 damagedPiece);
void ProcessBuoyancy(void);
void DoDriveByShootings(void);
void DoHoverSuspensionRatios(void);
int32 RcbanditCheckHitWheels(void);
int32 RcbanditCheck1CarWheels(CPtrList &list);
void PlaceOnRoadProperly(void);
@ -181,6 +190,9 @@ public:
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false);
void TellHeliToGoToCoors(float x, float y, float z, uint8 speed);
void TellPlaneToGoToCoors(float x, float y, float z, uint8 speed);
void SetHeliOrientation(float orient) { m_fHeliOrientation = orient; }
void ClearHeliOrientation(void) { m_fHeliOrientation = -1.0f; }
void Fix(void);
void SetComponentVisibility(RwFrame *frame, uint32 flags);
@ -190,6 +202,12 @@ public:
void HideAllComps(void);
void ShowAllComps(void);
void ReduceHornCounter(void);
void PopBoot(void);
void PopBootUsingPhysics(void);
void CloseAllDoors(void);
void KnockPedOutCar(eWeaponType weapon, uint16 door, CPed *ped);
#ifdef COMPATIBLE_SAVES
virtual void Save(uint8*& buf);
virtual void Load(uint8*& buf);

View file

@ -10,14 +10,20 @@ float G_aComponentDamage[] = { 2.5f, 1.25f, 3.2f, 1.4f, 2.5f, 2.8f, 0.5f };
CDamageManager::CDamageManager(void)
{
ResetDamageStatus();
m_fWheelDamageEffect = 0.75f;
field_24 = 1;
m_fWheelDamageEffect = 0.5f;
field_18 = 1;
}
void
CDamageManager::ResetDamageStatus(void)
{
memset(this, 0, sizeof(*this));
int i;
m_fWheelDamageEffect = 0.0f;
m_engineStatus = 0;
for(i = 0; i < ARRAY_SIZE(m_wheelStatus); i++) m_wheelStatus[i] = 0;
for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++) m_doorStatus[i] = 0;
m_lightStatus = 0;
m_panelStatus = 0;
}
void
@ -28,12 +34,8 @@ CDamageManager::FuckCarCompletely(void)
m_wheelStatus[0] = WHEEL_STATUS_MISSING;
// wheels 1-3 not reset?
m_doorStatus[0] = DOOR_STATUS_MISSING;
m_doorStatus[1] = DOOR_STATUS_MISSING;
m_doorStatus[2] = DOOR_STATUS_MISSING;
m_doorStatus[3] = DOOR_STATUS_MISSING;
m_doorStatus[4] = DOOR_STATUS_MISSING;
m_doorStatus[5] = DOOR_STATUS_MISSING;
for(i = 0; i < ARRAY_SIZE(m_doorStatus); i++)
m_doorStatus[i] = DOOR_STATUS_MISSING;
for(i = 0; i < 3; i++){
#ifdef FIX_BUGS
@ -59,6 +61,8 @@ CDamageManager::ApplyDamage(tComponent component, float damage, float unused)
GetComponentGroup(component, &group, &subComp);
damage *= G_aComponentDamage[group];
if(component == COMPONENT_PANEL_WINDSCREEN)
damage *= 0.6f;
if(damage > 150.0f){
switch(group){
case COMPGROUP_WHEEL:
@ -222,10 +226,6 @@ CDamageManager::GetEngineStatus(void)
bool
CDamageManager::ProgressEngineDamage(void)
{
int status = GetEngineStatus();
int newstatus = status + 32 + (CGeneral::GetRandomNumber() & 0x1F);
if(status < ENGINE_STATUS_ON_FIRE && newstatus > ENGINE_STATUS_ON_FIRE-1)
newstatus = ENGINE_STATUS_ON_FIRE-1;
SetEngineStatus(newstatus);
return true;
// gone in VC
return false;
}

View file

@ -86,7 +86,7 @@ public:
uint8 m_doorStatus[6];
uint32 m_lightStatus;
uint32 m_panelStatus;
uint32 field_24;
uint8 field_18;
CDamageManager(void);

View file

@ -41,6 +41,8 @@ bool CVehicle::bCheat5;
#ifdef ALT_DODO_CHEAT
bool CVehicle::bAltDodoCheat;
#endif
bool CVehicle::bHoverCheat;
bool CVehicle::bAllTaxisHaveNitro;
bool CVehicle::m_bDisableMouseSteering = true;
bool CVehicle::bDisableRemoteDetonation;
bool CVehicle::bDisableRemoteDetonationOnContact;
@ -125,7 +127,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
bCreatedAsPoliceVehicle = false;
bRestingOnPhysical = false;
bParking = false;
bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // BUG? this makes no sense
bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well
bIsVan = false;
bIsBus = false;
bIsBig = false;
@ -344,7 +346,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
// thrust
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
CVector vecWidthForward = GetColModel()->boundingBox.min.y * GetForward();
CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
float fThrustAccel;
if(fForwSpeed > 0.0f || fThrust > 0.0f)
@ -362,9 +364,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float fSideSlipAccel = pFlyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed);
ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight());
float fYaw = -DotProduct(GetSpeed(vecTail), GetRight());
float fYawAccel = pFlyingHandling->fYawStab * fYaw * Abs(fYaw) + pFlyingHandling->fYaw * fSteerLR * fForwSpeed;
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecTail);
float fRollAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE) {
@ -384,9 +386,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right?
// up/down
float fTail = -DotProduct(GetSpeed(vecWidthForward), GetUp());
float fTail = -DotProduct(GetSpeed(vecTail), GetUp());
float fPitchAccel = pFlyingHandling->fPitchStab * fTail * Abs(fTail) + pFlyingHandling->fPitch * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail);
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
float fLiftAccel = (pFlyingHandling->fAttackLift * fLift + pFlyingHandling->fFormLift) * fForwSpeed * fForwSpeed;
@ -554,7 +556,7 @@ CVehicle::DoBladeCollision(CVector pos, CMatrix &matrix, int16 rotorType, float
rotorColModel.numSpheres = 1;
pos = matrix * pos;
bool hadCollision;
bool hadCollision = false;
int minX = CWorld::GetSectorIndexX(pos.x - radius);
if(minX <= 0) minX = 0;
@ -655,7 +657,7 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
if(entity->IsPed())
entityCol = ((CPedModelInfo*)CModelInfo::GetModelInfo(entity->GetModelIndex()))->AnimatePedColModelSkinned(entity->GetClump());
else
entityCol = CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel();
entityCol = entity->GetColModel();
if(entityCol)
numCollisions = CCollision::ProcessColModels(matrix, rotorColModel, entity->GetMatrix(), *entityCol,
CWorld::m_aTempColPts, nil, nil);
@ -690,10 +692,12 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
CVector localColpos = colpos - center;
float axisDir = DotProduct(axis, localColpos);
float colDir = DotProduct(CWorld::m_aTempColPts[i].normal, localColpos);
if(2.0f*ROTOR_SEMI_THICKNESS < Abs(axisDir) &&
ROTOR_DISGUARD_MULT*Abs(colDir) < Abs(axisDir))
continue;
hadCollision = true;
colpos -= axisDir*axis; // get rid of axis component
CVector tangentSpeed = CrossProduct(turnSpeed, colpos - center);
@ -707,19 +711,18 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
// Apply Collision
if(IsCar()){
CAutomobile *heli = (CAutomobile*)this;
if(heli->m_fRotorSpeed > 0.15f){
if(heli->m_aWheelSpeed[1] > 0.15f){
ApplyCollision(CWorld::m_aTempColPts[i], impulse);
ApplyTurnForce(m_fTurnMass*ROTOR_COL_TURNMULT*tangentSpeed, colpos - center);
heli->m_fRotorSpeed = 0.15f;
}else if(heli->m_fRotorSpeed < 0.075f && heli->m_fRotorSpeed > 0.0f)
heli->m_fRotorSpeed *= -1.0f;
heli->m_aWheelSpeed[1] = 0.15f;
}else if(heli->m_aWheelSpeed[1] < 0.075f && heli->m_aWheelSpeed[1] > 0.0f)
heli->m_aWheelSpeed[1] *= -1.0f;
}
float damageImpulse = damageMult * Max(impulse, ROTOR_DEFAULT_DAMAGE*m_fMass/3000.0f);
if(damageImpulse > m_fDamageImpulse)
SetDamagedPieceRecord(0, damageImpulse, entity, CWorld::m_aTempColPts[i].normal);
hadCollision = true;
}
if(hadCollision && !entity->IsPed())
@ -1395,7 +1398,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
return false;
if (pPassengers[1] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_LR) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_LEFT, nil)) {
IsRoomForPedToLeaveCar(CAR_DOOR_LR, nil)) {
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1];
pPassengers[1] = nil;
@ -1412,7 +1415,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[2] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RR) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_REAR_RIGHT, nil)) {
IsRoomForPedToLeaveCar(CAR_DOOR_RR, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2];
pPassengers[2] = nil;
@ -1429,7 +1432,7 @@ CVehicle::ShufflePassengersToMakeSpace(void)
}
if (pPassengers[0] &&
!(m_nGettingInFlags & CAR_DOOR_FLAG_RF) &&
IsRoomForPedToLeaveCar(COMPONENT_DOOR_FRONT_RIGHT, nil)) {
IsRoomForPedToLeaveCar(CAR_DOOR_RF, nil)) {
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0];
pPassengers[0] = nil;
@ -1581,9 +1584,8 @@ CVehicle::CarHasRoof(void)
{
if((pHandling->Flags & HANDLING_HAS_NO_ROOF) == 0)
return true;
if(m_aExtras[0] && m_aExtras[1])
return false;
return true;
// component 0 is assumed to be a roof
return m_aExtras[0] == 0 || m_aExtras[1] == 0;
}
bool
@ -1712,6 +1714,15 @@ CVehicle::CanPedExitCar(bool jumpExit)
}
}
bool
CVehicle::CanPedJumpOutCar(void)
{
if(GetUp().z < 0.3f)
return false;
float speed = m_vecMoveSpeed.MagnitudeSqr();
return speed < 0.1f || speed > 0.5f ? false : true;
}
bool
CVehicle::CanPedJumpOffBike(void)
{
@ -1977,7 +1988,7 @@ CVehicle::ProcessCarAlarm(void)
{
uint32 step;
if(m_nAlarmState == 0 || m_nAlarmState == -1)
if(!IsAlarmOn())
return;
step = CTimer::GetTimeStepInMilliseconds();
@ -2267,6 +2278,32 @@ CVehicle::DoSunGlare(void)
}
}
void
CVehicle::KillPedsInVehicle(void)
{
int i;
if(pDriver){
CDarkel::RegisterKillByPlayer(pDriver, WEAPONTYPE_EXPLOSION);
if(pDriver->GetPedState() == PED_DRIVING){
pDriver->SetDead();
if(!pDriver->IsPlayer())
pDriver->FlagToDestroyWhenNextProcessed();
}else
pDriver->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
}
for(i = 0; i < m_nNumMaxPassengers; i++){
if(pPassengers[i]){
CDarkel::RegisterKillByPlayer(pPassengers[i], WEAPONTYPE_EXPLOSION);
if(pPassengers[i]->GetPedState() == PED_DRIVING){
pPassengers[i]->SetDead();
if(!pPassengers[i]->IsPlayer())
pPassengers[i]->FlagToDestroyWhenNextProcessed();
}else
pPassengers[i]->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
}
}
}
void
DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle)
{

View file

@ -276,7 +276,7 @@ public:
virtual void BlowUpCar(CEntity *ent) {}
virtual bool SetUpWheelColModel(CColModel *colModel) { return false; }
virtual void BurstTyre(uint8 tyre, bool applyForces) {}
virtual bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos) { return false;}
virtual bool IsRoomForPedToLeaveCar(uint32 component, CVector *forcedDoorPos) { return false; }
virtual bool IsClearToDriveAway(void);
virtual float GetHeightAboveRoad(void);
virtual void PlayCarHorn(void) {}
@ -317,6 +317,7 @@ public:
bool CanDoorsBeDamaged(void);
bool CanPedEnterCar(void);
bool CanPedExitCar(bool jumpExit);
bool CanPedJumpOutCar(void);
bool CanPedJumpOffBike(void);
// do these two actually return something?
CPed *SetUpDriver(void);
@ -340,6 +341,7 @@ public:
void FireFixedMachineGuns(void);
void ActivateBomb(void);
void ActivateBombWhenEntered(void);
void KillPedsInVehicle(void);
void SetComponentAtomicAlpha(RpAtomic *atomic, int32 alpha);
void UpdateClumpAlpha(void);
@ -347,11 +349,12 @@ public:
static void HeliDustGenerate(CEntity *heli, float radius, float ground, int rnd);
void DoSunGlare(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; }
bool IsLimo(void) { return GetModelIndex() == MI_STRETCH || GetModelIndex() == MI_LOVEFIST; }
bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); }
bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); }
static bool bWheelsOnlyCheat;
static bool bAllDodosCheat;
@ -361,6 +364,8 @@ public:
#ifdef ALT_DODO_CHEAT
static bool bAltDodoCheat;
#endif
static bool bHoverCheat;
static bool bAllTaxisHaveNitro;
static bool m_bDisableMouseSteering;
static bool bDisableRemoteDetonation;
static bool bDisableRemoteDetonationOnContact;

View file

@ -86,7 +86,7 @@ CExplosion::GetExplosionPosition(uint8 id)
}
bool
CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime)
CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk)
{
CVector pPosn;
CVector posGround;

View file

@ -40,7 +40,8 @@ public:
static void ResetExplosionActiveCounter(uint8 id);
static uint8 GetExplosionType(uint8 id);
static CVector *GetExplosionPosition(uint8 id);
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime);
// TODO(MIAMI): that new parameter
static bool AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32 lifetime, bool unk = true);
static void Update();
static bool TestForExplosionInArea(eExplosionType type, float x1, float x2, float y1, float y2, float z1, float z2);
static void RemoveAllExplosionsInArea(CVector pos, float radius);

View file

@ -113,6 +113,18 @@ CWeapon::UpdateWeapons(void)
CBulletInfo::Update();
}
//--MIAMI: done
CWeapon::CWeapon(eWeaponType type, int32 ammo)
{
m_eWeaponType = type;
m_eWeaponState = WEAPONSTATE_READY;
m_nAmmoTotal = Min(ammo, 99999);
m_nAmmoInClip = 0;
Reload();
m_nTimer = 0;
m_bAddRotOffset = false;
}
// --MIAMI: Done
void
CWeapon::Initialise(eWeaponType type, int32 ammo)

View file

@ -25,6 +25,7 @@ public:
CWeapon() {
m_bAddRotOffset = false;
}
CWeapon(eWeaponType type, int32 ammo);
CWeaponInfo *GetInfo();