This commit is contained in:
Christoph Oelckers 2016-01-04 11:55:07 +01:00
commit 0e9eb2f305
6 changed files with 82 additions and 76 deletions

View file

@ -81,7 +81,7 @@ struct MapinfoEdMapItem
{
FName classname; // DECORATE is read after MAPINFO so we do not have the actual classes available here yet.
short special;
bool argsdefined;
signed char argsdefined;
int args[5];
// These are for error reporting. We must store the file information because it's no longer available when these items get resolved.
FString filename;
@ -181,14 +181,14 @@ void FMapInfoParser::ParseDoomEdNums()
editem.special = -1;
}
memset(editem.args, 0, sizeof(editem.args));
editem.argsdefined = false;
editem.argsdefined = 0;
int minargs = 0;
int maxargs = 5;
FString specialname;
if (sc.CheckString(","))
{
editem.argsdefined = true; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing.
editem.argsdefined = 5; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing.
if (editem.special < 0) editem.special = 0;
if (!sc.CheckNumber())
{
@ -221,7 +221,14 @@ void FMapInfoParser::ParseDoomEdNums()
editem.args[i] = sc.Number;
i++;
if (!sc.CheckString(",")) break;
// special check for the ambient sounds which combine the arg being set here with the ones on the mapthing.
if (sc.CheckString("+"))
{
editem.argsdefined = i;
break;
}
sc.MustGetNumber();
}
if (specialname.IsNotEmpty() && (i < minargs || i > maxargs))
{

View file

@ -283,7 +283,7 @@ struct FDoomEdEntry
{
const PClass *Type;
short Special;
bool ArgsDefined;
signed char ArgsDefined;
int Args[5];
};

View file

@ -57,7 +57,9 @@ public:
// Returns a random number in the range [0,mod)
int operator() (int mod)
{
return GenRand32() % mod;
return (0 == mod)
? 0
: (GenRand32() % mod);
}
// Returns rand# - rand#

View file

@ -4674,10 +4674,10 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
}
// copy args to mapthing so that we have them in one place for the rest of this function
if (mentry->ArgsDefined)
if (mentry->ArgsDefined > 0)
{
if (mentry->Type!= NULL) mthing->special = mentry->Special;
memcpy(mthing->args, mentry->Args, sizeof(mthing->args));
memcpy(mthing->args, mentry->Args, sizeof(mthing->args[0]) * mentry->ArgsDefined);
}
int pnum = -1;

View file

@ -625,7 +625,7 @@ void CocoaVideo::SetFullscreenMode(const int width, const int height)
[m_window setHidesOnDeactivate:YES];
}
[m_window setFrame:displayRect display:YES];
[m_window setFrame:screenFrame display:YES];
[m_window setFrameOrigin:NSMakePoint(0.0f, 0.0f)];
}
@ -1231,10 +1231,7 @@ NSSize I_GetContentViewSize(const NSWindow* const window)
const NSView* const view = [window contentView];
const NSSize frameSize = [view frame].size;
// TODO: figure out why [NSView frame] returns different values in "fullscreen" and in window
// In "fullscreen" the result is multiplied by [NSScreen backingScaleFactor], but not in window
return (vid_hidpi && !fullscreen)
return (vid_hidpi)
? [view convertSizeToBacking:frameSize]
: frameSize;
}