BVB Source Codes

CRYENGINE Show DialogScript.h Source code

Return Download CRYENGINE: download DialogScript.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   DialogScript.h
  5. //  Version:     v1.00
  6. //  Created:     07/07/2006 by AlexL
  7. //  Compilers:   Visual Studio.NET
  8. //  Description: Dialog Script
  9. // -------------------------------------------------------------------------
  10. //  History:
  11. //
  12. ////////////////////////////////////////////////////////////////////////////
  13.  
  14. #ifndef __DIALOGSCRIPT_H__
  15. #define __DIALOGSCRIPT_H__
  16.  
  17. #pragma once
  18.  
  19. #include <CryCore/StlUtils.h>
  20.  
  21. class CDialogScript
  22. {
  23. public:
  24.         typedef uint8 TActorID;
  25.         static const TActorID MAX_ACTORS = sizeof(TActorID) * 8; // number of bits in TActorID (8 for uint8)
  26.         static const TActorID NO_ACTOR_ID = ~TActorID(0);
  27.         static const TActorID STICKY_LOOKAT_RESET_ID = NO_ACTOR_ID - 1;
  28.  
  29.         enum VersionFlags
  30.         {
  31.                 VF_EXCEL_BASED = 0x0001,
  32.         };
  33.  
  34.         // helper struct (basically a bitset replicate)
  35.         struct SActorSet
  36.         {
  37.                 SActorSet() : m_actorBits(0) {}
  38.                 SActorSet(TActorID requiredActors) : m_actorBits(0) {}
  39.                 void SetActor(TActorID id);
  40.                 void ResetActor(TActorID id);
  41.                 bool HasActor(TActorID id);
  42.                 int  NumActors() const;
  43.                 bool Matches(const SActorSet& other) const;   // exact match
  44.                 bool Satisfies(const SActorSet& other) const; // fulfills or super-fulfills other
  45.                 TActorID m_actorBits;
  46.         };
  47.  
  48.         struct SScriptLine
  49.         {
  50.                 SScriptLine()
  51.                         : m_delay(0.0f)
  52.                         , m_facialWeight(0.0f)
  53.                         , m_facialFadeTime(0.0f)
  54.                 {
  55.                 }
  56.  
  57.                 SScriptLine(TActorID actor, TActorID lookat, AudioControlId audioID, const char* anim, const char* facial, float delay, float facialWeight, float facialFadeTime, bool bLookAtSticky, bool bResetFacial, bool bResetLookAt, bool bSoundStopsAnim, bool bUseAGSignal, bool bUseAGEP)
  58.                         : m_actor(actor),
  59.                         m_lookatActor(lookat),
  60.                         m_audioID(audioID),
  61.                         m_anim(anim),
  62.                         m_facial(facial),
  63.                         m_delay(delay),
  64.                         m_facialWeight(facialWeight),
  65.                         m_facialFadeTime(facialFadeTime),
  66.                         m_flagLookAtSticky(bLookAtSticky),
  67.                         m_flagResetFacial(bResetFacial),
  68.                         m_flagResetLookAt(bResetLookAt),
  69.                         m_flagSoundStopsAnim(bSoundStopsAnim),
  70.                         m_flagAGSignal(bUseAGSignal),
  71.                         m_flagAGEP(bUseAGEP),
  72.                         m_flagUnused(0)
  73.                 {
  74.                 }
  75.  
  76.                 TActorID       m_actor;       // [0..MAX_ACTORS)
  77.                 TActorID       m_lookatActor; // [0..MAX_ACTORS)
  78.                 uint16         m_flagLookAtSticky   : 1;
  79.                 uint16         m_flagResetFacial    : 1;
  80.                 uint16         m_flagResetLookAt    : 1;
  81.                 uint16         m_flagSoundStopsAnim : 1;
  82.                 uint16         m_flagAGSignal       : 1; // it's an AG Signal / AG Action
  83.                 uint16         m_flagAGEP           : 1; // use exact positioning
  84.                 uint16         m_flagUnused         : 10;
  85.  
  86.                 AudioControlId m_audioID;
  87.                 string         m_anim;           // Animation to Play
  88.                 string         m_facial;         // Facial Animation to Play
  89.                 float          m_delay;          // Delay
  90.                 float          m_facialWeight;   // Weight of facial expression
  91.                 float          m_facialFadeTime; // Time of facial fade-in
  92.  
  93.                 void           GetMemoryUsage(ICrySizer* pSizer) const
  94.                 {
  95.                         //pSizer->AddObject(m_audioID);
  96.                         pSizer->AddObject(m_anim);
  97.                         pSizer->AddObject(m_facial);
  98.                 }
  99.         };
  100.         typedef std::vector<SScriptLine> TScriptLineVec;
  101.  
  102. public:
  103.         CDialogScript(const string& dialogScriptID);
  104.         virtual ~CDialogScript();
  105.  
  106.         // Get unique ID of this DialogScript
  107.         const string& GetID() const
  108.         {
  109.                 return m_id;
  110.         }
  111.  
  112.         // Get description
  113.         const string& GetDescription() const
  114.         {
  115.                 return m_desc;
  116.         }
  117.  
  118.         // Set a description
  119.         void SetDescription(const string& desc)
  120.         {
  121.                 m_desc = desc;
  122.         }
  123.  
  124.         // Add one line after another
  125.         // Ugly interface exists purely for speed reasons
  126.         bool AddLine(TActorID actorID, AudioControlId audioID, const char* anim, const char* facial, TActorID lookAtTargetID, float delay, float facialWeight, float facialFadeTime, bool bLookAtSticky, bool bResetFacial, bool bResetLookAt, bool bSoundStopsAnim, bool bUseAGSignal, bool bUseAGEP);
  127.  
  128.         // Add one line after another
  129.         bool AddLine(const SScriptLine& line);
  130.  
  131.         // Call this after all lines have been added
  132.         bool Complete();
  133.  
  134.         // Is the dialogscript completed
  135.         bool IsCompleted() const;
  136.  
  137.         // Retrieves an empty actor set
  138.         SActorSet GetRequiredActorSet() const
  139.         {
  140.                 return m_reqActorSet;
  141.         }
  142.  
  143.         // Get number of required actors (these may not be in sequence!)
  144.         int GetNumRequiredActors() const;
  145.  
  146.         // Get number of dialog lines
  147.         int GetNumLines() const;
  148.  
  149.         // Get a certain line
  150.         // const SScriptLine& GetLine(int index) const;
  151.  
  152.         // Get a certain line
  153.         const SScriptLine* GetLine(int index) const;
  154.  
  155.         // Get special version flags
  156.         uint32 GetVersionFlags() const { return m_versionFlags; }
  157.  
  158.         // Set special version flag
  159.         void SetVersionFlags(uint32 which, bool bSet = true);
  160.  
  161.         void GetMemoryUsage(ICrySizer* pSizer) const;
  162.  
  163. protected:
  164.         string         m_id;
  165.         string         m_desc;
  166.         TScriptLineVec m_lines;
  167.         SActorSet      m_reqActorSet;
  168.         int            m_versionFlags;
  169.         bool           m_bComplete;
  170. };
  171.  
  172. typedef std::map<string, CDialogScript*, stl::less_stricmp<string>> TDialogScriptMap;
  173.  
  174. #endif
  175.  
downloadDialogScript.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top