diff --git a/src/hwrenderer/scene/hw_renderhacks.cpp b/src/hwrenderer/scene/hw_renderhacks.cpp index c9e34b062..6814fd5f5 100644 --- a/src/hwrenderer/scene/hw_renderhacks.cpp +++ b/src/hwrenderer/scene/hw_renderhacks.cpp @@ -763,12 +763,12 @@ void HWDrawInfo::PrepareUpperGap(seg_t * seg) CreateFloodPoly(&ws, vertices.first+4, ws.z2, fakebsector, true); gl_floodrendernode *node = NewFloodRenderNode(); - auto pNode = floodFloorSegs.CheckKey(fakebsector->sectornum); + auto pNode = floodCeilingSegs.CheckKey(fakebsector->sectornum); node->next = pNode? *pNode : nullptr; node->seg = seg; node->vertexindex = vertices.second; - floodFloorSegs[fakebsector->sectornum] = node; + floodCeilingSegs[fakebsector->sectornum] = node; } diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 3789fe7cd..93a521a25 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4503,13 +4503,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeCountFlags) return 0; } - -enum ERaise -{ - RF_TRANSFERFRIENDLINESS = 1, - RF_NOCHECKPOSITION = 2 -}; - //=========================================================================== // // A_RaiseMaster @@ -4520,10 +4513,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster) PARAM_SELF_PROLOGUE(AActor); PARAM_INT(flags); - bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); if (self->master != NULL) { - P_Thing_Raise(self->master, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); + P_Thing_Raise(self->master, self, flags); } return 0; } @@ -4541,12 +4533,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren) TThinkerIterator it; AActor *mo; - bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); while ((mo = it.Next()) != NULL) { if (mo->master == self) { - P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); + P_Thing_Raise(mo, self, flags); } } return 0; @@ -4565,14 +4556,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) TThinkerIterator it; AActor *mo; - bool copy = !!(flags & RF_TRANSFERFRIENDLINESS); if (self->master != NULL) { while ((mo = it.Next()) != NULL) { if (mo->master == self->master && mo != self) { - P_Thing_Raise(mo, copy ? self : NULL, (flags & RF_NOCHECKPOSITION)); + P_Thing_Raise(mo, self, flags); } } } @@ -4588,7 +4578,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSelf) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT(flags); - ACTION_RETURN_BOOL(P_Thing_Raise(self, NULL, (flags & RF_NOCHECKPOSITION))); + ACTION_RETURN_BOOL(P_Thing_Raise(self, self, flags)); } //=========================================================================== @@ -4602,7 +4592,7 @@ DEFINE_ACTION_FUNCTION(AActor, RaiseActor) PARAM_SELF_PROLOGUE(AActor); PARAM_OBJECT(other, AActor); PARAM_INT(flags); - ACTION_RETURN_BOOL(P_Thing_Raise(other, self, (flags & RF_NOCHECKPOSITION))); + ACTION_RETURN_BOOL(P_Thing_Raise(other, self, flags)); } //=========================================================================== diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 2d48937e8..85d40081a 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1764,7 +1764,7 @@ FUNC(LS_Thing_Raise) if (arg0==0) { - ok = P_Thing_Raise (it,NULL, arg1); + ok = P_Thing_Raise (it, it, arg1); } else { @@ -1772,7 +1772,7 @@ FUNC(LS_Thing_Raise) while ( (target = iterator.Next ()) ) { - ok |= P_Thing_Raise(target,NULL, arg1); + ok |= P_Thing_Raise(target, target, arg1); } } return ok; diff --git a/src/p_local.h b/src/p_local.h index e9c2d0f2e..9b41253a9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -160,7 +160,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog); int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type); void P_Thing_SetVelocity(AActor *actor, const DVector3 &vec, bool add, bool setbob); void P_RemoveThing(AActor * actor); -bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck = false); +bool P_Thing_Raise(AActor *thing, AActor *raiser, int flags = 0); bool P_Thing_CanRaise(AActor *thing); bool P_CanResurrect(AActor *ththing, AActor *thing); PClassActor *P_GetSpawnableType(int spawnnum); @@ -475,4 +475,10 @@ enum ETexReplaceFlags void P_ReplaceTextures(const char *fromname, const char *toname, int flags); +enum ERaise +{ + RF_TRANSFERFRIENDLINESS = 1, + RF_NOCHECKPOSITION = 2 +}; + #endif // __P_LOCAL__ diff --git a/src/p_things.cpp b/src/p_things.cpp index 568bfd2b8..8b38141d7 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -432,7 +432,7 @@ void P_RemoveThing(AActor * actor) } -bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck) +bool P_Thing_Raise(AActor *thing, AActor *raiser, int flags) { if (!thing) return false; @@ -455,7 +455,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck) thing->flags |= MF_SOLID; thing->Height = info->Height; // [RH] Use real height thing->radius = info->radius; // [RH] Use real radius - if (!nocheck && !P_CheckPosition (thing, thing->Pos())) + if (!(flags & RF_NOCHECKPOSITION) && !P_CheckPosition (thing, thing->Pos())) { thing->flags = oldflags; thing->radius = oldradius; @@ -470,7 +470,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser, int nocheck) thing->Revive(); - if (raiser != NULL) + if ((flags & RF_TRANSFERFRIENDLINESS) && raiser != nullptr) { // Let's copy the friendliness of the one who raised it. thing->CopyFriendliness(raiser, false); diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index b15cccea4..b13537762 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8140,12 +8140,17 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) } if (isDynArrayObj && ((MethodName == NAME_Push && idx == 0) || (MethodName == NAME_Insert && idx == 1))) { - // The DynArray_Obj declaration in dynarrays.txt doesn't support generics yet. Check the type here as if it did. - if (!static_cast(elementType)->PointedClass()->IsAncestorOf(static_cast(a->ValueType)->PointedClass())) + // Null pointers are always valid. + if (!a->isConstant() || static_cast(a)->GetValue().GetPointer() != nullptr) { - ScriptPosition.Message(MSG_ERROR, "Type mismatch in function argument"); - delete this; - return nullptr; + // The DynArray_Obj declaration in dynarrays.txt doesn't support generics yet. Check the type here as if it did. + if (!a->ValueType->isObjectPointer() || + !static_cast(elementType)->PointedClass()->IsAncestorOf(static_cast(a->ValueType)->PointedClass())) + { + ScriptPosition.Message(MSG_ERROR, "Type mismatch in function argument"); + delete this; + return nullptr; + } } } if (a->IsDynamicArray())