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 // Makes the next move of a minigame that can say how: pPieces host a
38 // gfIMinigameNextMove (a jigsaw piece is tapped upright, then dragged home).
39 fsBool minigameTry(const std::vector<fsCEntity*>& pPieces);
40 // Call once the drag dragTry() or minigameTry() started has dropped.
41 void dragVerdictRecord();
42 // The drag was released early - it owes no verdict.
43 void dragForget();
44
45 // Logs the finished level's tally and forgets per-level state - entities are per level.
46 void levelChange();
47 // Logs the last level's tally and the total for the whole run.
48 void runEnd();
49
50private:
51
52 void tallyReport();
53
54 // True while the tutorial sequencer or a modal is consuming every pointer message.
55 fsBool inputStolenGet() const;
56
57 fsCEntity* tapTargetGet() const;
58 // Scene INS keys plus inventory INT tools - both open locks.
59 std::vector<fsCEntity*> draggableKeyEntitiesGet() const;
60 fsBool dragKeyRefusedGet() const;
61
62 fsS32 missesGet(const fsCEntity* pEnt) const;
63 // Ages a target out of aiming, forcing a lock open once it has given up.
64 void missAdvance(fsCEntity* pEnt, const fsStr& pWhat);
65 // pWhat is the miss reason as tallied; pDetail only goes into the give-up note.
66 void outcomeRecord(fsCEntity* pEnt, fsBool pTaken, const fsStr& pWhat, const fsStr& pDetail = "");
67
68 const fsIComponent& mOwner;
69 gfCAutoTestPointer& mPointer;
70
71 // Targets written off after mMissLimit tries, so one stuck entity does not
72 // stall the aiming or report itself over and over.
73 struct sMiss
74 {
75 const fsCEntity* mEnt;
76 fsS32 mMisses;
77 };
78 std::vector<sMiss> mMisses;
79 const fsS32 mMissLimit;
80
81 // Attempts and how many landed - this level, then the whole run.
82 fsS32 mTried;
83 fsS32 mTaken;
84 fsS32 mRunTried;
85 fsS32 mRunTaken;
86 fsStr mLevelName;
87
88 // This level's misses by reason, logged with the tally.
89 struct sMissReason
90 {
91 fsStr mWhat;
92 fsS32 mCount;
93 };
94 std::vector<sMissReason> mMissReasons;
95
96 // Rotates the starting lock, so it cannot loop on a pair the tutorial
97 // sequencer will never accept.
98 fsS32 mLockCursor;
99 fsS32 mPieceCursor;
100
101 // The aimed drag in flight, checked when it drops - a key onto a lock, or a
102 // minigame piece onto its target.
103 fsCEntity* mDragLockEnt;
104 fsCEntity* mDragKeyEnt;
105 fsCEntity* mDragMoveEnt;
106 const gfIMinigameNextMove* mDragMove;
107 fsStr mDragFailReason;
108};
109
110#endif
Definition fsCEntity.h:39
Definition fsIComponent.h:26
Definition fsStr.h:23
fsBool minigameTry(const std::vector< fsCEntity * > &pPieces)
Definition gfCAutoTestAim.cpp:306
fsBool dragTry()
Definition gfCAutoTestAim.cpp:234
void runEnd()
Definition gfCAutoTestAim.cpp:440
void levelChange()
Definition gfCAutoTestAim.cpp:429
fsBool tapTry()
Definition gfCAutoTestAim.cpp:173
void dragVerdictRecord()
Definition gfCAutoTestAim.cpp:381
gfCAutoTestAim(const fsIComponent &pOwner, gfCAutoTestPointer &pPointer, fsS32 pMissLimit)
Definition gfCAutoTestAim.cpp:450
void dragForget()
Definition gfCAutoTestAim.cpp:400
Definition gfCAutoTestPointer.h:26
Definition gfIMinigameNextMove.h:26
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20