Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-09-11 16:39:35 +03:00
commit f0b15ee053
31 changed files with 1719 additions and 627 deletions

View File

@ -110,6 +110,9 @@ public:
static CVehicle *pPlayerVehicle;
static CVector StaticCamCoors;
static uint32 StaticCamStartTime;
//TODO(MIAMI)
static void RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType) {}
};
extern uint16 AmmoForWeapon[20];

View File

@ -3772,7 +3772,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CPed* pNearPed = ped->m_nearPeds[i];
if (pNearPed->m_leader == ped) {
pNearPed->Teleport(pos);
pNearPed->PositionPedOutOfCollision(); // TODO(MIAMI): this is PositionAnyPedOutOfCollision!!!
pNearPed->PositionAnyPedOutOfCollision();
}
}
}

View File

@ -18,6 +18,8 @@
// TODO: figure out the meaning of this
enum { SOME_FLAG = 0x80 };
bool CTrafficLights::bGreenLightsCheat;
void
CTrafficLights::DisplayActualLight(CEntity *ent)
{
@ -310,6 +312,12 @@ CTrafficLights::LightForPeds(void)
uint8
CTrafficLights::LightForCars1(void)
{
if (CWeather::Wind > 1.1f)
return CAR_LIGHTS_GREEN;
if (bGreenLightsCheat)
return CAR_LIGHTS_GREEN;
uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
if(period < 5000)
@ -323,6 +331,12 @@ CTrafficLights::LightForCars1(void)
uint8
CTrafficLights::LightForCars2(void)
{
if (CWeather::Wind > 1.1f)
return CAR_LIGHTS_GREEN;
if (bGreenLightsCheat)
return CAR_LIGHTS_GREEN;
uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
if(period < 6000)

View File

@ -16,6 +16,8 @@ enum {
class CTrafficLights
{
public:
static bool bGreenLightsCheat;
static void DisplayActualLight(CEntity *ent);
static void ScanForLightsOnMap(void);
static int FindTrafficLightType(CEntity *light);

View File

@ -24,6 +24,7 @@ enum eEventType
EVENT_CAR_SET_ON_FIRE,
EVENT_ASSAULT_NASTYWEAPON,
EVENT_ASSAULT_NASTYWEAPON_POLICE,
EVENT_UNK, // Not on SA it seems
EVENT_ICECREAM,
EVENT_ATM,
EVENT_SHOPSTALL,

View File

@ -5369,6 +5369,7 @@ CMenuManager::ConstructStatLine(int rowIdx)
STAT_LINE("FEST_CC", &CStats::CriminalsCaught, false, nil);
STAT_LINE("FEST_FE", &CStats::FiresExtinguished, false, nil);
STAT_LINE("DAYPLC", &(nTemp = CTimer::GetTimeInMilliseconds() + 100), false, nil);
//TODO(MIAMI): move this function to the CStats and add reading of Stat lines tied with "MEDIA" for the "CHASESTAT" cheatcode
return counter;
#undef STAT_LINE

View File

@ -47,6 +47,7 @@
#include "platform.h"
#include "Stats.h"
#include "CarCtrl.h"
#include "TrafficLights.h"
#ifdef GTA_PS2
#include "eetypes.h"
@ -208,15 +209,20 @@ void HealthCheat()
}
}
void VehicleCheat(bool something, int model)
void VehicleCheat(int model)
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CStreaming::RequestModel(model, 0);
CStreaming::LoadAllRequestedModels(something);
CStreaming::RequestModel(model, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
if (CStreaming::ms_aInfoForModel[model].m_loadState == STREAMSTATE_LOADED) {
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f);
if (!(CStreaming::ms_aInfoForModel[model].m_loadState & STREAMFLAGS_DONT_REMOVE)) {
CStreaming::SetModelIsDeletable(model);
CStreaming::SetModelTxdIsDeletable(model);
}
int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f);
if (node < 0) return;
#ifdef FIX_BUGS
@ -362,18 +368,18 @@ void SunnyWeatherCheat()
CWeather::ForceWeatherNow(WEATHER_SUNNY);
}
void ExtraSunnyWeatherCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
CWeather::ForceWeatherNow(WEATHER_EXTRA_SUNNY);
}
void CloudyWeatherCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
CWeather::ForceWeatherNow(WEATHER_CLOUDY);
}
void StormyWeatherCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
CWeather::ForceWeatherNow(WEATHER_HURRICANE);
}
void RainyWeatherCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
@ -442,6 +448,12 @@ void PinkCarsCheat()
gbPinkCars = true;
}
void TrafficLightsCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CTrafficLights::bGreenLightsCheat = true;
}
void MadCarsCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
@ -548,6 +560,11 @@ void FlyingFishCheat(void)
CVehicle::bCheat8 = !CVehicle::bCheat8;
}
void DoShowChaseStatCheat(void) {
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CStats::ShowChaseStatOnScreen = 1;
}
bool
CControllerState::CheckForInput(void)
{
@ -1030,7 +1047,7 @@ void CPad::AddToCheatString(char c)
// "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT123CCCCCC") )
VehicleCheat(true, MI_RHINO);
VehicleCheat(MI_RHINO);
// "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT1SSSSSCCC") )
@ -1142,19 +1159,22 @@ void CPad::AddToPCCheatString(char c)
// "APLEASANTDAY"
else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKU[\\VHFW]I")) {
KeyBoardCheatString[0] = ' ';
CloudyWeatherCheat();
SunnyWeatherCheat();
}
// "ALOVELYDAY"
else if (!Cheat_strncmp(KeyBoardCheatString, "\\FKZY`YVML")) {
KeyBoardCheatString[0] = ' ';
SunnyWeatherCheat();
ExtraSunnyWeatherCheat();
}
// "ABITDRIEG"
else if (!Cheat_strncmp(KeyBoardCheatString, "JJPSQoLIB")) {
KeyBoardCheatString[0] = ' ';
CloudyWeatherCheat();
}
// "CATSANDDOGS"
else if (!Cheat_strncmp(KeyBoardCheatString, "VLVEQiDZULP")) {
KeyBoardCheatString[0] = ' ';
StormyWeatherCheat();
RainyWeatherCheat();
}
// "CANTSEEATHING"
else if (!Cheat_strncmp(KeyBoardCheatString, "JSPIa\\HLT_[IJ")) {
@ -1164,10 +1184,13 @@ void CPad::AddToPCCheatString(char c)
// "PANZER"
else if (!Cheat_strncmp(KeyBoardCheatString, "UJaONk")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_RHINO);
VehicleCheat(MI_RHINO);
}
// "LIFEISPASSINGMEBY"
else if (!Cheat_strncmp(KeyBoardCheatString, "\\GLNTiLZTL][PeSOh")) {
KeyBoardCheatString[0] = ' ';
FastWeatherCheat();
}
// "BIGBANG"
else if (!Cheat_strncmp(KeyBoardCheatString, "JSHCTdE")) {
KeyBoardCheatString[0] = ' ';
@ -1221,6 +1244,7 @@ void CPad::AddToPCCheatString(char c)
// "CHASESTAT"
else if (!Cheat_strncmp(KeyBoardCheatString, "WF[TRnDOD")) {
KeyBoardCheatString[0] = ' ';
DoShowChaseStatCheat();
}
// "CHICKSWITHGUNS"
else if (!Cheat_strncmp(KeyBoardCheatString, "VS\\HUoL^TVPQOc")) {
@ -1235,6 +1259,7 @@ void CPad::AddToPCCheatString(char c)
// "GREENLIGHT"
else if (!Cheat_strncmp(KeyBoardCheatString, "WMNJYiHLSR")) {
KeyBoardCheatString[0] = ' ';
TrafficLightsCheat();
}
// "MIAMITRAFFIC"
else if (!Cheat_strncmp(KeyBoardCheatString, "FNMGNmWPNLVU")) {
@ -1254,47 +1279,47 @@ void CPad::AddToPCCheatString(char c)
// "TRAVELINSTYLE"
else if (!Cheat_strncmp(KeyBoardCheatString, "HQ`U`iLSFaNZ[")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_BLOODRA);
VehicleCheat(MI_BLOODRA);
}
// "THELASTRIDE"
else if (!Cheat_strncmp(KeyBoardCheatString, "HIPSanDSFSa")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_ROMERO);
VehicleCheat(MI_ROMERO);
}
// "ROCKANDROLLCAR"
else if (!Cheat_strncmp(KeyBoardCheatString, "UFJMYjUKOLXKVr")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_LOVEFIST);
VehicleCheat(MI_LOVEFIST);
}
// "RUBBISHCAR"
else if (!Cheat_strncmp(KeyBoardCheatString, "UFJI`dEIV]")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_TRASH);
VehicleCheat(MI_TRASH);
}
// "GETTHEREQUICKLY"
else if (!Cheat_strncmp(KeyBoardCheatString, "\\QRDVpTLSPU\\[eT")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_BLOODRB);
VehicleCheat(MI_BLOODRB);
}
// "GETTHEREFAST"
else if (!Cheat_strncmp(KeyBoardCheatString, "WXHGRmHOU_RO")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_SABRETUR);
VehicleCheat(MI_SABRETUR);
}
// "BETTERTHANWALKING"
else if (!Cheat_strncmp(KeyBoardCheatString, "JSPLY\\ZUBSaZLtaK^")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_CADDY);
VehicleCheat(MI_CADDY);
}
// "GETTHEREFASTINDEED"
else if (!Cheat_strncmp(KeyBoardCheatString, "GJLE[dWZBQfZLvRXa[^WHL")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_HOTRINA);
VehicleCheat(MI_HOTRINA);
}
// "GETTHEREAMAZINGLYFAST"
else if (!Cheat_strncmp(KeyBoardCheatString, "WXHGfgJUJeNUHe_Kdg^HJ")) {
KeyBoardCheatString[0] = ' ';
VehicleCheat(true, MI_HOTRINB);
VehicleCheat(MI_HOTRINB);
}
// LOOKLIKELANCE
else if (!Cheat_strncmp(KeyBoardCheatString, "HHUBY`NPMV\\WS")) {
@ -1346,6 +1371,16 @@ void CPad::AddToPCCheatString(char c)
KeyBoardCheatString[0] = ' ';
ChangePlayerModel("igdiaz");
}
// DEEPFRIEDMARSBARS
else if (!Cheat_strncmp(KeyBoardCheatString, "VWHC`mDTEPVZMpRK")) {
KeyBoardCheatString[0] = ' ';
gfTommyFatness = 0.26f;
}
// PROGRAMMER
else if (!Cheat_strncmp(KeyBoardCheatString, "UJTNNmJVS[")) {
KeyBoardCheatString[0] = ' ';
gfTommyFatness = -0.3f;
}
// SEAWAYS
else if (!Cheat_strncmp(KeyBoardCheatString, "V^HXN`V")) {
KeyBoardCheatString[0] = ' ';
@ -1366,17 +1401,6 @@ void CPad::AddToPCCheatString(char c)
KeyBoardCheatString[0] = ' ';
FannyMagnetCheat();
}
// "ILOVESCOTLAND"
if (!_CHEATCMP("DNALTOCSEVOLI"))
RainyWeatherCheat();
// "MADWEATHER"
if (!_CHEATCMP("REHTAEWDAM"))
FastWeatherCheat();
// "CHITTYCHITTYBB"
if (!_CHEATCMP("BBYTTIHCYTTIHC"))
ChittyChittyBangBangCheat();
// "NASTYLIMBSCHEAT"
if (!_CHEATCMP("TAEHCSBMILYTSAN"))
@ -3117,6 +3141,8 @@ void CPad::ResetCheats(void)
gbBlackCars = false;
gbPinkCars = false;
CCarCtrl::bMadDriversCheat = false;
CTrafficLights::bGreenLightsCheat = false;
CStats::ShowChaseStatOnScreen = 0;
gbFastTime = false;
CTimer::SetTimeScale(1.0f);
}

View File

@ -341,6 +341,30 @@ wchar *CStats::FindCriminalRatingString()
return TheText.Get(CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney > 10000000 ? "RATNG52" : "RATNG51");
}
wchar *CStats::FindChaseString(float fMediaLevel) {
if (fMediaLevel < 20.0f) return TheText.Get("MEDIA1");
if (fMediaLevel < 50.0f) return TheText.Get("MEDIA2");
if (fMediaLevel < 75.0f) return TheText.Get("MEDIA3");
if (fMediaLevel < 100.0f) return TheText.Get("MEDIA4");
if (fMediaLevel < 150.0f) return TheText.Get("MEDIA5");
if (fMediaLevel < 200.0f) return TheText.Get("MEDIA6");
if (fMediaLevel < 250.0f) return TheText.Get("MEDIA7");
if (fMediaLevel < 300.0f) return TheText.Get("MEDIA8");
if (fMediaLevel < 350.0f) return TheText.Get("MEDIA9");
if (fMediaLevel < 400.0f) return TheText.Get("MEDIA10");
if (fMediaLevel < 500.0f) return TheText.Get("MEDIA11");
if (fMediaLevel < 600.0f) return TheText.Get("MEDIA12");
if (fMediaLevel < 700.0f) return TheText.Get("MEDIA13");
if (fMediaLevel < 800.0f) return TheText.Get("MEDIA14");
if (fMediaLevel < 900.0f) return TheText.Get("MEDIA15");
if (fMediaLevel < 1000.0f) return TheText.Get("MEDIA16");
if (fMediaLevel < 1200.0f) return TheText.Get("MEDIA17");
if (fMediaLevel < 1400.0f) return TheText.Get("MEDIA18");
if (fMediaLevel < 1600.0f) return TheText.Get("MEDIA19");
if (fMediaLevel < 1800.0f) return TheText.Get("MEDIA20");
return TheText.Get("MEDIA21");
}
int32 CStats::FindCriminalRatingNumber()
{
int32 rating;

View File

@ -118,6 +118,7 @@ public:
static void RegisterLevelFireMission(int32);
static void AnotherFireExtinguished();
static wchar *FindCriminalRatingString();
static wchar *FindChaseString(float fMediaLevel);
static void AnotherKillFrenzyPassed();
static void SetTotalNumberKillFrenzies(int32);
static void SetTotalNumberMissions(int32);

View File

@ -49,6 +49,7 @@ bool CWorld::bProcessCutsceneOnly;
bool CWorld::bDoingCarCollisions;
bool CWorld::bIncludeCarTyres;
bool CWorld::bIncludeBikers;
CColPoint CWorld::m_aTempColPts[MAX_COLLISION_POINTS];
@ -63,6 +64,7 @@ CWorld::Initialise()
bIncludeDeadPeds = false;
bForceProcessControl = false;
bIncludeCarTyres = false;
bIncludeBikers = false;
}
void
@ -272,7 +274,9 @@ CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoin
{
float mindist = dist;
bool deadPeds = !!bIncludeDeadPeds;
bool bikers = !!bIncludeBikers;
bIncludeDeadPeds = false;
bIncludeBikers = false;
if(checkBuildings) {
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity,
@ -290,11 +294,13 @@ CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoin
if(checkPeds) {
if(deadPeds) bIncludeDeadPeds = true;
if(bikers) bIncludeBikers = true;
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity,
ignoreSeeThrough, false, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough, false, ignoreShootThrough);
bIncludeDeadPeds = false;
bIncludeBikers = false;
}
if(checkObjects) {
@ -312,6 +318,7 @@ CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoin
}
bIncludeDeadPeds = deadPeds;
bIncludeBikers = bikers;
if(mindist < dist) {
dist = mindist;
@ -325,22 +332,24 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough)
{
bool deadPeds = false;
bool bikers = false;
float mindist = dist;
CPtrNode *node;
CEntity *e;
CColModel *colmodel;
if(list.first && bIncludeDeadPeds && ((CEntity *)list.first->item)->IsPed()) deadPeds = true;
if(list.first && bIncludeBikers && ((CEntity *)list.first->item)->IsPed()) bikers = true;
for(node = list.first; node; node = node->next) {
e = (CEntity *)node->item;
if(e->m_scanCode != GetCurrentScanCode() && e != pIgnoreEntity && (e->bUsesCollision || deadPeds) &&
if(e->m_scanCode != GetCurrentScanCode() && e != pIgnoreEntity && (e->bUsesCollision || deadPeds || bikers) &&
!(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
colmodel = nil;
e->m_scanCode = GetCurrentScanCode();
if(e->IsPed()) {
if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD) {
if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD || bikers) {
colmodel = ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))->AnimatePedColModelSkinned(e->GetClump());
} else
colmodel = nil;

View File

@ -71,6 +71,7 @@ public:
static bool bProcessCutsceneOnly;
static bool bDoingCarCollisions;
static bool bIncludeCarTyres;
static bool bIncludeBikers;
static CColPoint m_aTempColPts[MAX_COLLISION_POINTS];
static void Remove(CEntity *entity);

View File

@ -80,7 +80,7 @@ void WeaponCheat1();
void WeaponCheat2();
void WeaponCheat3();
void HealthCheat();
void VehicleCheat(bool something, int model);
void VehicleCheat(int model);
void BlowUpCarsCheat();
void ChangePlayerCheat();
void MayhemCheat();
@ -353,7 +353,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Cheats", "Health", HealthCheat);
DebugMenuAddCmd("Cheats", "Wanted level up", WantedLevelUpCheat);
DebugMenuAddCmd("Cheats", "Wanted level down", WantedLevelDownCheat);
DebugMenuAddCmd("Cheats", "Tank", []() { VehicleCheat(true, MI_TAXI); });
DebugMenuAddCmd("Cheats", "Tank", []() { VehicleCheat(MI_TAXI); });
DebugMenuAddCmd("Cheats", "Blow up cars", BlowUpCarsCheat);
DebugMenuAddCmd("Cheats", "Change player", ChangePlayerCheat);
DebugMenuAddCmd("Cheats", "Mayhem", MayhemCheat);

232
src/objects/Stinger.cpp Normal file
View File

@ -0,0 +1,232 @@
#include "common.h"
#include "Stinger.h"
#include "CopPed.h"
#include "ModelIndices.h"
#include "RpAnimBlend.h"
#include "World.h"
#include "Automobile.h"
#include "Bike.h"
#include "Particle.h"
#include "AnimBlendAssociation.h"
#include "General.h"
uint32 NumOfStingerSegments;
/* -- CStingerSegment -- */
CStingerSegment::CStingerSegment()
{
m_fMass = 1.0f;
m_fTurnMass = 1.0f;
m_fAirResistance = 0.99999f;
m_fElasticity = 0.75f;
m_fBuoyancy = GRAVITY * m_fMass * 0.1f;
bExplosionProof = true;
SetModelIndex(MI_PLC_STINGER);
ObjectCreatedBy = ESCALATOR_OBJECT;
NumOfStingerSegments++;
}
CStingerSegment::~CStingerSegment()
{
NumOfStingerSegments--;
}
/* -- CStinger -- */
CStinger::CStinger()
{
bIsDeployed = false;
}
void
CStinger::Init(CPed *pPed)
{
int32 i;
pOwner = pPed;
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
pSpikes[i] = new CStingerSegment;
pSpikes[i]->bUsesCollision = false;
}
bIsDeployed = true;
m_vPos = pPed->GetPosition();
m_vPos.z -= 1.0f;
m_fMax_Z = Atan2(-pPed->GetForward().x, pPed->GetForward().y) + HALFPI;
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
pSpikes[i]->SetOrientation(0.0f, 0.0f, Atan2(-pPed->GetForward().x, pPed->GetForward().y));
pSpikes[i]->SetPosition(m_vPos);
}
CVector2D fwd2d(pPed->GetForward().x, pPed->GetForward().y);
for (i = 0; i < ARRAY_SIZE(m_vPositions); i++)
m_vPositions[i] = fwd2d * 1.8f * Sin(DEGTORAD(i));
m_nSpikeState = STINGERSTATE_NONE;
m_nTimeOfDeploy = CTimer::GetTimeInMilliseconds();
}
void
CStinger::Remove()
{
if (!bIsDeployed) return;
for (int32 i = 0; i < NUM_STINGER_SEGMENTS; i++) {
CStingerSegment *spikeSegment = pSpikes[i];
if (spikeSegment->m_entryInfoList.first != nil)
spikeSegment->bRemoveFromWorld = true;
else
delete spikeSegment;
}
bIsDeployed = false;
}
void
CStinger::Deploy(CPed *pPed)
{
if (NumOfStingerSegments < NUM_STINGER_SEGMENTS*2 && !pPed->bInVehicle && pPed->IsPedInControl()) {
if (!bIsDeployed && RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_WEAPON_THROWU) == nil) {
Init(pPed);
pPed->SetPedState(PED_DEPLOY_STINGER);
CAnimManager::AddAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_WEAPON_THROWU);
}
}
}
void
CStinger::CheckForBurstTyres()
{
CVector firstPos = pSpikes[0]->GetPosition();
firstPos.z += 0.2f;
CVector lastPos = pSpikes[NUM_STINGER_SEGMENTS - 1]->GetPosition();
lastPos.z += 0.2f;
float dist = (lastPos - firstPos).Magnitude();
if (dist < 0.1f) return;
CVehicle *vehsInRange[16];
int16 numObjects;
CEntity entity;
CWorld::FindObjectsInRange((lastPos + firstPos) / 2.0f,
dist, true, &numObjects, 15, (CEntity**)vehsInRange,
false, true, false, false, false);
for (int32 i = 0; i < numObjects; i++) {
CAutomobile *pAutomobile = nil;
CBike *pBike = nil;
if (vehsInRange[i]->IsCar())
pAutomobile = (CAutomobile*)vehsInRange[i];
else if (vehsInRange[i]->IsBike())
pBike = (CBike*)vehsInRange[i];
if (pAutomobile == nil && pBike == nil) continue;
float maxWheelDistToSpike = sq(((CVehicleModelInfo*)CModelInfo::GetModelInfo(vehsInRange[i]->GetModelIndex()))->m_wheelScale + 0.1f);
for (int wheelId = 0; wheelId < 4; wheelId++) {
if ((pAutomobile != nil && pAutomobile->m_aSuspensionSpringRatioPrev[wheelId] < 1.0f) ||
(pBike != nil && pBike->m_aSuspensionSpringRatioPrev[wheelId] < 1.0f)) {
CVector vecWheelPos;
if (pAutomobile != nil)
vecWheelPos = pAutomobile->m_aWheelColPoints[wheelId].point;
else if (pBike != nil)
vecWheelPos = pBike->m_aWheelColPoints[wheelId].point;
for (int32 spike = 0; spike < NUM_STINGER_SEGMENTS; spike++) {
if ((pSpikes[spike]->GetPosition() - vecWheelPos).Magnitude() < maxWheelDistToSpike) {
if (pBike) {
if (wheelId < 2)
vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true);
else
vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true);
}
else {
switch (wheelId) {
case 0: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LF, true); break;
case 1: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_LR, true); break;
case 2: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RF, true); break;
case 3: vehsInRange[i]->BurstTyre(CAR_PIECE_WHEEL_RR, true); break;
}
}
vecWheelPos.z += 0.15f;
for (int j = 0; j < 4; j++)
CParticle::AddParticle(PARTICLE_BULLETHIT_SMOKE, vecWheelPos, vehsInRange[i]->GetRight() * 0.1f);
}
}
}
}
}
}
void
CStinger::Process()
{
switch (m_nSpikeState)
{
case STINGERSTATE_NONE:
if (pOwner != nil
&& !pOwner->bInVehicle
&& pOwner->GetPedState() == PED_DEPLOY_STINGER
&& RpAnimBlendClumpGetAssociation(pOwner->GetClump(), ANIM_WEAPON_THROWU)->currentTime > 0.39f)
{
m_nSpikeState = STINGERSTATE_DEPLOYING;
for (int i = 0; i < NUM_STINGER_SEGMENTS; i++)
CWorld::Add(pSpikes[i]);
pOwner->SetIdle();
}
break;
case STINGERSTATE_DEPLOYED:
if (pOwner != nil && pOwner->m_nPedType == PEDTYPE_COP)
((CCopPed*)pOwner)->m_bThrowsSpikeTrap = false;
break;
case STINGERSTATE_UNDEPLOYING:
if (CTimer::GetTimeInMilliseconds() > m_nTimeOfDeploy + 2500)
m_nSpikeState = STINGERSTATE_REMOVE;
// no break
case STINGERSTATE_DEPLOYING:
if (m_nSpikeState == STINGERSTATE_DEPLOYING && CTimer::GetTimeInMilliseconds() > m_nTimeOfDeploy + 2500)
m_nSpikeState = STINGERSTATE_DEPLOYED;
else {
float progress = (CTimer::GetTimeInMilliseconds() - m_nTimeOfDeploy) / 2500.0f;
if (m_nSpikeState != STINGERSTATE_DEPLOYING)
progress = 1.0f - progress;
float degangle = progress * ARRAY_SIZE(m_vPositions);
float angle1 = m_fMax_Z + DEGTORAD(degangle);
float angle2 = m_fMax_Z - DEGTORAD(degangle);
int pos = clamp(degangle, 0, ARRAY_SIZE(m_vPositions)-1);
CVector2D pos2d = m_vPositions[pos];
CVector pos3d = m_vPos;
CColPoint colPoint;
CEntity *pEntity;
if (CWorld::ProcessVerticalLine(CVector(pos3d.x, pos3d.y, pos3d.z - 10.0f), pos3d.z, colPoint, pEntity, true, false, false, false, true, false, nil))
pos3d.z = colPoint.point.z + 0.15f;
angle1 = CGeneral::LimitRadianAngle(angle1);
angle2 = CGeneral::LimitRadianAngle(angle2);
for (int spike = 0; spike < NUM_STINGER_SEGMENTS; spike++) {
if (CWorld::TestSphereAgainstWorld(pos3d + CVector(pos2d.x, pos2d.y, 0.6f), 0.3f, nil, true, false, false, true, false, false))
pos2d = CVector2D(0.0f, 0.0f);
if (spike % 2 == 0) {
pSpikes[spike]->SetOrientation(0.0f, 0.0f, angle1);
pos3d.x += pos2d.x;
pos3d.y += pos2d.y;
} else {
pSpikes[spike]->SetOrientation(0.0f, 0.0f, angle2);
}
pSpikes[spike]->SetPosition(pos3d);
}
}
break;
case STINGERSTATE_REMOVE:
Remove();
break;
}
CheckForBurstTyres();
}

40
src/objects/Stinger.h Normal file
View File

@ -0,0 +1,40 @@
#pragma once
#include "Object.h"
class CStingerSegment : public CObject
{
public:
CStingerSegment();
~CStingerSegment();
};
#define NUM_STINGER_SEGMENTS (12)
enum {
STINGERSTATE_NONE = 0,
STINGERSTATE_DEPLOYING,
STINGERSTATE_DEPLOYED,
STINGERSTATE_UNDEPLOYING,
STINGERSTATE_REMOVE,
};
class CStinger
{
public:
bool bIsDeployed;
uint32 m_nTimeOfDeploy;
CVector m_vPos;
float m_fMax_Z;
float m_fMin_Z;
CVector2D m_vPositions[60];
CStingerSegment *pSpikes[NUM_STINGER_SEGMENTS];
class CPed *pOwner;
uint8 m_nSpikeState;
CStinger();
void Init(CPed *pPed);
void Remove();
void Deploy(CPed *pPed);
void CheckForBurstTyres();
void Process();
};

View File

@ -18,6 +18,7 @@
#include "Camera.h"
#include "PedPlacement.h"
#include "Ropes.h"
#include "Stinger.h"
CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
{
@ -92,14 +93,17 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
m_nHassleTimer = 0;
field_61C = 0;
field_624 = 0;
m_pStinger = new CStinger;
if (m_pPointGunAt)
m_pPointGunAt->CleanUpOldReference((CEntity**)&m_pPointGunAt);
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil;
}
CCopPed::~CCopPed()
{
ClearPursuit();
m_pStinger->Remove();
delete m_pStinger;
}
// --MIAMI: Done
@ -597,7 +601,7 @@ CCopPed::CopAI(void)
}
}
// --MIAMI: Done except commented things
// --MIAMI: Done
void
CCopPed::ProcessControl(void)
{
@ -607,15 +611,13 @@ CCopPed::ProcessControl(void)
CPed::ProcessControl();
if (m_bThrowsSpikeTrap) {
// TODO(Miami)
/*
if (CGame::currArea != AREA_MALL)
ProcessStingerCop();
*/
return;
}
// TODO(Miami): CStinger::Process
if (m_pStinger && m_pStinger->bIsDeployed && m_pStinger->m_nSpikeState == STINGERSTATE_DEPLOYED && CGame::currArea != AREA_MALL)
m_pStinger->Process();
if (bWasPostponed)
return;
@ -854,4 +856,36 @@ CCopPed::ProcessHeliSwat(void)
SetInTheAir();
bKnockedUpIntoAir = true;
}
}
// --MIAMI: Done
void
CCopPed::ProcessStingerCop(void)
{
if (m_pStinger->bIsDeployed || FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) {
if (m_pStinger->bIsDeployed) {
m_pStinger->Process();
} else {
CVector2D vehDist = GetPosition() - FindPlayerVehicle()->GetPosition();
CVector2D dirVehGoing = FindPlayerVehicle()->m_vecMoveSpeed;
if (vehDist.MagnitudeSqr() < sq(30.0f)) {
if (dirVehGoing.MagnitudeSqr() > 0.0f) {
vehDist.Normalise();
dirVehGoing.Normalise();
if (DotProduct2D(vehDist, dirVehGoing) > 0.8f) {
float angle = (CrossProduct2D(vehDist, dirVehGoing - vehDist) < 0.0f ?
FindPlayerVehicle()->GetForward().Heading() - HALFPI :
HALFPI + FindPlayerVehicle()->GetForward().Heading());
SetHeading(angle);
m_fRotationCur = angle;
m_fRotationDest = angle;
m_pStinger->Deploy(this);
}
}
}
}
} else {
ClearPursuit();
}
}

View File

@ -30,6 +30,7 @@ public:
uintptr m_nRopeID;
uint32 m_nHassleTimer;
uint32 field_61C;
class CStinger *m_pStinger;
int32 field_624;
int8 field_628;
@ -44,6 +45,7 @@ public:
void ScanForCrimes(void);
void CopAI(void);
void ProcessHeliSwat(void);
void ProcessStingerCop(void);
};
#ifndef PED_SKIN

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
#define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
#define ENTER_CAR_MAX_DIST 30.0f
class CAccident;
class CObject;
@ -358,6 +359,8 @@ enum eMoveState {
PEDMOVE_THROWN
};
extern float gfTommyFatness;
class CVehicle;
class CPed : public CPhysical
@ -457,8 +460,8 @@ public:
uint32 bHasAlreadyUsedAttractor : 1;
uint32 b155_2 : 1;
uint32 bCarPassenger : 1;
uint32 b155_8 : 1;
uint32 b155_10 : 1;
uint32 bFleeWhenStanding : 1;
uint32 bGotUpOfMyOwnAccord : 1;
uint32 bMiamiViceCop : 1;
uint32 bMoneyHasBeenGivenByScript : 1; //
uint32 bHasBeenPhotographed : 1; //
@ -475,10 +478,10 @@ public:
uint32 bDontFight : 1;
uint32 bDoomAim : 1;
uint32 bCanBeShotInVehicle : 1;
uint32 b157_8 : 1;
uint32 bCanGiveUpSunbathing : 1;
uint32 bMakeFleeScream : 1;
uint32 bPushedAlongByCar : 1;
uint32 b157_40 : 1;
uint32 bRemoveMeWhenIGotIntoCar : 1;
uint32 bIgnoreThreatsBehindObjects : 1;
uint32 bNeverEverTargetThisPed : 1;
@ -487,7 +490,7 @@ public:
uint32 b158_8 : 1;
uint32 bCollectBusFare : 1;
uint32 bBoughtIceCream : 1;
uint32 b158_40 : 1;
uint32 bDonePositionOutOfCollision : 1;
uint32 b158_80 : 1;
// our own flags
@ -580,7 +583,7 @@ public:
float m_fleeFromPosY;
CEntity *m_fleeFrom;
uint32 m_fleeTimer;
CEntity* pThreatEx; // TODO(Miami): What is this?
CEntity* m_threatEx; // TODO(Miami): What is this?
CEntity* m_collidingEntityWhileFleeing;
uint32 m_collidingThingTimer;
CEntity *m_pCollidingEntity;
@ -831,6 +834,7 @@ public:
void ReactToPointGun(CEntity*);
void SeekCar(void);
bool PositionPedOutOfCollision(void);
bool PositionAnyPedOutOfCollision(void);
bool RunToReportCrime(eCrimeType);
bool PlacePedOnDryLand(void);
bool PossiblyFindBetterPosToSeekCar(CVector*, CVehicle*);
@ -905,6 +909,9 @@ public:
static void RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg);
static void DeleteSunbatheIdleAnimCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetPreviousStateCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimShuffleCB(CAnimBlendAssociation *assoc, void *arg);
bool IsPlayer(void);
bool IsFemale(void) { return m_nPedType == PEDTYPE_CIVFEMALE || m_nPedType == PEDTYPE_PROSTITUTE; }

View File

@ -1611,13 +1611,13 @@ void CScriptPath::Clear(void) {
m_state = SCRIPT_PATH_DISABLED;
}
void CScriptPath::InitialiseOne(int32 numNodes, float width) {
void CScriptPath::InitialiseOne(int32 numNodes, float length) {
char Dest[32];
sprintf(Dest, "data\\paths\\spath%d.dat", numNodes);
m_pNode = CPlane::LoadPath(Dest, m_numNodes, m_fTotalLength, false);
m_fSpeed = 1.0f;
m_fPosition = 0.0f;
m_fObjectLength = width;
m_fObjectLength = length;
m_state = SCRIPT_PATH_INITIALIZED;
}
@ -1697,7 +1697,7 @@ INITSAVEBUF
VALIDATESAVEBUF(*size);
}
CObject* g_pScriptPathObjects[18];
CObject *g_pScriptPathObjects[18];
void CScriptPaths::Load_ForReplay(void) {
for (int i = 0; i < 3; i++) {

View File

@ -24,7 +24,7 @@ public:
void Clear(void);
void Update(void);
void InitialiseOne(int32 numNodes, float width);
void InitialiseOne(int32 numNodes, float length);
void FindCoorsFromDistanceOnPath(float t, float *pX, float *pY, float *pZ);
void SetObjectToControl(CObject *pObj);
};

View File

@ -53,4 +53,5 @@ public:
//TODO(MIAMI)
static void CarWindscreenShatters(CVehicle *vehicle, bool unk) {}
static void BreakGlassPhysically(CVector, float) {}
};

View File

@ -21,6 +21,8 @@
#include "User.h"
#include "World.h"
#include "CutsceneMgr.h"
#include "Stats.h"
#include "main.h"
// Game has colors inlined in code.
// For easier modification we collect them here:
@ -91,6 +93,8 @@ float CHud::PagerXOffset;
int16 CHud::PagerTimer;
int16 CHud::PagerOn;
wchar *prevChaseString;
uint32 CHud::m_WantedFadeTimer;
uint32 CHud::m_WantedState;
uint32 CHud::m_WantedTimer;
@ -524,6 +528,53 @@ void CHud::Draw()
}
}
static int32 nMediaLevelCounter = 0;
if (CStats::ShowChaseStatOnScreen != 0) {
float fCurAttentionLevel = CWorld::Players[CWorld::PlayerInFocus].m_fMediaAttention;
if (0.7f * CStats::HighestChaseValue > fCurAttentionLevel
|| fCurAttentionLevel <= 40.0f || CTheScripts::IsPlayerOnAMission()) {
nMediaLevelCounter = 0;
}
else {
if (fCurAttentionLevel == CStats::HighestChaseValue) {
sprintf(gString, "%s %d", UnicodeToAscii(TheText.Get("CHSE")), (int32)fCurAttentionLevel);
}
else {
sprintf(gString, "%s %d" "-%d-", UnicodeToAscii(TheText.Get("CHSE")), (int32)fCurAttentionLevel, (int32)CStats::HighestChaseValue);
}
AsciiToUnicode(gString, gUString);
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetPropOff();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CRGBA colour;
if (CTimer::GetTimeInMilliseconds() & 0x200)
colour = CRGBA(204, 0, 185, 180);
else
colour = CRGBA(178, 0, 162, 180);
CFont::SetColor(colour);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(113.0f), gUString);
if (CStats::FindChaseString(fCurAttentionLevel) != prevChaseString) {
prevChaseString = CStats::FindChaseString(fCurAttentionLevel);
nMediaLevelCounter = 100;
}
if (nMediaLevelCounter != 0) {
nMediaLevelCounter--;
UnicodeMakeUpperCase(gUString, CStats::FindChaseString(fCurAttentionLevel));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(138.0f), gUString);
}
}
}
/*
DrawZoneName
*/

View File

@ -32,6 +32,7 @@ RwIm3DVertex TraceVertices[6];
RwImVertexIndex TraceIndexList[12];
bool CSpecialFX::bSnapShotActive;
int32 CSpecialFX::SnapShotFrames;
void
CSpecialFX::Init(void)

View File

@ -4,6 +4,7 @@ class CSpecialFX
{
public:
static bool bSnapShotActive;
static int32 SnapShotFrames;
static void Render(void);
static void Update(void);
@ -56,6 +57,13 @@ public:
static void AddTrace(CVector*, CVector*);
static void Render(void);
static void Update(void);
//TODO(MIAMI)
static void AddTrace(CVector *, CVector *, float, unsigned int, unsigned char) {}
static void AddTrace(CVector *a, CVector *b, int32 weapontype, class CEntity *shooter)
{
AddTrace(a, b); //TODO: temp
}
};
enum

View File

@ -494,6 +494,20 @@ UnicodeToAsciiForMemoryCard(wchar *src)
return aStr;
}
void
UnicodeMakeUpperCase(wchar *dst, wchar *src) //idk what to do with it, seems to be incorrect implementation by R*
{
while (*src != '\0') {
if (*src < 'a' || *src > 'z')
*dst = *src;
else
*dst = *src - 32;
dst++;
src++;
}
*dst = '\0';
}
void
UnicodeStrcpy(wchar *dst, const wchar *src)
{

View File

@ -8,6 +8,7 @@ void UnicodeStrcpy(wchar *dst, const wchar *src);
void UnicodeStrcat(wchar *dst, wchar *append);
int UnicodeStrlen(const wchar *str);
void TextCopy(wchar *dst, const wchar *src);
void UnicodeMakeUpperCase(wchar *dst, wchar *src);
struct CKeyEntry
{

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,9 @@ public:
int32 m_nAmmoTotal;
uint32 m_nTimer;
bool m_bAddRotOffset;
static bool bPhotographHasBeenTaken;
CWeapon() {
m_bAddRotOffset = false;
}
@ -41,6 +43,7 @@ public:
bool FireMelee (CEntity *shooter, CVector &fireSource);
bool FireInstantHit(CEntity *shooter, CVector *fireSource);
static void AddGunFlashBigGuns(CVector start, CVector end);
void AddGunshell (CEntity *shooter, CVector const &source, CVector2D const &direction, float size);
void DoBulletImpact(CEntity *shooter, CEntity *victim, CVector *source, CVector *target, CColPoint *point, CVector2D ahead);
@ -50,13 +53,15 @@ public:
static void GenerateFlameThrowerParticles(CVector pos, CVector dir);
bool FireAreaEffect (CEntity *shooter, CVector *fireSource);
bool LaserScopeDot (CVector *pOutPos, float *pOutSize);
bool FireSniper (CEntity *shooter);
bool TakePhotograph (CEntity *shooter);
bool FireM16_1stPerson (CEntity *shooter);
bool FireInstantHitFromCar(CVehicle *shooter, bool left, bool right);
static void DoDoomAiming (CEntity *shooter, CVector *source, CVector *target);
static void DoTankDoomAiming (CEntity *shooter, CEntity *driver, CVector *source, CVector *target);
static void DoDriveByAutoAiming(CEntity *driver, CVehicle *vehicle, CVector *source, CVector *target);
static void DoDoomAiming (CEntity *shooter, CVector *source, CVector *target);
static void DoTankDoomAiming (CEntity *shooter, CEntity *driver, CVector *source, CVector *target);
static void DoDriveByAutoAiming(CEntity *driver, CVehicle *vehicle, CVector *source, CVector *target);
void Reload(void);
void Update(int32 audioEntity, CPed *pedToAdjustSound);
@ -68,14 +73,12 @@ public:
bool HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo);
static void BlowUpExplosiveThings(CEntity *thing);
bool HasWeaponAmmoToBeUsed(void);
static void AddGunFlashBigGuns(CVector, CVector);
static bool IsShotgun(int weapon) { return weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_SPAS12_SHOTGUN || weapon == WEAPONTYPE_STUBBY_SHOTGUN; }
// TODO(Miami): Is that still used?
static bool ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects);
static void CheckForShootingVehicleOccupant(CEntity**, CColPoint*, eWeaponType, CVector const&, CVector const&);
static void CheckForShootingVehicleOccupant(CEntity **victim, CColPoint *point, eWeaponType weapon, CVector const& source, CVector const& target);
#ifdef COMPATIBLE_SAVES
void Save(uint8*& buf);

View File

@ -3,6 +3,9 @@
#include "WeaponEffects.h"
#include "TxdStore.h"
#include "Sprite.h"
#include "PlayerPed.h"
#include "World.h"
#include "WeaponType.h"
RwTexture *gpCrossHairTex;
RwRaster *gpCrossHairRaster;
@ -24,10 +27,10 @@ CWeaponEffects::Init(void)
{
gCrossHair.m_bActive = false;
gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f);
gCrossHair.m_nRed = 0;
gCrossHair.m_nRed = 255;
gCrossHair.m_nGreen = 0;
gCrossHair.m_nBlue = 0;
gCrossHair.m_nAlpha = 255;
gCrossHair.m_nAlpha = 127;
gCrossHair.m_fSize = 1.0f;
gCrossHair.m_fRotation = 0.0f;
@ -46,9 +49,7 @@ void
CWeaponEffects::Shutdown(void)
{
RwTextureDestroy(gpCrossHairTex);
#ifdef GTA3_1_1_PATCH
gpCrossHairTex = nil;
#endif
}
void
@ -56,10 +57,6 @@ CWeaponEffects::MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint
{
gCrossHair.m_bActive = true;
gCrossHair.m_vecPos = pos;
gCrossHair.m_nRed = red;
gCrossHair.m_nGreen = green;
gCrossHair.m_nBlue = blue;
gCrossHair.m_nAlpha = alpha;
gCrossHair.m_fSize = size;
}
@ -72,12 +69,32 @@ CWeaponEffects::ClearCrossHair(void)
void
CWeaponEffects::Render(void)
{
static float aCrossHairSize[WEAPONTYPE_TOTALWEAPONS] =
{
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
0.4f, 0.4f,
0.5f,
0.3f,
0.9f, 0.9f, 0.9f,
0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
0.1f, 0.1f,
1.0f,
0.6f,
0.7f,
0.0f, 0.0f
};
if ( gCrossHair.m_bActive )
{
float size = aCrossHairSize[FindPlayerPed()->GetWeapon()->m_eWeaponType];
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVDESTALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpCrossHairRaster);
RwV3d pos;
@ -85,15 +102,25 @@ CWeaponEffects::Render(void)
if ( CSprite::CalcScreenCoors(gCrossHair.m_vecPos, &pos, &w, &h, true) )
{
float recipz = 1.0f / pos.z;
CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z,
gCrossHair.m_fSize * w, gCrossHair.m_fSize * h,
gCrossHair.m_nRed, gCrossHair.m_nGreen, gCrossHair.m_nBlue, 255,
recipz, 255);
CSprite::RenderOneXLUSprite_Rotate_Aspect(pos.x, pos.y, pos.z,
w, h,
255, 88, 100, 158,
recipz, gCrossHair.m_fRotation, gCrossHair.m_nAlpha);
float recipz2 = 1.0f / pos.z;
CSprite::RenderOneXLUSprite_Rotate_Aspect(pos.x, pos.y, pos.z,
size*w, size*h,
107, 134, 247, 158,
recipz2, TWOPI - gCrossHair.m_fRotation, gCrossHair.m_nAlpha);
gCrossHair.m_fRotation += 0.02f;
if ( gCrossHair.m_fRotation > TWOPI )
gCrossHair.m_fRotation = 0.0;
}
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
}
}

View File

@ -9,16 +9,57 @@
#include "ModelInfo.h"
#include "ModelIndices.h"
uint16 CWeaponInfo::ms_aReloadSampleTime[WEAPONTYPE_TOTALWEAPONS] =
{
0, // UNARMED
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0, // GRENADE
0, // DETONATEGRENADE
0, // TEARGAS
0, // MOLOTOV
0, // ROCKET
250, // COLT45
250, // PYTHON
650, // SHOTGUN
650, // SPAS12 SHOTGUN
650, // STUBBY SHOTGUN
400, // TEC9
400, // UZIhec
400, // SILENCED_INGRAM
400, // MP5
300, // M16
300, // AK47
423, // SNIPERRIFLE
423, // LASERSCOPE
400, // ROCKETLAUNCHER
0, // FLAMETHROWER
0, // M60
0, // MINIGUN
0, // DETONATOR
0, // HELICANNON
0 // CAMERA
};
// Yeah...
int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] = {
int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1
};
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
// --MIAMI: Todo
static char ms_aWeaponNames[][32] = {
char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] =
{
"Unarmed",
"BrassKnuckle",
"ScrewDriver",
@ -61,7 +102,7 @@ static char ms_aWeaponNames[][32] = {
CWeaponInfo*
CWeaponInfo::GetWeaponInfo(eWeaponType weaponType)
{
return &CWeaponInfo::ms_apWeaponInfos[weaponType];
return &ms_apWeaponInfos[weaponType];
}
// --MIAMI: done except WEAPONTYPE_TOTALWEAPONS value

View File

@ -8,7 +8,9 @@ enum AssocGroupId;
class CWeaponInfo {
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
static char ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32];
public:
static uint16 ms_aReloadSampleTime[WEAPONTYPE_TOTALWEAPONS];
static int32 ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS];
eWeaponFire m_eWeaponFire;