Fission FSN
Loading...
Searching...
No Matches
gfCAutoTestAim.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCAutoTestAim.h
4*
5* Purpose: Auto play aimed input - cheat the aim, never the result
6*
7*********************************************************************/
8
9#ifndef gfCAutoTestAimhdr
10#define gfCAutoTestAimhdr
11
12#include <vector>
13
14#include <fsCore/fsBaseTypes.h>
15#include <fsCore/fsPoint.h>
16#include <fsCore/fsStr.h>
17
18class fsCEntity;
19class fsIComponent;
22
23
24// Asks the scene where a thing is, then sends real pointer events at it, so the
25// input path still runs in full. It reports a landed/attempted ratio, never a
26// failure - it cannot tell "broken" from "not available to the player yet".
28{
29public:
30
31 gfCAutoTestAim(const fsIComponent& pOwner, gfCAutoTestPointer& pPointer, fsS32 pMissLimit);
32
33 // Each returns true if it made an attempt.
34 fsBool tapTry();
35 // Starts a drag of a key onto a lock; finish with dragVerdictRecord().
37 // Taps a loose jigsaw piece upright, then drags it onto its home.
38 fsBool jigsawTry(const std::vector<fsCEntity*>& pPieces);
39 // Call once the drag dragTry() or jigsawTry() started has dropped.
40 void dragVerdictRecord();
41 // The drag was released early - it owes no verdict.
42 void dragForget();
43
44 // Logs the finished level's tally and forgets per-level state - entities are per level.
45 void levelChange();
46 // Logs the last level's tally and the total for the whole run.
47 void runEnd();
48
49private:
50
51 void tallyReport();
52
53 // True while the tutorial sequencer is consuming every pointer message.
54 fsBool tutorialInputStolenGet() const;
55
56 fsCEntity* tapTargetGet() const;
57 // The loose piece the last pointer down picked up, if any.
58 static fsCEntity* jigsawGrabbedPieceGet(const std::vector<fsCEntity*>& pPieces, const fsPoint& pAt);
59 // pLocalPos in posGet() space of the space the piece is dragged in.
60 static fsPoint jigsawScreenPosGet(gfCJigsawMinigameComponent* pPiece, const fsPoint& pLocalPos);
61 // Scene INS keys plus inventory INT tools - both open locks.
62 std::vector<fsCEntity*> draggableKeyEntitiesGet() const;
63 fsBool dragKeyRefusedGet() const;
64
65 fsS32 missesGet(const fsCEntity* pEnt) const;
66 // Ages a target out of aiming, forcing a lock open once it has given up.
67 void missAdvance(fsCEntity* pEnt, const fsStr& pWhat);
68 // pWhat is the miss reason as tallied; pDetail only goes into the give-up note.
69 void outcomeRecord(fsCEntity* pEnt, fsBool pTaken, const fsStr& pWhat, const fsStr& pDetail = "");
70
71 const fsIComponent& mOwner;
72 gfCAutoTestPointer& mPointer;
73
74 // Targets written off after mMissLimit tries, so one stuck entity does not
75 // stall the aiming or report itself over and over.
76 struct sMiss
77 {
78 const fsCEntity* mEnt;
79 fsS32 mMisses;
80 };
81 std::vector<sMiss> mMisses;
82 const fsS32 mMissLimit;
83
84 // Attempts and how many landed - this level, then the whole run.
85 fsS32 mTried;
86 fsS32 mTaken;
87 fsS32 mRunTried;
88 fsS32 mRunTaken;
89 fsStr mLevelName;
90
91 // This level's misses by reason, logged with the tally.
92 struct sMissReason
93 {
94 fsStr mWhat;
95 fsS32 mCount;
96 };
97 std::vector<sMissReason> mMissReasons;
98
99 // Rotates the starting lock, so it cannot loop on a pair the tutorial
100 // sequencer will never accept.
101 fsS32 mLockCursor;
102 fsS32 mPieceCursor;
103
104 // The aimed drag in flight, checked when it drops - a key onto a lock, or a
105 // jigsaw piece onto its home.
106 fsCEntity* mDragLockEnt;
107 fsCEntity* mDragKeyEnt;
108 fsCEntity* mDragPieceEnt;
109 fsStr mDragFailReason;
110};
111
112#endif
Definition fsCEntity.h:39
Definition fsIComponent.h:26
Definition fsStr.h:23
fsBool dragTry()
Definition gfCAutoTestAim.cpp:216
void runEnd()
Definition gfCAutoTestAim.cpp:464
fsBool jigsawTry(const std::vector< fsCEntity * > &pPieces)
Definition gfCAutoTestAim.cpp:327
void levelChange()
Definition gfCAutoTestAim.cpp:453
fsBool tapTry()
Definition gfCAutoTestAim.cpp:155
void dragVerdictRecord()
Definition gfCAutoTestAim.cpp:403
gfCAutoTestAim(const fsIComponent &pOwner, gfCAutoTestPointer &pPointer, fsS32 pMissLimit)
Definition gfCAutoTestAim.cpp:474
void dragForget()
Definition gfCAutoTestAim.cpp:425
Definition gfCAutoTestPointer.h:24
Definition gfCJigsawMinigameComponent.h:30
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17