2025-07-17 23:35 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000402Spring engineGeneralpublic2007-01-31 23:04
Reporterredstar 
Assigned Totvo 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000402: [PATCH] AirStrafe tag
DescriptionAllows the modder to disable the circular strafing behaviour of aircraft when building attacking or repairing etc.

Tested in EE and XTA.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon AirStrafe.patch (3,719 bytes) 2007-01-27 00:27 -
    Index: Sim/MoveTypes/TAAirMoveType.cpp
    ===================================================================
    --- Sim/MoveTypes/TAAirMoveType.cpp	(revision 3269)
    +++ Sim/MoveTypes/TAAirMoveType.cpp	(working copy)
    @@ -343,43 +343,48 @@
     				//logOutput.Print("In position, landing");
     				return;
     			case FLY_CIRCLING:
    +				// break;
     				waitCounter++;
     				if (waitCounter > 100) {
     					//logOutput.Print("moving circlepos");
    +					if(owner->unitDef->AirStrafe){
    +						float3 relPos = pos - circlingPos;
    +						if(relPos.x<0.0001f && relPos.x>-0.0001f)
    +							relPos.x=0.0001f;
    +						relPos.y = 0;
    +						relPos.Normalize();
    +						CMatrix44f rot;
    +						rot.RotateY(1.0f);
    +						float3 newPos = rot.Mul(relPos);
    +
    +						//Make sure the point is on the circle
    +						newPos = newPos.Normalize() * goalDistance;
    +
    +						//Go there in a straight line
    +						goalPos = circlingPos + newPos;
    +					}
    +					waitCounter = 0;
    +				}
    +				break;
    +			case FLY_ATTACKING:{
    +				//logOutput.Print("wait is %d", waitCounter);
    +				if(owner->unitDef->AirStrafe){
     					float3 relPos = pos - circlingPos;
     					if(relPos.x<0.0001f && relPos.x>-0.0001f)
     						relPos.x=0.0001f;
     					relPos.y = 0;
     					relPos.Normalize();
     					CMatrix44f rot;
    -					rot.RotateY(1.0f);
    +					if (gs->randFloat()>0.5f)
    +						rot.RotateY(0.6f+gs->randFloat()*0.6f);
    +					else
    +						rot.RotateY(-(0.6f+gs->randFloat()*0.6f));
     					float3 newPos = rot.Mul(relPos);
    -
    -					//Make sure the point is on the circle
     					newPos = newPos.Normalize() * goalDistance;
     
     					//Go there in a straight line
     					goalPos = circlingPos + newPos;
    -					waitCounter = 0;
     				}
    -				break;
    -			case FLY_ATTACKING:{
    -				//logOutput.Print("wait is %d", waitCounter);
    -				float3 relPos = pos - circlingPos;
    -				if(relPos.x<0.0001f && relPos.x>-0.0001f)
    -					relPos.x=0.0001f;
    -				relPos.y = 0;
    -				relPos.Normalize();
    -				CMatrix44f rot;
    -				if (gs->randFloat()>0.5f)
    -					rot.RotateY(0.6f+gs->randFloat()*0.6f);
    -				else
    -					rot.RotateY(-(0.6f+gs->randFloat()*0.6f));
    -				float3 newPos = rot.Mul(relPos);
    -				newPos = newPos.Normalize() * goalDistance;
    -
    -				//Go there in a straight line
    -				goalPos = circlingPos + newPos;
     //				logOutput.Print("Changed circle pos");
     				break;}
     			case FLY_LANDING:{
    Index: Sim/Units/UnitDef.h
    ===================================================================
    --- Sim/Units/UnitDef.h	(revision 3269)
    +++ Sim/Units/UnitDef.h	(working copy)
    @@ -177,6 +177,7 @@
     	float turnRadius;
     	float wantedHeight;
     	bool hoverAttack;
    +	bool AirStrafe;
     	float dlHoverFactor; // < 0 means it can land, >= 0 indicates how much the unit will move during hovering on the spot
     	bool DontLand () { return dlHoverFactor >= 0.0f; }
     
    Index: Sim/Units/UnitDefHandler.cpp
    ===================================================================
    --- Sim/Units/UnitDefHandler.cpp	(revision 3269)
    +++ Sim/Units/UnitDefHandler.cpp	(working copy)
    @@ -352,8 +352,9 @@
     	if(ud.builder && !ud.buildSpeed)		//core anti is flagged as builder for some reason
     		ud.builder=false;
     
    -	ud.wantedHeight=atof(tdfparser.SGetValueDef("0", "UNITINFO\\cruisealt").c_str());;
    -	ud.hoverAttack = !!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\hoverattack").c_str());
    +	ud.wantedHeight=atof(tdfparser.SGetValueDef("0", "UNITINFO\\cruisealt").c_str());
    +	tdfparser.GetDef(ud.hoverAttack,"0", "UNITINFO\\hoverattack");
    +	tdfparser.GetDef(ud.AirStrafe,"1", "UNITINFO\\AirStrafe");
     	ud.dlHoverFactor = atof(tdfparser.SGetValueDef("-1", "UNITINFO\\airhoverfactor").c_str());
     
     	tdfparser.GetDef(ud.transportSize, "0", "UNITINFO\\transportsize");
    
    patch file icon AirStrafe.patch (3,719 bytes) 2007-01-27 00:27 +

-Relationships
+Relationships

-Notes

~0000681

tvo (reporter)

committed
+Notes

-Issue History
Date Modified Username Field Change
2007-01-27 00:27 redstar New Issue
2007-01-27 00:27 redstar File Added: AirStrafe.patch
2007-01-31 23:04 tvo Status new => resolved
2007-01-31 23:04 tvo Resolution open => fixed
2007-01-31 23:04 tvo Assigned To => tvo
2007-01-31 23:04 tvo Note Added: 0000681
+Issue History