diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 25 | ||||
-rw-r--r-- | src/animation/AnimBlendAssocGroup.cpp | 20 | ||||
-rw-r--r-- | src/audio/AudioManager.cpp | 2 | ||||
-rw-r--r-- | src/audio/DMAudio.h | 1 | ||||
-rw-r--r-- | src/audio/sampman.cpp | 119 | ||||
-rw-r--r-- | src/control/Darkel.h | 3 | ||||
-rw-r--r-- | src/control/PathFind.cpp | 35 | ||||
-rw-r--r-- | src/control/TrafficLights.cpp | 2 | ||||
-rw-r--r-- | src/core/CrimeType.h | 23 | ||||
-rw-r--r-- | src/core/Game.cpp | 2 | ||||
-rw-r--r-- | src/core/General.h | 2 | ||||
-rw-r--r-- | src/core/Pad.cpp | 2 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 2 | ||||
-rw-r--r-- | src/core/Wanted.h | 22 | ||||
-rw-r--r-- | src/core/common.h | 4 | ||||
-rw-r--r-- | src/objects/ParticleObject.h | 2 | ||||
-rw-r--r-- | src/peds/Ped.h | 10 | ||||
-rw-r--r-- | src/render/ParticleMgr.h | 78 | ||||
-rw-r--r-- | src/weapons/Weapon.h | 48 |
19 files changed, 172 insertions, 230 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..2871dff4 --- /dev/null +++ b/CMakeLists.txt @@ -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}) diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp index e65bdf8d..27b091bd 100644 --- a/src/animation/AnimBlendAssocGroup.cpp +++ b/src/animation/AnimBlendAssocGroup.cpp @@ -59,8 +59,7 @@ 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); } @@ -70,19 +69,26 @@ 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(c1 == '\0' && c2 == '\0') return true; +#if 1 + if(iswdigit(c1) && iswdigit(c2)) +#else 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); - if(c1 != c2) - return false; +#endif + if(c1 != c2) return false; } } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 4d5f8474..0a156cd4 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -10035,7 +10035,7 @@ cAudioManager::UpdateReflections() if(CWorld::ProcessVerticalLine( camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, - false)) { + nil)) { m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; } else { diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 9ce073b4..00bf75ad 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -1,6 +1,7 @@ #pragma once #include "audio_enums.h" +#include "CrimeType.h" enum eSound : int16 { diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index d24de27f..a375b847 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -1986,50 +1986,59 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER ) { uint32 i = 0; - - 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; + 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(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; @@ -2039,10 +2048,23 @@ FIND_MP3TRACK: if ( e == NULL ) { 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 ( e->pLinkPath != NULL ) mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0); else @@ -2064,17 +2086,14 @@ FIND_MP3TRACK: 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]); diff --git a/src/control/Darkel.h b/src/control/Darkel.h index b6092dcb..14529c63 100644 --- a/src/control/Darkel.h +++ b/src/control/Darkel.h @@ -1,9 +1,10 @@ #pragma once + #include "ModelIndices.h" +#include "WeaponType.h" class CVehicle; class CPed; -enum eWeaponType; enum { diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index 9d0959a8..cedef63c 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1466,8 +1466,11 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta targetNode = FindNodeClosestToCoors(target, type, distLimit); else targetNode = forcedTargetNode; - if(targetNode < 0) - goto fail; + if(targetNode < 0) { + *pNumNodes = 0; + if(pDist) *pDist = 100000.0f; + return; + } // Find start int numPathsToTry; @@ -1486,19 +1489,28 @@ CPathFind::DoPathSearch(uint8 type, CVector start, int32 startNodeId, CVector ta numPathsToTry = 1; startObj = m_mapObjects[m_pathNodes[startNodeId].objectIndex]; } - if(numPathsToTry == 0) - goto fail; + if(numPathsToTry == 0) { + *pNumNodes = 0; + if(pDist) *pDist = 100000.0f; + return; + } if(startNodeId < 0){ // why only check node 0? - if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != m_pathNodes[targetNode].group) - goto fail; + if(m_pathNodes[startObj->m_nodeIndices[type][0]].group != + m_pathNodes[targetNode].group) { + *pNumNodes = 0; + if(pDist) *pDist = 100000.0f; + return; + } }else{ - if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) - goto fail; + if(m_pathNodes[startNodeId].group != m_pathNodes[targetNode].group) { + *pNumNodes = 0; + if(pDist) *pDist = 100000.0f; + return; + } } - for(i = 0; i < 512; i++) m_searchNodes[i].next = nil; AddNodeToList(&m_pathNodes[targetNode], 0); @@ -1576,11 +1588,6 @@ 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]; diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index 096bb484..70fcbc32 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -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" diff --git a/src/core/CrimeType.h b/src/core/CrimeType.h new file mode 100644 index 00000000..23f609eb --- /dev/null +++ b/src/core/CrimeType.h @@ -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 +};
\ No newline at end of file diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 7ccf78d0..8b2f8604 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -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" diff --git a/src/core/General.h b/src/core/General.h index 77828854..103bafde 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -124,7 +124,7 @@ public: static bool faststricmp(const char *str1, const char *str2) { for (; *str1; str1++, str2++) { -#if MUCH_SLOWER +#if 1 if (toupper(*str1) != toupper(*str2)) #else if (__ascii_toupper(*str1) != __ascii_toupper(*str2)) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 86aff05e..49affbbe 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -6,7 +6,7 @@ #include "common.h" #ifdef XINPUT -#include <Xinput.h> +#include <xinput.h> #pragma comment( lib, "Xinput9_1_0.lib" ) #endif diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index cfa0cea4..3852f540 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -180,7 +180,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle) m_pPed->bExplosionProof = true; m_pPed->m_bCanBeDamaged = false; ((CPlayerPed*)m_pPed)->ClearAdrenaline(); - CancelPlayerEnteringCars(false); + CancelPlayerEnteringCars(nil); gFireManager.ExtinguishPoint(GetPos(), 4000.0f); CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f); CProjectileInfo::RemoveAllProjectiles(); diff --git a/src/core/Wanted.h b/src/core/Wanted.h index afeec8b0..c5e9d388 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -3,27 +3,7 @@ class CEntity; class CCopPed; -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 -}; +#include "CrimeType.h" class CCrimeBeingQd { diff --git a/src/core/common.h b/src/core/common.h index 454b848a..e10b222c 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -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 nullptr +#define nil NULL #endif #include "config.h" diff --git a/src/objects/ParticleObject.h b/src/objects/ParticleObject.h index cfa5936d..fc74bef0 100644 --- a/src/objects/ParticleObject.h +++ b/src/objects/ParticleObject.h @@ -1,6 +1,7 @@ #pragma once #include "Placeable.h" #include "AudioManager.h" +#include "ParticleType.h" #define MAX_PARTICLEOBJECTS 100 #define MAX_AUDIOHYDRANTS 8 @@ -37,7 +38,6 @@ enum eParticleObjectState POBJECTSTATE_FREE, }; -enum tParticleType; class CParticle; class CParticleObject : public CPlaceable diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 9f660693..27f699d5 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -1,12 +1,13 @@ #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 @@ -17,7 +18,6 @@ class CObject; class CFire; struct AnimBlendFrameData; class CAnimBlendAssociation; -enum eCrimeType; struct PedAudioData { diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h index 5e8da1e4..e3ec21c6 100644 --- a/src/render/ParticleMgr.h +++ b/src/render/ParticleMgr.h @@ -1,82 +1,8 @@ #pragma once -class CParticle; +#include "ParticleType.h" -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 -}; +class CParticle; enum { diff --git a/src/weapons/Weapon.h b/src/weapons/Weapon.h index 265ffddb..76fe0870 100644 --- a/src/weapons/Weapon.h +++ b/src/weapons/Weapon.h @@ -3,53 +3,7 @@ #define DRIVEBYAUTOAIMING_MAXDIST (2.5f) #define DOOMAUTOAIMING_MAXDIST (9000.0f) -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 -}; +#include "WeaponType.h" class CEntity; class CPhysical; |