Allow PHOT deco, in old saves only
This commit is contained in:
parent
10a26002b4
commit
c83945e281
@ -1003,6 +1003,11 @@ void GameSave::readOPS(char * data, int dataLength)
|
|||||||
particles[newIndex].ctype = 0;
|
particles[newIndex].ctype = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case PT_PHOT:
|
||||||
|
if (savedVersion < 90)
|
||||||
|
{
|
||||||
|
particles[newIndex].flags |= FLAG_PHOTDECO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//note: PSv was used in version 77.0 and every version before, add something in PSv too if the element is that old
|
//note: PSv was used in version 77.0 and every version before, add something in PSv too if the element is that old
|
||||||
newIndex++;
|
newIndex++;
|
||||||
@ -1550,6 +1555,10 @@ void GameSave::readPSv(char * data, int dataLength)
|
|||||||
// no more particle properties to load, so we can change type here without messing up loading
|
// no more particle properties to load, so we can change type here without messing up loading
|
||||||
if (i && i<=NPART)
|
if (i && i<=NPART)
|
||||||
{
|
{
|
||||||
|
if (ver<90 && particles[i-1].type == PT_PHOT)
|
||||||
|
{
|
||||||
|
particles[i-1].flags |= FLAG_PHOTDECO;
|
||||||
|
}
|
||||||
if (ver<79 && particles[i-1].type == PT_SPNG)
|
if (ver<79 && particles[i-1].type == PT_SPNG)
|
||||||
{
|
{
|
||||||
if (fabs(particles[i-1].vx)>0.0f || fabs(particles[i-1].vy)>0.0f)
|
if (fabs(particles[i-1].vx)>0.0f || fabs(particles[i-1].vy)>0.0f)
|
||||||
|
@ -1910,6 +1910,7 @@ void LuaScriptInterface::initElementsAPI()
|
|||||||
SETCONST(l, FLAG_STAGNANT);
|
SETCONST(l, FLAG_STAGNANT);
|
||||||
SETCONST(l, FLAG_SKIPMOVE);
|
SETCONST(l, FLAG_SKIPMOVE);
|
||||||
SETCONST(l, FLAG_MOVABLE);
|
SETCONST(l, FLAG_MOVABLE);
|
||||||
|
SETCONST(l, FLAG_PHOTDECO);
|
||||||
SETCONST(l, ST_NONE);
|
SETCONST(l, ST_NONE);
|
||||||
SETCONST(l, ST_SOLID);
|
SETCONST(l, ST_SOLID);
|
||||||
SETCONST(l, ST_LIQUID);
|
SETCONST(l, ST_LIQUID);
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
#define FLAG_STAGNANT 0x1
|
#define FLAG_STAGNANT 0x1
|
||||||
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
|
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT
|
||||||
#define FLAG_WATEREQUAL 0x4 //if a liquid was already checked during equalization
|
#define FLAG_WATEREQUAL 0x4 //if a liquid was already checked during equalization
|
||||||
#define FLAG_MOVABLE 0x8 // if can move
|
#define FLAG_MOVABLE 0x8 // compatibility with old saves (moving SPNG), only applies to SPNG
|
||||||
|
#define FLAG_PHOTDECO 0x8 // compatibility with old saves (decorated photons), only applies to PHOT. Having the same value as FLAG_MOVABLE is fine because they apply to different elements, and this saves space for future flags,
|
||||||
|
|
||||||
|
|
||||||
#define ST_NONE 0
|
#define ST_NONE 0
|
||||||
#define ST_SOLID 1
|
#define ST_SOLID 1
|
||||||
|
@ -121,6 +121,10 @@ int Element_PHOT::graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
|
|
||||||
*pixel_mode &= ~PMODE_FLAT;
|
*pixel_mode &= ~PMODE_FLAT;
|
||||||
*pixel_mode |= FIRE_ADD | PMODE_ADD | NO_DECO;
|
*pixel_mode |= FIRE_ADD | PMODE_ADD | NO_DECO;
|
||||||
|
if (cpart->flags & FLAG_PHOTDECO)
|
||||||
|
{
|
||||||
|
*pixel_mode &= ~NO_DECO;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user