summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2020-04-18 12:08:38 +0200
committerFilip Gawin <filip.gawin@zoho.com>2020-04-18 12:08:38 +0200
commit2b1570de703c32ab43c979c286413a3a1c5e3dc0 (patch)
treeff5510329a08fd5b3dca88de1c9fc5e36abef1b9
parentPart one (diff)
parentZones save/load (diff)
downloadre3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar.gz
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar.bz2
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar.lz
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar.xz
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.tar.zst
re3-2b1570de703c32ab43c979c286413a3a1c5e3dc0.zip
m---------librw0
-rw-r--r--premake5.lua18
-rw-r--r--src/audio/AudioManager.h37
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/core/ControllerConfig.h5
-rw-r--r--src/core/Frontend.cpp15
-rw-r--r--src/core/Frontend.h4
-rw-r--r--src/core/Pad.h1
-rw-r--r--src/core/PlayerInfo.h12
-rw-r--r--src/core/Zones.cpp279
-rw-r--r--src/core/timebars.cpp2
-rw-r--r--src/fakerw/fake.cpp39
-rw-r--r--src/objects/Object.h6
-rw-r--r--src/objects/ParticleObject.h2
-rw-r--r--src/peds/CopPed.h12
-rw-r--r--src/peds/Ped.h174
-rw-r--r--src/peds/PlayerPed.h7
-rw-r--r--src/peds/Population.cpp6
-rw-r--r--src/render/Glass.h1
-rw-r--r--src/render/Particle.h2
-rw-r--r--src/render/ParticleMgr.h2
-rw-r--r--src/render/Renderer.cpp2
-rw-r--r--src/render/Shadows.h6
-rw-r--r--src/render/WaterCannon.h1
-rw-r--r--src/rw/RwHelper.cpp3
-rw-r--r--src/rw/rw.cpp40
-rw-r--r--src/save/PCSave.cpp4
-rw-r--r--src/vehicles/Automobile.h1
-rw-r--r--src/vehicles/Heli.h1
-rw-r--r--src/vehicles/Plane.h2
-rw-r--r--src/vehicles/Vehicle.h3
-rw-r--r--src/weapons/WeaponEffects.h1
32 files changed, 212 insertions, 478 deletions
diff --git a/librw b/librw
-Subproject 7bd6d4649e575e0a2a5f046fdf0d687cea87ca8
+Subproject 4893889621621c077690d522e7e9a10249a65a8
diff --git a/premake5.lua b/premake5.lua
index e5db2dd0..c427211a 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -1,4 +1,4 @@
-Librw = os.getenv("LIBRW")
+Librw = os.getenv("LIBRW") or "librw"
workspace "re3"
configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" }
@@ -54,8 +54,8 @@ workspace "re3"
filter "configurations:Debug or Release"
files { "src/fakerw/*.*" }
includedirs { "src/fakerw" }
- includedirs { "librw" }
- libdirs { path.join("librw", "lib/win-x86-d3d9/%{cfg.buildcfg}") }
+ includedirs { Librw }
+ libdirs { path.join(Librw, "lib/win-x86-d3d9/%{cfg.buildcfg}") }
links { "rw", "d3d9" }
filter {}
@@ -106,31 +106,33 @@ project "re3"
defines { "DEBUG", "LIBRW", "RW_D3D9" }
staticruntime "off"
symbols "Full"
- setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "")
+ setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
filter "configurations:Release"
defines { "NDEBUG", "LIBRW", "RW_D3D9" }
optimize "On"
staticruntime "off"
symbols "Full"
- setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "")
+ setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
filter "configurations:ReleaseFH"
defines { "NDEBUG" }
symbols "Full"
optimize "off"
staticruntime "on"
- setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "")
+ setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
filter "configurations:DebugRW"
defines { "DEBUG" }
staticruntime "on"
symbols "On"
- setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "")
+ setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
+ linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
filter "configurations:ReleaseRW"
defines { "NDEBUG" }
optimize "On"
staticruntime "on"
- setpaths("$(GTA_III_RE_DIR)/", "re3.exe", "")
+ setpaths("$(GTA_III_RE_DIR)/", "$(TargetFileName)", "")
+ linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index ad558061..01fa055d 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -143,28 +143,17 @@ public:
int32 m_nSampleIndex;
uint8 m_bBankIndex;
bool m_bIs2D;
- uint8 field_14; // unused
- uint8 field_15; // unused
int32 m_nReleasingVolumeModificator;
int32 m_nFrequency;
uint8 m_bVolume;
- uint8 field_25; // unused
- uint8 field_26; // unused
- uint8 field_27; // unused
float m_fDistance;
int32 m_nLoopCount;
int32 m_nLoopStart;
int32 m_nLoopEnd;
uint8 m_bEmittingVolume;
- uint8 field_45; // unused
- uint8 field_46; // unused
- uint8 field_47; // unused
float m_fSpeedMultiplier;
float m_fSoundIntensity;
bool m_bReleasingSoundFlag;
- uint8 field_57; // unused
- uint8 field_58; // unused
- uint8 field_59; // unused
CVector m_vecPos;
bool m_bReverbFlag;
uint8 m_bLoopsRemaining;
@@ -173,15 +162,8 @@ public:
int32 m_nReleasingVolumeDivider;
bool m_bIsProcessed;
bool m_bLoopEnded;
- uint8 field_82; // unused
- uint8 field_83; // unused
int32 m_nCalculatedVolume;
int8 m_nVolumeChange;
- uint8 field_89; // unused
- uint8 field_90; // unused
- uint8 field_91; // unused
-
- // no methods
};
static_assert(sizeof(tSound) == 92, "tSound: error");
@@ -197,12 +179,8 @@ public:
bool m_bIsUsed;
uint8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
- //uint8 gap_18[2];
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents;
- uint8 field_25[3];
-
- // no methods
};
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
@@ -216,8 +194,6 @@ public:
float m_fDistance;
uint8 m_bVolume;
int8 m_nProcess;
-
- // no methods
};
static_assert(sizeof(tPedComment) == 28, "tPedComment: error");
@@ -244,18 +220,12 @@ class cMissionAudio
public:
CVector m_vecPos;
bool m_bPredefinedProperties;
- //uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
uint8 field_22; // todo find a name
- uint8 field_23; // unused
int32 m_nMissionAudioCounter;
bool m_bIsPlayed;
- uint8 field_29; // unused
- uint8 field_30; // unused
- uint8 field_31; // unused
- // no methods
};
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
@@ -305,17 +275,11 @@ public:
uint8 m_bActiveSamples;
uint8 field_4; // unused
bool m_bDynamicAcousticModelingStatus;
- uint8 field_6; // unused
- uint8 field_7; // unused
float m_fSpeedOfSound;
bool m_bTimerJustReset;
- uint8 field_13; // unused
- uint8 field_14; // unused
- uint8 field_15; // unused
int32 m_nTimer;
tSound m_sQueueSample;
bool m_bActiveSampleQueue;
- uint8 gap_109[3]; // unused
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
uint8 m_bSampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
@@ -341,7 +305,6 @@ public:
uint8 m_bTimeSpent;
uint8 m_bUserPause;
uint8 m_bPreviousUserPause;
- uint8 field_19195; // unused
uint32 m_FrameCounter;
cAudioManager();
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 6a8028a2..f1cc8ede 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -6909,7 +6909,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CVector cp3 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.max.y, pColModel->boundingBox.min.z);
CVector cp4 = tmp_matrix * CVector(pColModel->boundingBox.min.x, pColModel->boundingBox.min.y, pColModel->boundingBox.max.z);
int16 collisions;
- CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, pos,
+ CWorld::FindObjectsIntersectingAngledCollisionBox(pColModel->boundingBox, tmp_matrix, newPosition,
min(cp1.x, min(cp2.x, min(cp3.x, cp4.x))),
min(cp1.y, min(cp2.y, min(cp3.y, cp4.y))),
max(cp1.x, max(cp2.x, max(cp3.x, cp4.x))),
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index c328594e..82174343 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -112,20 +112,17 @@ public:
};
bool m_bFirstCapture;
- char _pad0[3];
#ifdef __DINPUT_INCLUDED__
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
#else
- uint8 ___padd[0x110 * 2];
+ uint32 ___padd[0x110 / 4 * 2];
#endif
wchar m_aActionNames[MAX_CONTROLLERACTIONS][ACTIONNAME_LENGTH];
bool m_aButtonStates[MAX_BUTTONS];
- char _pad1[3];
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated;
- char _pad2[3];
CControllerConfigManager();
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 790de046..e9282c44 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -118,7 +118,7 @@ const CRGBA TEXT_COLOR = CRGBA(150, 110, 30, 255);
const CRGBA TEXT_COLOR = CRGBA(235, 170, 50, 255); // PC briefs text color
#endif
-const float menuXYpadding = MENUACTION_POS_Y; // *(float*)0x5F355C; // not original name
+const float menuXYpadding = MENUACTION_POS_Y; // TODO this is non-existant, remove it
float MENU_TEXT_SIZE_X = SMALLTEXT_X_SCALE;
float MENU_TEXT_SIZE_Y = SMALLTEXT_Y_SCALE;
@@ -754,9 +754,9 @@ CMenuManager::Draw()
#ifdef FIX_BUGS
// Label is wrapped from right by StretchX(40)px, but wrapped from left by 40px. And this is only place R* didn't use StretchX in here.
- CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(menuXYpadding), str);
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN), MENU_Y(MENUACTION_POS_Y), str);
#else
- CFont::PrintString(MENU_X_MARGIN, menuXYpadding, str);
+ CFont::PrintString(MENU_X_MARGIN, MENUACTION_POS_Y, str);
#endif
}
@@ -3181,7 +3181,7 @@ CMenuManager::PrintBriefs()
CFont::SetRightJustifyOff();
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
- float nextY = 40.0f;
+ float nextY = BRIEFS_TOP_MARGIN;
CRGBA newColor;
for (int i = 4; i >= 0; i--) {
tPreviousBrief &brief = CMessages::PreviousBriefs[i];
@@ -3214,8 +3214,8 @@ CMenuManager::PrintBriefs()
newColor.a = FadeIn(255);
CFont::SetColor(newColor);
#endif
- CFont::PrintString(MENU_X_LEFT_ALIGNED(50.0f), nextY, gUString);
- nextY += MENU_Y(menuXYpadding);
+ CFont::PrintString(MENU_X_LEFT_ALIGNED(BRIEFS_LINE_X), nextY, gUString);
+ nextY += MENU_Y(BRIEFS_LINE_HEIGHT);
}
}
@@ -3252,6 +3252,9 @@ void
CMenuManager::PrintStats()
{
int rowNum = ConstructStatLine(99999);
+#ifdef GTA3_1_1_PATCH
+ CFont::SetFontStyle(FONT_BANK);
+#endif
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why
float nextYChange, y, alphaMult;
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 8fe61a36..41c12122 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -68,6 +68,10 @@
#define STATS_RATING_X 24.0f
#define STATS_RATING_Y 20.0f
+#define BRIEFS_TOP_MARGIN 40.0f
+#define BRIEFS_LINE_X 50.0f
+#define BRIEFS_LINE_HEIGHT 60.0f
+
#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 9ebd6396..b3b0849b 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -155,7 +155,6 @@ public:
uint8 DisablePlayerControls;
int8 bApplyBrakes;
char CheatString[12];
- char _pad0[3];
int32 LastTimeTouched;
int32 AverageWeapon;
int32 AverageEntries;
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index 19c5ce23..ff31418c 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -31,22 +31,13 @@ public:
uint32 m_nLastBumpPlayerCarTimer;
uint32 m_nUnusedTaxiTimer;
bool m_bUnusedTaxiThing;
- int8 field_197;
- int8 field_198;
- int8 field_199;
uint32 m_nNextSexFrequencyUpdateTime;
uint32 m_nNextSexMoneyUpdateTime;
int32 m_nSexFrequency;
CCivilianPed *m_pHooker;
int8 m_WBState; // eWastedBustedState
- int8 field_217;
- int8 field_218;
- int8 field_219;
uint32 m_nWBTime;
bool m_bInRemoteMode;
- int8 field_225;
- int8 field_226;
- int8 field_227;
uint32 m_nTimeLostRemoteCar;
uint32 m_nTimeLastHealthLoss;
uint32 m_nTimeLastArmourLoss;
@@ -54,8 +45,6 @@ public:
int32 m_nUpsideDownCounter;
int32 field_248;
int16 m_nTrafficMultiplier;
- int8 field_254;
- int8 field_255;
float m_fRoadDensity;
uint32 m_nPreviousTimeRewardedForExplosion;
int32 m_nExplosionsSinceLastReward;
@@ -90,7 +79,6 @@ public:
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
~CPlayerInfo() { };
- void dtor(void) { this->CPlayerInfo::~CPlayerInfo(); }
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 6375de1c..804708b4 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -625,218 +625,113 @@ CTheZones::InitialiseAudioZoneArray(void)
}
void
-CTheZones::SaveAllZones(uint8 *buffer, uint32 *length)
+CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
{
+ INITSAVEBUF
int i;
- *length = 8 + 12 +
- NUMZONES*56 + 2*NUMZONES*58 + 4 +
- NUMMAPZONES*56 + NUMAUDIOZONES*2 + 4;
-
- buffer[0] = 'Z';
- buffer[1] = 'N';
- buffer[2] = 'S';
- buffer[3] = '\0';
- *(uint32*)(buffer+4) = *length - 8;
- buffer += 8;
-
- *(int32*)(buffer) = GetIndexForZonePointer(m_pPlayersZone);
- *(int32*)(buffer+4) = m_CurrLevel;
- *(int16*)(buffer+8) = FindIndex;
- *(int16*)(buffer+10) = 0;
- buffer += 12;
-
- for(i = 0; i < NUMZONES; i++){
- memcpy(buffer, ZoneArray[i].name, 8);
- *(float*)(buffer+8) = ZoneArray[i].minx;
- *(float*)(buffer+12) = ZoneArray[i].miny;
- *(float*)(buffer+16) = ZoneArray[i].minz;
- *(float*)(buffer+20) = ZoneArray[i].maxx;
- *(float*)(buffer+24) = ZoneArray[i].maxy;
- *(float*)(buffer+28) = ZoneArray[i].maxz;
- *(int32*)(buffer+32) = ZoneArray[i].type;
- *(int32*)(buffer+36) = ZoneArray[i].level;
- *(int16*)(buffer+40) = ZoneArray[i].zoneinfoDay;
- *(int16*)(buffer+42) = ZoneArray[i].zoneinfoNight;
- *(int32*)(buffer+44) = GetIndexForZonePointer(ZoneArray[i].child);
- *(int32*)(buffer+48) = GetIndexForZonePointer(ZoneArray[i].parent);
- *(int32*)(buffer+52) = GetIndexForZonePointer(ZoneArray[i].next);
- buffer += 56;
+ *size = SAVE_HEADER_SIZE
+ + sizeof(int32) // GetIndexForZonePointer
+ + sizeof(m_CurrLevel) + sizeof(FindIndex)
+ + sizeof(int16) // padding
+ + sizeof(ZoneArray) + sizeof(ZoneInfoArray)
+ + sizeof(TotalNumberOfZones) + sizeof(TotalNumberOfZoneInfos)
+ + sizeof(MapZoneArray) + sizeof(AudioZoneArray)
+ + sizeof(TotalNumberOfMapZones) + sizeof(NumberOfAudioZones);
+
+ WriteSaveHeader(buffer, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
+
+ WriteSaveBuf(buffer, GetIndexForZonePointer(m_pPlayersZone));
+ WriteSaveBuf(buffer, m_CurrLevel);
+ WriteSaveBuf(buffer, FindIndex);
+ WriteSaveBuf(buffer, (int16)0); // padding
+
+ for(i = 0; i < ARRAY_SIZE(ZoneArray); i++){
+ CZone *zone = WriteSaveBuf(buffer, ZoneArray[i]);
+ zone->child = (CZone*)GetIndexForZonePointer(ZoneArray[i].child);
+ zone->parent = (CZone*)GetIndexForZonePointer(ZoneArray[i].parent);
+ zone->next = (CZone*)GetIndexForZonePointer(ZoneArray[i].next);
}
- for(i = 0; i < 2*NUMZONES; i++){
- *(int16*)(buffer) = ZoneInfoArray[i].carDensity;
- *(int16*)(buffer+2) = ZoneInfoArray[i].carThreshold[0];
- *(int16*)(buffer+4) = ZoneInfoArray[i].carThreshold[1];
- *(int16*)(buffer+6) = ZoneInfoArray[i].carThreshold[2];
- *(int16*)(buffer+8) = ZoneInfoArray[i].carThreshold[3];
- *(int16*)(buffer+10) = ZoneInfoArray[i].carThreshold[4];
- *(int16*)(buffer+12) = ZoneInfoArray[i].carThreshold[5];
- *(int16*)(buffer+14) = ZoneInfoArray[i].copThreshold;
- *(int16*)(buffer+16) = ZoneInfoArray[i].gangThreshold[0];
- *(int16*)(buffer+18) = ZoneInfoArray[i].gangThreshold[1];
- *(int16*)(buffer+20) = ZoneInfoArray[i].gangThreshold[2];
- *(int16*)(buffer+22) = ZoneInfoArray[i].gangThreshold[3];
- *(int16*)(buffer+24) = ZoneInfoArray[i].gangThreshold[4];
- *(int16*)(buffer+26) = ZoneInfoArray[i].gangThreshold[5];
- *(int16*)(buffer+28) = ZoneInfoArray[i].gangThreshold[6];
- *(int16*)(buffer+30) = ZoneInfoArray[i].gangThreshold[7];
- *(int16*)(buffer+32) = ZoneInfoArray[i].gangThreshold[8];
- *(uint16*)(buffer+34) = ZoneInfoArray[i].pedDensity;
- *(uint16*)(buffer+36) = ZoneInfoArray[i].copDensity;
- *(uint16*)(buffer+38) = ZoneInfoArray[i].gangDensity[0];
- *(uint16*)(buffer+40) = ZoneInfoArray[i].gangDensity[1];
- *(uint16*)(buffer+42) = ZoneInfoArray[i].gangDensity[2];
- *(uint16*)(buffer+44) = ZoneInfoArray[i].gangDensity[3];
- *(uint16*)(buffer+46) = ZoneInfoArray[i].gangDensity[4];
- *(uint16*)(buffer+48) = ZoneInfoArray[i].gangDensity[5];
- *(uint16*)(buffer+50) = ZoneInfoArray[i].gangDensity[6];
- *(uint16*)(buffer+52) = ZoneInfoArray[i].gangDensity[7];
- *(uint16*)(buffer+54) = ZoneInfoArray[i].gangDensity[8];
- *(uint16*)(buffer+56) = ZoneInfoArray[i].pedGroup;
- buffer += 58;
+ for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
+ WriteSaveBuf(buffer, ZoneInfoArray[i]);
+
+ WriteSaveBuf(buffer, TotalNumberOfZones);
+ WriteSaveBuf(buffer, TotalNumberOfZoneInfos);
+
+ for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++) {
+ CZone* zone = WriteSaveBuf(buffer, MapZoneArray[i]);
+
+ /*
+ The call of GetIndexForZonePointer is wrong, as it is
+ meant for a different array, but the game doesn't brake
+ if those fields are nil. Let's make sure they are.
+ */
+ assert(MapZoneArray[i].child == nil);
+ assert(MapZoneArray[i].parent == nil);
+ assert(MapZoneArray[i].next == nil);
+ zone->child = (CZone*)GetIndexForZonePointer(MapZoneArray[i].child);
+ zone->parent = (CZone*)GetIndexForZonePointer(MapZoneArray[i].parent);
+ zone->next = (CZone*)GetIndexForZonePointer(MapZoneArray[i].next);
}
- *(uint16*)(buffer) = TotalNumberOfZones;
- *(uint16*)(buffer+2) = TotalNumberOfZoneInfos;
- buffer += 4;
-
- for(i = 0; i < NUMMAPZONES; i++){
- memcpy(buffer, MapZoneArray[i].name, 8);
- *(float*)(buffer+8) = MapZoneArray[i].minx;
- *(float*)(buffer+12) = MapZoneArray[i].miny;
- *(float*)(buffer+16) = MapZoneArray[i].minz;
- *(float*)(buffer+20) = MapZoneArray[i].maxx;
- *(float*)(buffer+24) = MapZoneArray[i].maxy;
- *(float*)(buffer+28) = MapZoneArray[i].maxz;
- *(int32*)(buffer+32) = MapZoneArray[i].type;
- *(int32*)(buffer+36) = MapZoneArray[i].level;
- *(int16*)(buffer+40) = MapZoneArray[i].zoneinfoDay;
- *(int16*)(buffer+42) = MapZoneArray[i].zoneinfoNight;
-#ifdef STANDALONE
- // BUG: GetIndexForZonePointer uses ZoneArray
- // so indices will be unpredictable with different memory layout
- assert(0);
-#endif
- *(int32*)(buffer+44) = GetIndexForZonePointer(MapZoneArray[i].child);
- *(int32*)(buffer+48) = GetIndexForZonePointer(MapZoneArray[i].parent);
- *(int32*)(buffer+52) = GetIndexForZonePointer(MapZoneArray[i].next);
- buffer += 56;
- }
+ for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
+ WriteSaveBuf(buffer, AudioZoneArray[i]);
- for(i = 0; i < NUMAUDIOZONES; i++){
- *(int16*)buffer = AudioZoneArray[i];
- buffer += 2;
- }
+ WriteSaveBuf(buffer, TotalNumberOfMapZones);
+ WriteSaveBuf(buffer, NumberOfAudioZones);
- *(uint16*)(buffer) = TotalNumberOfMapZones;
- *(uint16*)(buffer+2) = NumberOfAudioZones;
+ VALIDATESAVEBUF(*size)
}
void
-CTheZones::LoadAllZones(uint8 *buffer, uint32 length)
+CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
{
+ INITSAVEBUF
int i;
- assert(length == 8 + 12 +
- NUMZONES*56 + 2*NUMZONES*58 + 4 +
- NUMMAPZONES*56 + NUMAUDIOZONES*2 + 4);
- assert(buffer[0] == 'Z');
- assert(buffer[1] == 'N');
- assert(buffer[2] == 'S');
- assert(buffer[3] == '\0');
- assert(*(uint32*)(buffer+4) == length - 8);
- buffer += 8;
-
- m_pPlayersZone = GetPointerForZoneIndex(*(int32*)(buffer));
- m_CurrLevel = (eLevelName)*(int32*)(buffer+4);
- FindIndex = *(int16*)(buffer+8);
- assert(*(int16*)(buffer+10) == 0);
- buffer += 12;
-
- for(i = 0; i < NUMZONES; i++){
- memcpy(ZoneArray[i].name, buffer, 8);
- ZoneArray[i].minx = *(float*)(buffer+8);
- ZoneArray[i].miny = *(float*)(buffer+12);
- ZoneArray[i].minz = *(float*)(buffer+16);
- ZoneArray[i].maxx = *(float*)(buffer+20);
- ZoneArray[i].maxy = *(float*)(buffer+24);
- ZoneArray[i].maxz = *(float*)(buffer+28);
- ZoneArray[i].type = (eZoneType)*(int32*)(buffer+32);
- ZoneArray[i].level = (eLevelName)*(int32*)(buffer+36);
- ZoneArray[i].zoneinfoDay = *(int16*)(buffer+40);
- ZoneArray[i].zoneinfoNight = *(int16*)(buffer+42);
- ZoneArray[i].child = GetPointerForZoneIndex(*(int32*)(buffer+44));
- ZoneArray[i].parent = GetPointerForZoneIndex(*(int32*)(buffer+48));
- ZoneArray[i].next = GetPointerForZoneIndex(*(int32*)(buffer+52));
- buffer += 56;
- }
+ CheckSaveHeader(buffer, 'Z', 'N', 'S', '\0', size - SAVE_HEADER_SIZE);
- for(i = 0; i < 2*NUMZONES; i++){
- ZoneInfoArray[i].carDensity = *(int16*)(buffer);
- ZoneInfoArray[i].carThreshold[0] = *(int16*)(buffer+2);
- ZoneInfoArray[i].carThreshold[1] = *(int16*)(buffer+4);
- ZoneInfoArray[i].carThreshold[2] = *(int16*)(buffer+6);
- ZoneInfoArray[i].carThreshold[3] = *(int16*)(buffer+8);
- ZoneInfoArray[i].carThreshold[4] = *(int16*)(buffer+10);
- ZoneInfoArray[i].carThreshold[5] = *(int16*)(buffer+12);
- ZoneInfoArray[i].copThreshold = *(int16*)(buffer+14);
- ZoneInfoArray[i].gangThreshold[0] = *(int16*)(buffer+16);
- ZoneInfoArray[i].gangThreshold[1] = *(int16*)(buffer+18);
- ZoneInfoArray[i].gangThreshold[2] = *(int16*)(buffer+20);
- ZoneInfoArray[i].gangThreshold[3] = *(int16*)(buffer+22);
- ZoneInfoArray[i].gangThreshold[4] = *(int16*)(buffer+24);
- ZoneInfoArray[i].gangThreshold[5] = *(int16*)(buffer+26);
- ZoneInfoArray[i].gangThreshold[6] = *(int16*)(buffer+28);
- ZoneInfoArray[i].gangThreshold[7] = *(int16*)(buffer+30);
- ZoneInfoArray[i].gangThreshold[8] = *(int16*)(buffer+32);
- ZoneInfoArray[i].pedDensity = *(uint16*)(buffer+34);
- ZoneInfoArray[i].copDensity = *(uint16*)(buffer+36);
- ZoneInfoArray[i].gangDensity[0] = *(uint16*)(buffer+38);
- ZoneInfoArray[i].gangDensity[1] = *(uint16*)(buffer+40);
- ZoneInfoArray[i].gangDensity[2] = *(uint16*)(buffer+42);
- ZoneInfoArray[i].gangDensity[3] = *(uint16*)(buffer+44);
- ZoneInfoArray[i].gangDensity[4] = *(uint16*)(buffer+46);
- ZoneInfoArray[i].gangDensity[5] = *(uint16*)(buffer+48);
- ZoneInfoArray[i].gangDensity[6] = *(uint16*)(buffer+50);
- ZoneInfoArray[i].gangDensity[7] = *(uint16*)(buffer+52);
- ZoneInfoArray[i].gangDensity[8] = *(uint16*)(buffer+54);
- ZoneInfoArray[i].pedGroup = *(uint16*)(buffer+56);
- buffer += 58;
- }
+ m_pPlayersZone = GetPointerForZoneIndex(ReadSaveBuf<int32>(buffer));
+ m_CurrLevel = ReadSaveBuf<eLevelName>(buffer);
+ FindIndex = ReadSaveBuf<int16>(buffer);
+ ReadSaveBuf<int16>(buffer);
- TotalNumberOfZones = *(uint16*)(buffer);
- TotalNumberOfZoneInfos = *(uint16*)(buffer+2);
- buffer += 4;
+ for(i = 0; i < ARRAY_SIZE(ZoneArray); i++){
+ ZoneArray[i] = ReadSaveBuf<CZone>(buffer);
- for(i = 0; i < NUMMAPZONES; i++){
- memcpy(MapZoneArray[i].name, buffer, 8);
- MapZoneArray[i].minx = *(float*)(buffer+8);
- MapZoneArray[i].miny = *(float*)(buffer+12);
- MapZoneArray[i].minz = *(float*)(buffer+16);
- MapZoneArray[i].maxx = *(float*)(buffer+20);
- MapZoneArray[i].maxy = *(float*)(buffer+24);
- MapZoneArray[i].maxz = *(float*)(buffer+28);
- MapZoneArray[i].type = (eZoneType)*(int32*)(buffer+32);
- MapZoneArray[i].level = (eLevelName)*(int32*)(buffer+36);
- MapZoneArray[i].zoneinfoDay = *(int16*)(buffer+40);
- MapZoneArray[i].zoneinfoNight = *(int16*)(buffer+42);
-#ifdef STANDALONE
- // BUG: GetPointerForZoneIndex uses ZoneArray
- // so pointers will be unpredictable with different memory layout
- assert(0);
-#endif
- MapZoneArray[i].child = GetPointerForZoneIndex(*(int32*)(buffer+44));
- MapZoneArray[i].parent = GetPointerForZoneIndex(*(int32*)(buffer+48));
- MapZoneArray[i].next = GetPointerForZoneIndex(*(int32*)(buffer+52));
- buffer += 56;
+ ZoneArray[i].child = GetPointerForZoneIndex((int32)ZoneArray[i].child);
+ ZoneArray[i].parent = GetPointerForZoneIndex((int32)ZoneArray[i].parent);
+ ZoneArray[i].next = GetPointerForZoneIndex((int32)ZoneArray[i].next);
}
- for(i = 0; i < NUMAUDIOZONES; i++){
- AudioZoneArray[i] = *(int16*)buffer;
- buffer += 2;
+ for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)
+ ZoneInfoArray[i] = ReadSaveBuf<CZoneInfo>(buffer);
+
+ TotalNumberOfZones = ReadSaveBuf<int16>(buffer);
+ TotalNumberOfZoneInfos = ReadSaveBuf<int16>(buffer);
+
+ for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++){
+ MapZoneArray[i] = ReadSaveBuf<CZone>(buffer);
+
+ /*
+ The call of GetPointerForZoneIndex is wrong, as it is
+ meant for a different array, but the game doesn't brake
+ if save data stored is -1.
+ */
+ MapZoneArray[i].child = GetPointerForZoneIndex((int32)MapZoneArray[i].child);
+ MapZoneArray[i].parent = GetPointerForZoneIndex((int32)MapZoneArray[i].parent);
+ MapZoneArray[i].next = GetPointerForZoneIndex((int32)MapZoneArray[i].next);
+ assert(MapZoneArray[i].child == nil);
+ assert(MapZoneArray[i].parent == nil);
+ assert(MapZoneArray[i].next == nil);
}
- TotalNumberOfMapZones = *(uint16*)(buffer);
- NumberOfAudioZones = *(uint16*)(buffer+2);
+ for(i = 0; i < ARRAY_SIZE(AudioZoneArray); i++)
+ AudioZoneArray[i] = ReadSaveBuf<int16>(buffer);
+
+ TotalNumberOfMapZones = ReadSaveBuf<uint16>(buffer);
+ NumberOfAudioZones = ReadSaveBuf<uint16>(buffer);
+
+ VALIDATESAVEBUF(size)
}
diff --git a/src/core/timebars.cpp b/src/core/timebars.cpp
index 93d85f8d..5c2dbe3a 100644
--- a/src/core/timebars.cpp
+++ b/src/core/timebars.cpp
@@ -1,5 +1,5 @@
-#ifndef MASTER
#include "common.h"
+#ifndef MASTER
#include "Font.h"
#include "Frontend.h"
#include "Timer.h"
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 557318be..03df55e2 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -201,40 +201,9 @@ RwInt32 RwImageStreamGetSize(const RwImage * image);
RwImage *RwImageStreamRead(RwStream * stream);
const RwImage *RwImageStreamWrite(const RwImage * image, RwStream * stream);
-// TODO: this is kind hard...
RwImage *RwImageFindRasterFormat(RwImage *ipImage,RwInt32 nRasterType, RwInt32 *npWidth,RwInt32 *npHeight, RwInt32 *npDepth,RwInt32 *npFormat)
{
- // very dumb implementation for now
- // this is also platform specific
- if((nRasterType&rwRASTERTYPEMASK) != rwRASTERTYPETEXTURE){
- *npFormat = 0;
- return nil;
- }
- *npWidth = ipImage->width;
- *npHeight = ipImage->height;
- switch(ipImage->depth){
- case 4:
- case 8:
- *npDepth = 8;
- *npFormat = Raster::C8888 | Raster::PAL8;
- break;
- case 16:
- *npDepth = 16;
- *npFormat = Raster::C1555;
- break;
- case 24:
- *npDepth = 32;
- *npFormat = Raster::C888;
- break;
- case 32:
- *npDepth = 32;
- *npFormat = Raster::C8888;
- break;
- default:
- assert(0 && "invalid depth");
- return nil;
- }
- return ipImage;
+ return Raster::imageFindRasterFormat(ipImage, nRasterType, npWidth, npHeight, npDepth, npFormat) ? ipImage : nil;
}
@@ -269,11 +238,7 @@ RwInt32 RwRasterRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObj
RwInt32 RwRasterGetPluginOffset(RwUInt32 pluginID);
RwBool RwRasterValidatePlugins(const RwRaster * raster);
-// TODO: let's hope this works
-RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) {
- engine->driver[raster->platform]->rasterFromImage(raster, image);
- return raster;
-}
+RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) { return raster->setFromImage(image); }
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 0c00f441..081c285a 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -55,20 +55,20 @@ public:
int8 bUseVehicleColours : 1;
int8 m_obj_flag80 : 1;
int8 m_nBonusValue;
- int8 field_173;
float m_fCollisionDamageMultiplier;
uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject;
+
+ // this batch is unused
int8 field_17B;
int8 field_17C;
int8 field_17D;
int8 field_17E;
int8 field_17F;
+
uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex;
- int8 field_186;
- int8 field_187;
CEntity *m_pCurSurface;
CEntity *m_pCollidingEntity;
int8 m_colour1, m_colour2;
diff --git a/src/objects/ParticleObject.h b/src/objects/ParticleObject.h
index fc74bef0..7e4aebb7 100644
--- a/src/objects/ParticleObject.h
+++ b/src/objects/ParticleObject.h
@@ -53,14 +53,12 @@ public:
uint8 m_nSkipFrames;
uint16 m_nFrameCounter;
uint16 m_nState;
- char _pad0[2];
CVector m_vecTarget;
float m_fRandVal;
float m_fSize;
CRGBA m_Color;
uint8 m_bRemove;
int8 m_nCreationChance;
- char _pad1[2];
static CParticleObject *pCloseListHead;
static CParticleObject *pFarListHead;
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index 625cae49..62234b7e 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -13,17 +13,13 @@ class CCopPed : public CPed
{
public:
int16 m_wRoadblockNode;
- int8 field_1342;
- int8 field_1343;
float m_fDistanceToTarget;
- int8 m_bIsInPursuit;
- int8 m_bIsDisabledCop;
+ bool m_bIsInPursuit;
+ bool m_bIsDisabledCop;
int8 field_1350;
bool m_bBeatingSuspect;
- int8 m_bStopAndShootDisabledZone;
- int8 m_bZoneDisabled;
- int8 field_1354;
- int8 field_1355;
+ bool m_bStopAndShootDisabledZone;
+ bool m_bZoneDisabled;
int32 field_1356;
eCopType m_nCopType;
int8 field_1364;
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 27f699d5..41f0ffb2 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -301,95 +301,92 @@ public:
float m_fCollisionSpeed;
// cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CPed.h from R*
- uint8 bIsStanding : 1;
- uint8 m_ped_flagA2 : 1; // bWasStanding?
- uint8 bIsAttacking : 1; // doesn't reset after fist fight
- uint8 bIsPointingGunAt : 1;
- uint8 bIsLooking : 1;
- uint8 bKeepTryingToLook : 1; // if we can't look somewhere due to unreachable angles
- uint8 bIsRestoringLook : 1;
- uint8 bIsAimingGun : 1;
-
- uint8 bIsRestoringGun : 1;
- uint8 bCanPointGunAtTarget : 1;
- uint8 bIsTalking : 1;
- uint8 bIsInTheAir : 1;
- uint8 bIsLanding : 1;
- uint8 bIsRunning : 1; // on some conditions
- uint8 bHitSomethingLastFrame : 1;
- uint8 bVehEnterDoorIsBlocked : 1; // because someone else enters/exits from there
-
- uint8 bCanPedEnterSeekedCar : 1;
- uint8 bRespondsToThreats : 1;
- uint8 bRenderPedInCar : 1;
- uint8 bChangedSeat : 1;
- uint8 bUpdateAnimHeading : 1;
- uint8 bBodyPartJustCameOff : 1;
- uint8 bIsShooting : 1;
- uint8 bFindNewNodeAfterStateRestore : 1;
-
- uint8 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
- uint8 bGonnaInvestigateEvent : 1;
- uint8 bPedIsBleeding : 1;
- uint8 bStopAndShoot : 1; // Ped cannot reach target to attack with fist, need to use gun
- uint8 bIsPedDieAnimPlaying : 1;
- uint8 bUsePedNodeSeek : 1;
- uint8 bObjectiveCompleted : 1;
- uint8 bScriptObjectiveCompleted : 1;
-
- uint8 bKindaStayInSamePlace : 1;
- uint8 bBeingChasedByPolice : 1; // Unused VC leftover. Should've been set for criminal/gang members
- uint8 bNotAllowedToDuck : 1;
- uint8 bCrouchWhenShooting : 1;
- uint8 bIsDucking : 1;
- uint8 bGetUpAnimStarted : 1;
- uint8 bDoBloodyFootprints : 1;
- uint8 bFleeAfterExitingCar : 1;
-
- uint8 bWanderPathAfterExitingCar : 1;
- uint8 bIsLeader : 1;
- uint8 bDontDragMeOutCar : 1; // unfinished feature
- uint8 m_ped_flagF8 : 1;
- uint8 bWillBeQuickJacked : 1;
- uint8 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
- uint8 bObstacleShowedUpDuringKillObjective : 1;
- uint8 bDuckAndCover : 1;
-
- uint8 bStillOnValidPoly : 1; // set if the polygon the ped is on is still valid for collision
- uint8 bAllowMedicsToReviveMe : 1;
- uint8 bResetWalkAnims : 1;
- uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
- uint8 bOnBoat : 1; // not just driver, may be just standing
- uint8 bBusJacked : 1;
- uint8 bGonnaKillTheCarJacker : 1; // only set when car is jacked from right door and when arrested by police
- uint8 bFadeOut : 1;
-
- uint8 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
- uint8 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type)
- uint8 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks)
- uint8 bClearObjective : 1;
- uint8 bTryingToReachDryLand : 1; // has ped just exited boat and trying to get to dry land
- uint8 bCollidedWithMyVehicle : 1;
- uint8 bRichFromMugging : 1; // ped has lots of cash cause they've been mugging people
- uint8 bChrisCriminal : 1; // Is a criminal as killed during Chris' police mission (should be counted as such)
-
- uint8 bShakeFist : 1; // test shake hand at look entity
- uint8 bNoCriticalHits : 1; // if set, limbs won't came off
- uint8 bVehExitWillBeInstant : 1;
- uint8 bHasAlreadyBeenRecorded : 1;
- uint8 bFallenDown : 1;
+ uint32 bIsStanding : 1;
+ uint32 m_ped_flagA2 : 1; // bWasStanding?
+ uint32 bIsAttacking : 1; // doesn't reset after fist fight
+ uint32 bIsPointingGunAt : 1;
+ uint32 bIsLooking : 1;
+ uint32 bKeepTryingToLook : 1; // if we can't look somewhere due to unreachable angles
+ uint32 bIsRestoringLook : 1;
+ uint32 bIsAimingGun : 1;
+
+ uint32 bIsRestoringGun : 1;
+ uint32 bCanPointGunAtTarget : 1;
+ uint32 bIsTalking : 1;
+ uint32 bIsInTheAir : 1;
+ uint32 bIsLanding : 1;
+ uint32 bIsRunning : 1; // on some conditions
+ uint32 bHitSomethingLastFrame : 1;
+ uint32 bVehEnterDoorIsBlocked : 1; // because someone else enters/exits from there
+
+ uint32 bCanPedEnterSeekedCar : 1;
+ uint32 bRespondsToThreats : 1;
+ uint32 bRenderPedInCar : 1;
+ uint32 bChangedSeat : 1;
+ uint32 bUpdateAnimHeading : 1;
+ uint32 bBodyPartJustCameOff : 1;
+ uint32 bIsShooting : 1;
+ uint32 bFindNewNodeAfterStateRestore : 1;
+
+ uint32 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
+ uint32 bGonnaInvestigateEvent : 1;
+ uint32 bPedIsBleeding : 1;
+ uint32 bStopAndShoot : 1; // Ped cannot reach target to attack with fist, need to use gun
+ uint32 bIsPedDieAnimPlaying : 1;
+ uint32 bUsePedNodeSeek : 1;
+ uint32 bObjectiveCompleted : 1;
+ uint32 bScriptObjectiveCompleted : 1;
+
+ uint32 bKindaStayInSamePlace : 1;
+ uint32 bBeingChasedByPolice : 1; // Unused VC leftover. Should've been set for criminal/gang members
+ uint32 bNotAllowedToDuck : 1;
+ uint32 bCrouchWhenShooting : 1;
+ uint32 bIsDucking : 1;
+ uint32 bGetUpAnimStarted : 1;
+ uint32 bDoBloodyFootprints : 1;
+ uint32 bFleeAfterExitingCar : 1;
+
+ uint32 bWanderPathAfterExitingCar : 1;
+ uint32 bIsLeader : 1;
+ uint32 bDontDragMeOutCar : 1; // unfinished feature
+ uint32 m_ped_flagF8 : 1;
+ uint32 bWillBeQuickJacked : 1;
+ uint32 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
+ uint32 bObstacleShowedUpDuringKillObjective : 1;
+ uint32 bDuckAndCover : 1;
+
+ uint32 bStillOnValidPoly : 1; // set if the polygon the ped is on is still valid for collision
+ uint32 bAllowMedicsToReviveMe : 1;
+ uint32 bResetWalkAnims : 1;
+ uint32 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
+ uint32 bOnBoat : 1; // not just driver, may be just standing
+ uint32 bBusJacked : 1;
+ uint32 bGonnaKillTheCarJacker : 1; // only set when car is jacked from right door and when arrested by police
+ uint32 bFadeOut : 1;
+
+ uint32 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
+ uint32 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type)
+ uint32 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks)
+ uint32 bClearObjective : 1;
+ uint32 bTryingToReachDryLand : 1; // has ped just exited boat and trying to get to dry land
+ uint32 bCollidedWithMyVehicle : 1;
+ uint32 bRichFromMugging : 1; // ped has lots of cash cause they've been mugging people
+ uint32 bChrisCriminal : 1; // Is a criminal as killed during Chris' police mission (should be counted as such)
+
+ uint32 bShakeFist : 1; // test shake hand at look entity
+ uint32 bNoCriticalHits : 1; // if set, limbs won't came off
+ uint32 bVehExitWillBeInstant : 1;
+ uint32 bHasAlreadyBeenRecorded : 1;
+ uint32 bFallenDown : 1;
#ifdef VC_PED_PORTS
- uint8 bSomeVCflag1 : 1;
+ uint32 bSomeVCflag1 : 1;
#else
- uint8 m_ped_flagI20 : 1;
+ uint32 m_ped_flagI20 : 1;
#endif
- uint8 m_ped_flagI40 : 1; // bMakePedsRunToPhonesToReportCrimes makes use of this as runover by car indicator
- uint8 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle
+ uint32 m_ped_flagI40 : 1; // bMakePedsRunToPhonesToReportCrimes makes use of this as runover by car indicator
+ uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle
- uint8 stuff10[3];
uint8 CharCreatedBy;
- uint8 field_161;
- uint8 pad_162[2];
eObjective m_objective;
eObjective m_prevObjective;
CPed *m_pedInObjective;
@@ -424,8 +421,6 @@ public:
uint16 m_nPathNodes;
int16 m_nCurPathNode;
int8 m_nPathDir;
-private:
- int8 _pad2B5[3];
public:
CPathNode *m_pLastPathNode;
CPathNode *m_pNextPathNode;
@@ -436,7 +431,6 @@ public:
int16 m_routePointsPassed;
int16 m_routeType; // See PedRouteType
int16 m_routePointsBeingPassed;
- uint16 field_2D2;
CVector2D m_moved;
float m_fRotationCur;
float m_fRotationDest;
@@ -450,10 +444,8 @@ public:
CEntity *m_pSeekTarget;
CVehicle *m_pMyVehicle;
bool bInVehicle;
- uint8 pad_315[3];
float m_distanceToCountSeekDone;
bool bRunningToPhone;
- uint8 field_31D;
int16 m_phoneId;
eCrimeType m_crimeToReportOnPhone;
uint32 m_phoneTalkTimer;
@@ -468,7 +460,6 @@ public:
uint32 m_collidingThingTimer;
CEntity *m_pCollidingEntity;
uint8 m_stateUnused;
- uint8 pad_351[3];
uint32 m_timerUnused;
CVector2D *m_wanderRangeBounds; // array with 2 CVector2D (actually unused CRange2D class) - unused
CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
@@ -483,7 +474,6 @@ public:
uint8 m_fightButtonPressure;
FightState m_fightState;
bool m_takeAStepAfterAttack;
- uint8 pad_4B3;
CFire *m_pFire;
CEntity *m_pLookTarget;
float m_fLookDirection;
@@ -502,11 +492,9 @@ public:
uint8 m_panicCounter;
bool m_deadBleeding;
int8 m_bodyPartBleeding; // PedNode, but -1 if there isn't
- uint8 m_field_4F3;
CPed *m_nearPeds[10];
uint16 m_numNearPeds;
int8 m_lastWepDam;
- uint8 pad_51F;
uint32 m_lastSoundStart;
uint32 m_soundStart;
uint16 m_lastQueuedSound;
diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h
index f96d8e6a..81f8e4d7 100644
--- a/src/peds/PlayerPed.h
+++ b/src/peds/PlayerPed.h
@@ -23,20 +23,13 @@ public:
uint32 m_nHitAnimDelayTimer;
float m_fAttackButtonCounter;
bool m_bHaveTargetSelected; // may have better name
- int8 field_1381;
- int8 field_1382;
- int8 field_1383;
CEntity *m_pEvadingFrom; // is this CPhysical?
int32 m_nTargettableObjects[4];
bool m_bAdrenalineActive;
bool m_bHasLockOnTarget;
- int8 field_1406;
- int8 field_1407;
uint32 m_nAdrenalineTime;
bool m_bCanBeDamaged;
int8 field_1413;
- int8 field_1414;
- int8 field_1415;
CVector m_vecSafePos[6]; // safe places from the player, for example behind a tree
CPed *m_pPedAtSafePos[6];
float m_fWalkAngle;
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 681c6b1a..c1eee828 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1050,7 +1050,7 @@ CPopulation::TestSafeForRealObject(CDummyObject *dummy)
if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y;
#endif
- static CColPoint aTempColPoints;
+ static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
for (int curY = minY; curY <= maxY; curY++) {
for (int curX = minX; curX <= maxX; curX++) {
@@ -1061,7 +1061,7 @@ CPopulation::TestSafeForRealObject(CDummyObject *dummy)
if (veh->m_scanCode != CWorld::GetCurrentScanCode()) {
if (veh->GetIsTouching(colCentre, colRadius)) {
veh->m_scanCode = CWorld::GetCurrentScanCode();
- if (CCollision::ProcessColModels(dummy->GetMatrix(), *dummyCol, veh->GetMatrix(), *veh->GetColModel(), &aTempColPoints, nil, nil) > 0)
+ if (CCollision::ProcessColModels(dummy->GetMatrix(), *dummyCol, veh->GetMatrix(), *veh->GetColModel(), aTempColPoints, nil, nil) > 0)
return false;
}
}
@@ -1072,7 +1072,7 @@ CPopulation::TestSafeForRealObject(CDummyObject *dummy)
if (veh->m_scanCode != CWorld::GetCurrentScanCode()) {
if (veh->GetIsTouching(colCentre, colRadius)) {
veh->m_scanCode = CWorld::GetCurrentScanCode();
- if (CCollision::ProcessColModels(dummy->GetMatrix(), *dummyCol, veh->GetMatrix(), *veh->GetColModel(), &aTempColPoints, nil, nil) > 0)
+ if (CCollision::ProcessColModels(dummy->GetMatrix(), *dummyCol, veh->GetMatrix(), *veh->GetColModel(), aTempColPoints, nil, nil) > 0)
return false;
}
}
diff --git a/src/render/Glass.h b/src/render/Glass.h
index dccd9d3d..51c5aae9 100644
--- a/src/render/Glass.h
+++ b/src/render/Glass.h
@@ -13,7 +13,6 @@ public:
uint8 m_nTriIndex;
bool m_bActive;
bool m_bShattered;
- char _pad0[1];
CFallingGlassPane() { }
~CFallingGlassPane() { }
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 604fbb82..b51be6a5 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -24,7 +24,6 @@ public:
uint16 m_nZRotationTimer;
float m_fCurrentZRadius;
uint16 m_nZRadiusTimer;
- char _pad0[2];
float m_fSize;
float m_fExpansionRate;
uint16 m_nFadeToBlackTimer;
@@ -36,7 +35,6 @@ public:
int16 m_nRotationStep;
int16 m_nRotation;
RwRGBA m_Color;
- char _pad1[2];
CParticle *m_pNext;
CParticle()
diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h
index e3ec21c6..0b4091de 100644
--- a/src/render/ParticleMgr.h
+++ b/src/render/ParticleMgr.h
@@ -46,7 +46,6 @@ struct tParticleSystemData
uint16 m_nFinalAnimationFrame;
uint16 m_nAnimationSpeed;
uint16 m_nRotationSpeed;
- char _pad1[2];
float m_fGravitationalAcceleration;
int32 m_nFrictionDecceleration;
int32 m_nLifeSpan;
@@ -60,7 +59,6 @@ struct tParticleSystemData
RwRGBA m_RenderColouring;
uint8 m_InitialColorVariation;
RwRGBA m_FadeDestinationColor;
- char _pad2[3];
uint32 m_ColorFadeTime;
RwRaster **m_ppRaster;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 9c78853f..3d308c52 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -194,8 +194,6 @@ CRenderer::RenderRoads(void)
DeActivateDirectional();
SetAmbientColours();
- ThePaths.m_pathNodes[-1].group = 6;
-
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
t = (CTreadable*)ms_aVisibleEntityPtrs[i];
if(t->IsBuilding() && t->GetIsATreadable()){
diff --git a/src/render/Shadows.h b/src/render/Shadows.h
index d209fe90..65274879 100644
--- a/src/render/Shadows.h
+++ b/src/render/Shadows.h
@@ -46,7 +46,6 @@ public:
uint8 bRendered : 1;
//uint8 bDrawOnBuildings : 1;
} m_nFlags;
- char _pad0;
RwTexture *m_pTexture;
CStoredShadow()
@@ -58,11 +57,9 @@ class CPolyBunch
{
public:
int16 m_nNumVerts;
- char _pad0[2];
CVector m_aVerts[7];
uint8 m_aU[7];
uint8 m_aV[7];
- char _pad1[2];
CPolyBunch *m_pNext;
CPolyBunch()
@@ -82,7 +79,6 @@ public:
float m_fZDistance;
float m_fScale;
uint8 m_nType;
- char _pad0;
int16 m_nIntensity; // unsigned ?
uint8 m_nRed;
uint8 m_nGreen;
@@ -90,7 +86,6 @@ public:
bool m_bJustCreated;
bool m_bRendered;
bool m_bTemp;
- char _pad1[2];
RwTexture *m_pTexture;
CStaticShadow()
@@ -113,7 +108,6 @@ public:
uint8 m_nRed;
uint8 m_nGreen;
uint8 m_nBlue;
- char _pad0[2];
uint32 m_nTimeCreated;
uint32 m_nLifeTime;
RwTexture *m_pTexture;
diff --git a/src/render/WaterCannon.h b/src/render/WaterCannon.h
index 826dc78e..d2d20863 100644
--- a/src/render/WaterCannon.h
+++ b/src/render/WaterCannon.h
@@ -13,7 +13,6 @@ public:
int32 m_nId;
int16 m_nCur;
- char _pad0[2];
uint32 m_nTimeCreated;
CVector m_avecPos[NUM_SEGMENTPOINTS];
CVector m_avecVelocity[NUM_SEGMENTPOINTS];
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index e5c4ceae..acf811ad 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -91,7 +91,8 @@ DefinedState(void)
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
#ifdef LIBRW
- #pragma message (" TODO: alphatest func")
+ rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
+ rw::SetRenderState(rw::ALPHATESTREF, 3);
#else
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
diff --git a/src/rw/rw.cpp b/src/rw/rw.cpp
deleted file mode 100644
index 09cd246e..00000000
--- a/src/rw/rw.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef LIBRW
-#include "common.h"
-
-#include "rwcore.h"
-#include "rpworld.h"
-#include "rpmatfx.h"
-#include "rpskin.h"
-#include "rphanim.h"
-#include "rtbmp.h"
-
-typedef RwV3d *(*rwVectorsMultFn) (RwV3d * pointsOut,
- const RwV3d * pointsIn,
- RwInt32 numPoints,
- const RwMatrix * matrix);
-
-#ifndef RWLIBS
-
-#else
-
-extern "C"
-{
- void* _rwFrameOpen(void* instance, RwInt32 offset, RwInt32 size);
- void* _rwFrameClose(void* instance, RwInt32 offset, RwInt32 size);
- RwFrame* _rwFrameCloneAndLinkClones(RwFrame* root);
- RwFrame* _rwFramePurgeClone(RwFrame* root);
- RwBool RwFrameDirty(RwFrame const* frame);
- void _rwFrameInit(RwFrame* frame);
- RwBool _rwMatrixSetMultFn(rwMatrixMultFn multMat);
- void* _rwMatrixClose(void* instance, RwInt32 offset, RwInt32 size);
- void* _rwMatrixOpen(void* instance, RwInt32 offset, RwInt32 size);
- RwBool _rwVectorSetMultFn(rwVectorMultFn multPoint, rwVectorsMultFn multPoints, rwVectorMultFn multVector, rwVectorsMultFn multVectors);
- void* _rwVectorClose(void* instance, RwInt32 offset, RwInt32 size);
- void* _rwVectorOpen(void* instance, RwInt32 offset, RwInt32 size);
- RwBool _rwPluginRegistryOpen();
- RwBool _rwPluginRegistryClose();
-
- RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags);
-}
-#endif
-#endif \ No newline at end of file
diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp
index 3794ba88..46185850 100644
--- a/src/save/PCSave.cpp
+++ b/src/save/PCSave.cpp
@@ -86,7 +86,11 @@ C_PcSave::PopulateSlotInfo()
SlotSaveDate[i][0] = '\0';
}
for (int i = 0; i < SLOT_COUNT; i++) {
+#ifdef FIX_BUGS
+ char savename[MAX_PATH];
+#else
char savename[52];
+#endif
struct {
int size;
wchar FileName[24];
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 66774612..2de85a99 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -92,7 +92,6 @@ public:
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;
- uint8 field_4DB;
CEntity *m_pBombRigger;
int16 field_4E0;
uint16 m_hydraulicState;
diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h
index 15dff7b1..39e4cbcf 100644
--- a/src/vehicles/Heli.h
+++ b/src/vehicles/Heli.h
@@ -70,7 +70,6 @@ public:
static bool ScriptHeliOn;
CHeli(int32 id, uint8 CreatedBy);
- CHeli* ctor(int, uint8);
// from CEntity
void SetModelIndex(uint32 id);
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index 4c8e70aa..79738858 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -33,8 +33,6 @@ public:
int16 m_nPlaneId;
int16 m_isFarAway;
int16 m_nCurPathNode;
- char field_654;
- char field_655;
float m_fSpeed;
uint32 m_nFrameWhenHit;
bool m_bHasBeenHit;
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index bfc6d95d..2ae78829 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -130,7 +130,6 @@ public:
int8 m_nGettingInFlags;
int8 m_nGettingOutFlags;
uint8 m_nNumMaxPassengers;
- char field_1CD[3];
float field_1D0[4];
CEntity *m_pCurGroundEntity;
CFire *m_pCarFire;
@@ -180,7 +179,6 @@ public:
int16 m_nRoadblockNode;
float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode
uint8 m_nCurrentGear;
- int8 field_205[3];
float m_fChangeGearTime;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath;
@@ -296,7 +294,6 @@ class cVehicleParams
{
public:
bool m_bDistanceCalculated;
- char gap_1[3];
float m_fDistance;
CVehicle *m_pVehicle;
cTransmission *m_pTransmission;
diff --git a/src/weapons/WeaponEffects.h b/src/weapons/WeaponEffects.h
index 31c5a309..f6592b3e 100644
--- a/src/weapons/WeaponEffects.h
+++ b/src/weapons/WeaponEffects.h
@@ -4,7 +4,6 @@ class CWeaponEffects
{
public:
bool m_bActive;
- char _pad[3];
CVector m_vecPos;
uint8 m_nRed;
uint8 m_nGreen;