forked from Phobos-developers/Phobos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59b383b
commit fe3afaa
Showing
6 changed files
with
654 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "AStar.hpp" | ||
#include <MapClass.h> | ||
#include <FootClass.h> | ||
#include <InfantryClass.h> | ||
#include <LocomotionClass.h> | ||
|
||
PathType* AStar::FindPath( | ||
CellStruct* from, CellStruct* to | ||
, FootClass* object | ||
, FacingType* way, int maxLoop, MovementZone movementZoneOverride | ||
, HierarchicalStage stage) | ||
{ | ||
auto* map = MapClass::Instance.get(); | ||
auto* technoType = object->GetTechnoType(); | ||
|
||
boolpathfind_38 = true; | ||
Cleanup(); | ||
for (auto& v : CellIndexesVector) | ||
v.Clear(); | ||
|
||
__Blockage = stage; | ||
CellClass* fromCell = map->GetCellAt(*from); | ||
CellClass* toCell = map->GetCellAt(*to); | ||
|
||
auto movementZoneOfObject = movementZoneOverride == MovementZone::None ? technoType->MovementZone : movementZoneOverride; | ||
|
||
auto fromZoneType = map->GetMovementZoneType(*from, movementZoneOfObject, object->OnBridge); | ||
auto toZoneType = map->GetMovementZoneType(*to, movementZoneOfObject, toCell->ContainsBridge()); | ||
|
||
auto src = map->SubzoneBridgeCheck_583180(fromCell, object->OnBridge); | ||
auto dst = map->SubzoneBridgeCheck_583180(toCell, toCell->ContainsBridge()); | ||
|
||
if (object->AbsID == AbstractType::Infantry && technoType->JumpJet) | ||
{ | ||
auto* inf = (InfantryClass*) object; | ||
movementZoneOfObject = MovementZone::Infantry; | ||
|
||
void* ppvObject; | ||
ILocomotion* locomotor = object->Locomotor; | ||
auto status = locomotor ? locomotor->QueryInterface(__uuidof(IPersist), &ppvObject) : E_POINTER; | ||
if (status < 0) | ||
_com_issue_error(status); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#pragma once | ||
#include <AStarClass.h> | ||
|
||
class NOVTABLE __declspec(align(4)) AStar | ||
{ | ||
public: | ||
static constexpr reference<AStar, 0x87E8B8> const Instance {}; | ||
|
||
char bool_0; | ||
bool ScaleMovementCost; | ||
char bool_2; | ||
char __DoPostProcess; | ||
float MovementCostScaler; | ||
char CheckLocomotor; | ||
AStarWorkPathStructDataHeap* WorkingNodesBuffer; | ||
AStarWorkPathStructHeap* WorkingNodes; | ||
PriorityQueueClass<AStarWorkPathStruct>* OpenNodes; | ||
int* celllevel_costarray2_alt; | ||
int* celllevel_costarray1; | ||
float* MovementCosts; | ||
float* MovementCostsAlt; | ||
DWORD initedcount; | ||
DWORD ObjectSpeed; | ||
int CurrentCellLevel; | ||
int DestCellLevel; | ||
bool boolpathfind_38; | ||
HierarchicalStage __Blockage; | ||
int* ints_40_costs[3]; | ||
int* ints_4C_costs[3]; | ||
float* HierarchicalCosts[3]; | ||
AStarQueueNodeHierarchical* HierarchicalOpenNodesBuffer; | ||
PriorityQueueClass<AStarQueueNodeHierarchical>* HierarchicalOpenNodes; | ||
int CellsProcessed; | ||
CellStruct CurrentCell; | ||
DynamicVectorClass<DWORD> CellIndexesVector[3]; | ||
unsigned __int16 somearray_BC[1500]; | ||
int counts_for_subzones_field_C74[3]; | ||
|
||
double GetMovementCost( | ||
CellClass** from, CellClass** to | ||
, bool useAlt, MoveType move | ||
, FootClass* object | ||
) | ||
{ | ||
JMP_THIS(0x429830); | ||
} | ||
PathType* FindPathRegular( | ||
CellStruct* from, CellStruct* to | ||
, FootClass* object, FacingType* moves | ||
, signed int maxLoops, HierarchicalStage postProcess | ||
) | ||
{ | ||
JMP_THIS(0x429A90); | ||
} | ||
AStarWorkPathStruct* CreateNode( | ||
AStarWorkPathStructNode** pathNodes | ||
, CellClass** a3, CellStruct* a4 | ||
, float movementCost | ||
) | ||
{ | ||
JMP_THIS(0x42A460); | ||
} | ||
void Cleanup() { JMP_THIS(0x42A5B0); } | ||
bool IsSameCostCommon(int a2, char a3, int a4) { JMP_THIS(0x42A690); } | ||
AStar() { JMP_THIS(0x42A6D0); } | ||
~AStar() { JMP_THIS(0x42A900); } | ||
PathType* BuildFinalPathRegular(AStarWorkPathStruct* workPath, FacingType* moves) | ||
{ JMP_THIS(0x42AA90); } | ||
void ReinitCostArrays(RectangleStruct* where) { JMP_THIS(0x42AC00); } | ||
char PostProcessCells(FootClass* object) { JMP_THIS(0x42ACF0); } | ||
FootClass* GetOccupierRegular(CellStruct* pos, int level) { JMP_THIS(0x42B080); }; | ||
void ProcessFinalPathRegular(PathType* path, FootClass* object) { JMP_THIS(0x42B210); } | ||
int FixupFinalPathRegular(int a2, CellStruct a3, int a4, int a5, int a6, int a7) | ||
{ JMP_THIS(0x42B420); } | ||
void OptimizeFinalPath(PathType* path, FootClass* object) { JMP_THIS(0x42B7F0); } | ||
void AdjacentCellRegular(FacingType* moves, int a3, int a4, int a5, CellStruct* cellOut) | ||
{ JMP_THIS(0x42BCA0); } | ||
bool PlotStraightLineRegular( | ||
FacingType* moves, int arg4 | ||
, CellStruct* a4, CellStruct* a5 | ||
, FootClass* object, int* overlap, int a8) | ||
{ | ||
JMP_THIS(0x42BE20); | ||
}; | ||
DWORD* ClearPointers() { JMP_THIS(0x42C1C0); } | ||
bool FindPathHierarchical( | ||
CellStruct* from, CellStruct* to | ||
, MovementZone movementZone, FootClass* object) | ||
{ | ||
JMP_THIS(0x42C290); | ||
} | ||
PathType* FindPath( | ||
CellStruct* from, CellStruct* to | ||
, FootClass* object | ||
, FacingType* way, int maxLoop, MovementZone movementZoneOverride | ||
, HierarchicalStage stage); | ||
|
||
void InitCellIndexSets(int a2) { JMP_THIS(0x42CCD0); } | ||
bool IsCellIndexSetRegistered(int xPos, int yPos, int vectorNum) { JMP_THIS(0x42CEB0); } | ||
void RegisterCellIndexSet(unsigned int xPos, unsigned int yPos, int vectorNum) | ||
{ JMP_THIS(0x42CF10); } | ||
void RegisterCellIndexSets(SubzoneTrackingStruct* tracking, HierarchicalStage postProcess) | ||
{ JMP_THIS(0x42CF80); } | ||
unsigned int TestCellWalk(CellStruct* a2, CellStruct* a3, FootClass* object, bool bridge1, int bridge2, MovementZone zoneType) | ||
{ JMP_THIS(0x42D170); } | ||
}; | ||
|
||
constexpr size_t AStarSize = sizeof(AStar); | ||
static_assert(AStarSize == 0xC80, "AStar size must be C80h (3200d)!"); |
Oops, something went wrong.