Vanilla-Conquer
Vanilla-Conquer copied to clipboard
[TD] Fix Sabotage Response
Credit goes for this to Nyerguds
diff -urN a/tiberiandawn/infantry.cpp b/tiberiandawn/infantry.cpp
--- a/tiberiandawn/infantry.cpp 2020-10-01 20:14:21.258708912 +0200
+++ b/tiberiandawn/infantry.cpp 2020-10-01 20:32:16.015172002 +0200
@@ -2686,6 +2686,30 @@
}
}
+ /***********************************************************************************************
+ * InfantryClass::Response_Sabotage -- Plays infantry audio response to sabotage order. *
+ * *
+ * When the player gives an infantry unit the order to sabotage, this routine handles *
+ * the audio response by that unit. *
+ * *
+ * INPUT: none *
+ * *
+ * OUTPUT: none *
+ * *
+ * WARNINGS: none *
+ * *
+ * HISTORY: *
+ * 01/01/1995 JLB : Created. *
+ * 05/05/1995 JLB : Rambo response types added. *
+ *=============================================================================================*/
+void InfantryClass::Response_Sabotage(void)
+{
+ Validate();
+ if (*this == INFANTRY_RAMBO && AllowVoice) {
+ Sound_Effect(VOC_RAMBO_PRESENT, 0, Infantry.ID(this) + 1);
+ }
+}
+
/***********************************************************************************************
* InfantryClass::Fire_Coord -- Calculates the origin point for projectiles fired. *
* *
@@ -2830,7 +2854,7 @@
void InfantryClass::Assign_Mission(MissionType order)
{
Validate();
- if (order == MISSION_SABOTAGE) {
+ if (order == MISSION_SABOTAGE && PlayerPtr->Class->House != Owner()) {
Sound_Effect(VOC_RAMBO_PRESENT, Coord);
}
diff -urN a/tiberiandawn/infantry.h b/tiberiandawn/infantry.h
--- a/tiberiandawn/infantry.h 2020-10-01 20:14:21.261708970 +0200
+++ b/tiberiandawn/infantry.h 2020-10-01 20:32:52.381818449 +0200
@@ -160,6 +160,7 @@
virtual void Response_Select(void);
virtual void Response_Move(void);
virtual void Response_Attack(void);
+ virtual void Response_Sabotage(void);
virtual void Active_Click_With(ActionType action, ObjectClass* object);
/*
diff -urN a/tiberiandawn/techno.cpp b/tiberiandawn/techno.cpp
--- a/tiberiandawn/techno.cpp 2020-10-01 20:14:21.266709066 +0200
+++ b/tiberiandawn/techno.cpp 2020-10-01 20:35:45.673952225 +0200
@@ -2521,7 +2521,9 @@
void TechnoClass::Player_Assign_Mission(MissionType mission, TARGET target, TARGET destination)
{
if (AllowVoice) {
- if (mission == MISSION_ATTACK) {
+ if (mission == MISSION_SABOTAGE) {
+ Response_Sabotage();
+ } else if (mission == MISSION_ATTACK) {
Response_Attack();
} else {
Response_Move();
@@ -4224,6 +4226,25 @@
{
}
+/***********************************************************************************************
+ * TechnoClass::Response_Sabotage -- Handles the voice response when given sabotage order. *
+ * *
+ * This routine is called when a voice response to a sabotage order is desired. This *
+ * routine should be overridden for any object that actually have a voice response. *
+ * *
+ * INPUT: none *
+ * *
+ * OUTPUT: none *
+ * *
+ * WARNINGS: This can generate an audio response. *
+ * *
+ * HISTORY: *
+ * 07/29/1995 JLB : Created. *
+ *=============================================================================================*/
+void TechnoClass::Response_Sabotage(void)
+{
+}
+
/***********************************************************************************************
* TechnoClass::Target_Something_Nearby -- Handles finding and assigning a nearby target. *
* *
diff -urN a/tiberiandawn/techno.h b/tiberiandawn/techno.h
--- a/tiberiandawn/techno.h 2020-10-01 20:14:21.265709047 +0200
+++ b/tiberiandawn/techno.h 2020-10-01 20:36:21.833616398 +0200
@@ -261,6 +261,7 @@
virtual void Response_Select(void);
virtual void Response_Move(void);
virtual void Response_Attack(void);
+ virtual void Response_Sabotage(void);
virtual void
Player_Assign_Mission(MissionType order, TARGET target = TARGET_NONE, TARGET destination = TARGET_NONE);
This was fixed in #682 / #683. It should be closed.