ScummVM API documentation
GameLamp.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of Penumbra Overture.
26  */
27 
28 #ifndef GAME_GAME_LAMP_H
29 #define GAME_GAME_LAMP_H
30 
31 #include "hpl1/engine/engine.h"
32 #include "hpl1/penumbra-overture/GameEntity.h"
33 
34 using namespace hpl;
35 
36 //----------------------------------------------
37 
39  kSerializableClassInit(cGameLamp_SaveData);
40 
41 public:
42  bool mbLit;
43  tString msLitChangeCallback;
44 
45  bool mbFlickering;
46 
47  iGameEntity *CreateEntity();
48 };
49 
50 //----------------------------------------------
51 
52 class cGameLamp_PS {
53 public:
54  tString msName;
55  tString msDataName;
56  cMatrixf m_mtxTransform;
57 };
58 
59 //----------------------------------------------
60 
61 class cGameLamp : public iGameEntity {
62  typedef iGameEntity super;
63  friend class cEntityLoader_GameLamp;
64 
65 public:
66  cGameLamp(cInit *apInit, const tString &asName);
67  ~cGameLamp(void);
68 
69  void OnPlayerInteract();
70  void OnPlayerPick();
71  bool OnUseItem(cInventoryItem *apItem);
72 
73  void Update(float afTimeStep);
74 
75  void SetLitChangeCallback(const tString &asCallback) { msLitChangeCallback = asCallback; }
76 
77  void SetLit(bool abX, bool abFade);
78 
79  void SetFlicker(bool abX);
80 
81  void Init();
82 
83  // SaveObject implementation
84  iGameEntity_SaveData *CreateSaveData();
85  void SaveToSaveData(iGameEntity_SaveData *apSaveData);
86  void LoadFromSaveData(iGameEntity_SaveData *apSaveData);
87 
88 private:
89  void SetUpFlicker(int alIdx);
90 
91  bool mbLit;
92 
93  float mfAlpha;
94  float mfTurnOnTime;
95  float mfTurnOffTime;
96 
97  bool mbInteractOff;
98  bool mbInteractOn;
99 
100  tString msTurnOnSound;
101  tString msTurnOffSound;
102 
103  tString msOnItem;
104  tString msOffItem;
105 
106  tString msLitChangeCallback;
107 
108  tString msOffMaterialName;
109  tString msOffSubMesh;
110  iMaterial *mpOffMaterial;
111  iMaterial *mpOnMaterial;
112  cSubMeshEntity *mpSubMesh;
113 
114  // Flickering
115  bool mbFlickering;
116  tString msFlickerOffSound;
117  tString msFlickerOnSound;
118  tString msFlickerOffPS;
119  tString msFlickerOnPS;
120  float mfFlickerOnMinLength;
121  float mfFlickerOffMinLength;
122  float mfFlickerOnMaxLength;
123  float mfFlickerOffMaxLength;
124  cColor mFlickerOffColor;
125  float mfFlickerOffRadius;
126  bool mbFlickerFade;
127  float mfFlickerOnFadeLength;
128  float mfFlickerOffFadeLength;
129 
130  // Init data
131  Common::Array<cColor> mvLightColors;
132  Common::Array<cColor> mvBBColors;
133  Common::Array<cGameLamp_PS> mvParticleSystemNames;
134 };
135 
136 //--------------------------------------
137 
139 public:
140  cEntityLoader_GameLamp(const tString &asName, cInit *apInit);
142 
143 private:
144  void BeforeLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
145  void AfterLoad(TiXmlElement *apRootElem, const cMatrixf &a_mtxTransform, cWorld3D *apWorld);
146 
147  cInit *mpInit;
148 };
149 
150 #endif // GAME_GAME_LAMP_H
Definition: AI.h:36
Definition: SubMeshEntity.h:95
Definition: str.h:59
Definition: GameEntity.h:76
Definition: GameLamp.h:61
Definition: World3D.h:179
Definition: Inventory.h:123
Definition: GameLamp.h:52
Definition: Color.h:37
Definition: GameLamp.h:38
Definition: EntityLoader_Object.h:52
Definition: tinyxml.h:864
Definition: GameLamp.h:138
Definition: Material.h:203
Definition: GameEntity.h:126
Definition: Init.h:70