This commit is contained in:
Rachael Alexanderson 2018-01-18 10:27:42 -05:00
commit 88fbf92018
13 changed files with 58 additions and 130 deletions

View file

@ -735,7 +735,11 @@ void M_Ticker (void)
if (CurrentMenu != nullptr && menuactive != MENU_Off)
{
CurrentMenu->CallTicker();
}
// Check again because menu could be closed from Ticker()
if (CurrentMenu != nullptr && menuactive != MENU_Off)
{
for (int i = 0; i < NUM_MKEYS; ++i)
{
if (MenuButtons[i].bDown)

View file

@ -542,7 +542,7 @@ static bool FindMatchingItem(DMenuItemBase *desc)
{
// Check for presence of menu
auto menu = MenuDescriptors.CheckKey(name);
if (menu == nullptr) return true;
if (menu == nullptr) return false;
}
else if (grp == 4)
{

View file

@ -761,35 +761,6 @@ protected:
private:
DLevelScript();
int getbyte(int *&pc)
{
CheckInstructionPointer(pc);
int res = *(uint8_t *)pc;
pc = (int *)((uint8_t *)pc+1);
return res;
}
int getshort(int *&pc)
{
CheckInstructionPointer(pc);
int res = LittleShort( *(int16_t *)pc);
pc = (int *)((uint8_t *)pc+2);
return res;
}
void CheckInstructionPointer(int *pc) const
{
const uint32_t offset = activeBehavior->PC2Ofs(pc);
const uint32_t size = activeBehavior->GetDataSize();
if (offset >= size)
{
I_Error("Out of bounds instruction pointer in ACS VM");
}
}
friend class DACSThinker;
};
@ -844,7 +815,7 @@ TArray<FString> ACS_StringBuilderStack;
//
//============================================================================
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__)
#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__)
inline int uallong(const int &foo)
{
return foo;
@ -6925,7 +6896,7 @@ enum
};
#define NEXTWORD (CheckInstructionPointer(pc), LittleLong(*pc++))
#define NEXTWORD (LittleLong(*pc++))
#define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD)
#define NEXTSHORT (fmt==ACS_LittleEnhanced?getshort(pc):NEXTWORD)
#define STACK(a) (Stack[sp - (a)])
@ -6933,6 +6904,20 @@ enum
// Direct instructions that take strings need to have the tag applied.
#define TAGSTR(a) (a|activeBehavior->GetLibraryID())
inline int getbyte (int *&pc)
{
int res = *(uint8_t *)pc;
pc = (int *)((uint8_t *)pc+1);
return res;
}
inline int getshort (int *&pc)
{
int res = LittleShort( *(int16_t *)pc);
pc = (int *)((uint8_t *)pc+2);
return res;
}
static bool CharArrayParms(int &capacity, int &offset, int &a, FACSStackMemory& Stack, int &sp, bool ranged)
{
if (ranged)

View file

@ -226,14 +226,7 @@ void OriginalMainTry(int argc, char** argv)
namespace
{
const int ARGC_MAX = 64;
int s_argc;
char* s_argv[ARGC_MAX];
TArray<FString> s_argvStorage;
bool s_restartedFromWADPicker;
TArray<FString> s_argv;
void NewFailure()
@ -348,7 +341,17 @@ ApplicationController* appCtrl;
FConsoleWindow::CreateInstance();
atterm(FConsoleWindow::DeleteInstance);
exit(OriginalMain(s_argc, s_argv));
const size_t argc = s_argv.Size();
TArray<char*> argv(argc + 1, true);
for (size_t i = 0; i < argc; ++i)
{
argv[i] = s_argv[i].LockBuffer();
}
argv[argc] = nullptr;
exit(OriginalMain(argc, &argv[0]));
}
@ -356,20 +359,13 @@ ApplicationController* appCtrl;
{
ZD_UNUSED(theApplication);
if (s_restartedFromWADPicker
|| 0 == [filename length]
|| s_argc + 2 >= ARGC_MAX)
{
return FALSE;
}
// Some parameters from command line are passed to this function
// These parameters need to be skipped to avoid duplication
// Note: SDL has different approach to fix this issue, see the same method in SDLMain.m
const char* const charFileName = [filename UTF8String];
for (int i = 0; i < s_argc; ++i)
for (size_t i = 0, count = s_argv.Size(); i < count; ++i)
{
if (0 == strcmp(s_argv[i], charFileName))
{
@ -377,11 +373,8 @@ ApplicationController* appCtrl;
}
}
s_argvStorage.Push("-file");
s_argv[s_argc++] = s_argvStorage.Last().LockBuffer();
s_argvStorage.Push([filename UTF8String]);
s_argv[s_argc++] = s_argvStorage.Last().LockBuffer();
s_argv.Push("-file");
s_argv.Push([filename UTF8String]);
return TRUE;
}
@ -539,21 +532,12 @@ void ReleaseApplicationController()
int main(int argc, char** argv)
{
for (int i = 0; i <= argc; ++i)
for (int i = 0; i < argc; ++i)
{
const char* const argument = argv[i];
if (NULL == argument || '\0' == argument[0])
{
continue;
}
if (0 == strcmp(argument, "-wad_picker_restart"))
{
s_restartedFromWADPicker = true;
}
#if _DEBUG
else if (0 == strcmp(argument, "-wait_for_debugger"))
if (0 == strcmp(argument, "-wait_for_debugger"))
{
NSAlert* alert = [[NSAlert alloc] init];
[alert setMessageText:@GAMENAME];
@ -562,11 +546,8 @@ int main(int argc, char** argv)
[alert runModal];
}
#endif // _DEBUG
else
{
s_argvStorage.Push(argument);
s_argv[s_argc++] = s_argvStorage.Last().LockBuffer();
}
s_argv.Push(argument);
}
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

View file

@ -418,7 +418,6 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
executablePath = @"/usr/bin/arch";
}
[arguments addObject:@"-wad_picker_restart"];
[arguments addObject:@"-iwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Path]];

View file

@ -394,7 +394,7 @@ public:
}
// Moves a plane up/down by hdiff units
double GetChangedHeight(double hdiff)
double GetChangedHeight(double hdiff) const
{
return D - hdiff * normal.Z;
}

View file

@ -8935,7 +8935,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
else
{
bool writable;
ArgList[i] = ArgList[i]->Resolve(ctx); // nust be resolved before the address is requested.
ArgList[i] = ArgList[i]->Resolve(ctx); // must be resolved before the address is requested.
if (ArgList[i] != nullptr && ArgList[i]->ValueType != TypeNullPtr)
{
if (type == ArgList[i]->ValueType && type->isRealPointer() && type->toPointer()->PointedType->isStruct())

View file

@ -1627,7 +1627,7 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
}
else
{
Error(field, "%s: Base type for dynamic array types nust be integral, but got %s", name.GetChars(), ftype->DescriptiveName());
Error(field, "%s: Base type for dynamic array types must be integral, but got %s", name.GetChars(), ftype->DescriptiveName());
}
}
else

View file

@ -649,18 +649,11 @@ void CALLBACK WinMIDIDevice::CallbackFunc(HMIDIOUT hOut, UINT uMsg, DWORD_PTR dw
// are done by sending MIDI channel volume messages to the stream, not
// through midiOutSetVolume().)
//
// This is using VC++'s __uuidof extension instead of the the CLSID_ and
// IID_ definitions because I couldn't figure out why it wasn't finding them
// when linking, and __uuidof circumvents that problem. I'd also be
// surprised if w32api includes any WASAPI stuff any time soon, so it's no
// big loss making this VC++-specific for the time being
//
//==========================================================================
static bool IgnoreMIDIVolume(UINT id)
{
MIDIOUTCAPS caps;
bool mustcheck = false;
if (MMSYSERR_NOERROR == midiOutGetDevCaps(id, &caps, sizeof(caps)))
{
@ -668,7 +661,7 @@ static bool IgnoreMIDIVolume(UINT id)
{
// We cannot determine what this is so we have to assume the worst, as the default
// devive's volume control is irreparably broken.
mustcheck = true;
return true;
}
// The Microsoft GS Wavetable Synth advertises itself as MIDIDEV_SWSYNTH with a VOLUME control.
// If the one we're using doesn't match that, we don't need to bother checking the name.
@ -676,28 +669,8 @@ static bool IgnoreMIDIVolume(UINT id)
{
if (strncmp(caps.szPname, "Microsoft GS", 12) == 0)
{
mustcheck = true;
}
}
if (mustcheck)
{
#ifndef __GNUC__
IMMDeviceEnumerator *enumerator;
// Now try to create an IMMDeviceEnumerator interface. If it succeeds,
// we know we're using the new audio stack introduced with Vista and
// should ignore this MIDI device's volume control.
if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL,
__uuidof(IMMDeviceEnumerator), (void**)&enumerator))
&& enumerator != nullptr)
{
enumerator->Release();
return true;
}
#else
// assume the worst and consider volume control broken.
return true;
#endif
}
}
return false;

View file

@ -175,15 +175,14 @@ protected:
struct TexPart
{
int16_t OriginX, OriginY;
uint8_t Rotate;
uint8_t op;
FRemapTable *Translation;
PalEntry Blend;
FTexture *Texture;
blend_t Alpha;
TexPart();
FRemapTable *Translation = nullptr;
FTexture *Texture = nullptr;
PalEntry Blend = 0;
blend_t Alpha = FRACUNIT;
int16_t OriginX = 0;
int16_t OriginY = 0;
uint8_t Rotate = 0;
uint8_t op = OP_COPY;
};
struct TexInit
@ -797,23 +796,6 @@ FTexture *FMultiPatchTexture::GetRawTexture()
return NumParts == 1 ? Parts->Texture : this;
}
//==========================================================================
//
// FMultiPatchTexture :: TexPart :: TexPart
//
//==========================================================================
FMultiPatchTexture::TexPart::TexPart()
{
OriginX = OriginY = 0;
Rotate = 0;
Texture = NULL;
Translation = NULL;
Blend = 0;
Alpha = FRACUNIT;
op = OP_COPY;
}
//==========================================================================
//
// FTextureManager :: AddTexturesLump
@ -1369,7 +1351,7 @@ void FMultiPatchTexture::ResolvePatches()
{
if (Parts[i].Texture == nullptr)
{
memcpy(&Parts[i], &Parts[i + 1], NumParts - i - 1);
memcpy(&Parts[i], &Parts[i + 1], (NumParts - i - 1) * sizeof(TexPart));
i--;
NumParts--;
}

View file

@ -184,7 +184,7 @@ struct SecPlane native play
native bool isEqual(Secplane other) const;
native void ChangeHeight(double hdiff);
native double GetChangedHeight(double hdiff) const;
native double HeightDiff(double oldd, double newd = 0.0);
native double HeightDiff(double oldd, double newd = 0.0) const;
native double PointToDist(Vector2 xy, double z) const;
}

View file

@ -46,6 +46,8 @@ struct StrifeDialogueNode native version("2.4")
native String Goodbye;
native StrifeDialogueReply Children;
native Name MenuClassName;
native String UserData;
}
// FStrifeDialogueReply holds responses the player can give to the NPC

View file

@ -62,6 +62,8 @@ class InterpolationPoint : Actor
Next = null;
}
override void Tick () {} // Nodes do no thinking
void FormChain ()
{
let me = self;