This commit is contained in:
Filip Gawin 2020-04-17 19:30:57 +02:00
parent ac26d9cdda
commit 63951d9b95
19 changed files with 172 additions and 230 deletions

25
CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
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,8 +59,7 @@ CAnimBlendAssociation*
CAnimBlendAssocGroup::CopyAnimation(const char *name) CAnimBlendAssocGroup::CopyAnimation(const char *name)
{ {
CAnimBlendAssociation *anim = GetAnimation(name); CAnimBlendAssociation *anim = GetAnimation(name);
if(anim == nil) if(anim == nil) return nil;
return nil;
CAnimManager::UncompressAnimation(anim->hierarchy); CAnimManager::UncompressAnimation(anim->hierarchy);
return new CAnimBlendAssociation(*anim); return new CAnimBlendAssociation(*anim);
} }
@ -75,14 +74,21 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
c2 = *s2; c2 = *s2;
if(c1) s1++; if(c1) s1++;
if(c2) s2++; if(c2) s2++;
if(c1 == '\0' && c2 == '\0') if(c1 == '\0' && c2 == '\0') return true;
return true; #if 1
if(iswdigit(c1) && iswdigit(c2))
#else
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2)) if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif
continue; continue;
#if 1
c1 = toupper(c1);
c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1); c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2); c2 = __ascii_toupper(c2);
if(c1 != c2) #endif
return false; if(c1 != c2) return false;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

23
src/core/CrimeType.h Normal file
View File

@ -0,0 +1,23 @@
#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 "Streaming.h"
#include "SurfaceTable.h" #include "SurfaceTable.h"
#include "TempColModels.h" #include "TempColModels.h"
#include "TimeCycle.h" #include "Timecycle.h"
#include "TrafficLights.h" #include "TrafficLights.h"
#include "Train.h" #include "Train.h"
#include "TxdStore.h" #include "TxdStore.h"

View File

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

View File

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

View File

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

View File

@ -3,27 +3,7 @@
class CEntity; class CEntity;
class CCopPed; class CCopPed;
enum eCrimeType #include "CrimeType.h"
{
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 class CCrimeBeingQd
{ {

View File

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

View File

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

View File

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

View File

@ -1,83 +1,9 @@
#pragma once #pragma once
#include "ParticleType.h"
class CParticle; 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 enum
{ {
ZCHECK_FIRST = BIT(0), ZCHECK_FIRST = BIT(0),

View File

@ -3,53 +3,7 @@
#define DRIVEBYAUTOAIMING_MAXDIST (2.5f) #define DRIVEBYAUTOAIMING_MAXDIST (2.5f)
#define DOOMAUTOAIMING_MAXDIST (9000.0f) #define DOOMAUTOAIMING_MAXDIST (9000.0f)
enum eWeaponType #include "WeaponType.h"
{
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 CEntity;
class CPhysical; class CPhysical;