Skip to content

Commit

Permalink
August 6th Patch Update
Browse files Browse the repository at this point in the history
Accumulated DLL source code changes since June 22nd patch
  • Loading branch information
PG-SteveT authored and hifi committed Aug 7, 2020
1 parent 9f2cdee commit 555bafa
Show file tree
Hide file tree
Showing 67 changed files with 1,096 additions and 205 deletions.
4 changes: 2 additions & 2 deletions redalert/adata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ static AnimTypeClass const LZSmoke(ANIM_LZ_SMOKE, // Animation number.
72, // Loop start frame number.
91, // Ending frame of loop back.
-1, // Number of animation stages.
255, // Number of times the animation loops.
127, // Number of times the animation loops.
VOC_NONE, // Sound effect to play.
ANIM_NONE);

Expand Down Expand Up @@ -1048,7 +1048,7 @@ static AnimTypeClass const OilFieldBurn(ANIM_OILFIELD_BURN, // Animation number.
33, // Loop start frame number.
99, // Ending frame of loop back.
66, // Number of animation stages.
65535, // Number of times the animation loops.
127, // Number of times the animation loops.
VOC_NONE, // Sound effect to play.
ANIM_NONE);

Expand Down
19 changes: 14 additions & 5 deletions redalert/aircraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2021,9 +2021,17 @@ void AircraftClass::Enter_Idle_Mode(bool)
/*
** Normal aircraft try to find a good landing spot to rest.
*/
BuildingClass* building = Find_Docking_Bay(Class->Building, false);
BuildingClass* building = NULL;
if (In_Radio_Contact() && Contact_With_Whom()->What_Am_I() == RTTI_BUILDING) {
building = (BuildingClass*)Contact_With_Whom();
} else {
building = Find_Docking_Bay(Class->Building, false);
if (Transmit_Message(RADIO_HELLO, building) != RADIO_ROGER) {
building = NULL;
}
}
Assign_Destination(TARGET_NONE);
if (building != NULL && Transmit_Message(RADIO_HELLO, building) == RADIO_ROGER) {
if (building != NULL) {
if (Class->IsFixedWing) {
Status =
0; // BG - reset the mission status to avoid landing on the ground next to the airstrip
Expand Down Expand Up @@ -2448,7 +2456,7 @@ ActionType AircraftClass::What_Action(CELL cell) const
ActionType action = FootClass::What_Action(cell);

// using function for IsVisible so we have different results for different players - JAS 2019/09/30
if (action == ACTION_MOVE && !Map[cell].Is_Visible(PlayerPtr)) {
if ((action == ACTION_MOVE || action == ACTION_ATTACK) && !Map[cell].Is_Visible(PlayerPtr)) {
action = ACTION_NOMOVE;
}

Expand Down Expand Up @@ -3148,7 +3156,7 @@ MoveType AircraftClass::Can_Enter_Cell(CELL cell, FacingType) const
ObjectClass const* occupier = cellptr->Cell_Occupier();

if (occupier == NULL || !occupier->Is_Techno() || ((TechnoClass*)occupier)->House->Is_Ally(House)
|| (((TechnoClass*)occupier)->Cloak != CLOAKED
|| (!((TechnoClass*)occupier)->Is_Cloaked(this)
&& (ScenarioInit == 0
&& (occupier->What_Am_I() != RTTI_BUILDING || !((BuildingClass*)occupier)->Class->IsInvisible)))) {

Expand Down Expand Up @@ -3208,9 +3216,10 @@ TARGET AircraftClass::Good_Fire_Location(TARGET target) const
for (int face = 0; face < 255; face += 16) {
COORDINATE newcoord = Coord_Move(tcoord, (DirType)face, r);
CELL newcell = Coord_Cell(newcoord);
CELL actualcell = Coord_Cell(Coord_Sub(newcoord, XY_Coord(0, FLIGHT_LEVEL)));

// using function for IsVisible so we have different results for different players - JAS 2019/09/30
if (Map.In_Radar(newcell) && (Session.Type != GAME_NORMAL || Map[newcell].Is_Visible(PlayerPtr))
if (Map.In_Radar(actualcell) && (Session.Type != GAME_NORMAL || Map[newcell].Is_Visible(PlayerPtr))
&& Cell_Seems_Ok(newcell, true)) {
int dist;
if (altcoord != 0) {
Expand Down
10 changes: 7 additions & 3 deletions redalert/anim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ AnimClass::AnimClass(AnimType animnum, COORDINATE coord, unsigned char timedelay

AnimClass::Unlimbo(coord);

VisibleFlags = 0xffff;
VisibleFlags = static_cast<unsigned int>(-1);

/*
** Drop zone smoke always reveals the map around itself.
Expand Down Expand Up @@ -820,10 +820,10 @@ void AnimClass::AI(void)
int damage = Accum;
Accum -= damage;
if (As_Object(xObject)->Take_Damage(damage, 0, WARHEAD_FIRE) == RESULT_DESTROYED) {
delete this;
if (Target_Legal(VirtualAnimTarget)) {
delete As_Animation(VirtualAnimTarget);
}
delete this;
return;
}
}
Expand Down Expand Up @@ -1181,8 +1181,12 @@ void AnimClass::Detach(TARGET target, bool all)
assert(IsActive);

if (all) {
if (VirtualAnimTarget && VirtualAnimTarget == target) {
if (Target_Legal(VirtualAnimTarget) && VirtualAnimTarget == target) {
VirtualAnimTarget = TARGET_NONE;
if (IsInvisible) {
IsToDelete = true;
Mark(MARK_UP);
}
}
if (xObject == target) {
Map.Remove(this, In_Which_Layer());
Expand Down
30 changes: 23 additions & 7 deletions redalert/building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ RadioMessageType BuildingClass::Receive_Message(RadioClass* from, RadioMessageTy
if (!House->Is_Ally(from))
return (RADIO_STATIC);
if (Mission == MISSION_CONSTRUCTION || Mission == MISSION_DECONSTRUCTION || BState == BSTATE_CONSTRUCTION
|| (!ScenarioInit && In_Radio_Contact() && Contact_With_Whom() != from))
|| (!ScenarioInit && Class->Type != STRUCT_REFINERY && In_Radio_Contact()))
return (RADIO_NEGATIVE);
switch (Class->Type) {
case STRUCT_AIRSTRIP:
Expand All @@ -201,7 +201,7 @@ RadioMessageType BuildingClass::Receive_Message(RadioClass* from, RadioMessageTy
if (from->What_Am_I() == RTTI_UNIT && *((UnitClass*)from) == UNIT_HARVESTER
&& (ScenarioInit || !Is_Something_Attached())) {

return (RADIO_ROGER);
return ((Contact_With_Whom() != from) ? RADIO_ROGER : RADIO_NEGATIVE);
}
break;

Expand Down Expand Up @@ -2623,13 +2623,21 @@ void BuildingClass::Grand_Opening(bool captured)
** to place it in a nearby location.
*/
if (!unit->Unlimbo(Cell_Coord(cell), DIR_W)) {
cell = unit->Nearby_Location(this);
/*
** Check multiple times for clear locations.
*/
for (int i = 0; i < 10; i++) {
cell = unit->Nearby_Location(this, i);
if (unit->Unlimbo(Cell_Coord(cell), DIR_SW)) {
break;
}
}

/*
** If the harvester could still not be placed, then refund the money
** to the owner and then bail.
*/
if (!unit->Unlimbo(Cell_Coord(cell), DIR_SW)) {
if (unit->IsInLimbo) {
House->Refund_Money(unit->Class->Cost_Of());
delete unit;
}
Expand Down Expand Up @@ -3780,9 +3788,17 @@ int BuildingClass::Mission_Deconstruction(void)
}
}

if (House->IsPlayerControl) {
Sound_Effect(VOC_CASHTURN, Coord);
}
// MBL 07.10.2020 - In 1v1, sometimes both players will hear this SFX, or neither player will hear it
// Making it so all players hear it positionally in the map; Per thread discussion in
// https://jaas.ea.com/browse/TDRA-7245
//
#if 0
if (House->IsPlayerControl) {
Sound_Effect(VOC_CASHTURN, Coord);
}
#else
Sound_Effect(VOC_CASHTURN, Coord);
#endif

/*
** Destroy all attached objects. ST - 4/24/2020 9:38PM
Expand Down
13 changes: 11 additions & 2 deletions redalert/cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2859,9 +2859,18 @@ void CellClass::Flag_Create(void)
{
if (!CTFFlag) {
CTFFlag = new AnimClass(ANIM_FLAG, Cell_Coord());
if (CTFFlag) {
CTFFlag->OwnerHouse = Owner;
if (CTFFlag == NULL) {
for (int i = 0; i < Anims.Count(); ++i) {
AnimClass* anim = Anims.Ptr(i);
if (*anim != ANIM_FLAG) {
delete anim;
break;
}
}
CTFFlag = new AnimClass(ANIM_FLAG, Cell_Coord());
}
assert(CTFFlag != NULL);
CTFFlag->OwnerHouse = Owner;
}
}

Expand Down
9 changes: 9 additions & 0 deletions redalert/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3636,6 +3636,15 @@ typedef enum OptionControlType : char
OPTION_COUNT
} OptionControlType;

/****************************************************************************
** Used to store firing data for a unit.
*/
typedef struct
{
COORDINATE Center;
int Distance;
} FireDataType;

#define size_of(typ, id) sizeof(((typ*)0)->id)

#define MAX_LOG_LEVEL 10
Expand Down
6 changes: 2 additions & 4 deletions redalert/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3189,11 +3189,9 @@ int DisplayClass::TacticalClass::Action(unsigned flags, KeyNumType& key)
object = Map.Close_Object(coord);

/*
** Special case check to ignore cloaked object if not owned by the player.
** Special case check to ignore cloaked object if not allied with the player.
*/
if (object != NULL && object->Is_Techno() && !((TechnoClass*)object)->IsOwnedByPlayer
&& (((TechnoClass*)object)->Cloak == CLOAKED
|| ((TechnoClass*)object)->Techno_Type_Class()->IsInvisible)) {
if (object != NULL && object->Is_Techno() && ((TechnoClass*)object)->Is_Cloaked(PlayerPtr, true)) {
object = NULL;
}
}
Expand Down
Loading

0 comments on commit 555bafa

Please sign in to comment.