Merge branch 'master' into Glew_Version_For_Real

This commit is contained in:
Christoph Oelckers 2014-06-14 01:24:45 +02:00
commit 4ad1e0b4cb
5 changed files with 65 additions and 27 deletions

View File

@ -1307,7 +1307,7 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags)
}
// Clears the entire inventory and gives back the defaults for starting a game
if (flags & CHANGELEVEL_RESETINVENTORY)
if ((flags & CHANGELEVEL_RESETINVENTORY) && p->playerstate != PST_DEAD)
{
p->mo->ClearInventory();
p->mo->GiveDefaultInventory();

View File

@ -335,7 +335,7 @@ FString M_GetCachePath(bool create)
char pathstr[PATH_MAX];
FSRef folder;
if (noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX))
{
path = pathstr;

View File

@ -959,6 +959,7 @@ bool P_LoadGLNodes(MapData * map)
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
{
bool ret = false;
bool loaded = false;
// If the map loading code has performed a node rebuild we don't need to check for it again.
if (!rebuilt && !P_CheckForGLNodes())
@ -978,7 +979,8 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
numsegs = 0;
// Try to load GL nodes (cached or GWA)
if (!P_LoadGLNodes(map))
loaded = P_LoadGLNodes(map);
if (!loaded)
{
// none found - we have to build new ones!
unsigned int startTime, endTime;
@ -1006,20 +1008,22 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
}
}
if (!loaded)
{
#ifdef DEBUG
// Building nodes in debug is much slower so let's cache them only if cachetime is 0
buildtime = 0;
// Building nodes in debug is much slower so let's cache them only if cachetime is 0
buildtime = 0;
#endif
if (gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
CreateCachedNodes(map);
if (gl_cachenodes && buildtime/1000.f >= gl_cachetime)
{
DPrintf("Caching nodes\n");
CreateCachedNodes(map);
}
else
{
DPrintf("Not caching nodes (time = %f)\n", buildtime/1000.f);
}
}
else
{
DPrintf("Not caching nodes (time = %f)\n", buildtime/1000.f);
}
if (!gamenodes)
{
@ -1168,8 +1172,21 @@ static void CreateCachedNodes(MapData *map)
FString path = CreateCacheName(map, true);
FILE *f = fopen(path, "wb");
fwrite(compressed, 1, outlen+offset, f);
fclose(f);
if (f != NULL)
{
if (fwrite(compressed, outlen+offset, 1, f) != 1)
{
Printf("Error saving nodes to file %s\n", path.GetChars());
}
fclose(f);
}
else
{
Printf("Cannot open nodes file %s for writing\n", path.GetChars());
}
delete [] compressed;
}

View File

@ -1246,6 +1246,7 @@ public:
int fadecolor = -1;
int desaturation = -1;
int fplaneflags = 0, cplaneflags = 0;
double fp[4] = { 0 }, cp[4] = { 0 };
memset(sec, 0, sizeof(*sec));
sec->lightlevel = 160;
@ -1449,44 +1450,42 @@ public:
case NAME_floorplane_a:
fplaneflags |= 1;
sec->floorplane.a = CheckFixed(key);
fp[0] = CheckFloat(key);
break;
case NAME_floorplane_b:
fplaneflags |= 2;
sec->floorplane.b = CheckFixed(key);
fp[1] = CheckFloat(key);
break;
case NAME_floorplane_c:
fplaneflags |= 4;
sec->floorplane.c = CheckFixed(key);
sec->floorplane.ic = FixedDiv(FRACUNIT, sec->floorplane.c);
fp[2] = CheckFloat(key);
break;
case NAME_floorplane_d:
fplaneflags |= 8;
sec->floorplane.d = CheckFixed(key);
fp[3] = CheckFloat(key);
break;
case NAME_ceilingplane_a:
cplaneflags |= 1;
sec->ceilingplane.a = CheckFixed(key);
cp[0] = CheckFloat(key);
break;
case NAME_ceilingplane_b:
cplaneflags |= 2;
sec->ceilingplane.b = CheckFixed(key);
cp[1] = CheckFloat(key);
break;
case NAME_ceilingplane_c:
cplaneflags |= 4;
sec->ceilingplane.c = CheckFixed(key);
sec->ceilingplane.ic = FixedDiv(FRACUNIT, sec->ceilingplane.c);
cp[2] = CheckFloat(key);
break;
case NAME_ceilingplane_d:
cplaneflags |= 8;
sec->ceilingplane.d = CheckFixed(key);
cp[3] = CheckFloat(key);
break;
default:
@ -1509,6 +1508,17 @@ public:
sec->floorplane.c = FRACUNIT;
sec->floorplane.ic = FRACUNIT;
}
else
{
double ulen = TVector3<double>(fp[0], fp[1], fp[2]).Length();
// normalize the vector, it must have a length of 1
sec->floorplane.a = FLOAT2FIXED(fp[0] / ulen);
sec->floorplane.b = FLOAT2FIXED(fp[1] / ulen);
sec->floorplane.c = FLOAT2FIXED(fp[2] / ulen);
sec->floorplane.d = FLOAT2FIXED(fp[3] / ulen);
sec->floorplane.ic = FLOAT2FIXED(ulen / fp[2]);
}
if (cplaneflags != 15)
{
sec->ceilingplane.a = sec->ceilingplane.b = 0;
@ -1516,6 +1526,17 @@ public:
sec->ceilingplane.c = -FRACUNIT;
sec->ceilingplane.ic = -FRACUNIT;
}
else
{
double ulen = TVector3<double>(cp[0], cp[1], cp[2]).Length();
// normalize the vector, it must have a length of 1
sec->floorplane.a = FLOAT2FIXED(cp[0] / ulen);
sec->floorplane.b = FLOAT2FIXED(cp[1] / ulen);
sec->floorplane.c = FLOAT2FIXED(cp[2] / ulen);
sec->floorplane.d = FLOAT2FIXED(cp[3] / ulen);
sec->floorplane.ic = FLOAT2FIXED(ulen / cp[2]);
}
if (lightcolor == -1 && fadecolor == -1 && desaturation == -1)
{

View File

@ -1324,7 +1324,7 @@ flickerlight2 BCANDLE
object ZBlueCandle
{
frame CAND { light BCANDLE }
frame BCAN { light BCANDLE }
}
// Small flame