56 if (pReact && (*pReact->
pFunc)(pReact, iX,iY, iX,iY,
xdir,
ydir,
Mat,inmat,
meePXSPos,
nullptr))
71 xdir += ((txdir -
xdir) * iWindDrift) * WindDrift_Factor;
72 ydir += ((tydir -
ydir) * iWindDrift) * WindDrift_Factor;
90 int32_t iX0 = iX, iY0 = iY;
91 bool fStopMovement =
false;
95 int32_t inX = iX +
Sign(iToX - iX), inY = iY +
Sign(iToY - iY);
101 if ((*pReact->
pFunc)(pReact, iX,iY, inX,inY,
xdir,
ydir,
Mat,inmat,
meePXSMove, &fStopMovement))
122 while (iX != iToX || iY != iToY);
179 if (!(pxp=
New()))
return false;
181 pxp->
x=ix; pxp->
y=iy;
188 for (
size_t i = 0; i <
Count; i++)
206 std::vector<C4BltVertex> pixVtx;
207 std::vector<C4BltVertex> lineVtx;
208 std::map<int, std::vector<C4BltVertex> > bltVtx;
214 for (
size_t i = 0; i <
Count; i++)
228 uint32_t size = (1103515245 * i + 12345) >> 3;
229 float z = pMat->
PXSGfxSize * (0.625f + 0.05f * int(size % 16));
230 pny = (i / pnx) % pny; pnx = i % pnx;
233 const float h =
z * fcHgt / fcWdt;
236 const float x2 = x1 + w;
237 const float y2 = y1 + h;
243 vtx[0].
tx = (pnx + 0.f) * fcWdt / sfcWdt; vtx[0].
ty = (pny + 0.f) * fcHgt / sfcHgt;
244 vtx[0].
ftx = x1; vtx[0].
fty = y1;
245 vtx[1].
tx = (pnx + 1.f) * fcWdt / sfcWdt; vtx[1].
ty = (pny + 0.f) * fcHgt / sfcHgt;
246 vtx[1].
ftx = x2; vtx[1].
fty = y1;
247 vtx[2].
tx = (pnx + 1.f) * fcWdt / sfcWdt; vtx[2].
ty = (pny + 1.f) * fcHgt / sfcHgt;
248 vtx[2].
ftx = x2; vtx[2].
fty = y2;
249 vtx[3].
tx = (pnx + 0.f) * fcWdt / sfcWdt; vtx[3].
ty = (pny + 1.f) * fcHgt / sfcHgt;
250 vtx[3].
ftx = x1; vtx[3].
fty = y2;
251 DwTo4UB(0xFFFFFFFF, vtx[0].color);
252 DwTo4UB(0xFFFFFFFF, vtx[1].color);
253 DwTo4UB(0xFFFFFFFF, vtx[2].color);
254 DwTo4UB(0xFFFFFFFF, vtx[3].color);
258 std::vector<C4BltVertex>& vec = bltVtx[pxp->
Mat];
259 vec.push_back(vtx[0]);
260 vec.push_back(vtx[1]);
261 vec.push_back(vtx[2]);
262 vec.push_back(vtx[3]);
263 vec.push_back(vtx[4]);
264 vec.push_back(vtx[5]);
273 const DWORD dwMatClrLen = uint32_t(std::max<int>(dwMatClr >> 24, 195 - (195 - (dwMatClr >> 24)) / len)) << 24 | (dwMatClr & 0xffffff);
279 lineVtx.push_back(begin);
280 lineVtx.push_back(end);
289 pixVtx.push_back(vtx);
302 for(std::map<
int, std::vector<C4BltVertex> >::const_iterator iter = bltVtx.begin(); iter != bltVtx.end(); ++iter)
312 for (cnt=0; cnt<num; cnt++)
337 #ifdef C4REAL_USE_FIXNUM
338 int32_t iNumFormat = 1;
340 int32_t iNumFormat = 2;
342 if (!hTempFile.
Write(&iNumFormat, sizeof (iNumFormat)))
347 if (!hTempFile.
Close())
361 size_t iBinSize, PXSNum;
366 int32_t iNumForm = 1;
367 if (iBinSize %
sizeof(
C4PXS) == 4)
369 if (!hGroup.
Read(&iNumForm, sizeof (iNumForm)))
return false;
370 if (!Inside<int32_t>(iNumForm, 1, 2))
return false;
374 else if (iBinSize %
sizeof(
C4PXS) != 0)
return false;
376 PXSNum = iBinSize /
sizeof(
C4PXS);
377 if (PXSNum >
PXSMax)
return false;
378 if (!hGroup.
Read(
PXS, iBinSize))
return false;
382 for (
size_t i = 0; i <
Count; i++)
388 #ifdef C4REAL_USE_FIXNUM
391 if (iNumForm == 1) { FIXED_TO_FLOAT(&pxp->
x); FIXED_TO_FLOAT(&pxp->
y); FIXED_TO_FLOAT(&pxp->
xdir); FIXED_TO_FLOAT(&pxp->
ydir); }
402 for (
size_t i = 0; i <
Count; i++)
404 if (
PXS[i].Mat == mat) ++result;
413 for (
size_t i = 0; i <
Count; i++)
416 if (pxp->
Mat == mat || mat ==
MNone)
417 if (
Inside(pxp->
x, x, x + wdt - 1) &&
Inside(pxp->
y, y, y + hgt - 1))
void DwTo4UB(DWORD dwClr, unsigned char(&r)[4])
constexpr bool DEBUGREC_PXS
int32_t GBackMat(int32_t x, int32_t y)
int32_t GBackDensity(int32_t x, int32_t y)
C4MaterialMap MaterialMap
bool MatValid(int32_t mat)
BYTE Mat2PixColDefault(int32_t mat)
float fixtof(const C4Fixed &x)
C4Fixed itofix(int32_t x)
int fixtoi(const C4Fixed &x)
void FLOAT_TO_FIXED(C4Real *pVal)
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
bool Inside(T ival, U lbound, V rbound)
const char * AtTempPath(const char *filename)
C4ConfigGraphics Graphics
virtual void PerformMultiLines(C4Surface *sfcTarget, const C4BltVertex *vertices, unsigned int n_vertices, float width, C4ShaderCall *shader_call)=0
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
virtual void PerformMultiPix(C4Surface *sfcTarget, const C4BltVertex *vertices, unsigned int n_vertices, C4ShaderCall *shader_call)=0
bool GetPhaseNum(int32_t &rX, int32_t &rY)
bool Read(void *buffer, size_t size) override
bool AccessEntry(const char *wildcard, size_t *size=nullptr, char *filename=nullptr, bool needs_to_be_a_group=false)
bool Move(const char *filename, const char *entry_name)
bool Delete(const char *files, bool recursive=false)
CStdPalette * GetPal() const
int32_t GetHeight() const
bool _PathFree(int32_t x, int32_t y, int32_t x2, int32_t y2) const
C4MaterialReaction * GetReactionUnsafe(int32_t iPXSMat, int32_t iLandscapeMat)
void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level)
bool Save(C4Group &hGroup)
bool Load(C4Group &hGroup)
bool Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir=Fix0, C4Real iydir=Fix0)
void Draw(C4TargetFacet &cgo)
void Enlarge(int32_t iByX, int32_t iByY)
bool Contains(int32_t iX, int32_t iY) const
std::unique_ptr< C4TexRef > texture
int32_t GetWind(int32_t x, int32_t y)
bool Close(StdBuf **ppMemory=nullptr)
bool Create(const char *szFileName, bool fCompressed=false, bool fExecutable=false, bool fMemory=false)
bool Write(const void *pBuffer, int iSize)
C4MaterialReactionFunc pFunc