TheAssemblyArmada / Vanilla-Conquer

Vanilla Conquer provides clean, cross-platform builds of the C&C Remastered Collection and the standalone legacy games.
Other
332 stars 51 forks source link

Make oil pump capturable #287

Open TobiasKarnat opened 3 years ago

TobiasKarnat commented 3 years ago

Make oil pump capturable by jonwil (ported to RA aswell)

diff -urN a/redalert/building.cpp b/redalert/building.cpp
--- a/redalert/building.cpp 2020-09-24 17:51:41.818408083 +0200
+++ b/redalert/building.cpp 2020-09-24 17:51:50.281550324 +0200
@@ -1064,6 +1064,13 @@
     if (*this == STRUCT_CHRONOSPHERE && BState == BSTATE_ACTIVE && QueueBState == BSTATE_NONE && Scen.FadeTimer == 0) {
         Begin_Mode(BSTATE_IDLE);
     }
+
+    if (*this == STRUCT_PUMP && PumpTime == 0)
+
+    {
+        PumpTime = TICKS_PER_SECOND * 10;
+        HouseClass::As_Pointer(this->Owner())->Refund_Money(20);
+    }
 }

 /***********************************************************************************************
@@ -1676,6 +1683,7 @@
     , AnimToTrack(TARGET_NONE)
     , LastStrength(0)
     , PlacementDelay(0)
+    , PumpTime(0)
 {
     House->Tracking_Add(this);
     IsSecondShot = !Class->Is_Two_Shooter();
@@ -3321,6 +3329,10 @@
         TARGET tocap = As_Target();

         IsCaptured = true;
+        if (*this == STRUCT_PUMP)
+        {
+             PumpTime = TICKS_PER_SECOND * 10;
+        }
         TechnoClass::Captured(newowner);

         oldowner->ToCapture = tocap;
diff -urN a/redalert/building.h b/redalert/building.h
--- a/redalert/building.h   2020-09-24 17:51:41.809407932 +0200
+++ b/redalert/building.h   2020-09-24 17:51:50.282550341 +0200
@@ -207,6 +207,8 @@
     */
     CDTimerClass<FrameTimerClass> PlacementDelay;

+    CDTimerClass<FrameTimerClass> PumpTime;
+
     /*---------------------------------------------------------------------
     ** Constructors, Destructors, and overloaded operators.
     */
@@ -223,13 +225,15 @@
         , Class(x)
         , Factory(x)
         , CountDown(x)
-        , PlacementDelay(x){};
+        , PlacementDelay(x)
+        , PumpTime(x){};
 #else
     BuildingClass(NoInitClass const& x)
         : TechnoClass(x)
         , Class(x)
         , CountDown(x)
-        , PlacementDelay(x){};
+        , PlacementDelay(x)
+        , PumpTime(x){};
 #endif
     virtual ~BuildingClass(void);
     operator StructType(void) const
diff -urN a/tiberiandawn/bdata.cpp b/tiberiandawn/bdata.cpp
--- a/tiberiandawn/bdata.cpp    2020-09-24 17:51:41.792407647 +0200
+++ b/tiberiandawn/bdata.cpp    2020-09-24 17:51:50.285550391 +0200
@@ -2281,7 +2281,7 @@
                                         true,            // Always use the given name for the building?
                                         false,           // Is this a wall type structure?
                                         false,           // Is it a factory type building?
-                                        false,           // Can this building be captured?
+                                        true,            // Can this building be captured?
                                         true,            // Does it catch fire?
                                         false,           // Simple (one frame) damage imagery?
                                         false,           // Is it invisible to radar?
@@ -2317,7 +2317,8 @@
                                         BSIZE_11,            // SIZE:          Building size.
                                         NULL,                // Preferred exit cell list.
                                         (short const*)List1, // OCCUPYLIST:    List of active foundation squares.
-                                        (short const*)NULL   // OVERLAPLIST:List of overlap cell offset.
+                                        (short const*)NULL,   // OVERLAPLIST:List of overlap cell offset.
+                                        true                 // Is this building un-sellable?
 );

 static BuildingTypeClass const ClassV20(STRUCT_V20,
diff -urN a/tiberiandawn/building.cpp b/tiberiandawn/building.cpp
--- a/tiberiandawn/building.cpp 2020-09-24 17:51:41.791407630 +0200
+++ b/tiberiandawn/building.cpp 2020-09-24 17:51:50.288550442 +0200
@@ -1288,6 +1288,12 @@
             }
         }
     }
+    
+    if (*this == STRUCT_PUMP && PumpTime.Expired())
+    {
+        PumpTime = TICKS_PER_SECOND * 10;
+        HouseClass::As_Pointer(this->Owner())->Refund_Money(20);
+    }
 }

 /***********************************************************************************************
@@ -1836,6 +1842,7 @@
     , TechnoClass(house)
 {
     PlacementDelay = 0;
+    PumpTime = 0;
     LastStrength = 0;
     ActLike = House->ActLike;
     BState = BSTATE_NONE;
@@ -3715,6 +3722,10 @@
         HouseClass* oldowner = House; // Added for RA AI in TD. ST - 7/26/2019 9:25AM

         IsCaptured = true;
+        if (*this == STRUCT_PUMP)
+        {
+            PumpTime = TICKS_PER_SECOND * 10;
+        }
         TechnoClass::Captured(newowner);

 #ifdef USE_RA_AI
diff -urN a/tiberiandawn/building.h b/tiberiandawn/building.h
--- a/tiberiandawn/building.h   2020-09-24 17:51:41.770407277 +0200
+++ b/tiberiandawn/building.h   2020-09-24 17:51:50.289550459 +0200
@@ -159,6 +159,8 @@
     */
     TCountDownTimerClass PlacementDelay;

+    TCountDownTimerClass PumpTime;
+
     /*---------------------------------------------------------------------
     ** Constructors, Destructors, and overloaded operators.
     */
hazelnot commented 3 years ago

I'm pretty sure gameplay changes are beyond the scope of this project

mvdhout1992 commented 3 years ago

It's a cool idea, not bad as optional rules.ini mod feature especially if it can be enabled from map files.