Skip to content

Commit

Permalink
Merge pull request #28 from xthebat/23-add-de-mirage-teleport
Browse files Browse the repository at this point in the history
Added teleport to de_mirage from warmup
  • Loading branch information
xthebat authored Oct 29, 2023
2 parents 6bd4c30 + 5118ae6 commit 49218bd
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 9 deletions.
Binary file modified Content/Maps/de_mirage.umap
Binary file not shown.
Binary file modified Content/Maps/de_mirage/concrete_blend_blacktopsand_01.uasset
Binary file not shown.
Binary file modified Content/Maps/de_mirage/de_mirage_decals_window_b_decal.uasset
Binary file not shown.
Binary file modified Content/Maps/de_mirage/tools_toolsnodraw.uasset
Binary file not shown.
Binary file modified Content/Maps/de_train/decals_bombsite_left_arrow_spray.uasset
Binary file not shown.
Binary file modified Content/Maps/warmup.umap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 26 additions & 1 deletion Source/Cloud9/Character/Cloud9Character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ ACloud9Character::ACloud9Character(const FObjectInitializer& ObjectInitializer)
UCloud9CharacterMovement* ACloud9Character::GetCloud9CharacterMovement() const
{
if (const auto MyCharacterMovement = GetCharacterMovement())
{
return Cast<UCloud9CharacterMovement>(MyCharacterMovement);
}

return nullptr;
}

ACloud9PlayerController* ACloud9Character::GetCloud9Controller() const
{
if (const auto MyController = GetController())
{
return Cast<ACloud9PlayerController>(MyController);
}

return nullptr;
}
Expand All @@ -84,13 +88,17 @@ bool ACloud9Character::CanSneak() const { return !GetCloud9CharacterMovement()->
void ACloud9Character::Sneak() const
{
if (const auto Movement = GetCloud9CharacterMovement())
{
Movement->Sneak();
}
}

void ACloud9Character::UnSneak() const
{
if (const auto Movement = GetCloud9CharacterMovement())
{
Movement->UnSneak();
}
}

void ACloud9Character::SetViewDirection(const FHitResult& HitResult, bool bIsHitValid)
Expand Down Expand Up @@ -147,6 +155,14 @@ void ACloud9Character::SetViewDirection(const FHitResult& HitResult, bool bIsHit
}
}

void ACloud9Character::SetCameraRotationYaw(float Angle) const
{
auto Rotation = CameraBoom->GetRelativeRotation();
Rotation.Yaw = Angle;
UE_LOG(LogCloud9, Display, TEXT("SetRelativeRotation Pitch: %s"), *Rotation.ToString());
CameraBoom->SetRelativeRotation(Rotation);
}

void ACloud9Character::AddCameraRotationYaw(float Angle) const
{
const FRotator Rotation = {0.0f, Angle, 0.0f};
Expand All @@ -163,6 +179,7 @@ void ACloud9Character::SetCameraRotationRoll(float Angle) const
{
auto Rotation = CameraBoom->GetRelativeRotation();
Rotation.Pitch = -Angle;
UE_LOG(LogCloud9, Display, TEXT("SetRelativeRotation Yaw: %s"), *Rotation.ToString());
CameraBoom->SetRelativeRotation(Rotation);
}

Expand All @@ -187,6 +204,14 @@ void ACloud9Character::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);

UE_LOG(LogCloud9, Display, TEXT("Contruction transform %s"), *Transform.ToString());

const auto Rotator = Transform.Rotator();

TargetRotation.Yaw = Rotator.Yaw;
SetCameraRotationYaw(Rotator.Yaw);
SetActorRotation(TargetRotation);

SetCursorIsHidden(true);

if (IsValid(CursorDecal))
Expand Down Expand Up @@ -227,7 +252,7 @@ void ACloud9Character::Tick(float DeltaSeconds)
const auto ActorRotation = GetActorRotation();
const auto NewRotation = FMath::Lerp(ActorRotation, TargetRotation, RotationSpeed * DeltaSeconds);
SetActorRotation(NewRotation);

// const auto ActorRotation = GetActorRotation();
// ActorRotation.GetNormalized()
// const auto Remain = TargetRotation - ActorRotation;
Expand Down
17 changes: 9 additions & 8 deletions Source/Cloud9/Character/Cloud9Character.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class ACloud9Character : public ACharacter
static const FName CameraComponentName;
static const FName DecalComponentName;
static const FName InventoryComponentName;

ACloud9Character(const FObjectInitializer& ObjectInitializer);

virtual void OnConstruction(const FTransform& Transform) override;

virtual void BeginPlay() override;

// Called every frame.
virtual void Tick(float DeltaSeconds) override;

Expand All @@ -37,7 +37,7 @@ class ACloud9Character : public ACharacter

ACloud9PlayerController* GetCloud9Controller() const;
UCloud9CharacterMovement* GetCloud9CharacterMovement() const;

bool CanSneak() const;

void Sneak() const;
Expand All @@ -46,6 +46,7 @@ class ACloud9Character : public ACharacter

void SetViewDirection(const FHitResult& HitResult, bool bIsHitValid);

void SetCameraRotationYaw(float Angle) const;
void AddCameraRotationYaw(float Angle) const;
float GetCameraRotationRoll() const;
void SetCameraRotationRoll(float Angle) const;
Expand All @@ -54,22 +55,22 @@ class ACloud9Character : public ACharacter

float GetCameraZoomHeight() const;
void SetCameraZoomHeight(float Value) const;

UCloud9Inventory* GetInventory() const;

// Set by character movement to specify that this Character is currently sneaking.
// TODO: replicatedUsing=OnRep_IsSneaking
UPROPERTY(BlueprintReadOnly, Category=Character)
uint32 bIsSneaking:1;
uint32 bIsSneaking : 1;

private:
UPROPERTY(EditDefaultsOnly)
UMaterial* CursorDecal;

/** A decal that projects to the cursor location. */
UPROPERTY(EditDefaultsOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
FName CameraTargetBoneName;

/** Top down camera */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
UCameraComponent* TopDownCameraComponent;
Expand All @@ -86,6 +87,6 @@ class ACloud9Character : public ACharacter
UCloud9Inventory* Inventory;

float RotationSpeed;

FRotator TargetRotation;
};

0 comments on commit 49218bd

Please sign in to comment.