diff --git a/src/actionspecials.h b/src/actionspecials.h index 7bd89cbfbf..eee1c9589d 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -69,7 +69,7 @@ DEFINE_SPECIAL(Floor_RaiseInstant, 67, 3, 3, 3) DEFINE_SPECIAL(Floor_MoveToValueTimes8, 68, 4, 4, 4) DEFINE_SPECIAL(Ceiling_MoveToValueTimes8, 69, 4, 4, 4) DEFINE_SPECIAL(Teleport, 70, 1, 3, 3) -DEFINE_SPECIAL(Teleport_NoFog, 71, 1, 3, 3) +DEFINE_SPECIAL(Teleport_NoFog, 71, 1, 4, 4) DEFINE_SPECIAL(ThrustThing, 72, 2, 4, 4) DEFINE_SPECIAL(DamageThing, 73, 1, 2, 2) DEFINE_SPECIAL(Teleport_NewMap, 74, 2, 3, 3) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 5f93be98e2..5ea9d66444 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1090,6 +1090,15 @@ static int PatchThing (int thingy) value[0] &= ~MF_TRANSLUCENT; // clean the slot vchanged[2] = true; value[2] |= 2; // let the TRANSLUCxx code below handle it } + if ((info->flags & MF_MISSILE) && (info->flags2 & MF2_NOTELEPORT) + && !(value[0] & MF_MISSILE)) + { + // ZDoom gives missiles flags that did not exist in Doom: MF2_NOTELEPORT, + // MF2_IMPACT, and MF2_PCROSS. The NOTELEPORT one can be a problem since + // some projectile actors (those new to Doom II) were not excluded from + // triggering line effects and can teleport when the missile flag is removed. + info->flags2 &= ~MF2_NOTELEPORT; + } info->flags = value[0]; } if (vchanged[1]) diff --git a/src/d_main.cpp b/src/d_main.cpp index 26095d93a7..1b1d94a56c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -585,7 +585,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) COMPATF_MBFMONSTERMOVE|COMPATF_NOBLOCKFRIENDS; break; - case 6: // Boom with some added settings to reenable spme 'broken' behavior + case 6: // Boom with some added settings to reenable some 'broken' behavior v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_NO_PASSMOBJ| COMPATF_INVISIBILITY|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|COMPATF_WALLRUN|COMPATF_NOTOSSDROPS; break; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 5e65320011..48fb5ffa17 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -215,13 +215,15 @@ void P_InitEffects () P_InitParticles(); while (color->color) { - *(color->color) = ColorMatcher.Pick (color->r, color->g, color->b); + *(color->color) = (MAKERGB(color->r, color->g, color->b) + | (ColorMatcher.Pick (color->r, color->g, color->b) << 24)); color++; } int kind = gameinfo.defaultbloodparticlecolor; - blood1 = ColorMatcher.Pick(RPART(kind), GPART(kind), BPART(kind)); - blood2 = ColorMatcher.Pick(RPART(kind)/3, GPART(kind)/3, BPART(kind)/3); + int kind3 = MAKERGB(RPART(kind)/3, GPART(kind)/3, BPART(kind)/3); + blood1 = kind | (ColorMatcher.Pick(RPART(kind), GPART(kind), BPART(kind)) << 24); + blood2 = kind3 | (ColorMatcher.Pick(RPART(kind3), GPART(kind3), BPART(kind3)) << 24); } @@ -520,8 +522,9 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i color2 = grey1; break; default: // colorized blood - color1 = ColorMatcher.Pick(RPART(kind), GPART(kind), BPART(kind)); - color2 = ColorMatcher.Pick(RPART(kind)>>1, GPART(kind)>>1, BPART(kind)>>1); + color1 = kind | (ColorMatcher.Pick(RPART(kind), GPART(kind), BPART(kind)) << 24); + color2 = MAKERGB((kind)>>1, GPART(kind)>>1, BPART(kind)>>1) + | (ColorMatcher.Pick(RPART(kind)>>1, GPART(kind)>>1, BPART(kind)>>1) << 24); break; } @@ -598,7 +601,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end { // Only consider sound in 2D (for now, anyway) - // [BB] You have to devide by lengthsquared here, not multiply with it. + // [BB] You have to divide by lengthsquared here, not multiply with it. r = ((start.Y - FIXED2FLOAT(mo->y)) * (-dir.Y) - (start.X - FIXED2FLOAT(mo->x)) * (dir.X)) / lengthsquared; r = clamp(r, 0., 1.); @@ -646,7 +649,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end FVector3 spiral_step = step * r_rail_spiralsparsity; int spiral_steps = steps * r_rail_spiralsparsity; - color1 = color1 == 0 ? -1 : ColorMatcher.Pick(RPART(color1), GPART(color1), BPART(color1)); + color1 = color1 == 0 ? -1 : color1 | (ColorMatcher.Pick(RPART(color1), GPART(color1), BPART(color1)) <<24); pos = start; deg = FAngle(270); for (i = spiral_steps; i; i--) @@ -699,7 +702,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end FVector3 trail_step = step * r_rail_trailsparsity; int trail_steps = steps * r_rail_trailsparsity; - color2 = color2 == 0 ? -1 : ColorMatcher.Pick(RPART(color2), GPART(color2), BPART(color2)); + color2 = color2 == 0 ? -1 : color2 | (ColorMatcher.Pick(RPART(color2), GPART(color2), BPART(color2)) <<24); FVector3 diff(0, 0, 0); pos = start; diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 26bd4b1dff..3ca7fc6d37 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1078,7 +1078,7 @@ static FString GetCachePath() FSRef folder; if (noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType, kCreateFolder, &folder) && - noErr == FSRefMakePath(&folder, (UInt8*)path.GetChars(), PATH_MAX)) + noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX)) { path = pathstr; } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 430f29bb70..8cbeec3358 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -855,9 +855,9 @@ FUNC( LS_Teleport_NoStop ) } FUNC(LS_Teleport_NoFog) -// Teleport_NoFog (tid, useang, sectortag) +// Teleport_NoFog (tid, useang, sectortag, keepheight) { - return EV_Teleport (arg0, arg2, ln, backSide, it, false, false, !arg1); + return EV_Teleport (arg0, arg2, ln, backSide, it, false, false, !arg1, true, !!arg3); } FUNC(LS_Teleport_ZombieChanger) diff --git a/src/p_local.h b/src/p_local.h index 879a876ad3..0b6474baa0 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -383,7 +383,7 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm); bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y); AActor *P_CheckOnmobj (AActor *thing); void P_FakeZMovement (AActor *mo); -bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor, FCheckPosition &tm); +bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor = NULL); bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y); void P_ApplyTorque(AActor *mo); diff --git a/src/p_map.cpp b/src/p_map.cpp index 35ab352ce8..605f0bbc32 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1646,7 +1646,8 @@ static void CheckForPushSpecial (line_t *line, int side, AActor *mobj) bool P_TryMove (AActor *thing, fixed_t x, fixed_t y, int dropoff, // killough 3/15/98: allow dropoff as option const secplane_t *onfloor, // [RH] Let P_TryMove keep the thing on the floor - FCheckPosition &tm) + FCheckPosition &tm, + bool missileCheck) // [GZ] Fired missiles ignore the drop-off test { fixed_t oldx; fixed_t oldy; @@ -1777,7 +1778,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y, if (dropoff==2 && // large jump down (e.g. dogs) (tm.floorz-tm.dropoffz > 128*FRACUNIT || thing->target == NULL || thing->target->z >tm.dropoffz)) { - dropoff = false; + dropoff = false; } @@ -1795,8 +1796,9 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y, } if (floorz - tm.dropoffz > thing->MaxDropOffHeight && - !(thing->flags2 & MF2_BLASTED)) + !(thing->flags2 & MF2_BLASTED) && !missileCheck) { // Can't move over a dropoff unless it's been blasted + // [GZ] Or missile-spawned thing->z = oldz; return false; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 559b2e477a..7f8e9b3f9e 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5017,7 +5017,7 @@ bool P_CheckMissileSpawn (AActor* th) bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF)); // killough 3/15/98: no dropoff (really = don't care for missiles) - if (!(P_TryMove (th, th->x, th->y, false, NULL, tm))) + if (!(P_TryMove (th, th->x, th->y, false, NULL, tm, true))) { // [RH] Don't explode ripping missiles that spawn inside something if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP)) diff --git a/src/p_spec.h b/src/p_spec.h index 547154c19a..96bd4c8eec 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -876,8 +876,8 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag); // // P_TELEPT // -bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true); -bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, bool sourceFog, bool keepOrientation, bool haltVelocity = true); +bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false); +bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false); bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse); bool EV_TeleportOther (int other_tid, int dest_tid, bool fog); bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_tid, bool moveSource, bool fog); diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 12497590a6..cc31358a87 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -99,7 +99,7 @@ void P_SpawnTeleportFog(fixed_t x, fixed_t y, fixed_t z, int spawnid) // bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, - bool useFog, bool sourceFog, bool keepOrientation, bool bHaltVelocity) + bool useFog, bool sourceFog, bool keepOrientation, bool bHaltVelocity, bool keepHeight) { fixed_t oldx; fixed_t oldy; @@ -127,7 +127,11 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, { // We don't measure z velocity, because it doesn't change. missilespeed = xs_CRoundToInt(TVector2(thing->velx, thing->vely).Length()); } - if (z == ONFLOORZ) + if (keepHeight) + { + z = floorheight + aboveFloor; + } + else if (z == ONFLOORZ) { if (player) { @@ -320,7 +324,7 @@ static AActor *SelectTeleDest (int tid, int tag) } bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool fog, - bool sourceFog, bool keepOrientation, bool haltVelocity) + bool sourceFog, bool keepOrientation, bool haltVelocity, bool keepHeight) { AActor *searcher; fixed_t z; @@ -377,7 +381,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool { badangle = 1 << ANGLETOFINESHIFT; } - if (P_Teleport (thing, searcher->x, searcher->y, z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity)) + if (P_Teleport (thing, searcher->x, searcher->y, z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity, keepHeight)) { // [RH] Lee Killough's changes for silent teleporters from BOOM if (!fog && line && keepOrientation) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 8968db07c7..e1e0f371aa 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1452,6 +1452,8 @@ public: char *buffer = new char[map->Size(ML_TEXTMAP)]; isTranslated = true; + isExtended = false; + floordrop = false; map->Read(ML_TEXTMAP, buffer); sc.OpenMem(Wads.GetLumpFullName(map->lumpnum), buffer, map->Size(ML_TEXTMAP)); @@ -1570,6 +1572,12 @@ public: } } + // Catch bogus maps here rather than during nodebuilding + if (ParsedVertices.Size() == 0) I_Error("Map has no vertices.\n"); + if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. \n"); + if (ParsedLines.Size() == 0) I_Error("Map has no linedefs.\n"); + if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs.\n"); + // Create the real vertices numvertexes = ParsedVertices.Size(); vertexes = new vertex_t[numvertexes]; diff --git a/src/r_things.cpp b/src/r_things.cpp index ec8ec89f11..a2d257563d 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2112,7 +2112,7 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, vis->x1 = x1; vis->x2 = x2; vis->Translation = 0; - vis->startfrac = particle->color; + vis->startfrac = 255 & (particle->color >>24); vis->pic = NULL; vis->bIsVoxel = false; vis->renderflags = particle->trans; diff --git a/src/sdl/crashcatcher.c b/src/sdl/crashcatcher.c index 73fa4b0361..863f97680b 100644 --- a/src/sdl/crashcatcher.c +++ b/src/sdl/crashcatcher.c @@ -14,6 +14,8 @@ #ifndef PR_SET_PTRACER #define PR_SET_PTRACER 0x59616d61 #endif +#else if defined (__APPLE__) +#include #endif diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index 3b2de3c577..cda8d54e21 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -255,10 +255,12 @@ void I_ShutdownJoysticks(); int main (int argc, char **argv) { +#if !defined (__APPLE__) { int s[4] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS }; cc_install_handlers(argc, argv, 4, s, "zdoom-crash.log", DoomSpecificInfo); } +#endif // !__APPLE__ printf(GAMENAME" v%s - SVN revision %s - SDL version\nCompiled on %s\n", DOTVERSIONSTR_NOREV,SVN_REVISION_STRING,__DATE__); @@ -297,6 +299,26 @@ int main (int argc, char **argv) } SDL_WM_SetCaption (GAMESIG " " DOTVERSIONSTR " (" __DATE__ ")", NULL); + +#ifdef __APPLE__ + + const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo(); + if ( NULL != videoInfo ) + { + EXTERN_CVAR( Int, vid_defwidth ) + EXTERN_CVAR( Int, vid_defheight ) + EXTERN_CVAR( Int, vid_defbits ) + EXTERN_CVAR( Bool, vid_vsync ) + EXTERN_CVAR( Bool, fullscreen ) + + vid_defwidth = videoInfo->current_w; + vid_defheight = videoInfo->current_h; + vid_defbits = videoInfo->vfmt->BitsPerPixel; + vid_vsync = True; + fullscreen = True; + } + +#endif // __APPLE__ try { diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index bee304f4c5..6c88a173bf 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -39,6 +39,7 @@ #endif #ifdef __APPLE__ +#include #include #include #include @@ -393,9 +394,25 @@ void STACK_ARGS I_FatalError (const char *error, ...) int index; va_list argptr; va_start (argptr, error); - index = vsprintf (errortext, error, argptr); + index = vsnprintf (errortext, MAX_ERRORTEXT, error, argptr); va_end (argptr); +#ifdef __APPLE__ + // Close window or exit fullscreen and release mouse capture + SDL_Quit(); + + const CFStringRef errorString = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault, + errortext, kCFStringEncodingASCII, kCFAllocatorNull ); + if ( NULL != errorString ) + { + CFOptionFlags dummy; + + CFUserNotificationDisplayAlert( 0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, + CFSTR( "Error" ), errorString, CFSTR( "Exit" ), NULL, NULL, &dummy ); + CFRelease( errorString ); + } +#endif // __APPLE__ + // Record error to log (if logging) if (Logfile) { diff --git a/src/stats.cpp b/src/stats.cpp index dba058caa6..76fe36c268 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -42,6 +42,15 @@ #include "m_swap.h" #include "sbar.h" + +#if defined (__APPLE__) + +mach_timebase_info_data_t cycle_t::s_info; +bool cycle_t::s_initialized; + +#endif // __APPLE__ + + FStat *FStat::FirstStat; FStat::FStat (const char *name) diff --git a/src/stats.h b/src/stats.h index 65eb73926a..ed493188b6 100644 --- a/src/stats.h +++ b/src/stats.h @@ -38,6 +38,77 @@ #ifndef _WIN32 +#if defined (__APPLE__) + + +#include + + +class cycle_t +{ +public: + cycle_t() + { + if ( !s_initialized ) + { + mach_timebase_info( &s_info ); + s_initialized = true; + } + + Reset(); + } + + cycle_t &operator=( const cycle_t &other ) + { + if ( &other != this ) + { + m_seconds = other.m_seconds; + + } + + return *this; + } + + void Reset() + { + m_seconds = 0; + } + + void Clock() + { + m_seconds -= Nanoseconds() * 1e-9; + } + + void Unclock() + { + m_seconds += Nanoseconds() * 1e-9; + } + + double Time() + { + return m_seconds; + } + + double TimeMS() + { + return m_seconds * 1e3; + } + +private: + double m_seconds; + + static mach_timebase_info_data_t s_info; + static bool s_initialized; + + uint64_t Nanoseconds() const + { + return mach_absolute_time() * s_info.numer / s_info.denom; + } + +}; + +#else // !__APPLE__ + #ifdef NO_CLOCK_GETTIME class cycle_t { @@ -100,6 +171,8 @@ private: #endif +#endif // __APPLE__ + #else // Windows diff --git a/wadsrc/static/xlat/base.txt b/wadsrc/static/xlat/base.txt index f9c9e01251..c5c7d71052 100644 --- a/wadsrc/static/xlat/base.txt +++ b/wadsrc/static/xlat/base.txt @@ -209,10 +209,10 @@ include "xlat/defines.i" 204 = USE, Ceiling_LowerToHighestFloor (tag, C_SLOW) 205 = USE|REP, Ceiling_LowerToLowest (tag, C_SLOW) 206 = USE|REP, Ceiling_LowerToHighestFloor (tag, C_SLOW) -207 = WALK|MONST, Teleport_NoFog (0, 0, tag) -208 = WALK|REP|MONST, Teleport_NoFog (0, 0, tag) -209 = USE|MONST, Teleport_NoFog (0, 0, tag) -210 = USE|REP|MONST, Teleport_NoFog (0, 0, tag) +207 = WALK|MONST, Teleport_NoFog (0, 0, tag, 1) +208 = WALK|REP|MONST, Teleport_NoFog (0, 0, tag, 1) +209 = USE|MONST, Teleport_NoFog (0, 0, tag, 1) +210 = USE|REP|MONST, Teleport_NoFog (0, 0, tag, 1) 211 = USE|REP, Plat_ToggleCeiling (tag) 212 = WALK|REP, Plat_ToggleCeiling (tag) 213 = 0, Transfer_FloorLight (tag) @@ -270,8 +270,8 @@ include "xlat/defines.i" 265 = MONWALK|REP, Teleport_Line (tag, tag, 1) 266 = MONWALK, Teleport_Line (tag, tag, 0) 267 = MONWALK|REP, Teleport_Line (tag, tag, 0) -268 = MONWALK, Teleport_NoFog (0, 0, tag) -269 = MONWALK|REP, Teleport_NoFog (0, 0, tag) +268 = MONWALK, Teleport_NoFog (0, 0, tag, 1) +269 = MONWALK|REP, Teleport_NoFog (0, 0, tag, 1) /****** MBF linetypes ******/ diff --git a/zdoom.vcproj b/zdoom.vcproj index 4601991fa3..dff0e6cb22 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -1840,14 +1848,6 @@ Outputs="$(IntDir)/$(InputName).obj" /> - - - @@ -2037,14 +2037,6 @@ Outputs="$(IntDir)\$(InputName).obj" /> - - - @@ -2055,6 +2047,14 @@ Outputs="$(IntDir)\$(InputName).obj" /> + + + - - - @@ -2485,6 +2477,14 @@ AdditionalIncludeDirectories="src\win32;$(NoInherit)" /> + + + @@ -2783,7 +2783,7 @@ /> - - - + + +