From 9d216bc081e266364bb32e85eedd5635474f085f Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:42:02 -0800 Subject: [PATCH 01/10] Update Gun.cpp --- Source/S05_TestingGrounds/Weapons/Gun.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/S05_TestingGrounds/Weapons/Gun.cpp b/Source/S05_TestingGrounds/Weapons/Gun.cpp index 502cfbb..3351772 100644 --- a/Source/S05_TestingGrounds/Weapons/Gun.cpp +++ b/Source/S05_TestingGrounds/Weapons/Gun.cpp @@ -40,18 +40,19 @@ void AGun::Tick( float DeltaTime ) void AGun::OnFire() { // try and fire a projectile - if (ProjectileClass != NULL) + if (ProjectileClass == NULL) { - const FRotator SpawnRotation = FP_MuzzleLocation->GetComponentRotation(); - // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position - const FVector SpawnLocation = FP_MuzzleLocation->GetComponentLocation(); + return; + } + const FRotator SpawnRotation = FP_MuzzleLocation->GetComponentRotation(); + // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position + const FVector SpawnLocation = FP_MuzzleLocation->GetComponentLocation(); - UWorld* const World = GetWorld(); - if (World != NULL) - { - // spawn the projectile at the muzzle - World->SpawnActor(ProjectileClass, SpawnLocation, SpawnRotation); - } + UWorld* const World = GetWorld(); + if (World != NULL) + { + // spawn the projectile at the muzzle + World->SpawnActor(ProjectileClass, SpawnLocation, SpawnRotation); } // try and play the sound if specified @@ -70,4 +71,4 @@ void AGun::OnFire() } } -} \ No newline at end of file +} From c6a3ff2793087fc1da217b16044f18988100e64b Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:49:04 -0800 Subject: [PATCH 02/10] Changed style Changed to a style seen within the Unreal Engine 4 example projects. --- Source/S05_TestingGrounds.Target.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/S05_TestingGrounds.Target.cs b/Source/S05_TestingGrounds.Target.cs index 3b931af..24e5063 100644 --- a/Source/S05_TestingGrounds.Target.cs +++ b/Source/S05_TestingGrounds.Target.cs @@ -10,10 +10,9 @@ public S05_TestingGroundsTarget(TargetInfo Target) Type = TargetType.Game; } - // - // TargetRules interface. - // - + /** + * TargetRules interface. + */ public override void SetupBinaries( TargetInfo Target, ref List OutBuildBinaryConfigurations, From 5242b9c96607cc5eccad7d09aae00de2e3d21963 Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:50:26 -0800 Subject: [PATCH 03/10] Update S05_TestingGroundsEditor.Target.cs --- Source/S05_TestingGroundsEditor.Target.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/S05_TestingGroundsEditor.Target.cs b/Source/S05_TestingGroundsEditor.Target.cs index a8cfe07..bd05fe6 100644 --- a/Source/S05_TestingGroundsEditor.Target.cs +++ b/Source/S05_TestingGroundsEditor.Target.cs @@ -10,10 +10,9 @@ public S05_TestingGroundsEditorTarget(TargetInfo Target) Type = TargetType.Editor; } - // - // TargetRules interface. - // - + /** + * TargetRules interface. + */ public override void SetupBinaries( TargetInfo Target, ref List OutBuildBinaryConfigurations, From f40dbd47ffc1c0dae8a733b815f61a35c8255056 Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:53:45 -0800 Subject: [PATCH 04/10] Updated comments to create consistency --- .../Player/FirstPersonCharacter.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Source/S05_TestingGrounds/Player/FirstPersonCharacter.cpp b/Source/S05_TestingGrounds/Player/FirstPersonCharacter.cpp index 978ec1e..cd41014 100644 --- a/Source/S05_TestingGrounds/Player/FirstPersonCharacter.cpp +++ b/Source/S05_TestingGrounds/Player/FirstPersonCharacter.cpp @@ -15,7 +15,7 @@ AFirstPersonCharacter::AFirstPersonCharacter() // Set size for collision capsule GetCapsuleComponent()->InitCapsuleSize(55.f, 96.0f); - // set our turn rates for input + // Set our turn rates for input BaseTurnRate = 45.f; BaseLookUpRate = 45.f; @@ -37,8 +37,9 @@ AFirstPersonCharacter::AFirstPersonCharacter() // Default offset from the character location for projectiles to spawn GunOffset = FVector(100.0f, 30.0f, 10.0f); - // Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the - // derived blueprint asset named MyCharacter (to avoid direct content references in C++) + /* Note: The ProjectileClass and the skeletal mesh/anim blueprints for Mesh1P are set in the + derived blueprint asset named MyCharacter (to avoid direct content references in C++) + */ } void AFirstPersonCharacter::BeginPlay() @@ -64,19 +65,20 @@ void AFirstPersonCharacter::BeginPlay() void AFirstPersonCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent) { - // set up gameplay key bindings + // Set up gameplay key bindings check(InputComponent); InputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); InputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping); - //InputComponent->BindTouch(EInputEvent::IE_Pressed, this, &AFirstPersonCharacter::TouchStarted); + // InputComponent->BindTouch(EInputEvent::IE_Pressed, this, &AFirstPersonCharacter::TouchStarted); InputComponent->BindAxis("MoveForward", this, &AFirstPersonCharacter::MoveForward); InputComponent->BindAxis("MoveRight", this, &AFirstPersonCharacter::MoveRight); - // We have 2 versions of the rotation bindings to handle different kinds of devices differently - // "turn" handles devices that provide an absolute delta, such as a mouse. - // "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick + /* We have 2 versions of the rotation bindings to handle different kinds of devices differently + "turn" handles devices that provide an absolute delta, such as a mouse. + "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick + */ InputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput); InputComponent->BindAxis("TurnRate", this, &AFirstPersonCharacter::TurnAtRate); InputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput); @@ -149,7 +151,7 @@ void AFirstPersonCharacter::MoveForward(float Value) { if (Value != 0.0f) { - // add movement in that direction + // Add movement in that direction AddMovementInput(GetActorForwardVector(), Value); } } @@ -158,20 +160,20 @@ void AFirstPersonCharacter::MoveRight(float Value) { if (Value != 0.0f) { - // add movement in that direction + // Add movement in that direction AddMovementInput(GetActorRightVector(), Value); } } void AFirstPersonCharacter::TurnAtRate(float Rate) { - // calculate delta for this frame from the rate information + // Calculate delta for this frame from the rate information AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds()); } void AFirstPersonCharacter::LookUpAtRate(float Rate) { - // calculate delta for this frame from the rate information + // Calculate delta for this frame from the rate information AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds()); } From 0aa96fc767c212e2f6697cc6eac3b5e8ba179e75 Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:54:42 -0800 Subject: [PATCH 05/10] Removed unneeded asterisk. --- Source/S05_TestingGrounds/Player/FirstPersonCharacter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/S05_TestingGrounds/Player/FirstPersonCharacter.h b/Source/S05_TestingGrounds/Player/FirstPersonCharacter.h index c891145..774a85a 100644 --- a/Source/S05_TestingGrounds/Player/FirstPersonCharacter.h +++ b/Source/S05_TestingGrounds/Player/FirstPersonCharacter.h @@ -88,9 +88,9 @@ class AFirstPersonCharacter : public ACharacter bool EnableTouchscreenMovement(UInputComponent* InputComponent); public: - /** Returns Mesh1P subobject **/ + /** Returns Mesh1P subobject */ FORCEINLINE class USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; } - /** Returns FirstPersonCameraComponent subobject **/ + /** Returns FirstPersonCameraComponent subobject */ FORCEINLINE class UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; } }; From 16b1574e75e513dfd9a51f1c343590fb9d1d78ed Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:56:05 -0800 Subject: [PATCH 06/10] Modified casing of comments to create consistency --- Source/S05_TestingGrounds/S05_TestingGroundsHUD.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/S05_TestingGrounds/S05_TestingGroundsHUD.cpp b/Source/S05_TestingGrounds/S05_TestingGroundsHUD.cpp index 9a1afbe..7a66998 100644 --- a/Source/S05_TestingGrounds/S05_TestingGroundsHUD.cpp +++ b/Source/S05_TestingGrounds/S05_TestingGroundsHUD.cpp @@ -20,14 +20,14 @@ void AS05_TestingGroundsHUD::DrawHUD() // Draw very simple crosshair - // find center of the Canvas + // Find center of the Canvas const FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f); - // offset by half the texture's dimensions so that the center of the texture aligns with the center of the Canvas + // Offset by half the texture's dimensions so that the center of the texture aligns with the center of the Canvas const FVector2D CrosshairDrawPosition( (Center.X), (Center.Y)); - // draw the crosshair + // Draw the crosshair FCanvasTileItem TileItem( CrosshairDrawPosition, CrosshairTex->Resource, FLinearColor::White); TileItem.BlendMode = SE_BLEND_Translucent; Canvas->DrawItem( TileItem ); From d7d800ab86358f3de715c802f5f2994b4a097cdf Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:56:36 -0800 Subject: [PATCH 07/10] Modified casing of comments to create consistency Modified casing of comments to create consistency with other classes --- Source/S05_TestingGrounds/S05_TestingGroundsGameMode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/S05_TestingGrounds/S05_TestingGroundsGameMode.cpp b/Source/S05_TestingGrounds/S05_TestingGroundsGameMode.cpp index 640fa07..da8d1cb 100644 --- a/Source/S05_TestingGrounds/S05_TestingGroundsGameMode.cpp +++ b/Source/S05_TestingGrounds/S05_TestingGroundsGameMode.cpp @@ -8,10 +8,10 @@ AS05_TestingGroundsGameMode::AS05_TestingGroundsGameMode() : Super() { - // set default pawn class to our Blueprinted character + // Set default pawn class to our Blueprinted character static ConstructorHelpers::FClassFinder PlayerPawnClassFinder(TEXT("/Game/Dynamic/Player/Behaviour/FirstPersonCharacter")); DefaultPawnClass = PlayerPawnClassFinder.Class; - // use our custom HUD class + // Use our custom HUD class HUDClass = AS05_TestingGroundsHUD::StaticClass(); } From 7d2b119eb6987d7e0391bc15d5be07025fc54a96 Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:58:04 -0800 Subject: [PATCH 08/10] Modified comment casing to create consistency --- Source/S05_TestingGrounds/Weapons/BallProjectile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/S05_TestingGrounds/Weapons/BallProjectile.cpp b/Source/S05_TestingGrounds/Weapons/BallProjectile.cpp index 5d2bdd1..d0db76f 100644 --- a/Source/S05_TestingGrounds/Weapons/BallProjectile.cpp +++ b/Source/S05_TestingGrounds/Weapons/BallProjectile.cpp @@ -10,7 +10,7 @@ ABallProjectile::ABallProjectile() CollisionComp = CreateDefaultSubobject(TEXT("SphereComp")); CollisionComp->InitSphereRadius(5.0f); CollisionComp->BodyInstance.SetCollisionProfileName("Projectile"); - CollisionComp->OnComponentHit.AddDynamic(this, &ABallProjectile::OnHit); // set up a notification for when this component hits something blocking + CollisionComp->OnComponentHit.AddDynamic(this, &ABallProjectile::OnHit); // Set up a notification for when this component hits something blocking // Players can't walk on it CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f)); @@ -40,4 +40,4 @@ void ABallProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UP Destroy(); } -} \ No newline at end of file +} From 6a91320da66cb86eca1fa563b2a3e1e587f19ab2 Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 13:58:53 -0800 Subject: [PATCH 09/10] Modified comments Changed comment casing in order to create consistency as well as removed unneeded asterisks. --- Source/S05_TestingGrounds/Weapons/BallProjectile.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/S05_TestingGrounds/Weapons/BallProjectile.h b/Source/S05_TestingGrounds/Weapons/BallProjectile.h index 1bb47e0..37f968a 100644 --- a/Source/S05_TestingGrounds/Weapons/BallProjectile.h +++ b/Source/S05_TestingGrounds/Weapons/BallProjectile.h @@ -19,13 +19,13 @@ class ABallProjectile : public AActor public: ABallProjectile(); - /** called when projectile hits something */ + /** Called when projectile hits something */ UFUNCTION() void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit); - /** Returns CollisionComp subobject **/ + /** Returns CollisionComp subobject */ FORCEINLINE class USphereComponent* GetCollisionComp() const { return CollisionComp; } - /** Returns ProjectileMovement subobject **/ + /** Returns ProjectileMovement subobject */ FORCEINLINE class UProjectileMovementComponent* GetProjectileMovement() const { return ProjectileMovement; } }; From 94d1e599fb91ecf582d3c9ebdaaac3d28e62742c Mon Sep 17 00:00:00 2001 From: Markyroson Date: Tue, 29 Nov 2016 14:01:39 -0800 Subject: [PATCH 10/10] Improved comment consistency --- Source/S05_TestingGrounds/Weapons/Gun.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/S05_TestingGrounds/Weapons/Gun.cpp b/Source/S05_TestingGrounds/Weapons/Gun.cpp index 3351772..f17b3c4 100644 --- a/Source/S05_TestingGrounds/Weapons/Gun.cpp +++ b/Source/S05_TestingGrounds/Weapons/Gun.cpp @@ -39,7 +39,7 @@ void AGun::Tick( float DeltaTime ) void AGun::OnFire() { - // try and fire a projectile + // Try and fire a projectile if (ProjectileClass == NULL) { return; @@ -51,17 +51,17 @@ void AGun::OnFire() UWorld* const World = GetWorld(); if (World != NULL) { - // spawn the projectile at the muzzle + // Spawn the projectile at the muzzle World->SpawnActor(ProjectileClass, SpawnLocation, SpawnRotation); } - // try and play the sound if specified + // Try and play the sound if specified if (FireSound != NULL) { UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation()); } - // try and play a firing animation if specified + // Try and play a firing animation if specified if (FireAnimation != NULL) { // Get the animation object for the arms mesh