- another backend update from merging several GZDoom PRs.

This commit is contained in:
Christoph Oelckers 2020-09-27 16:16:53 +02:00
parent 9764c9de0b
commit 02afa90202
10 changed files with 24 additions and 17 deletions

View file

@ -75,6 +75,8 @@ enum EKeyCodes
KEY_JOY6,
KEY_JOY7,
KEY_JOY8,
KEY_JOY14 = KEY_FIRSTJOYBUTTON+13,
KEY_JOY15 = KEY_FIRSTJOYBUTTON+14,
KEY_LASTJOYBUTTON = 0x187,
KEY_JOYPOV1_UP = 0x188,
KEY_JOYPOV1_RIGHT = 0x189,

View file

@ -51,6 +51,7 @@
// TYPES -------------------------------------------------------------------
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
bool AreCompatiblePointerTypes(PType* dest, PType* source, bool forcompare = false);
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -665,7 +666,7 @@ PClass *PClass::FindClassTentative(FName name)
//
//==========================================================================
int PClass::FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc)
int PClass::FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc, bool exactReturnType)
{
auto proto = variant->Proto;
for (unsigned i = 0; i < Virtuals.Size(); i++)
@ -693,7 +694,10 @@ int PClass::FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction
for (unsigned a = 0; a < proto->ReturnTypes.Size(); a++)
{
if (proto->ReturnTypes[a] != vproto->ReturnTypes[a])
PType* expected = vproto->ReturnTypes[a];
PType* actual = proto->ReturnTypes[a];
if (expected != actual && (exactReturnType || !AreCompatiblePointerTypes(expected, actual)))
{
fail = true;
break;

View file

@ -43,7 +43,7 @@ public:
void InitializeSpecials(void* addr, void* defaults, TArray<FTypeAndOffset> PClass::* Inits);
void WriteAllFields(FSerializer &ar, const void *addr) const;
bool ReadAllFields(FSerializer &ar, void *addr) const;
int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc);
int FindVirtualIndex(FName name, PFunction::Variant *variant, PFunction *parentfunc, bool exactReturnType);
PSymbol *FindSymbol(FName symname, bool searchparents) const;
PField *AddField(FName name, PType *type, uint32_t flags);
void InitializeDefaults();

View file

@ -52,6 +52,7 @@ bool I_SetCursor(FGameTexture *cursorpic)
return false;
}
SDL_ShowCursor(SDL_DISABLE);
if (cursorSurface == NULL)
cursorSurface = SDL_CreateRGBSurface (0, 32, 32, 32, MAKEARGB(0,255,0,0), MAKEARGB(0,0,255,0), MAKEARGB(0,0,0,255), MAKEARGB(255,0,0,0));
@ -67,6 +68,7 @@ bool I_SetCursor(FGameTexture *cursorpic)
SDL_FreeCursor (cursor);
cursor = SDL_CreateColorCursor (cursorSurface, 0, 0);
SDL_SetCursor (cursor);
SDL_ShowCursor(SDL_ENABLE);
}
else
{

View file

@ -493,13 +493,10 @@ void MessagePump (const SDL_Event &sev)
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
if (!GUICapture)
{
event.type = sev.type == SDL_JOYBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
event.data1 = KEY_FIRSTJOYBUTTON + sev.jbutton.button;
if(event.data1 != 0)
D_PostEvent(&event);
}
break;
}
}

View file

@ -459,7 +459,7 @@ void FDInputJoystick::ProcessInput()
{
// Since we sorted the axes, we know that the first two are definitely X and Y.
// They are probably a single stick, so use angular position to determine buttons.
buttonstate = Joy_XYAxesToButtons(axisval, Axes[0].Value);
buttonstate = Joy_XYAxesToButtons(Axes[0].Value, axisval);
Joy_GenerateButtonEvents(info->ButtonValue, buttonstate, 4, KEY_JOYAXIS1PLUS);
}
info->ButtonValue = buttonstate;

View file

@ -169,7 +169,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
}
state.SetFog(cmd.mColor1, 0);
state.SetColor(1, 1, 1, 1, cmd.mDesaturate);
state.SetSoftLightLevel(cmd.mLightLevel);
if (cmd.mFlags & F2DDrawer::DTF_Indexed) state.SetSoftLightLevel(cmd.mLightLevel);
state.SetLightParms(0, 0);
state.AlphaFunc(Alpha_GEqual, 0.f);
@ -232,6 +232,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
state.SetTextureMode(TM_NORMAL);
state.EnableFog(false);
state.SetScreenFade(1);
state.SetSoftLightLevel(255);
state.ResetColor();
drawer->mIsFirstPass = false;
twoD.Unclock();

View file

@ -81,7 +81,7 @@ static const FLOP FxFlops[] =
{ NAME_Round, FLOP_ROUND, [](double v) { return round(v); } },
};
static bool AreCompatiblePointerTypes(PType* dest, PType* source, bool forcompare = false);
bool AreCompatiblePointerTypes(PType* dest, PType* source, bool forcompare = false);
//==========================================================================
//
@ -271,7 +271,7 @@ PFunction *FindBuiltinFunction(FName funcname)
//
//==========================================================================
static bool AreCompatiblePointerTypes(PType *dest, PType *source, bool forcompare)
bool AreCompatiblePointerTypes(PType *dest, PType *source, bool forcompare)
{
if (dest->isPointer() && source->isPointer())
{

View file

@ -2366,6 +2366,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
}
bool exactReturnType = mVersion < MakeVersion(4, 4);
PClass *clstype = forclass? static_cast<PClassType *>(c->Type())->Descriptor : nullptr;
if (varflags & VARF_Virtual)
{
@ -2379,7 +2380,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
{
auto parentfunc = clstype->ParentClass? dyn_cast<PFunction>(clstype->ParentClass->VMType->Symbols.FindSymbol(sym->SymbolName, true)) : nullptr;
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc);
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc, exactReturnType);
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
if (varflags & VARF_Override)
{
@ -2459,7 +2460,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
}
else if (forclass)
{
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr);
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
if (vindex != -1)
{
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());

View file

@ -239,7 +239,7 @@ public:
TexelWidth = x;
TexelHeight = y;
SetDisplaySize(float(x), float(y));
GetTexture()->SetSize(x, y);
if (GetTexture()) GetTexture()->SetSize(x, y);
}
void SetDisplaySize(float w, float h)
{