Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ This page lists all the individual contributions to the project by their author.
- MP saves support for quicksave command and savegame trigger action
- Ported XNA CnCNet Client MP save handling
- Retint fix toggle
- Voxel drawing invisible sections skip
- **Uranusian (Thrifinesma)**:
- Mind Control enhancement
- Custom warhead splash list
Expand Down Expand Up @@ -532,6 +533,7 @@ This page lists all the individual contributions to the project by their author.
- Fix a jumpjet crash related to voxel shadow drawing
- Replace `BLOWFISH.DLL` using Red Alert source code
- Adjust the dehardcoding of the 255 `OverlayType` limit to a different format
- Voxel drawing invisible sections skip
- **CrimRecya**:
- Fix `LimboKill` not working reliably
- Allow using waypoints, area guard and attack move with aircraft
Expand Down
2 changes: 1 addition & 1 deletion YRpp
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Allow the default value of `DefaultToGuardArea` to be defined by `[General] -> DefaultToGuardArea`.
- Fixed the bug that cause technos teleport to cell 0,0 by ChronoSphere superweapon.
- Fixed the bug that techno in attack move will move to target if it cannot attack it.
- Voxel drawing code now skips sections that are invisible (have all zeros in the transform matrix main diagonal, meaning that the scale is 0% on all axes), thus increasing drawing performance for some voxels.

## Fixes / interactions with other extensions

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ Vanilla fixes:
- Fixed the issue where units recruited by a team with `AreTeamMembersRecruitable=false` cannot be recruited even if they have been liberated by that team (by TaranDahl)
- Fixed the bug that cause technos teleport to cell 0,0 by ChronoSphere superweapon (by NetsuNegi)
- Fixed the bug that techno in attack move will move to target if it cannot attack it (by NetsuNegi)
- Voxel drawing code now skips sections that are invisible (have all zeros in the transform matrix main diagonal, meaning that the scale is 0% on all axes), thus increasing drawing performance for some voxels (by Kerbiter, ZivDero)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
26 changes: 25 additions & 1 deletion src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <AircraftTrackerClass.h>
#include <JumpjetLocomotionClass.h>
#include <TunnelLocomotionClass.h>
#include <FileFormats/HVA.h>

#include <Ext/BuildingType/Body.h>
#include <Ext/Techno/Body.h>
Expand Down Expand Up @@ -2716,7 +2717,7 @@ DEFINE_HOOK(0x5218C2, InfantryClass_UnmarkAllOccupationBits_ResetOwnerIdx, 0x6)
const auto pExt = CellExt::ExtMap.Find(pCell);
pExt->InfantryCount--;

// Vanilla check only the flag to decide if the InfantryOwnerIndex should be reset.
// Vanilla check only the flag to decide if the InfantryOwnerIndex should be reset.
// But the tree take one of the flag bit. So if a infantry walk through a cell with a tree, the InfantryOwnerIndex won't be reset.
return (newFlag & 0x1C) == 0 || pExt->InfantryCount == 0 ? Reset : NoReset;
}
Expand Down Expand Up @@ -3014,3 +3015,26 @@ DEFINE_HOOK(0x6EA870, TeamClass_LiberateMember_Start, 0x6)
pMember->RecruitableB = true;
return 0;
}

DEFINE_HOOK(0x706F64, TechnoClass_RenderVoxelObject_SkipInvisibleSections, 0x0)
{
enum { SkipLayer = 0x706FDF };

GET(MotLib* const, pMotLib, EDI);

// stolen code
if (!pMotLib)
return 0x706FBD;

GET(int const, layer, EBX);
GET_STACK(unsigned int const, frame, STACK_OFFSET(0x13C, 0x18));

auto mtx = pMotLib->GetLayerMatrix(layer, frame);

if (mtx.row[0][0] == 0.0 || mtx.row[1][1] == 0.0 || mtx.row[2][2] == 0.0)
return SkipLayer;

// stolen code
R->EAX(frame);
return 0x706F6F;
}