Revert "Part one"

This reverts commit 63951d9b95.
This commit is contained in:
Filip Gawin 2020-04-18 12:29:28 +02:00
parent 6eaf0e4b41
commit d6314f9564
19 changed files with 230 additions and 172 deletions

View File

@ -1,25 +0,0 @@
cmake_Minimum_required(VERSION 3.8)
project(Re3)
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -masm=intel -Wdouble-promotion")
file(GLOB_RECURSE Sources "*.cpp" "*.h")
MACRO(HEADER_DIRECTORIES return_list)
FILE(GLOB_RECURSE new_list *.h)
SET(dir_list "")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
HEADER_DIRECTORIES(header_list)
include_directories(${header_list})
add_library(re3 ${Sources})

View File

@ -59,7 +59,8 @@ CAnimBlendAssociation*
CAnimBlendAssocGroup::CopyAnimation(const char *name)
{
CAnimBlendAssociation *anim = GetAnimation(name);
if(anim == nil) return nil;
if(anim == nil)
return nil;
CAnimManager::UncompressAnimation(anim->hierarchy);
return new CAnimBlendAssociation(*anim);
}
@ -69,26 +70,19 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
{
char c1, c2;
for(;;) {
for(;;){
c1 = *s1;
c2 = *s2;
if(c1) s1++;
if(c2) s2++;
if(c1 == '\0' && c2 == '\0') return true;
#if 1
if(iswdigit(c1) && iswdigit(c2))
#else
if(c1 == '\0' && c2 == '\0')
return true;
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif
continue;
#if 1
c1 = toupper(c1);
c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#endif
if(c1 != c2) return false;
if(c1 != c2)
return false;
}
}

View File

@ -10035,7 +10035,7 @@ cAudioManager::UpdateReflections()
if(CWorld::ProcessVerticalLine(
camPos, m_avecReflectionsPos[4].z, colpoint,
ent, true, false, false, false, true, false,
nil)) {
false)) {
m_afReflectionsDistances[4] =
colpoint.point.z - camPos.z;
} else {

View File

@ -1,7 +1,6 @@
#pragma once
#include "audio_enums.h"
#include "CrimeType.h"
enum eSound : int16
{

View File

@ -1986,59 +1986,50 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER )
{
uint32 i = 0;
do {
if(i != 0 || _bIsMp3Active) {
if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0;
_CurMP3Pos = 0;
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if(mp3) {
mp3 = _pMP3List;
if(mp3 == NULL) {
_bIsMp3Active = false;
nFile = 0;
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
mp3Stream[nStream], 1);
AIL_set_stream_ms_position(
mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream],
0);
return true;
}
return false;
}
if ( !_bIsMp3Active ) goto FIND_MP3TRACK;
do
{
if ( ++_CurMP3Index >= nNumMP3s )
_CurMP3Index = 0;
_CurMP3Pos = 0;
tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index);
if ( mp3 )
{
mp3 = _pMP3List;
if ( mp3 == NULL )
{
_bIsMp3Active = false;
nFile = 0;
goto PLAY_STREAMEDTRACK;
}
if(mp3->pLinkPath != NULL)
mp3Stream[nStream] =
AIL_open_stream(DIG, mp3->pLinkPath, 0);
else {
strcpy(filename, _mp3DirectoryPath);
strcat(filename, mp3->aFilename);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
}
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
_bIsMp3Active = false;
continue;
}
if ( mp3->pLinkPath != NULL )
mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0);
else
{
strcpy(filename, _mp3DirectoryPath);
strcat(filename, mp3->aFilename);
mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0);
}
if ( mp3Stream[nStream] )
{
AIL_set_stream_loop_count(mp3Stream[nStream], 1);
AIL_set_stream_ms_position(mp3Stream[nStream], 0);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
goto NEXT_MP3TRACK;
FIND_MP3TRACK:
if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] )
position = 0;
@ -2048,23 +2039,10 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
if ( e == NULL )
{
nFile = 0;
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);
mp3Stream[nStream] =
AIL_open_stream(DIG, filename, 0);
if(mp3Stream[nStream]) {
AIL_set_stream_loop_count(
mp3Stream[nStream], 1);
AIL_set_stream_ms_position(
mp3Stream[nStream], position);
AIL_pause_stream(mp3Stream[nStream], 0);
return true;
}
return false;
goto PLAY_STREAMEDTRACK;
}
}
if ( e->pLinkPath != NULL )
mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0);
else
@ -2086,14 +2064,17 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
return true;
}
NEXT_MP3TRACK:
_bIsMp3Active = false;
} while(++i < nNumMP3s);
} while ( ++i < nNumMP3s );
position = 0;
nFile = 0;
goto PLAY_STREAMEDTRACK;
}
PLAY_STREAMEDTRACK:
strcpy(filename, m_szCDRomRootPath);
strcat(filename, StreamedNameTable[nFile]);

View File

@ -1,10 +1,9 @@
#pragma once
#include "ModelIndices.h"
#include "WeaponType.h"
class CVehicle;
class CPed;
enum eWeaponType;
enum
{

View File

@ -1466,11 +1466,8 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
targetNode = FindNodeClosestToCoors(target, type, distLimit);
else
targetNode = forcedTargetNode;
if(targetNode < 0) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
if(targetNode < 0)
goto fail;
// Find start
int numPathsToTry;
@ -1489,28 +1486,19 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
numPathsToTry = 1;
startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex];
}
if(numPathsToTry == 0) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
if(numPathsToTry == 0)
goto fail;
if(startNodeId < 0){
// why only check node 0?
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group !=
m_pathNodes[targetNode].group) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != m_pathNodes[targetNode].group)
goto fail;
}else{
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) {
*pNumNodes = 0;
if(pDist) *pDist = 100000.0f;
return;
}
if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group)
goto fail;
}
for(i = 0; i < 512; i++)
m_searchNodes[i].next = nil;
AddNodeToList(&m_pathNodes[targetNode], 0);
@ -1588,6 +1576,11 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta
for(i = 0; i < numNodesToBeCleared; i++)
apNodesToBeCleared[i]->distance = MAX_DIST;
return;
fail:
*pNumNodes = 0;
if(pDist)
*pDist = 100000.0f;
}
static CPathNode *pNodeList[32];

View File

@ -8,7 +8,7 @@
#include "Clock.h"
#include "Weather.h"
#include "Timecycle.h"
#include "PointLights.h"
#include "Pointlights.h"
#include "Shadows.h"
#include "Coronas.h"
#include "SpecialFX.h"

View File

@ -1,23 +0,0 @@
#pragma once
enum eCrimeType
{
CRIME_NONE,
CRIME_POSSESSION_GUN,
CRIME_HIT_PED,
CRIME_HIT_COP,
CRIME_SHOOT_PED,
CRIME_SHOOT_COP,
CRIME_STEAL_CAR,
CRIME_RUN_REDLIGHT,
CRIME_RECKLESS_DRIVING,
CRIME_SPEEDING,
CRIME_RUNOVER_PED,
CRIME_RUNOVER_COP,
CRIME_SHOOT_HELI,
CRIME_PED_BURNED,
CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA,
NUM_CRIME_TYPES
};

View File

@ -72,7 +72,7 @@
#include "Streaming.h"
#include "SurfaceTable.h"
#include "TempColModels.h"
#include "Timecycle.h"
#include "TimeCycle.h"
#include "TrafficLights.h"
#include "Train.h"
#include "TxdStore.h"

View File

@ -124,7 +124,7 @@ public:
static bool faststricmp(const char *str1, const char *str2)
{
for (; *str1; str1++, str2++) {
#if 1
#if MUCH_SLOWER
if (toupper(*str1) != toupper(*str2))
#else
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))

View File

@ -6,7 +6,7 @@
#include "common.h"
#ifdef XINPUT
#include <xinput.h>
#include <Xinput.h>
#pragma comment( lib, "Xinput9_1_0.lib" )
#endif

View File

@ -180,7 +180,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
m_pPed->bExplosionProof = true;
m_pPed->m_bCanBeDamaged = false;
((CPlayerPed*)m_pPed)->ClearAdrenaline();
CancelPlayerEnteringCars(nil);
CancelPlayerEnteringCars(false);
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
CProjectileInfo::RemoveAllProjectiles();

View File

@ -3,7 +3,27 @@
class CEntity;
class CCopPed;
#include "CrimeType.h"
enum eCrimeType
{
CRIME_NONE,
CRIME_POSSESSION_GUN,
CRIME_HIT_PED,
CRIME_HIT_COP,
CRIME_SHOOT_PED,
CRIME_SHOOT_COP,
CRIME_STEAL_CAR,
CRIME_RUN_REDLIGHT,
CRIME_RECKLESS_DRIVING,
CRIME_SPEEDING,
CRIME_RUNOVER_PED,
CRIME_RUNOVER_COP,
CRIME_SHOOT_HELI,
CRIME_PED_BURNED,
CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA,
NUM_CRIME_TYPES
};
class CCrimeBeingQd
{

View File

@ -12,7 +12,7 @@
#include <math.h>
#ifdef WITHWINDOWS
#include <windows.h>
#include <Windows.h>
#endif
#ifdef WITHD3D
@ -62,7 +62,7 @@ typedef int64_t int64;
typedef uint16_t wchar;
#ifndef nil
#define nil NULL
#define nil nullptr
#endif
#include "config.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "Placeable.h"
#include "AudioManager.h"
#include "ParticleType.h"
#define MAX_PARTICLEOBJECTS 100
#define MAX_AUDIOHYDRANTS 8
@ -38,6 +37,7 @@ enum eParticleObjectState
POBJECTSTATE_FREE,
};
enum tParticleType;
class CParticle;
class CParticleObject : public CPlaceable

View File

@ -1,13 +1,12 @@
#pragma once
#include "AnimManager.h"
#include "CrimeType.h"
#include "EventList.h"
#include "PedIK.h"
#include "PedStats.h"
#include "Physical.h"
#include "Weapon.h"
#include "PedStats.h"
#include "PedIK.h"
#include "AnimManager.h"
#include "WeaponInfo.h"
#include "EventList.h"
#define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
@ -18,6 +17,7 @@ class CObject;
class CFire;
struct AnimBlendFrameData;
class CAnimBlendAssociation;
enum eCrimeType;
struct PedAudioData
{

View File

@ -1,9 +1,83 @@
#pragma once
#include "ParticleType.h"
class CParticle;
enum tParticleType
{
PARTICLE_SPARK = 0,
PARTICLE_SPARK_SMALL,
PARTICLE_WHEEL_DIRT,
PARTICLE_WHEEL_WATER,
PARTICLE_BLOOD,
PARTICLE_BLOOD_SMALL,
PARTICLE_BLOOD_SPURT,
PARTICLE_DEBRIS,
PARTICLE_DEBRIS2,
PARTICLE_WATER,
PARTICLE_FLAME,
PARTICLE_FIREBALL,
PARTICLE_GUNFLASH,
PARTICLE_GUNFLASH_NOANIM,
PARTICLE_GUNSMOKE,
PARTICLE_GUNSMOKE2,
PARTICLE_SMOKE,
PARTICLE_SMOKE_SLOWMOTION,
PARTICLE_GARAGEPAINT_SPRAY,
PARTICLE_SHARD,
PARTICLE_SPLASH,
PARTICLE_CARFLAME,
PARTICLE_STEAM,
PARTICLE_STEAM2,
PARTICLE_STEAM_NY,
PARTICLE_STEAM_NY_SLOWMOTION,
PARTICLE_ENGINE_STEAM,
PARTICLE_RAINDROP,
PARTICLE_RAINDROP_SMALL,
PARTICLE_RAIN_SPLASH,
PARTICLE_RAIN_SPLASH_BIGGROW,
PARTICLE_RAIN_SPLASHUP,
PARTICLE_WATERSPRAY,
PARTICLE_EXPLOSION_MEDIUM,
PARTICLE_EXPLOSION_LARGE,
PARTICLE_EXPLOSION_MFAST,
PARTICLE_EXPLOSION_LFAST,
PARTICLE_CAR_SPLASH,
PARTICLE_BOAT_SPLASH,
PARTICLE_BOAT_THRUSTJET,
PARTICLE_BOAT_WAKE,
PARTICLE_WATER_HYDRANT,
PARTICLE_WATER_CANNON,
PARTICLE_EXTINGUISH_STEAM,
PARTICLE_PED_SPLASH,
PARTICLE_PEDFOOT_DUST,
PARTICLE_HELI_DUST,
PARTICLE_HELI_ATTACK,
PARTICLE_ENGINE_SMOKE,
PARTICLE_ENGINE_SMOKE2,
PARTICLE_CARFLAME_SMOKE,
PARTICLE_FIREBALL_SMOKE,
PARTICLE_PAINT_SMOKE,
PARTICLE_TREE_LEAVES,
PARTICLE_CARCOLLISION_DUST,
PARTICLE_CAR_DEBRIS,
PARTICLE_HELI_DEBRIS,
PARTICLE_EXHAUST_FUMES,
PARTICLE_RUBBER_SMOKE,
PARTICLE_BURNINGRUBBER_SMOKE,
PARTICLE_BULLETHIT_SMOKE,
PARTICLE_GUNSHELL_FIRST,
PARTICLE_GUNSHELL,
PARTICLE_GUNSHELL_BUMP1,
PARTICLE_GUNSHELL_BUMP2,
PARTICLE_TEST,
PARTICLE_BIRD_FRONT,
PARTICLE_RAINDROP_2D,
MAX_PARTICLES,
PARTICLE_FIRST = PARTICLE_SPARK,
PARTICLE_LAST = PARTICLE_RAINDROP_2D
};
enum
{
ZCHECK_FIRST = BIT(0),

View File

@ -3,7 +3,53 @@
#define DRIVEBYAUTOAIMING_MAXDIST (2.5f)
#define DOOMAUTOAIMING_MAXDIST (9000.0f)
#include "WeaponType.h"
enum eWeaponType
{
WEAPONTYPE_UNARMED,
WEAPONTYPE_BASEBALLBAT,
WEAPONTYPE_COLT45,
WEAPONTYPE_UZI,
WEAPONTYPE_SHOTGUN,
WEAPONTYPE_AK47,
WEAPONTYPE_M16,
WEAPONTYPE_SNIPERRIFLE,
WEAPONTYPE_ROCKETLAUNCHER,
WEAPONTYPE_FLAMETHROWER,
WEAPONTYPE_MOLOTOV,
WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR,
WEAPONTYPE_HELICANNON,
WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR,
WEAPONTYPE_EXPLOSION,
WEAPONTYPE_UZI_DRIVEBY,
WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED,
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
};
enum eWeaponFire {
WEAPON_FIRE_MELEE,
WEAPON_FIRE_INSTANT_HIT,
WEAPON_FIRE_PROJECTILE,
WEAPON_FIRE_AREA_EFFECT,
WEAPON_FIRE_USE
};
// Taken from MTA SA, seems it's unchanged
enum eWeaponState
{
WEAPONSTATE_READY,
WEAPONSTATE_FIRING,
WEAPONSTATE_RELOADING,
WEAPONSTATE_OUT_OF_AMMO,
WEAPONSTATE_MELEE_MADECONTACT
};
class CEntity;
class CPhysical;