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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ This page lists all the individual contributions to the project by their author.
- Add support for health tracking for bridges, as well as allowing bridges to have an armor type.
- Allow cloaked units to trigger cell tags when using Entered By trigger events.
- Add the ability to specify sight ranges for technos when they are veteran and elite.
- Fix a vanilla bug where cloaked units sensed by nearby enemy units can cloak again immediately
- **Kerbiter (Metadorius)**:
- Initial documentation setup.
- **Noble Fish**:
Expand Down
3 changes: 2 additions & 1 deletion docs/Bugfixes.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,5 @@ This page lists all vanilla bugs fixed by Vinifera.
- Fix a bug where AI medics would fail to heal their allies.
- Fix a bug that would make healer units unselect themselves when adding other units to current selection.
- Fix a bug that would make infantry healer units flash and go into Area Guard mode when they were added to current selection.
- EVA no longer says "Harvester under attack" when harvesters receive environmental damage.
- EVA no longer says "Harvester under attack" when harvesters receive environmental damage.
- Fix a vanilla bug where cloaked units sensed by nearby enemy units can cloak again immediately.
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ New:
- Fix Win32 dialog scaling with SDL (by Rampastring)
- Reimplement the software blitters with SIMD (SSE2/AVX2) for faster rendering on modern CPUs (by ZivDero)
- Add the ability to specify sight ranges for technos when they are veteran and elite (by JoyfulShush)
- Fix a bug where cloaked units sensed by nearby enemy units can cloak again immediately (by JoyfulShush)


Vinifera fixes:
Expand Down
36 changes: 36 additions & 0 deletions src/extensions/techno/technoext_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ DECLARE_EXTENDING_CLASS_AND_PAIR(TechnoClass)
void _Flashing_AI();
int _Anti_Air() const;
void _Look(bool incremental, bool dontmap);
bool _Is_Allowed_To_Recloak();
};


Expand Down Expand Up @@ -3388,6 +3389,40 @@ int TechnoClassExt::_Anti_Air(void) const
}


/*
* Reimplements TechnoClass::Is_Allowed_To_Recloak.
* Adds a check for nearby enemy technos around it preventing it from cloaking by having sensors capabilities.
* Uses the same logic as when cloaked units move to new cells, which has the same check forcing them to uncloak.
*/
bool TechnoClassExt::_Is_Allowed_To_Recloak()
{
if (!IsCloakable) {
return false;
}

Cell cell = Center_Coord().As_Cell();

// Get all adjacent cells and check if there are units with Sensors or sensing ability.
for (FacingType dir = FACING_FIRST; dir < FACING_COUNT; dir++) {
Cell adjacent_cell = Adjacent_Cell(cell, dir);
CellClass* adjacent_cellptr = &Map[adjacent_cell];

if (!Map.In_Local_Radar(adjacent_cell)) {
continue;
}

TechnoClass* cell_techno = adjacent_cellptr->Cell_Techno();
if (cell_techno != nullptr) {
if (!cell_techno->House->Is_Ally(this) && (cell_techno->TClass->IsScanner || cell_techno->Has_Ability(ABILITY_SENSORS))) {
return false;
}
}
}

return true;
}


/*
* Reimplements TechnoClass::Look based on the RE project code
* Additionally, adds the Veteran and Elite Sight ranges that are used when the techno is either Veteran or Elite, respectively.
Expand Down Expand Up @@ -3492,4 +3527,5 @@ void TechnoClassExtension_Hooks()
Patch_Jump(0x00639C70, &TechnoClassExt::_Apparent_Brightness);
Patch_Jump(0x006380F0, &TechnoClassExt::_Anti_Air);
Patch_Jump(0x00638310, &TechnoClassExt::_Look);
Patch_Jump(0x00639120, &TechnoClassExt::_Is_Allowed_To_Recloak);
}
Loading