ScummVM API documentation
set_pc.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  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_SET_PC_H
28 #define ICB_SET_PC_H
29 
30 #include "engines/icb/p4_generic.h"
31 #include "engines/icb/gfx/psx_pcdefines.h"
32 #include "engines/icb/gfx/rlp_api.h"
33 #include "engines/icb/common/pc_props.h"
34 #include "engines/icb/common/px_staticlayers.h"
35 
36 #include "common/endian.h"
37 
38 namespace ICB {
39 
40 #define WEATHER_SCREEN_WIDTH SCREEN_WIDTH
41 #define WEATHER_HALF_SCREEN_WIDTH (WEATHER_SCREEN_WIDTH / 2)
42 #define WEATHER_SCREEN_HEIGHT SCREEN_DEPTH
43 #define WEATHER_HALF_SCREEN_HEIGHT (WEATHER_SCREEN_HEIGHT / 2)
44 #define WEATHER_SCREEN_DEPTH 512
45 #define WEATHER_HALF_SCREEN_DEPTH (WEATHER_SCREEN_DEPTH / 2)
46 #define WEATHER_MAX_PARTICLES 256
47 
48 #define MAX_PROP_STATES 512
49 #define MAX_CAMERA_PROPS 16
50 
51 #define _MAX_SHADOW_LAYERS_ 4
52 #define WEATHER_NONE 0
53 #define WEATHER_RAIN 1
54 #define WEATHER_SNOW 2
55 
56 extern uint32 bg_buffer_id;
57 extern LRECT full_rect;
58 
59 class _set {
60  friend void sv_WeatherControls();
61 
62 public:
63  _set();
64  ~_set();
65 
66 public:
67  bool8 Init(const char *camera_name, const char *h_camera_name); // camera name
68  void Init_construction_matrices();
69  void Init_base_bitmap_buffers();
70  void ReInit();
71 
72 private:
73  void Load_props();
74  void Load_props_old();
75 
76 public:
77  inline PXcamera &GetCamera();
78  inline rlp_API *GetPRig();
79  inline pcStaticLayers *GetStaticLayers();
80  inline pcPropFile *GetProps();
81  inline pcInteractibleFile *GetInteractibles();
82  inline uint8 *GetBackground();
83  inline uint32 GetPropQty();
84  inline const char *GetPropName(uint32 n);
85  inline uint32 GetPropRange(uint32 n);
86  bool8 DoesPropExist(const char *propName);
87 
88  int32 OK() { return m_setOk; };
89  void Reset();
90  bool8 DoesCameraExist(const char *camera_name, const char *camera_cluster_name);
91 
92 private:
93  void HackMakeCamera();
94 
95 public: /* Drawing Functions */
96  void RefreshBackdrop();
97  void Set_draw(bool8 helper);
98 
99  const char *GetSetName() const { return set_name; }
100 
101 private: /* Member variables .... Move this to private section */
102  char set_name[MAXPATHLEN]; // the camera name (no url)
103  char set_url[MAXPATHLEN]; // the full url of the camera
104  uint32 set_url_hash; // the hashed url of the camera
105  char set_cluster[MAXPATHLEN]; // cluster file name
106  uint32 set_cluster_hash; // hashed cluster file name
107  /* Waiting for removal */
108  char h_set_name[MAXPATHLEN]; // just the hash camera name - not full url
109  char rvpcm_file_name[MAXPATHLEN]; // Props & Construction Matrix
110  uint32 rvpcm_file_hash; // Props & Construction Matrix hash value
111  char rvcam_file_name[MAXPATHLEN]; // Camera
112  uint32 rvcam_file_hash; // Camera hash value
113  char rvsl_file_name[MAXPATHLEN]; // Static Layers
114  uint32 rvsl_file_hash; // Static Layers hash value
115  char rvbg_file_name[MAXPATHLEN]; // Background
116  uint32 rvbg_file_hash; // Background hash value
117  char rlx_file_name[MAXPATHLEN]; // Poly Lighting rig
118  uint32 rlx_file_hash; // Poly Lighting rig hash
119  void SettleCamera();
120  /* Waiting for removal */
121 
122 public: /* _ WEATHER _ RAIN _ SNOW _ LIGHTNING _ SPARKLE */
123  void DrawSparkles();
124  void DrawWeather();
125  void InitWeather(int32 type, int32 particleQty, int32 lightning, int32 windX, int32 windY, int32 windZ);
126 
127 private:
128  int16 m_wParticleX[WEATHER_MAX_PARTICLES]; // -320 - 320
129  int16 m_wParticleY[WEATHER_MAX_PARTICLES]; // -240 - 240
130  int16 m_wParticleZ[WEATHER_MAX_PARTICLES]; // -512 - 512
131  int8 m_wParticleDX[WEATHER_MAX_PARTICLES];
132  int8 m_wParticleDY[WEATHER_MAX_PARTICLES];
133  int8 m_wParticleDZ[WEATHER_MAX_PARTICLES];
134  int32 m_wLightningTimer;
135  int32 m_wType;
136  int32 m_wWindX;
137  int32 m_wWindY;
138  int32 m_wWindZ;
139  int32 m_wParticleQty;
140  int32 m_wLightning;
141 
142 private:
143  int32 m_setOk; // Is The Set OK flag
144  PXcamera m_camera; // The camera
145  _pcSetHeader *m_currentCamera; // All the camera data
146 
147  pcPropFile *m_props;
148 
149 public: /* Prop Surfaces */
150  uint32 m_propSurfaceIds[MAX_CAMERA_PROPS];
151  int32 m_propSurfaces[MAX_PROP_STATES];
152  int32 m_propResolutions[MAX_CAMERA_PROPS];
153  int32 m_TotalPropSurfaces;
154 };
155 
156 inline rlp_API *_set::GetPRig() { return (rlp_API *)(((uint8 *)m_currentCamera) + FROM_LE_32(m_currentCamera->lightOffset)); }
157 
158 inline pcStaticLayers *_set::GetStaticLayers() { return (pcStaticLayers *)(((uint8 *)m_currentCamera) + FROM_LE_32(m_currentCamera->layerOffset)); }
159 
160 inline pcInteractibleFile *_set::GetInteractibles() {
161  if (m_currentCamera->id == PCSETFILE_ID_ICB) {
162  static pcInteractibleFile temp;
163  temp.SetQty(0);
164  temp.SetSchema(PCINTERACTIBLE_SCHEMA);
165  temp.SetId(PCINTERACTIBLE_ID);
166  return &temp;
167  }
168  else
169  return (pcInteractibleFile *)(((uint8 *)m_currentCamera) + FROM_LE_32(m_currentCamera->interactiblesOffset));
170 }
171 
172 inline pcPropFile *_set::GetProps() { return m_props; }
173 
174 inline uint8 *_set::GetBackground() { return (uint8 *)(((uint8 *)m_currentCamera) + FROM_LE_32(m_currentCamera->backgroundOffset)); }
175 
176 inline PXcamera &_set::GetCamera() { return m_camera; }
177 
178 inline uint32 _set::GetPropQty() {
179  // Load the prop file
180  pcPropFile *propFile = GetProps();
181  return propFile->GetPropQty();
182 }
183 
184 inline const char *_set::GetPropName(uint32 n) {
185  // Load the prop file
186  pcPropFile *propFile = GetProps();
187  // Get the name of prop n
188  return propFile->GetProp(n)->GetName();
189 }
190 
191 inline uint32 _set::GetPropRange(uint32 n) {
192  // Load the prop file
193  pcPropFile *propFile = GetProps();
194  // Get the name of prop n
195  return propFile->GetProp(n)->GetStateQty();
196 }
197 
198 } // End of namespace ICB
199 
200 #endif
Definition: set_pc.h:59
Definition: pc_props.h:86
Definition: rlp_api.h:185
Definition: actor.h:32
Definition: pc_props.h:44
Definition: pc_props.h:295
Definition: px_staticlayers.h:43
Definition: px_camera.h:39