Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
Changes required in preparation for Event code merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsons26 committed Mar 28, 2020
1 parent 713c536 commit 07c9d5b
Show file tree
Hide file tree
Showing 26 changed files with 560 additions and 325 deletions.
2 changes: 1 addition & 1 deletion src/game/engine/cargo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ FootClass *CargoClass::Detach_Object()
void CargoClass::Code_Pointers()
{
if (m_Object != nullptr) {
m_Object = reinterpret_cast<FootClass *>(As_Target(m_Object));
m_Object = reinterpret_cast<FootClass *>(m_Object->As_Target());
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/game/engine/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,39 +1044,39 @@ void CellClass::Wall_Update()
adjcell.m_OverlayFrame = 0;
adjcell.m_Overlay = OVERLAY_NONE;
adjcell.m_OwnerHouse = HOUSES_NONE; // C&C DOS sets this, bug fix perhaps?
Detach_This_From_All(As_Target(adjcell.m_CellNumber));
Detach_This_From_All(As_Target());
}

// Frame 16 for SBAG is after the nondamaged set
if (adjcell.m_Overlay == OVERLAY_SANDBAG && adjcell.m_OverlayFrame == 16) {
adjcell.m_OverlayFrame = 0;
adjcell.m_Overlay = OVERLAY_NONE;
adjcell.m_OwnerHouse = HOUSES_NONE;
Detach_This_From_All(As_Target(adjcell.m_CellNumber));
Detach_This_From_All(As_Target());
}

// Frame 32 for CYCL is after the first damage state set
if (adjcell.m_Overlay == OVERLAY_CYCLONE_FENCE && adjcell.m_OverlayFrame == 32) {
adjcell.m_OverlayFrame = 0;
adjcell.m_Overlay = OVERLAY_NONE;
adjcell.m_OwnerHouse = HOUSES_NONE;
Detach_This_From_All(As_Target(adjcell.m_CellNumber));
Detach_This_From_All(As_Target());
}

// Frame 16 for FENC is after the nondamaged set, on a 0 basis frame 32 doesn't exist, some hack for older art?
if (adjcell.m_Overlay == OVERLAY_FENCE && (adjcell.m_OverlayFrame == 16 || adjcell.m_OverlayFrame == 32)) {
adjcell.m_OverlayFrame = 0;
adjcell.m_Overlay = OVERLAY_NONE;
adjcell.m_OwnerHouse = HOUSES_NONE;
Detach_This_From_All(As_Target(adjcell.m_CellNumber));
Detach_This_From_All(As_Target());
}

// Frame 16 for SBAG is after the nondamaged set
if (adjcell.m_Overlay == OVERLAY_BARB_WIRE && adjcell.m_OverlayFrame == 16) {
adjcell.m_OverlayFrame = 0;
adjcell.m_Overlay = OVERLAY_NONE;
adjcell.m_OwnerHouse = HOUSES_NONE;
Detach_This_From_All(As_Target(adjcell.m_CellNumber));
Detach_This_From_All(As_Target());
}

adjcell.Recalc_Attributes();
Expand Down Expand Up @@ -1163,7 +1163,7 @@ BOOL CellClass::Reduce_Wall(int damage)
Adjacent_Cell(FACING_WEST).Wall_Update();
Adjacent_Cell(FACING_SOUTH).Wall_Update();
Adjacent_Cell(FACING_EAST).Wall_Update();
Detach_This_From_All(As_Target(Cell_Number()));
Detach_This_From_All(As_Target());

if (overlay.Is_Crushable()) {
g_Map.Zone_Reset(1 << MZONE_NORMAL);
Expand Down
1 change: 1 addition & 0 deletions src/game/engine/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class CellClass
BOOL Is_Occuppied() const { return m_OccupantBit != OCCUPANT_NONE; }

cell_t Cell_Number() const { return m_CellNumber; }
target_t As_Target() const { return ::As_Target(m_CellNumber); }
int8_t Get_Zone(MZoneType mzone) const { return m_Zones[mzone]; }
void Set_Zone(MZoneType mzone, int8_t zone) { m_Zones[mzone] = zone; }
BOOL Get_Placement_Check() const { return m_PlacementCheck; }
Expand Down
2 changes: 1 addition & 1 deletion src/game/engine/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ void DisplayClass::Mouse_Left_Up(
m_DisplayBit16 = false;

if (object != nullptr) {
target = As_Target(object);
target = object->As_Target();
} else if (cellnum != -1) {
target = As_Target(cellnum);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/engine/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ BOOL FactoryClass::Completed()
void FactoryClass::Code_Pointers()
{
if (m_Object != nullptr) {
m_Object = reinterpret_cast<TechnoClass *>(As_Target(m_Object));
m_Object = reinterpret_cast<TechnoClass *>(m_Object->As_Target());
}
if (m_Owner != nullptr) {
m_Owner = (HouseClass *)m_Owner->What_Type();
Expand Down
40 changes: 40 additions & 0 deletions src/game/engine/foot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1569,3 +1569,43 @@ BOOL FootClass::Is_On_Priority_Mission()
{
return m_Mission == MISSION_ENTER;
}

/**
*
*
* 0x004C35D0
*/
void FootClass::Queue_Navigation_List(target_t target)
{
if (Target_Legal(target)) {
int i;
for (i = 0; i < NAV_LENGTH && Target_Legal(m_NavList[i]); ++i);

if (target == As_Target() && i > 0) {
m_Bit2_4 = true;
} else {
if (i == 0) {
m_Bit2_4 = false;
}
if (i < NAV_LENGTH) {
m_NavList[i] = target;
}
}

if (!Target_Legal(m_NavCom) && m_Mission == MISSION_GUARD) {
Enter_Idle_Mode();
}
}
}

/**
*
*
* 0x004C3684
*/
void FootClass::Clear_Navigation_List()
{
for (int i = 0; i < NAV_LENGTH; ++i) {
m_NavList[i] = 0;
}
}
9 changes: 9 additions & 0 deletions src/game/engine/foot.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ class FootClass : public TechnoClass
FacingType Get_Path_Facing(int index) const { return m_Paths[index]; }
target_t Nav_Com() const { return m_NavCom; }

void Set_To_Scatter(BOOL state) { m_ToScatter = state; }
void Set_In_Formation(BOOL state) { m_InFormation = state; }
void Set_Team_Speed(SpeedType speed) { m_TeamSpeed = speed; }
void Set_Team_Max_Speed(MPHType mph) { m_TeamMaxSpeed = mph; }
void Set_Suspended_NavCom(target_t target) { m_SuspendedNavCom = target; }

static int Point_Relative_To_Line(int px, int py, int sx, int sy, int ex, int ey);
PathType *Find_Path_Wrapper(cell_t dest, FacingType *buffer, int length, MoveType move);

Expand All @@ -134,6 +140,9 @@ class FootClass : public TechnoClass
const fixed_t &Get_Speed_Multiplier() const { return m_SpeedMult; }
const GamePtr<TeamClass> &Get_Team() const { return m_Team; }

void Queue_Navigation_List(target_t target);
void Clear_Navigation_List();

protected:
#ifndef CHRONOSHIFT_NO_BITFIELDS
BOOL m_Bit1_1 : 1; // 1
Expand Down
Loading

0 comments on commit 07c9d5b

Please sign in to comment.