diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 05dc97c5ef..c559504f48 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -170,6 +170,12 @@ else() set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES inc ) set( FMOD_LIB_PATH_SUFFIXES PATH_SUFFIXES lib ) set( NO_GTK ON ) + + # Prevent inclusion of fp.h and FixMath.h from Carbon framework + # Declarations from these files are not used but cause the following conflicts: + # - redefinition of 'FixedToFloat' and 'FloatToFixed' macros + # - redefinition of 'pi' as different kind of symbol + add_definitions( -D__FP__ -D__FIXMATH__ ) else() option( NO_GTK "Disable GTK+ dialogs (Not applicable to Windows)" ) option( VALGRIND "Add special Valgrind sequences to self-modifying code" ) @@ -578,22 +584,6 @@ if( UNIX ) endif() endif() -CHECK_CXX_SOURCE_COMPILES( - "#include - int main() { va_list list1, list2; va_copy(list1, list2); return 0; }" - HAS_VA_COPY ) -if( NOT HAS_VA_COPY ) - CHECK_CXX_SOURCE_COMPILES( - "#include - int main() { va_list list1, list2; __va_copy(list1, list2); return 0; }" - HAS___VA_COPY ) - if( HAS___VA_COPY ) - add_definitions( -Dva_copy=__va_copy ) - else() - add_definitions( -DNO_VA_COPY ) - endif() -endif() - # Flags if( BACKPATCH ) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 1efb4e8eec..050a6215f9 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1704,7 +1704,7 @@ void APowerProtection::ModifyDamage(int damage, FName damageType, int &newdamage DmgFactors *df = GetClass()->DamageFactors; if (df != NULL && df->CountUsed() != 0) { - newdam = MIN(0, df->Apply(damageType, damage)); + newdam = MAX(0, df->Apply(damageType, damage)); } else { diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 40e2931a6e..60a53fda39 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -332,12 +332,12 @@ float FTexCoordInfo::RowOffset(float rowoffset) const if (mTempScale.Y == 1.f) { if (mScale.Y == 1.f || mWorldPanning) return rowoffset; - else return rowoffset * mScale.Y; + else return rowoffset / mScale.Y; } else { - if (mWorldPanning) return rowoffset * mTempScale.Y; - else return rowoffset * mScale.Y; + if (mWorldPanning) return rowoffset / mTempScale.Y; + else return rowoffset / mScale.Y; } } @@ -352,12 +352,12 @@ float FTexCoordInfo::TextureOffset(float textureoffset) const if (mTempScale.X == 1.f) { if (mScale.X == 1.f || mWorldPanning) return textureoffset; - else return textureoffset * mScale.X; + else return textureoffset / mScale.X; } else { - if (mWorldPanning) return textureoffset * mTempScale.X; - else return textureoffset * mScale.X; + if (mWorldPanning) return textureoffset / mTempScale.X; + else return textureoffset / mScale.X; } } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 186e9c3d4e..bdc13357e7 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -178,6 +178,11 @@ inline int AngleToACS(DAngle ang) return ang.BAMs() >> 16; } +inline int PitchToACS(DAngle ang) +{ + return int(ang.Normalized180().Degrees * (65536. / 360)); +} + struct CallReturn { CallReturn(int pc, ScriptFunction *func, FBehavior *module, SDWORD *locals, ACSLocalArrays *arrays, bool discard, unsigned int runaway) @@ -8751,7 +8756,7 @@ scriptwait: case PCD_GETACTORPITCH: { AActor *actor = SingleActorFromTID(STACK(1), activator); - STACK(1) = actor == NULL ? 0 : AngleToACS(actor->Angles.Pitch); + STACK(1) = actor == NULL ? 0 : PitchToACS(actor->Angles.Pitch); } break; diff --git a/src/p_local.h b/src/p_local.h index 0dd0dca68f..82f4580b9c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -221,7 +221,7 @@ void P_FakeZMovement (AActor *mo); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL); -bool P_CheckMove(AActor *thing, const DVector2 &pos); +bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff = false); void P_ApplyTorque(AActor *mo); bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters diff --git a/src/p_map.cpp b/src/p_map.cpp index 61e651ce65..73aa3f73fd 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2410,7 +2410,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos, // //========================================================================== -bool P_CheckMove(AActor *thing, const DVector2 &pos) +bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff) { FCheckPosition tm; double newz = thing->Z(); @@ -2469,6 +2469,17 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos) return false; } } + else if (dropoff) + { + const DVector3 oldpos = thing->Pos(); + thing->SetOrigin(pos.X, pos.Y, newz, true); + bool hcheck = (newz - thing->MaxDropOffHeight > thing->dropoffz); + thing->SetOrigin(oldpos, true); + if (hcheck && !(thing->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) + { + return false; + } + } } if (thing->flags2 & MF2_CANTLEAVEFLOORPIC diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d0a1579329..cc4ffd33bb 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -6707,7 +6707,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) if (flags & CBF_DROPOFF) { mobj->SetZ(pos.Z); - checker = P_CheckMove(mobj, pos); + checker = P_CheckMove(mobj, pos, true); mobj->SetZ(oldpos.Z); } else @@ -6742,8 +6742,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) } //[MC] I don't know why I let myself be persuaded not to include a flag. //If an actor is loaded with pointers, they don't really have any options to spare. + //Also, fail if a dropoff or a step is too great to pass over when checking for dropoffs. - if ((!(flags & CBF_NOACTORS) && (mobj->BlockingMobj)) || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL)) + if ((!(flags & CBF_NOACTORS) && (mobj->BlockingMobj)) || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL) || + ((flags & CBF_DROPOFF) && !checker)) { ACTION_RETURN_STATE(block); } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 3897cd9b4a..6cfb8aa416 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -127,6 +127,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms) FTexture::Span unmaskedSpan[2]; const FTexture::Span **spanptr, *spans; static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH]; + const BYTE *translation = NULL; if (parms.masked) { @@ -155,12 +156,16 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms) // Note that this overrides DTA_Translation in software, but not in hardware. FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255,255,255), parms.colorOverlay & MAKEARGB(0,255,255,255), 0); - parms.translation = &colormap->Maps[(APART(parms.colorOverlay)*NUMCOLORMAPS/255)*256]; + translation = &colormap->Maps[(APART(parms.colorOverlay)*NUMCOLORMAPS/255)*256]; + } + else if (parms.remap != NULL) + { + translation = parms.remap->Remap; } - if (parms.translation != NULL) + if (translation != NULL) { - dc_colormap = (lighttable_t *)parms.translation; + dc_colormap = (lighttable_t *)translation; } else { @@ -421,6 +426,7 @@ bool DCanvas::SetTextureParms(DrawParms *parms, FTexture *img, double xx, double parms->virtWidth, parms->virtHeight, parms->virtBottom, !parms->keepratio); } } + return false; } @@ -461,7 +467,6 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag parms->Alpha = 1.f; parms->fillcolor = -1; parms->remap = NULL; - parms->translation = NULL; parms->colorOverlay = 0; parms->alphaChannel = false; parms->flipX = false; @@ -826,11 +831,6 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag } } - if (parms->remap != NULL) - { - parms->translation = parms->remap->Remap; - } - if (parms->style.BlendOp == 255) { if (fillcolorset) diff --git a/src/v_text.cpp b/src/v_text.cpp index 7c97b0e6a6..b2ecb8d2c9 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -86,9 +86,6 @@ void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, B // void STACK_ARGS DCanvas::DrawText(FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...) { - INTBOOL boolval; - uint32 tag; - int w; const BYTE *ch; int c; diff --git a/src/v_video.h b/src/v_video.h index ef6efc2187..3af56513cb 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -158,7 +158,6 @@ struct DrawParms float Alpha; uint32 fillcolor; FRemapTable *remap; - const BYTE *translation; uint32 colorOverlay; INTBOOL alphaChannel; INTBOOL flipX;