- Update to latest version in trunk.

SVN r3890 (scripting)
This commit is contained in:
Randy Heit 2012-10-17 04:24:54 +00:00
commit e7efa1d802
117 changed files with 2260 additions and 787 deletions

View file

@ -403,14 +403,22 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
//
//----------------------------------------------------------------------------
void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b1, float r2, float g2, float b2)
void FRemapTable::AddDesaturation(int start, int end, double r1, double g1, double b1, double r2, double g2, double b2)
{
r1 = clamp(r1, 0.0f, 2.0f);
g1 = clamp(g1, 0.0f, 2.0f);
b1 = clamp(b1, 0.0f, 2.0f);
r2 = clamp(r2, 0.0f, 2.0f);
g2 = clamp(g2, 0.0f, 2.0f);
b2 = clamp(b2, 0.0f, 2.0f);
r1 = clamp(r1, 0.0, 2.0);
g1 = clamp(g1, 0.0, 2.0);
b1 = clamp(b1, 0.0, 2.0);
r2 = clamp(r2, 0.0, 2.0);
g2 = clamp(g2, 0.0, 2.0);
b2 = clamp(b2, 0.0, 2.0);
if (start > end)
{
swapvalues(start, end);
swapvalues(r1, r2);
swapvalues(g1, g2);
swapvalues(b1, b2);
}
r2 -= r1;
g2 -= g1;
@ -419,7 +427,7 @@ void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b
g1 *= 255;
b1 *= 255;
for(int c = start; c < end; c++)
for(int c = start; c <= end; c++)
{
double intensity = (GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 +
@ -443,7 +451,7 @@ void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b
//
//----------------------------------------------------------------------------
void FRemapTable::AddToTranslation(const char * range)
void FRemapTable::AddToTranslation(const char *range)
{
int start,end;
bool desaturated = false;
@ -515,39 +523,39 @@ void FRemapTable::AddToTranslation(const char * range)
else if (sc.TokenType == '%')
{
// translation using RGB values
float r1,g1,b1,r2,g2,b2;
double r1,g1,b1,r2,g2,b2;
sc.MustGetToken('[');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
r1 = float(sc.Float);
r1 = sc.Float;
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
g1 = float(sc.Float);
g1 = sc.Float;
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
b1 = float(sc.Float);
b1 = sc.Float;
sc.MustGetToken(']');
sc.MustGetToken(':');
sc.MustGetToken('[');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
r2 = float(sc.Float);
r2 = sc.Float;
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
g2 = float(sc.Float);
g2 = sc.Float;
sc.MustGetToken(',');
sc.MustGetAnyToken();
if (sc.TokenType != TK_IntConst) sc.TokenMustBe(TK_FloatConst);
b2 = float(sc.Float);
b2 = sc.Float;
sc.MustGetToken(']');
AddDesaturation(start, end, r1, g1, b1, r2, g2, b2);

View file

@ -38,7 +38,7 @@ struct FRemapTable
void Serialize(FArchive &ar);
void AddIndexRange(int start, int end, int pal1, int pal2);
void AddColorRange(int start, int end, int r1,int g1, int b1, int r2, int g2, int b2);
void AddDesaturation(int start, int end, float r1,float g1, float b1, float r2, float g2, float b2);
void AddDesaturation(int start, int end, double r1, double g1, double b1, double r2, double g2, double b2);
void AddToTranslation(const char * range);
int StoreTranslation();

View file

@ -423,6 +423,10 @@ static void R_ExtendSpriteFrames(spritedef_t &spr, int frame)
// at all, so we can tack the new frames directly on to the end
// of the SpriteFrames array.
newstart = SpriteFrames.Reserve(frame - spr.numframes);
if (spr.numframes == 0)
{
spr.spriteframes = WORD(newstart);
}
}
else
{ // We need to allocate space for all the sprite's frames and copy
@ -439,7 +443,6 @@ static void R_ExtendSpriteFrames(spritedef_t &spr, int frame)
// Initialize all new frames to 0.
memset(&SpriteFrames[newstart], 0, sizeof(spriteframe_t)*(frame - spr.numframes));
spr.numframes = frame;
spr.spriteframes = newstart;
}
//==========================================================================

View file

@ -71,7 +71,7 @@ TDeletingArray<FVoxelDef *> VoxelDefs;
struct VoxelOptions
{
VoxelOptions()
: DroppedSpin(0), PlacedSpin(0), Scale(FRACUNIT), AngleOffset(0)
: DroppedSpin(0), PlacedSpin(0), Scale(FRACUNIT), AngleOffset(ANGLE_90)
{}
int DroppedSpin;
@ -332,7 +332,7 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin)
voxdef->Voxel = vox;
voxdef->Scale = FRACUNIT;
voxdef->DroppedSpin = voxdef->PlacedSpin = spin;
voxdef->AngleOffset = 0;
voxdef->AngleOffset = ANGLE_90;
Voxels.Push(vox);
VoxelDefs.Push(voxdef);
@ -508,7 +508,7 @@ static void VOX_ReadOptions(FScanner &sc, VoxelOptions &opts)
{
sc.TokenMustBe(TK_FloatConst);
}
opts.AngleOffset = angle_t(sc.Float * ANGLE_180 / 180.0);
opts.AngleOffset = ANGLE_90 + angle_t(sc.Float * ANGLE_180 / 180.0);
}
else
{