Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ea62bf8
chore(rn): backup FAData.ini to FAData_bak.ini and initialize base INIs
Zero-Fanker Oct 8, 2026
c22546c
fix(rn): update FAData_ObjectBrowser.ini with Antalian side and RN ig…
Zero-Fanker Oct 8, 2026
1b001e1
fix(rn): update FAData_TriggerAndScript.ini with Antalian AI trigger …
Zero-Fanker Oct 8, 2026
0487b8a
fix(rn): restore RN customizations, sides, game modes, and templates …
Zero-Fanker Oct 8, 2026
0a417ed
docs(rn): document modular configuration suite in README.md
Zero-Fanker Oct 9, 2026
ffd4bd2
feat(shp): make SHP vehicle facing offset configurable via integer mu…
Zero-Fanker Oct 9, 2026
65e4e35
fix(rn): disable ObjectBrowser.SafeHouses in RN FAData.ini
Zero-Fanker Oct 9, 2026
03af0bf
chore(rn): remove all Phobos-specific triggers, scripts, and configur…
Zero-Fanker Oct 9, 2026
56cf0ed
chore(rn): correct terminology from HAres to Hares in comments and do…
Zero-Fanker Oct 9, 2026
d9beb94
fix(rn): align scripts 13, 15, 17, 32 with target C and expand script…
Zero-Fanker Oct 9, 2026
8c5969b
feat(rn): decouple script param 22 from BuildingwithProperty by intro…
Zero-Fanker Oct 9, 2026
591bdc7
chore(rn): purge dead SP_TargetList and ScriptExtras sections and upd…
Zero-Fanker Oct 9, 2026
aa982ba
fix(rn): align EventsRA2 33, 34, 61, 86 with Hares and disable invali…
Zero-Fanker Oct 10, 2026
9e2ff0d
fix(rn): align ActionsRA2 parameters with Hares engine capabilities a…
Zero-Fanker Oct 10, 2026
3a14013
fix(object-browser): filter GDI and Nod houses in Redraw_Owner
Zero-Fanker Oct 10, 2026
9128218
fix(rn): complete IgnoreSuperAnim entries for superweapons in FAData
Zero-Fanker Oct 10, 2026
32578dd
deleted old FAData bak .
Zero-Fanker Oct 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FA2sp.UnitTest/FA2sp.UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="SequencedKeyListTest.cpp" />
<ClCompile Include="CINIOrderTrackerTest.cpp" />
<ClCompile Include="SHPVehicleFacingTest.cpp" />
<ClCompile Include="..\FA2sp\Helpers\CINIOrderTracker.cpp" />
<ClCompile Include="..\FA2sp\Miscs\Hooks.INI.cpp" />
<ClCompile Include="..\FA2sp\Helpers\FString.cpp" />
Expand Down
86 changes: 86 additions & 0 deletions FA2sp.UnitTest/SHPVehicleFacingTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#include "TestCommon.h"
#include <vector>
#include <algorithm>

TEST(SHPVehicleFacingTest, ZeroOffsetDoesNotRotateFrames)
{
// When SHPVehicle.FacingOffset = 0 (RN configuration):
// std::rotate(begin, begin + 0 * targetFacings / 8, end) is a no-op.
const int offset = 0;
const int targetFacings = 8;
std::vector<int> framesToRead = { 0, 1, 2, 3, 4, 5, 6, 7 };

std::rotate(framesToRead.begin(), framesToRead.begin() + offset * targetFacings / 8, framesToRead.end());

std::vector<int> expected = { 0, 1, 2, 3, 4, 5, 6, 7 };
EXPECT_EQ(framesToRead, expected);
EXPECT_EQ(framesToRead[0], 0);
}

TEST(SHPVehicleFacingTest, ZeroOffsetTurretFacingAlignsWithBody)
{
// Turret facing formula: (((offset * targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32
// With offset = 0, facing 0 produces turret facing 0, perfectly aligned with body frame 0.
const int offset = 0;
const int targetFacings = 8;

for (int i = 0; i < targetFacings; ++i)
{
int turrentFacing = (((offset * targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32;
EXPECT_EQ(turrentFacing, i * (32 / targetFacings));
}

int facing0Turret = (((offset * targetFacings / 8 + 0) % targetFacings) * 32 / targetFacings) % 32;
EXPECT_EQ(facing0Turret, 0);
}

TEST(SHPVehicleFacingTest, LegacyOffsetOneShiftsFramesAndTurretBy45Degrees)
{
// When SHPVehicle.FacingOffset = 1 (legacy FA2sp cmcc patch default):
// Shifts frames forward by 1 step (45 degrees), reading frame 1 for facing 0.
const int offset = 1;
const int targetFacings = 8;
std::vector<int> framesToRead = { 0, 1, 2, 3, 4, 5, 6, 7 };

std::rotate(framesToRead.begin(), framesToRead.begin() + offset * targetFacings / 8, framesToRead.end());

std::vector<int> expected = { 1, 2, 3, 4, 5, 6, 7, 0 };
EXPECT_EQ(framesToRead, expected);
EXPECT_EQ(framesToRead[0], 1);

// Turret facing also shifted by +4 (45 degrees in 32-facing space)
int facing0Turret = (((offset * targetFacings / 8 + 0) % targetFacings) * 32 / targetFacings) % 32;
EXPECT_EQ(facing0Turret, 4);
}

TEST(SHPVehicleFacingTest, ExtFacings32Support)
{
// Verification with 32 facings (ExtFacings enabled):
const int targetFacings = 32;

// Offset = 0: no rotate
{
const int offset = 0;
std::vector<int> frames(32);
for (int i = 0; i < 32; ++i) frames[i] = i;

std::rotate(frames.begin(), frames.begin() + offset * targetFacings / 8, frames.end());
EXPECT_EQ(frames[0], 0);

int turrentFacing = (((offset * targetFacings / 8 + 0) % targetFacings) * 32 / targetFacings) % 32;
EXPECT_EQ(turrentFacing, 0);
}

// Offset = 1: rotate by 4 steps (32 / 8 = 4, 45 degrees)
{
const int offset = 1;
std::vector<int> frames(32);
for (int i = 0; i < 32; ++i) frames[i] = i;

std::rotate(frames.begin(), frames.begin() + offset * targetFacings / 8, frames.end());
EXPECT_EQ(frames[0], 4);

int turrentFacing = (((offset * targetFacings / 8 + 0) % targetFacings) * 32 / targetFacings) % 32;
EXPECT_EQ(turrentFacing, 4);
}
}
15 changes: 15 additions & 0 deletions FA2sp/Ext/CFinalSunDlg/Body.ObjectBrowserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,11 @@ void CViewObjectsExt::Redraw_Owner()
size_t i = 0;
for (auto& itr : section)
{
if (strcmp(itr.second, "Nod") == 0 || strcmp(itr.second, "GDI") == 0)
{
i++;
continue;
}
FString uiname = itr.second;

if (!ExtConfigs::NoHouseNameTranslation)
Expand Down Expand Up @@ -1416,6 +1421,11 @@ void CViewObjectsExt::Redraw_Owner()
size_t i = 0;
for (auto& itr : section)
{
if (strcmp(itr.second, "Nod") == 0 || strcmp(itr.second, "GDI") == 0)
{
i++;
continue;
}
FString uiname = itr.second;

if (!ExtConfigs::NoHouseNameTranslation)
Expand Down Expand Up @@ -1486,6 +1496,11 @@ void CViewObjectsExt::Redraw_Owner()
size_t i = 0;
for (auto& itr : section)
{
if (strcmp(itr.second, "Nod") == 0 || strcmp(itr.second, "GDI") == 0)
{
i++;
continue;
}
FString uiname = itr.second;

if (!ExtConfigs::NoHouseNameTranslation)
Expand Down
7 changes: 4 additions & 3 deletions FA2sp/Ext/CLoading/Body.LoadObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,8 @@ void CLoadingExt::LoadVehicleOrAircraft(const FString& ID, int tiltType)
}
}

std::rotate(framesToRead.begin(), framesToRead.begin() + 1 * targetFacings / 8, framesToRead.end());
int offset = ExtConfigs::SHPVehicle_FacingOffset;
std::rotate(framesToRead.begin(), framesToRead.begin() + offset * targetFacings / 8, framesToRead.end());

FString FileName = ImageID + ".shp";
FString FileNameTurret = ImageID + "tur.shp";
Expand Down Expand Up @@ -2648,7 +2649,7 @@ void CLoadingExt::LoadVehicleOrAircraft(const FString& ID, int tiltType)

// turret start from 0 + WalkFrames * Facings, ignore StartWalkFrame
// and always has 32 facings
turrentFacing = (((targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32;
turrentFacing = (((offset * targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32;
turretFrameToRead = bUseTurrentFile ? turrentFacing : (facingCount * nWalkFrames + turrentFacing);
if (KratosWeaponTurretFrameIndex >= 0)
{
Expand Down Expand Up @@ -2697,7 +2698,7 @@ void CLoadingExt::LoadVehicleOrAircraft(const FString& ID, int tiltType)
int nWalkFrames = CINI::Art->GetInteger(ArtID, "WalkFrames", 1);
int turrentFacing;

turrentFacing = (((targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32;
turrentFacing = (((offset * targetFacings / 8 + i) % targetFacings) * 32 / targetFacings) % 32;

bool barrelInFront = IsBarrelInFront(i, targetFacings);
if (hasVoxelBarl)
Expand Down
2 changes: 2 additions & 0 deletions FA2sp/FA2sp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ bool ExtConfigs::ExtTilts;
bool ExtConfigs::ExtFacings_Drag;
bool ExtConfigs::ExtFacings_Scroll;
bool ExtConfigs::ExtFacings_DragPreview;
int ExtConfigs::SHPVehicle_FacingOffset = 1;
int ExtConfigs::UndoRedoLimit;
bool ExtConfigs::UndoRedo_ShiftPlaceTile;
bool ExtConfigs::UndoRedo_RecordObjects;
Expand Down Expand Up @@ -375,6 +376,7 @@ void FA2sp::ExtConfigsInitialize()
ExtConfigs::ExtFacings_Drag = CINI::FAData->GetBool("ExtConfigs", "ExtFacings.Drag");
ExtConfigs::ExtFacings_Scroll = CINI::FAData->GetBool("ExtConfigs", "ExtFacings.Scroll");
ExtConfigs::ExtFacings_DragPreview = CINI::FAData->GetBool("ExtConfigs", "ExtFacings.DragPreview", true);
ExtConfigs::SHPVehicle_FacingOffset = CINI::FAData->GetInteger("ExtConfigs", "SHPVehicle.FacingOffset", 1);
ExtConfigs::ExtVariables = CINI::FAData->GetBool("ExtConfigs", "ExtVariables");
ExtConfigs::AIRepairDefaultYes = CINI::FAData->GetBool("ExtConfigs", "AIRepairDefaultYes");
ExtConfigs::AISellableDefaultYes = CINI::FAData->GetBool("ExtConfigs", "AISellableDefaultYes");
Expand Down
1 change: 1 addition & 0 deletions FA2sp/FA2sp.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class ExtConfigs
static bool ExtFacings_Drag;
static bool ExtFacings_Scroll;
static bool ExtFacings_DragPreview;
static int SHPVehicle_FacingOffset;
static int UndoRedoLimit;
static bool UndoRedo_RecordObjects;
static bool UndoRedo_ShiftPlaceTile;
Expand Down
4 changes: 4 additions & 0 deletions Supplementary/FAData.ini
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ ExtFacings.DragPreview=true
; BOOLEAN ; 启用32向的摆放时滚轮调整朝向, 否则为8向, 默认为 false
ExtFacings.Scroll=false

; INTEGER ; Facing offset index for SHP vehicles (default 1 for legacy cmcc patch behavior; set to 0 to restore pre-patch behavior and remove hardcoded offset)
; INTEGER ; SHP载具朝向帧偏移 (默认为 1 保持 cmcc patch 的历史效果; 设置为 0 则可以保持 cmcc patch 之前的效果,消除这个硬编码限制)
SHPVehicle.FacingOffset=1

; BOOLEAN ; Allow vehicles and aircraft to tilt on slopes. Default false
; BOOLEAN ; 车辆和飞行器在斜坡上显示倾斜图像, 默认为 false
ExtTilts=false
Expand Down
4 changes: 4 additions & 0 deletions Supplementary/MentalOmega/FAData.ini
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ ExtFacings.DragPreview=true
; BOOLEAN ; 启用32向的摆放时滚轮调整朝向, 否则为8向, 默认为 false
ExtFacings.Scroll=false

; INTEGER ; Facing offset index for SHP vehicles (default 1 for legacy cmcc patch behavior; set to 0 to restore pre-patch behavior and remove hardcoded offset)
; INTEGER ; SHP载具朝向帧偏移 (默认为 1 保持 cmcc patch 的历史效果; 设置为 0 则可以保持 cmcc patch 之前的效果,消除这个硬编码限制)
SHPVehicle.FacingOffset=1

; BOOLEAN ; Allow vehicles and aircraft to tilt on slopes. Default false
; BOOLEAN ; 车辆和飞行器在斜坡上显示倾斜图像, 默认为 false
ExtTilts=false
Expand Down
Loading
Loading