Files
gig-line/Game/GigLine/Source/GigLine/GigLineShotActor.cpp
T
zwitschi 71acffec12 qa(collision): no-blocking-collision release check — seam + wall audit (#13)
Merged PR #13: no-blocking-collision release check

Co-authored-by: Zwitschi <zwitschi82@gmail.com>
2026-11-08 14:55:58 +01:00

91 lines
2.3 KiB
C++

#include "GigLineShotActor.h"
#include "Camera/CameraActor.h"
#include "Engine/World.h"
#include "GameFramework/PlayerController.h"
#include "UnrealClient.h"
AGigLineShotActor::AGigLineShotActor()
{
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;
}
void AGigLineShotActor::BeginPlay()
{
Super::BeginPlay();
NextShot();
}
void AGigLineShotActor::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
// QA mode: the -qaselftest run owns the process (it walks, resets, pauses,
// transects, then quits on its own). Skip the screenshot rounds so the game
// does not exit mid-test via bQuitWhenDone.
if (FParse::Param(FCommandLine::Get(), TEXT("qaselftest")))
{
return;
}
if (bWaitingForSettle)
{
SettleCountdown -= DeltaSeconds;
if (SettleCountdown <= 0.f)
{
bWaitingForSettle = false;
// Use the stable custom name only (no list-index prefix): inserting or
// reordering cameras must not renumber files and orphan the old ones.
const FString Name = CurrentShot < ShotNames.Num()
? ShotNames[CurrentShot]
: FString::FromInt(CurrentShot);
const FString FileName = FString::Printf(TEXT("review-%s"), *Name);
// Resolution is the game window's; the runner passes -ResX/-ResY.
FScreenshotRequest::RequestScreenshot(FileName, /*bInShowUI=*/true, false);
bWaitingForScreenshot = true;
}
return;
}
if (bWaitingForScreenshot && !FScreenshotRequest::IsScreenshotRequested())
{
bWaitingForScreenshot = false;
UE_LOG(LogTemp, Log, TEXT("GigLineShotActor: captured %s"), *FScreenshotRequest::GetFilename());
++CurrentShot;
NextShot();
}
}
void AGigLineShotActor::NextShot()
{
if (!PlayerController)
{
PlayerController = GetWorld()->GetFirstPlayerController();
}
if (CurrentShot >= ShotLocations.Num() || !PlayerController)
{
UE_LOG(LogTemp, Log, TEXT("GigLineShotActor: done (%d shots)"), CurrentShot);
if (bQuitWhenDone)
{
PlayerController->ConsoleCommand(TEXT("quit"));
}
return;
}
if (CurrentCamera)
{
CurrentCamera->Destroy();
}
FActorSpawnParameters Params;
Params.ObjectFlags |= RF_Transient;
CurrentCamera = GetWorld()->SpawnActor<ACameraActor>(
ACameraActor::StaticClass(), ShotLocations[CurrentShot], ShotRotations[CurrentShot], Params);
PlayerController->SetViewTarget(CurrentCamera);
SettleCountdown = SettleSeconds;
bWaitingForSettle = true;
}