Skip to content

Commit

Permalink
compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhumbert committed May 18, 2023
1 parent cc5ef9f commit 6b6afdf
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 81 deletions.
43 changes: 22 additions & 21 deletions src/red4ext/Extensions/VehicleChassisComponent.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#include "Red/TypeInfo/Macros/Definition.hpp"
#include <RED4ext/Common.hpp>
#include <RED4ext/RTTISystem.hpp>
#include <RED4ext/Scripting/Natives/Generated/ent/IPlacedComponent.hpp>
#include <RED4ext/Scripting/Natives/Generated/vehicle/ChassisComponent.hpp>
#include <RED4ext/Scripting/Natives/Generated/physics/SystemBody.hpp>
#include <RED4ext/Scripting/Natives/Generated/physics/SystemBodyParams.hpp>
#include <RedLib.hpp>
// #include "Red/TypeInfo/Macros/Definition.hpp"
// #include <RED4ext/Common.hpp>
// #include <RED4ext/RTTISystem.hpp>
// #include <RED4ext/Scripting/Natives/Generated/ent/IPlacedComponent.hpp>
// #include <RED4ext/Scripting/Natives/Generated/vehicle/ChassisComponent.hpp>
// #include <RED4ext/Scripting/Natives/Generated/physics/SystemBody.hpp>
// #include <RED4ext/Scripting/Natives/Generated/physics/SystemBodyParams.hpp>
// #include <RedLib.hpp>

struct VehicleChassisComponent : RED4ext::vehicle::ChassisComponent {
RED4ext::Transform GetComOffset() {
auto hpsb = this->collisionResource.Fetch().GetPtr()->bodies[0];
return hpsb->params.comOffset;
}
RTTI_IMPL_TYPEINFO(VehicleChassisComponent);
RTTI_IMPL_ALLOCATOR();
};
// struct VehicleChassisComponent : RED4ext::vehicle::ChassisComponent {
// RED4ext::Transform GetComOffset() {
// auto hpsb = this->collisionResource.Fetch().GetPtr()->bodies[0];
// return hpsb->params.comOffset;
// }
// RTTI_IMPL_TYPEINFO(VehicleChassisComponent);
// RTTI_FWD_CONSTRUCTOR();
// // RTTI_IMPL_ALLOCATOR();
// };

RTTI_DEFINE_CLASS(VehicleChassisComponent, "vehicleChassisComponent", {
// RTTI_ABSTRACT();
RTTI_PARENT(RED4ext::ent::IPlacedComponent);
RTTI_METHOD(VehicleChassisComponent::GetComOffset);
});
// RTTI_DEFINE_CLASS(VehicleChassisComponent, "vehicleChassisComponent", {
// // RTTI_ABSTRACT();
// RTTI_PARENT(RED4ext::ent::IPlacedComponent);
// RTTI_METHOD(GetComOffset);
// });
26 changes: 13 additions & 13 deletions src/red4ext/Extensions/VehicleDriveToPointEvent.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include "Red/TypeInfo/Macros/Definition.hpp"
#include <RED4ext/Common.hpp>
#include <RED4ext/RTTISystem.hpp>
#include <RED4ext/Scripting/Natives/Generated/vehicle/DriveToPointEvent.hpp>
#include <RedLib.hpp>
// #include "Red/TypeInfo/Macros/Definition.hpp"
// #include <RED4ext/Common.hpp>
// #include <RED4ext/RTTISystem.hpp>
// #include <RED4ext/Scripting/Natives/Generated/vehicle/DriveToPointEvent.hpp>
// #include <RedLib.hpp>

struct VehicleDriveToPointEvent : RED4ext::vehicle::DriveToPointEvent {
};
// struct VehicleDriveToPointEvent : RED4ext::vehicle::DriveToPointEvent {
// };

RTTI_DEFINE_CLASS(VehicleDriveToPointEvent, "vehicleDriveToPointEvent", {
RTTI_PARENT(RED4ext::red::Event);
RTTI_PROPERTY(VehicleDriveToPointEvent::targetPos);
RTTI_PROPERTY(VehicleDriveToPointEvent::useTraffic);
RTTI_PROPERTY(VehicleDriveToPointEvent::speedInTraffic);
});
// RTTI_DEFINE_CLASS(VehicleDriveToPointEvent, "vehicleDriveToPointEvent", {
// RTTI_PARENT(RED4ext::red::Event);
// RTTI_PROPERTY(VehicleDriveToPointEvent::targetPos);
// RTTI_PROPERTY(VehicleDriveToPointEvent::useTraffic);
// RTTI_PROPERTY(VehicleDriveToPointEvent::speedInTraffic);
// });
41 changes: 21 additions & 20 deletions src/red4ext/Extensions/VehicleTPPCameraComponent.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#include "Red/TypeInfo/Macros/Definition.hpp"
#include <RED4ext/Common.hpp>
#include <RED4ext/RTTISystem.hpp>
#include <RED4ext/Scripting/Natives/Generated/vehicle/TPPCameraComponent.hpp>
#include <RedLib.hpp>
// #include "Red/TypeInfo/Macros/Definition.hpp"
// #include <RED4ext/Common.hpp>
// #include <RED4ext/RTTISystem.hpp>
// #include <RED4ext/Scripting/Natives/Generated/vehicle/TPPCameraComponent.hpp>
// #include <RedLib.hpp>

struct VehicleTPPCameraComponent : RED4ext::vehicle::TPPCameraComponent {
RTTI_IMPL_TYPEINFO(VehicleTPPCameraComponent);
RTTI_IMPL_ALLOCATOR();
};
// struct VehicleTPPCameraComponent : RED4ext::vehicle::TPPCameraComponent {
// RTTI_IMPL_TYPEINFO(VehicleTPPCameraComponent);
// RTTI_FWD_CONSTRUCTOR();
// // RTTI_IMPL_ALLOCATOR();
// };

RTTI_DEFINE_CLASS(VehicleTPPCameraComponent, "vehicleTPPCameraComponent", {
// RTTI_ABSTRACT();
RTTI_PARENT(RED4ext::game::CameraComponent);
RTTI_PROPERTY(VehicleTPPCameraComponent::drivingDirectionCompensationSpeedCoef);
RTTI_PROPERTY(VehicleTPPCameraComponent::drivingDirectionCompensationAngleSmooth);
RTTI_PROPERTY(VehicleTPPCameraComponent::lockedCamera);
RTTI_PROPERTY(VehicleTPPCameraComponent::initialTransform);
RTTI_PROPERTY(VehicleTPPCameraComponent::pitch);
RTTI_PROPERTY(VehicleTPPCameraComponent::yaw);
RTTI_PROPERTY(VehicleTPPCameraComponent::data);
});
// RTTI_DEFINE_CLASS(RED4ext::vehicle::TPPCameraComponent, "vehicleTPPCameraComponent", {
// // RTTI_ABSTRACT();
// RTTI_PARENT(RED4ext::game::CameraComponent);
// RTTI_PROPERTY(drivingDirectionCompensationSpeedCoef);
// RTTI_PROPERTY(drivingDirectionCompensationAngleSmooth);
// RTTI_PROPERTY(lockedCamera);
// RTTI_PROPERTY(initialTransform);
// RTTI_PROPERTY(pitch);
// RTTI_PROPERTY(yaw);
// RTTI_PROPERTY(data);
// });
4 changes: 2 additions & 2 deletions src/redscript/Extensions/VehicleObject.reds
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public func GetLocalToWorld() -> Matrix {
return WorldTransform.ToMatrix(this.GetWorldTransform());
}

@addField(VehicleObject)
public let chassis: ref<vehicleChassisComponent>;
// @addField(VehicleObject)
// public let chassis: ref<vehicleChassisComponent>;

@addField(VehicleObject)
@runtimeProperty("offset", "0x24C")
Expand Down
42 changes: 21 additions & 21 deletions src/redscript/Extensions/vehicleTPPCameraComponent.reds
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
public native class vehicleChassisComponent extends IPlacedComponent {
public native func GetComOffset() -> Transform;
}

native class vehicleTPPCameraComponent extends CameraComponent {
// public native let isInAir: Bool;
public native let drivingDirectionCompensationAngleSmooth: Float;
public native let drivingDirectionCompensationSpeedCoef: Float;
public native let lockedCamera: Bool;
public native let initialTransform: WorldTransform;
public native let pitch: Float;
public native let yaw: Float;
// public native let pitchDelta: Float; // positive moves camera down
// public native let yawDelta: Float; // positive moves camera right
// public native let chassis: ref<vehicleChassisComponent>;
}
// public native class vehicleChassisComponent extends IPlacedComponent {
// public native func GetComOffset() -> Transform;
// }

// native class vehicleTPPCameraComponent extends CameraComponent {
// // public native let isInAir: Bool;
// public native let drivingDirectionCompensationAngleSmooth: Float;
// public native let drivingDirectionCompensationSpeedCoef: Float;
// public native let lockedCamera: Bool;
// public native let initialTransform: WorldTransform;
// public native let pitch: Float;
// public native let yaw: Float;
// // public native let pitchDelta: Float; // positive moves camera down
// // public native let yawDelta: Float; // positive moves camera right
// // public native let chassis: ref<vehicleChassisComponent>;
// }

// @addMethod(vehicleChassisComponent)
// protected cb func OnRequestComponents(ri: EntityRequestComponentsInterface) -> Bool {
Expand All @@ -22,11 +22,11 @@ native class vehicleTPPCameraComponent extends CameraComponent {
// }


public native class vehicleDriveToPointEvent extends Event {
public native let targetPos: Vector3;
public native let useTraffic: Bool;
public native let speedInTraffic: Float;
}
// public native class vehicleDriveToPointEvent extends Event {
// public native let targetPos: Vector3;
// public native let useTraffic: Bool;
// public native let speedInTraffic: Float;
// }

// public importonly class EffectSpawnerComponent extends IVisualComponent {
// public native func AddEffect() -> Void;
Expand Down
2 changes: 1 addition & 1 deletion src/redscript/Flight/FlightStats.reds
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class FlightStats {
public static func Create(vehicle: wref<VehicleObject>) -> ref<FlightStats> {
let self: ref<FlightStats> = new FlightStats();
self.vehicle = vehicle;
self.vehicle.chassis = self.vehicle.FindComponentByName(n"Chassis") as vehicleChassisComponent;
// self.vehicle.chassis = self.vehicle.FindComponentByName(n"Chassis") as vehicleChassisComponent;
self.reset = false;
self.UpdateStatic();
// self.d_position = self.vehicle.GetWorldPosition() + self.s_centerOfMass;
Expand Down
4 changes: 2 additions & 2 deletions src/redscript/Flight/FlightSystem.reds
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public native class FlightSystem extends IGameSystem {
public let ctlr: ref<FlightController>;
public let stats: ref<FlightStats>;
// public let fx: ref<FlightFx>;
public let tppCamera: wref<vehicleTPPCameraComponent>;
// public let tppCamera: wref<vehicleTPPCameraComponent>;
public let playerComponent: wref<FlightComponent>;

public func Setup(player: ref<PlayerPuppet>) -> Void {
Expand All @@ -36,7 +36,7 @@ public native class FlightSystem extends IGameSystem {
// FlightLog.Info("[FlightSystem] FlightAudio Created");
// }
this.ctlr = FlightController.GetInstance();
this.tppCamera = player.FindComponentByName(n"vehicleTPPCamera") as vehicleTPPCameraComponent;
// this.tppCamera = player.FindComponentByName(n"vehicleTPPCamera") as vehicleTPPCameraComponent;
// this.soundListener = this.tppCamera;
}

Expand Down
4 changes: 3 additions & 1 deletion src/redscript/Flight/FlightThrusterFX.reds
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public abstract class IFlightThrusterFX extends IScriptable {
public class RegularFlightThrusterFX extends IFlightThrusterFX {
public func Create(thruster: ref<IFlightThruster>) -> ref<IFlightThrusterFX> {
super.Create(thruster);
this.SetResource(r"user\\jackhumbert\\effects\\flame.effect");
// needs work still
// this.SetResource(r"user\\jackhumbert\\effects\\flame.effect");
this.SetResource(r"user\\jackhumbert\\effects\\ion_thruster.effect");
return this;
}

Expand Down

0 comments on commit 6b6afdf

Please sign in to comment.