OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4PXS.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Pixel Sprite system for tiny bits of moving material */
19 
20 #include "C4Include.h"
21 #include "landscape/C4PXS.h"
22 
23 #include "c4group/C4Components.h"
24 #include "config/C4Config.h"
25 #include "game/C4Physics.h"
26 #include "lib/C4Random.h"
27 #include "landscape/C4Weather.h"
28 #include "control/C4Record.h"
29 #include "lib/StdColors.h"
30 #include "graphics/C4Draw.h"
31 
32 static const C4Real WindDrift_Factor = itofix(1, 800);
33 
35 {
36 #ifdef DEBUGREC_PXS
38  {
39  C4RCExecPXS rc;
40  rc.x=x; rc.y=y; rc.iMat=Mat;
41  rc.pos = 0;
42  AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
43  }
44 #endif
45  int32_t inmat;
46 
47  // Safety
48  if (!MatValid(Mat))
49  { Deactivate(); return; }
50 
51  // Out of bounds
52  if ((x<0) || (x>=::Landscape.GetWidth()) || (y<-10) || (y>=::Landscape.GetHeight()))
53  { Deactivate(); return; }
54 
55  // Material conversion
56  int32_t iX = fixtoi(x), iY = fixtoi(y);
57  inmat=GBackMat(iX,iY);
59  if (pReact && (*pReact->pFunc)(pReact, iX,iY, iX,iY, xdir,ydir, Mat,inmat, meePXSPos, nullptr))
60  { Deactivate(); return; }
61 
62  // Gravity
63  ydir+=GravAccel;
64 
65  if (GBackDensity(iX, iY + 1) < ::MaterialMap.Map[Mat].Density)
66  {
67  // Air speed: Wind plus some random
68  int32_t iWind = Weather.GetWind(iX, iY);
69  C4Real txdir = itofix(iWind, 15) + C4REAL256(Random(1200) - 600);
70  C4Real tydir = C4REAL256(Random(1200) - 600);
71 
72  // Air friction, based on WindDrift. MaxSpeed is ignored.
73  int32_t iWindDrift = std::max(::MaterialMap.Map[Mat].WindDrift - 20, 0);
74  xdir += ((txdir - xdir) * iWindDrift) * WindDrift_Factor;
75  ydir += ((tydir - ydir) * iWindDrift) * WindDrift_Factor;
76  }
77 
78  C4Real ctcox = x + xdir;
79  C4Real ctcoy = y + ydir;
80 
81  int32_t iToX = fixtoi(ctcox), iToY = fixtoi(ctcoy);
82 
83  // In bounds?
84  if (Inside<int32_t>(iToX, 0, ::Landscape.GetWidth()-1) && Inside<int32_t>(iToY, 0, ::Landscape.GetHeight()-1))
85  // Check path
86  if (::Landscape._PathFree(iX, iY, iToX, iToY))
87  {
88  x=ctcox; y=ctcoy;
89  return;
90  }
91 
92  // Test path to target position
93  int32_t iX0 = iX, iY0 = iY;
94  bool fStopMovement = false;
95  do
96  {
97  // Step
98  int32_t inX = iX + Sign(iToX - iX), inY = iY + Sign(iToY - iY);
99  // Contact?
100  inmat = GBackMat(inX, inY);
102  if (pReact)
103  {
104  if ((*pReact->pFunc)(pReact, iX,iY, inX,inY, xdir,ydir, Mat,inmat, meePXSMove, &fStopMovement))
105  {
106  // destructive contact
107  Deactivate();
108  return;
109  }
110  else
111  {
112  // no destructive contact, but speed or position changed: Stop moving for now
113  if (fStopMovement)
114  {
115  // But keep fractional positions to allow proper movement on moving ground
116  if (iX != iX0) x = itofix(iX);
117  if (iY != iY0) y = itofix(iY);
118  return;
119  }
120  // there was a reaction func, but it didn't do anything - continue movement
121  }
122  }
123  iX = inX; iY = inY;
124  }
125  while (iX != iToX || iY != iToY);
126 
127  // No contact? Free movement
128  x=ctcox; y=ctcoy;
129 #ifdef DEBUGREC_PXS
130  if (Config.General.DebugRec)
131  {
132  C4RCExecPXS rc;
133  rc.x=x; rc.y=y; rc.iMat=Mat;
134  rc.pos = 1;
135  AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
136  }
137 #endif
138  return;
139 }
140 
142 {
143 #ifdef DEBUGREC_PXS
144  if (Config.General.DebugRec)
145  {
146  C4RCExecPXS rc;
147  rc.x=x; rc.y=y; rc.iMat=Mat;
148  rc.pos = 2;
149  AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
150  }
151 #endif
152  Mat=MNone;
153  ::PXS.Delete(this);
154 }
155 
157 {
158  Default();
159 }
160 
162 {
163  Clear();
164 }
165 
167 {
168  Count=0;
169  for (unsigned int cnt=0; cnt<PXSMaxChunk; cnt++)
170  {
171  Chunk[cnt]=nullptr;
172  iChunkPXS[cnt]=0;
173  }
174 }
175 
177 {
178  for (unsigned int cnt=0; cnt<PXSMaxChunk; cnt++)
179  {
180  if (Chunk[cnt]) delete [] Chunk[cnt];
181  Chunk[cnt]=nullptr;
182  iChunkPXS[cnt]=0;
183  }
184 }
185 
187 {
188  unsigned int cnt,cnt2;
189  C4PXS *pxp;
190  // Check chunks for available space
191  for (cnt=0; cnt<PXSMaxChunk; cnt++)
192  {
193  // Create new chunk if necessary
194  if (!Chunk[cnt])
195  {
196  if (!(Chunk[cnt]=new C4PXS[PXSChunkSize])) return nullptr;
197  iChunkPXS[cnt] = 0;
198  }
199  // Check this chunk for space
200  if (iChunkPXS[cnt] < PXSChunkSize)
201  for (cnt2=0,pxp=Chunk[cnt]; cnt2<PXSChunkSize; cnt2++,pxp++)
202  if (pxp->Mat==MNone)
203  {
204  // count them
205  iChunkPXS[cnt]++;
206  return pxp;
207  }
208  }
209  return nullptr;
210 }
211 
212 bool C4PXSSystem::Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir, C4Real iydir)
213 {
214  C4PXS *pxp;
215  if (!MatValid(mat)) return false;
216  if (!(pxp=New())) return false;
217  pxp->Mat=mat;
218  pxp->x=ix; pxp->y=iy;
219  pxp->xdir=ixdir; pxp->ydir=iydir;
220  return true;
221 }
222 
224 {
225  // Execute all chunks
226  Count=0;
227  for (unsigned int cchunk=0; cchunk<PXSMaxChunk; cchunk++)
228  if (Chunk[cchunk])
229  {
230  // empty chunk?
231  if (!iChunkPXS[cchunk])
232  { delete [] Chunk[cchunk]; Chunk[cchunk]=nullptr; }
233  else
234  {
235  // Execute chunk pxs, check for empty
236  C4PXS *pxp = Chunk[cchunk];
237  for (unsigned int cnt2=0; cnt2<PXSChunkSize; cnt2++,pxp++)
238  if (pxp->Mat!=MNone)
239  {
240  pxp->Execute();
241  Count++;
242  }
243  }
244  }
245 }
246 
248 {
249  // Draw PXS in this region
250  C4Rect VisibleRect(cgo.TargetX, cgo.TargetY, cgo.Wdt, cgo.Hgt);
251  VisibleRect.Enlarge(20);
252 
253  // Go through all PXS and build vertex arrays. The vertex arrays are
254  // then submitted to the GL in one go.
255  std::vector<C4BltVertex> pixVtx;
256  std::vector<C4BltVertex> lineVtx;
257  std::map<int, std::vector<C4BltVertex> > bltVtx;
258  // TODO: reserve some space to avoid too many allocations
259  // TODO: keep vertex mem allocated between draw invocations
260 
261  float cgox = cgo.X - cgo.TargetX, cgoy = cgo.Y - cgo.TargetY;
262  // First pass: draw simple PXS (lines/pixels)
263  unsigned int cnt;
264  for (cnt=0; cnt < PXSMaxChunk; cnt++)
265  {
266  if (Chunk[cnt] && iChunkPXS[cnt])
267  {
268  C4PXS *pxp = Chunk[cnt];
269  for (unsigned int cnt2 = 0; cnt2 < PXSChunkSize; cnt2++, pxp++)
270  if (pxp->Mat != MNone && VisibleRect.Contains(fixtoi(pxp->x), fixtoi(pxp->y)))
271  {
272  C4Material *pMat = &::MaterialMap.Map[pxp->Mat];
273  const DWORD dwMatClr = ::Landscape.GetPal()->GetClr((BYTE) (Mat2PixColDefault(pxp->Mat)));
274  if(pMat->PXSFace.Surface)
275  {
276  int32_t pnx, pny;
277  pMat->PXSFace.GetPhaseNum(pnx, pny);
278  int32_t fcWdt = pMat->PXSFace.Wdt;
279  int32_t fcHgt = pMat->PXSFace.Hgt;
280  // calculate draw width and tile to use (random-ish)
281  uint32_t size = (1103515245 * (cnt * PXSChunkSize + cnt2) + 12345) >> 3;
282  float z = pMat->PXSGfxSize * (0.625f + 0.05f * int(size % 16));
283  pny = (cnt2 / pnx) % pny; pnx = cnt2 % pnx;
284 
285  const float w = z;
286  const float h = z * fcHgt / fcWdt;
287  const float x1 = fixtof(pxp->x) + cgox + z * pMat->PXSGfxRt.tx / fcWdt;
288  const float y1 = fixtof(pxp->y) + cgoy + z * pMat->PXSGfxRt.ty / fcHgt;
289  const float x2 = x1 + w;
290  const float y2 = y1 + h;
291 
292  const float sfcWdt = pMat->PXSFace.Surface->Wdt;
293  const float sfcHgt = pMat->PXSFace.Surface->Hgt;
294 
295  C4BltVertex vtx[6];
296  vtx[0].tx = (pnx + 0.f) * fcWdt / sfcWdt; vtx[0].ty = (pny + 0.f) * fcHgt / sfcHgt;
297  vtx[0].ftx = x1; vtx[0].fty = y1;
298  vtx[1].tx = (pnx + 1.f) * fcWdt / sfcWdt; vtx[1].ty = (pny + 0.f) * fcHgt / sfcHgt;
299  vtx[1].ftx = x2; vtx[1].fty = y1;
300  vtx[2].tx = (pnx + 1.f) * fcWdt / sfcWdt; vtx[2].ty = (pny + 1.f) * fcHgt / sfcHgt;
301  vtx[2].ftx = x2; vtx[2].fty = y2;
302  vtx[3].tx = (pnx + 0.f) * fcWdt / sfcWdt; vtx[3].ty = (pny + 1.f) * fcHgt / sfcHgt;
303  vtx[3].ftx = x1; vtx[3].fty = y2;
304  DwTo4UB(0xFFFFFFFF, vtx[0].color);
305  DwTo4UB(0xFFFFFFFF, vtx[1].color);
306  DwTo4UB(0xFFFFFFFF, vtx[2].color);
307  DwTo4UB(0xFFFFFFFF, vtx[3].color);
308  vtx[4] = vtx[2];
309  vtx[5] = vtx[0];
310 
311  std::vector<C4BltVertex>& vec = bltVtx[pxp->Mat];
312  vec.push_back(vtx[0]);
313  vec.push_back(vtx[1]);
314  vec.push_back(vtx[2]);
315  vec.push_back(vtx[3]);
316  vec.push_back(vtx[4]);
317  vec.push_back(vtx[5]);
318  }
319  else
320  {
321  // old-style: unicolored pixels or lines
322  if (fixtoi(pxp->xdir) || fixtoi(pxp->ydir))
323  {
324  // lines for stuff that goes whooosh!
325  int len = fixtoi(Abs(pxp->xdir) + Abs(pxp->ydir));
326  const DWORD dwMatClrLen = uint32_t(std::max<int>(dwMatClr >> 24, 195 - (195 - (dwMatClr >> 24)) / len)) << 24 | (dwMatClr & 0xffffff);
327  C4BltVertex begin, end;
328  begin.ftx = fixtof(pxp->x - pxp->xdir) + cgox; begin.fty = fixtof(pxp->y - pxp->ydir) + cgoy;
329  end.ftx = fixtof(pxp->x) + cgox; end.fty = fixtof(pxp->y) + cgoy;
330  DwTo4UB(dwMatClrLen, begin.color);
331  DwTo4UB(dwMatClrLen, end.color);
332  lineVtx.push_back(begin);
333  lineVtx.push_back(end);
334  }
335  else
336  {
337  // single pixels for slow stuff
338  C4BltVertex vtx;
339  vtx.ftx = fixtof(pxp->x) + cgox;
340  vtx.fty = fixtof(pxp->y) + cgoy;
341  DwTo4UB(dwMatClr, vtx.color);
342  pixVtx.push_back(vtx);
343  }
344  }
345  }
346  }
347  }
348 
349  if(!pixVtx.empty()) pDraw->PerformMultiPix(cgo.Surface, &pixVtx[0], pixVtx.size(), nullptr);
350  if(!lineVtx.empty()) pDraw->PerformMultiLines(cgo.Surface, &lineVtx[0], lineVtx.size(), 1.0f, nullptr);
351 
352  // PXS graphics disabled?
353  if (!Config.Graphics.PXSGfx)
354  return;
355 
356  for(std::map<int, std::vector<C4BltVertex> >::const_iterator iter = bltVtx.begin(); iter != bltVtx.end(); ++iter)
357  {
358  C4Material *pMat = &::MaterialMap.Map[iter->first];
359  pDraw->PerformMultiTris(cgo.Surface, &iter->second[0], iter->second.size(), nullptr, pMat->PXSFace.Surface->texture.get(), nullptr, nullptr, 0, nullptr);
360  }
361 }
362 
363 void C4PXSSystem::Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level)
364 {
365  int32_t cnt;
366  for (cnt=0; cnt<num; cnt++)
367  {
368  // Must do these calculation steps separately, because the order of
369  // invokations of Random() is not defined if they're used as parameters
370  C4Real xdir = itofix(Random(level+1)-level/2); xdir/=10;
371  C4Real ydir = itofix(Random(level+1)-level); ydir/=10;
372  Create(mat,
373  itofix(tx),itofix(ty),
374  xdir,
375  ydir);
376  }
377 }
378 
380 {
381  unsigned int cnt;
382 
383  // Check used chunk count
384  int32_t iChunks=0;
385  for (cnt=0; cnt<PXSMaxChunk; cnt++)
386  if (Chunk[cnt] && iChunkPXS[cnt])
387  iChunks++;
388  if (!iChunks)
389  {
390  hGroup.Delete(C4CFN_PXS);
391  return true;
392  }
393 
394  // Save chunks to temp file
395  CStdFile hTempFile;
396  if (!hTempFile.Create(Config.AtTempPath(C4CFN_TempPXS)))
397  return false;
398 #ifdef C4REAL_USE_FIXNUM
399  int32_t iNumFormat = 1;
400 #else
401  int32_t iNumFormat = 2;
402 #endif
403  if (!hTempFile.Write(&iNumFormat, sizeof (iNumFormat)))
404  return false;
405  for (cnt=0; cnt<PXSMaxChunk; cnt++)
406  if (Chunk[cnt]) // must save all chunks in order to keep order consistent on all clients
407  if (!hTempFile.Write(Chunk[cnt],PXSChunkSize * sizeof(C4PXS)))
408  return false;
409 
410  if (!hTempFile.Close())
411  return false;
412 
413  // Move temp file to group
414  if (!hGroup.Move( Config.AtTempPath(C4CFN_TempPXS),
415  C4CFN_PXS ))
416  return false;
417 
418  return true;
419 }
420 
422 {
423  // load new
424  size_t iBinSize,iChunkNum,cnt2;
425  size_t iChunkSize = PXSChunkSize * sizeof(C4PXS);
426  if (!hGroup.AccessEntry(C4CFN_PXS,&iBinSize)) return false;
427  // clear previous
428  Clear();
429  // using C4Real or float?
430  int32_t iNumForm = 1;
431  if (iBinSize % iChunkSize == 4)
432  {
433  if (!hGroup.Read(&iNumForm, sizeof (iNumForm))) return false;
434  if (!Inside<int32_t>(iNumForm, 1, 2)) return false;
435  iBinSize -= 4;
436  }
437  // old pxs-files have no tag for the number format
438  else if (iBinSize % iChunkSize != 0) return false;
439  // calc chunk count
440  iChunkNum = iBinSize / iChunkSize;
441  if (iChunkNum > PXSMaxChunk) return false;
442  for (uint32_t cnt=0; cnt<iChunkNum; cnt++)
443  {
444  if (!(Chunk[cnt]=new C4PXS[PXSChunkSize])) return false;
445  if (!hGroup.Read(Chunk[cnt],iChunkSize)) return false;
446  // count the PXS, Peter!
447  // convert num format, if neccessary
448  C4PXS *pxp; iChunkPXS[cnt]=0;
449  for (cnt2=0,pxp=Chunk[cnt]; cnt2<PXSChunkSize; cnt2++,pxp++)
450  if (pxp->Mat != MNone)
451  {
452  ++iChunkPXS[cnt];
453  // convert number format
454 #ifdef C4REAL_USE_FIXNUM
455  if (iNumForm == 2) { FLOAT_TO_FIXED(&pxp->x); FLOAT_TO_FIXED(&pxp->y); FLOAT_TO_FIXED(&pxp->xdir); FLOAT_TO_FIXED(&pxp->ydir); }
456 #else
457  if (iNumForm == 1) { FIXED_TO_FLOAT(&pxp->x); FIXED_TO_FLOAT(&pxp->y); FIXED_TO_FLOAT(&pxp->xdir); FIXED_TO_FLOAT(&pxp->ydir); }
458 #endif
459  }
460  }
461  return true;
462 }
463 
465 {
466  Count=0;
467 }
468 
470 {
471  // consolidate chunks; remove empty chunks
472  C4PXS **pDestChunk = Chunk;
473  int32_t iDestChunk = 0;
474  for (unsigned int cnt=0; cnt<PXSMaxChunk; cnt++)
475  {
476  if (Chunk[cnt])
477  {
478  if (iChunkPXS[cnt])
479  {
480  *pDestChunk++ = Chunk[cnt];
481  iChunkPXS[iDestChunk++] = iChunkPXS[cnt];
482  }
483  else
484  {
485  delete [] Chunk[cnt];
486  Chunk[cnt] = nullptr;
487  }
488  }
489  }
490 }
491 
493 {
494  // find chunk
495  unsigned int cnt;
496  for (cnt = 0; cnt < PXSMaxChunk; cnt++)
497  if (Chunk[cnt] && iChunkPXS[cnt])
498  if (pPXS >= Chunk[cnt] && pPXS < Chunk[cnt] + PXSChunkSize)
499  break;
500  // decrease pxs counter
501  if (cnt < PXSMaxChunk)
502  iChunkPXS[cnt]--;
503 }
504 
505 int32_t C4PXSSystem::GetCount(int32_t mat) const
506 {
507  // count PXS of given material
508  int32_t result = 0;
509  for (size_t cnt = 0; cnt < PXSMaxChunk; cnt++) if (Chunk[cnt] && iChunkPXS[cnt])
510  {
511  C4PXS *pxp = Chunk[cnt];
512  for (size_t cnt2 = 0; cnt2 < PXSChunkSize; cnt2++, pxp++) if (pxp->Mat == mat) ++result;
513  }
514  return result;
515 }
516 
517 int32_t C4PXSSystem::GetCount(int32_t mat, int32_t x, int32_t y, int32_t wdt, int32_t hgt) const
518 {
519  // count PXS of given material in given area
520  int32_t result = 0;
521  for (size_t cnt = 0; cnt < PXSMaxChunk; cnt++) if (Chunk[cnt] && iChunkPXS[cnt])
522  {
523  C4PXS *pxp = Chunk[cnt];
524  for (size_t cnt2 = 0; cnt2 < PXSChunkSize; cnt2++, pxp++)
525  if (pxp->Mat != MNone)
526  if (pxp->Mat == mat || mat == MNone)
527  if (Inside(pxp->x, x, x + wdt - 1) && Inside(pxp->y, y, y + hgt - 1)) ++result;
528  }
529  return result;
530 }
531 
C4PXS * New()
Definition: C4PXS.cpp:186
bool Close(StdBuf **ppMemory=nullptr)
Definition: CStdFile.cpp:155
C4MaterialReaction * GetReactionUnsafe(int32_t iPXSMat, int32_t iLandscapeMat)
Definition: C4Material.h:193
float fty
Definition: C4Draw.h:64
C4Real y
Definition: C4Record.h:171
bool Contains(int32_t iX, int32_t iY) const
Definition: C4Rect.h:42
C4Config Config
Definition: C4Config.cpp:831
int32_t iMat
Definition: C4Record.h:173
void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level)
Definition: C4PXS.cpp:363
float Y
Definition: C4Facet.h:120
#define z
uint32_t Random()
Definition: C4Random.cpp:43
int Wdt
Definition: C4Surface.h:67
float tx
Definition: C4Draw.h:62
C4TargetRect PXSGfxRt
Definition: C4Material.h:119
bool Create(const char *szFileName, bool fCompressed=false, bool fExecutable=false, bool fMemory=false)
Definition: CStdFile.cpp:53
bool AccessEntry(const char *szWildCard, size_t *iSize=nullptr, char *sFileName=nullptr, bool NeedsToBeAGroup=false)
Definition: C4Group.cpp:1695
C4ConfigGeneral General
Definition: C4Config.h:252
unsigned char color[4]
Definition: C4Draw.h:63
bool GetPhaseNum(int32_t &rX, int32_t &rY)
Definition: C4Facet.cpp:472
C4Material * Map
Definition: C4Material.h:171
void Default()
Definition: C4PXS.cpp:166
C4PXS * Chunk[PXSMaxChunk]
Definition: C4PXS.h:47
Definition: C4PXS.h:25
void Synchronize()
Definition: C4PXS.cpp:464
#define GravAccel
Definition: C4Physics.h:29
Definition: C4Rect.h:29
uint8_t BYTE
bool _PathFree(int32_t x, int32_t y, int32_t x2, int32_t y2) const
int Sign(T val)
Definition: Standard.h:47
bool Delete(const char *szFiles, bool fRecursive=false)
Definition: C4Group.cpp:1334
bool Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir=Fix0, C4Real iydir=Fix0)
Definition: C4PXS.cpp:212
float ty
Definition: C4Draw.h:62
C4Real y
Definition: C4PXS.h:31
int Hgt
Definition: C4Surface.h:67
virtual void PerformMultiTris(C4Surface *sfcTarget, const C4BltVertex *vertices, unsigned int n_vertices, const C4BltTransform *pTransform, C4TexRef *pTex, C4TexRef *pOverlay, C4TexRef *pNormal, DWORD dwOverlayClrMod, C4ShaderCall *shader_call)=0
bool Save(C4Group &hGroup)
Definition: C4PXS.cpp:379
Definition: C4Real.h:58
C4MaterialReactionFunc pFunc
Definition: C4Material.h:49
DWORD GetClr(BYTE byCol)
Definition: StdColors.h:188
C4ConfigGraphics Graphics
Definition: C4Config.h:254
void DwTo4UB(DWORD dwClr, unsigned char(&r)[4])
Definition: C4Draw.h:29
C4Real ydir
Definition: C4PXS.h:31
C4PXSSystem()
Definition: C4PXS.cpp:156
void Deactivate()
Definition: C4PXS.cpp:141
bool Write(const void *pBuffer, int iSize)
Definition: CStdFile.cpp:244
const int32_t MNone
Definition: C4Constants.h:178
void Clear()
Definition: C4PXS.cpp:176
C4Real x
Definition: C4Record.h:171
virtual void PerformMultiPix(C4Surface *sfcTarget, const C4BltVertex *vertices, unsigned int n_vertices, C4ShaderCall *shader_call)=0
bool Load(C4Group &hGroup)
Definition: C4PXS.cpp:421
C4Landscape Landscape
void SyncClearance()
Definition: C4PXS.cpp:469
bool Move(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1325
int32_t tx
Definition: C4Rect.h:81
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:36
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
C4Draw * pDraw
Definition: C4Draw.cpp:45
int32_t ty
Definition: C4Rect.h:81
virtual void PerformMultiLines(C4Surface *sfcTarget, const C4BltVertex *vertices, unsigned int n_vertices, float width, C4ShaderCall *shader_call)=0
C4Weather Weather
Definition: C4Weather.cpp:207
C4PXSSystem PXS
Definition: C4PXS.cpp:532
void Draw(C4TargetFacet &cgo)
Definition: C4PXS.cpp:247
const size_t PXSMaxChunk
Definition: C4PXS.h:37
int32_t Mat
Definition: C4PXS.h:30
int32_t PXSGfx
Definition: C4Config.h:110
const size_t PXSChunkSize
Definition: C4PXS.h:37
int32_t Density
Definition: C4Material.h:94
int32_t GetHeight() const
int32_t PXSGfxSize
Definition: C4Material.h:120
std::unique_ptr< C4TexRef > texture
Definition: C4Surface.h:80
float TargetX
Definition: C4Facet.h:167
int32_t WindDrift
Definition: C4Material.h:107
~C4PXSSystem()
Definition: C4PXS.cpp:161
float Hgt
Definition: C4Facet.h:120
int32_t GBackDensity(int32_t x, int32_t y)
Definition: C4Landscape.h:227
void Enlarge(int32_t iByX, int32_t iByY)
Definition: C4Rect.h:53
int32_t pos
Definition: C4Record.h:175
C4Real xdir
Definition: C4PXS.h:31
int32_t GetCount() const
Definition: C4PXS.h:61
C4MaterialMap MaterialMap
Definition: C4Material.cpp:970
CStdPalette * GetPal() const
C4Real x
Definition: C4PXS.h:31
float ftx
Definition: C4Draw.h:64
float fixtof(const C4Fixed &x)
Definition: C4Real.h:257
BYTE Mat2PixColDefault(int32_t mat)
Definition: C4Material.h:237
#define C4CFN_PXS
Definition: C4Components.h:75
int32_t DebugRec
Definition: C4Config.h:61
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:538
T Abs(T val)
Definition: Standard.h:44
void Execute()
Definition: C4PXS.cpp:223
C4Surface * Surface
Definition: C4Facet.h:119
float TargetY
Definition: C4Facet.h:167
uint32_t DWORD
#define C4CFN_TempPXS
Definition: C4Components.h:158
int fixtoi(const C4Fixed &x)
Definition: C4Real.h:259
void Execute()
Definition: C4PXS.cpp:34
bool MatValid(int32_t mat)
Definition: C4Material.h:212
C4Facet PXSFace
Definition: C4Material.h:159
float Wdt
Definition: C4Facet.h:120
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:45
float X
Definition: C4Facet.h:120
int32_t GBackMat(int32_t x, int32_t y)
Definition: C4Landscape.h:222
void FLOAT_TO_FIXED(C4Real *pVal)
Definition: C4Real.h:318
int32_t GetWidth() const
size_t iChunkPXS[PXSMaxChunk]
Definition: C4PXS.h:48
C4Real C4REAL256(int x)
Definition: C4Real.h:268
int32_t GetWind(int32_t x, int32_t y)
Definition: C4Weather.cpp:95
int32_t Count
Definition: C4PXS.h:45
bool Read(void *pBuffer, size_t iSize) override
Definition: C4Group.cpp:1125
void Delete(C4PXS *pPXS)
Definition: C4PXS.cpp:492