diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da8b6f2392..799bf6dd44 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1331,18 +1331,20 @@ if( APPLE ) LINK_FLAGS "-framework Carbon -framework Cocoa -framework IOKit -framework OpenGL" MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/zdoom-info.plist" ) - # Fix fmod link so that it can be found in the app bundle. - find_program( OTOOL otool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" ) - find_program( INSTALL_NAME_TOOL install_name_tool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" ) - execute_process( COMMAND "${OTOOL}" -L "${FMOD_LIBRARY}" - COMMAND grep "libfmodex.dylib (compat" - COMMAND head -n1 - COMMAND awk "{print $1}" - OUTPUT_VARIABLE FMOD_LINK - OUTPUT_STRIP_TRAILING_WHITESPACE ) - add_custom_command( TARGET zdoom POST_BUILD - COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$" - COMMENT "Relinking FMOD Ex" ) + if( NOT NO_FMOD ) + # Fix fmod link so that it can be found in the app bundle. + find_program( OTOOL otool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" ) + find_program( INSTALL_NAME_TOOL install_name_tool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" ) + execute_process( COMMAND "${OTOOL}" -L "${FMOD_LIBRARY}" + COMMAND grep "libfmodex.dylib (compat" + COMMAND head -n1 + COMMAND awk "{print $1}" + OUTPUT_VARIABLE FMOD_LINK + OUTPUT_STRIP_TRAILING_WHITESPACE ) + add_custom_command( TARGET zdoom POST_BUILD + COMMAND "${INSTALL_NAME_TOOL}" -change "${FMOD_LINK}" @executable_path/../Frameworks/libfmodex.dylib "$" + COMMENT "Relinking FMOD Ex" ) + endif( NOT NO_FMOD ) endif( APPLE ) source_group("Assembly Files\\ia32" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/asm_ia32/.+") diff --git a/src/am_map.cpp b/src/am_map.cpp index 0133a2493a..fdbacd34f9 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1935,8 +1935,6 @@ void AM_drawSubsectors() scalex = sec->GetXScale(sector_t::floor); scaley = sec->GetYScale(sector_t::floor); -#ifdef _3DFLOORS - if (sec->e->XFloor.ffloors.Size()) { secplane_t *floorplane = &sec->floorplane; @@ -1997,7 +1995,6 @@ void AM_drawSubsectors() floorlight = *light->p_lightlevel; colormap = light->extra_colormap; } -#endif if (maptex == skyflatnum) { continue; @@ -2153,8 +2150,6 @@ void AM_showSS() } } -#ifdef _3DFLOORS - //============================================================================= // // Determines if a 3D floor boundary should be drawn @@ -2214,7 +2209,6 @@ bool AM_Check3DFloors(line_t *line) // All 3D floors could be matched so let's not draw a boundary. return false; } -#endif //============================================================================= // @@ -2345,12 +2339,10 @@ void AM_drawWalls (bool allmap) { AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change } -#ifdef _3DFLOORS else if (AM_Check3DFloors(&lines[i])) { AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border } -#endif else if (am_cheat > 0 && am_cheat < 4) { AM_drawMline(&l, AMColors.TSWallColor); diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index d72993cb77..8ddd022e94 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -1076,7 +1076,8 @@ FString BuildString (int argc, FString *argv) // %x or %{x} in the command line with argument x. If argument x does not // exist, then the empty string is substituted in its place. // -// Substitution is not done inside of quoted strings. +// Substitution is not done inside of quoted strings, unless that string is +// prepended with a % character. // // To avoid a substitution, use %%. The %% will be replaced by a single %. // @@ -1091,19 +1092,12 @@ FString SubstituteAliasParams (FString &command, FCommandLine &args) char *p = command.LockBuffer(), *start = p; unsigned long argnum; FString buf; + bool inquote = false; while (*p != '\0') { - if (*p == '%' && ((p[1] >= '0' && p[1] <= '9') || p[1] == '{' || p[1] == '%')) + if (p[0] == '%' && ((p[1] >= '0' && p[1] <= '9') || p[1] == '{')) { - if (p[1] == '%') - { - // Do not substitute. Just collapse to a single %. - buf.AppendCStrPart (start, p - start + 1); - start = p = p + 2; - continue; - } - // Do a substitution. Output what came before this. buf.AppendCStrPart (start, p - start); @@ -1115,14 +1109,50 @@ FString SubstituteAliasParams (FString &command, FCommandLine &args) } p = (start += (p[1] == '{' && *start == '}')); } - else if (*p == '"') + else if (p[0] == '%' && p[1] == '%') { - // Don't substitute inside quoted strings. - p++; - while (*p != '\0' && (*p != '"' || *(p-1) == '\\')) + // Do not substitute. Just collapse to a single %. + buf.AppendCStrPart (start, p - start + 1); + start = p = p + 2; + continue; + } + else if (p[0] == '%' && p[1] == '"') + { + // Collapse %" to " and remember that we're in a quote so when we + // see a " character again, we don't start skipping below. + if (!inquote) + { + inquote = true; + buf.AppendCStrPart(start, p - start); + start = p + 1; + } + else + { + inquote = false; + } + p += 2; + } + else if (p[0] == '\\' && p[1] == '"') + { + p += 2; + } + else if (p[0] == '"') + { + // Don't substitute inside quoted strings if it didn't start + // with a %" + if (!inquote) + { p++; - if (*p != '\0') + while (*p != '\0' && (*p != '"' || *(p-1) == '\\')) + p++; + if (*p != '\0') + p++; + } + else + { + inquote = false; p++; + } } else { diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 6dbf3d1ec5..899f1f7d5b 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -624,7 +624,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) if (spray != NULL) { - if (spray->flags6 & MF6_MTHRUSPECIES && spray->GetSpecies() == linetarget->GetSpecies()) + if (spray->flags6 & MF6_MTHRUSPECIES && self->target->GetSpecies() == linetarget->GetSpecies()) { spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them. continue; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 17c9621d59..afc4f60079 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1046,7 +1046,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) x = self->x + ((pr_storm()&127) - 64) * FRACUNIT; y = self->y + ((pr_storm()&127) - 64) * FRACUNIT; mo = Spawn (x, y, ONCEILINGZ, ALLOW_REPLACE); -#ifdef _3DFLOORS // We used bouncecount to store the 3D floor index in A_HideInCeiling if (!mo) return; fixed_t newz; @@ -1058,7 +1057,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) int moceiling = P_Find3DFloor(NULL, x, y, newz, false, false, newz); if (moceiling >= 0) mo->z = newz - mo->height; -#endif mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0; mo->target = self->target; @@ -1098,7 +1096,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_RainImpact) DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) { -#ifdef _3DFLOORS // We use bouncecount to store the 3D floor index fixed_t foo; for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++) @@ -1114,7 +1111,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) } } self->bouncecount = -1; -#endif self->z = self->ceilingz + 4*FRACUNIT; } diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 576ff6a5cd..29fcbf8cbc 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -272,7 +272,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor Z -= back->GetPlaneTexZ(sector_t::ceiling); tex = wall->GetTexture(side_t::top); } -#ifdef _3DFLOORS else if (ffloor) // this is a 3d-floor segment - do this only if we know which one! { Sector=ffloor->model; @@ -295,7 +294,6 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor tex = ffloor->master->sidedef[0]->GetTexture(side_t::mid); } } -#endif else return FNullTextureID(); CalcFracPos (wall, x, y); diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index d2e8894266..285c85f1a4 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -41,6 +41,7 @@ #include "w_wad.h" #include "sc_man.h" #include "g_level.h" +#include "p_terrain.h" #include "r_data/colormaps.h" #ifdef _3DFLOORS @@ -343,8 +344,15 @@ void P_PlayerOnSpecial3DFloor(player_t* player) (player->mo->z + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo->x, player->mo->y)) continue; } - - if (rover->model->special || rover->model->damage) P_PlayerInSpecialSector(player, rover->model); + + // Apply sector specials + if (rover->model->special || rover->model->damage) + P_PlayerInSpecialSector(player, rover->model); + + // Apply flat specials (using the ceiling!) + P_PlayerOnSpecialFlat( + player, TerrainTypes[rover->model->GetTexture(rover->flags & FF_INVERTSECTOR? sector_t::floor : sector_t::ceiling)]); + break; } } @@ -957,8 +965,6 @@ int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, b return -1; } -#endif - #include "c_dispatch.h" diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 4321ad0e5d..7f18418a79 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -4,8 +4,6 @@ #define CenterSpot(sec) (vertex_t*)&(sec)->soundorg[0] -#define _3DFLOORS - // 3D floor flags. Most are the same as in Legacy but I added some for EDGE's and Vavoom's features as well. typedef enum { @@ -60,8 +58,6 @@ enum VC_COLORMASK = 0x00FFFFFF, }; -#ifdef _3DFLOORS - struct secplane_t; struct FDynamicColormap; @@ -150,39 +146,5 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z); int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz); -#else - -// Dummy definitions for disabled 3D floor code - -struct F3DFloor -{ - int dummy; -}; - -struct lightlist_t -{ - int dummy; -}; - -class player_s; -inline void P_PlayerOnSpecial3DFloor(player_t* player) {} - -inline void P_Get3DFloorAndCeiling(AActor * thing, sector_t * sector, fixed_t * floorz, fixed_t * ceilingz, int * floorpic) {} -inline bool P_CheckFor3DFloorHit(AActor * mo) { return false; } -inline bool P_CheckFor3DCeilingHit(AActor * mo) { return false; } -inline void P_Recalculate3DFloors(sector_t *) {} -inline void P_RecalculateAttached3DFloors(sector_t * sec) {} -inline lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside) { return NULL; } -inline void P_Spawn3DFloors( void ) {} - -struct FLineOpening; - -inline void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, - fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) {} - -//secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;} - -#endif - #endif \ No newline at end of file diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 5cd5774f49..2cc9f958f2 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1959,13 +1959,12 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) chunk = (DWORD *)FindChunk (MAKE_ID('M','S','T','R')); if (chunk != NULL) { - for (DWORD i = 0; i < chunk[1]/4; ++i) + for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i) { -// MapVarStore[chunk[i+2]] |= LibraryID; - const char *str = LookupString(MapVarStore[chunk[i+2]]); + const char *str = LookupString(MapVarStore[LittleLong(chunk[i+2])]); if (str != NULL) { - MapVarStore[chunk[i+2]] = GlobalACSStrings.AddString(str, NULL, 0); + MapVarStore[LittleLong(chunk[i+2])] = GlobalACSStrings.AddString(str, NULL, 0); } } } @@ -1973,7 +1972,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) chunk = (DWORD *)FindChunk (MAKE_ID('A','S','T','R')); if (chunk != NULL) { - for (DWORD i = 0; i < chunk[1]/4; ++i) + for (DWORD i = 0; i < LittleLong(chunk[1])/4; ++i) { int arraynum = MapVarStore[LittleLong(chunk[i+2])]; if ((unsigned)arraynum < (unsigned)NumArrays) @@ -2000,13 +1999,13 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) // First byte is version, it should be 0 if(*chunkData++ == 0) { - int arraynum = MapVarStore[uallong(*(const int*)(chunkData))]; + int arraynum = MapVarStore[uallong(LittleLong(*(const int*)(chunkData)))]; chunkData += 4; if ((unsigned)arraynum < (unsigned)NumArrays) { SDWORD *elems = ArrayStore[arraynum].Elements; // Ending zeros may be left out. - for (int j = MIN(chunk[1]-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData) + for (int j = MIN(LittleLong(chunk[1])-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData) { // For ATAG, a value of 0 = Integer, 1 = String, 2 = FunctionPtr // Our implementation uses the same tags for both String and FunctionPtr @@ -2073,7 +2072,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) ScriptFunction *func = &((ScriptFunction *)Functions)[j]; if (func->Address == 0 && func->ImportNum == 0) { - int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + chunk[3+j]); + int libfunc = lib->FindFunctionName ((char *)(chunk + 2) + LittleLong(chunk[3+j])); if (libfunc >= 0) { ScriptFunction *realfunc = &((ScriptFunction *)lib->Functions)[libfunc]; @@ -2086,14 +2085,14 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) if (realfunc->ArgCount != func->ArgCount) { Printf (TEXTCOLOR_ORANGE "Function %s in %s has %d arguments. %s expects it to have %d.\n", - (char *)(chunk + 2) + chunk[3+j], lib->ModuleName, realfunc->ArgCount, + (char *)(chunk + 2) + LittleLong(chunk[3+j]), lib->ModuleName, realfunc->ArgCount, ModuleName, func->ArgCount); Format = ACS_Unknown; } // The next two properties do not affect code compatibility, so it is // okay for them to be different in the imported module than they are // in this one, as long as we make sure to use the real values. - func->LocalCount = realfunc->LocalCount; + func->LocalCount = LittleLong(realfunc->LocalCount); func->HasReturnValue = realfunc->HasReturnValue; } } @@ -2105,7 +2104,7 @@ bool FBehavior::Init(int lumpnum, FileReader * fr, int len) if (chunk != NULL) { char *parse = (char *)&chunk[2]; - for (DWORD j = 0; j < chunk[1]; ) + for (DWORD j = 0; j < LittleLong(chunk[1]); ) { DWORD varNum = LittleLong(*(DWORD *)&parse[j]); j += 4; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 1b7ce0bc8c..db31295219 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -586,12 +586,12 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i } } -void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff, int flags, const PClass *spawnclass, angle_t angle, int duration, float sparsity, float drift, int SpiralOffset) +void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVector3 &end, int color1, int color2, double maxdiff, int flags, const PClass *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset) { double length, lengthsquared; int steps, i; - FAngle deg; - FVector3 step, dir, pos, extend; + TAngle deg; + TVector3 step, dir, pos, extend; bool fullbright; dir = end - start; @@ -615,9 +615,9 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end // The railgun's sound is special. It gets played from the // point on the slug's trail that is closest to the hearing player. AActor *mo = players[consoleplayer].camera; - FVector3 point; + TVector3 point; double r; - float dirz; + double dirz; if (abs(mo->x - FLOAT2FIXED(start.X)) < 20 * FRACUNIT && (mo->y - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT) @@ -630,7 +630,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end // Only consider sound in 2D (for now, anyway) // [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 = ((start.Y - FIXED2DBL(mo->y)) * (-dir.Y) - (start.X - FIXED2DBL(mo->x)) * (dir.X)) / lengthsquared; r = clamp(r, 0., 1.); dirz = dir.Z; @@ -662,7 +662,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end minelem = fabs(dir[i]); } } - FVector3 tempvec(0,0,0); + TVector3 tempvec(0, 0, 0); tempvec[epos] = 1; extend = tempvec - (dir | tempvec) * dir; // @@ -673,16 +673,16 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end // Create the outer spiral. if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL)) { - FVector3 spiral_step = step * r_rail_spiralsparsity * sparsity; + TVector3 spiral_step = step * r_rail_spiralsparsity * sparsity; int spiral_steps = (int)(steps * r_rail_spiralsparsity / sparsity); color1 = color1 == 0 ? -1 : ParticleColor(color1); pos = start; - deg = FAngle(SpiralOffset); + deg = TAngle(SpiralOffset); for (i = spiral_steps; i; i--) { particle_t *p = NewParticle (); - FVector3 tempvec; + TVector3 tempvec; if (!p) return; @@ -695,7 +695,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end p->size = 3; p->bright = fullbright; - tempvec = FMatrix3x3(dir, deg) * extend; + tempvec = TMatrix3x3(dir, deg) * extend; p->velx = FLOAT2FIXED(tempvec.X * drift)>>4; p->vely = FLOAT2FIXED(tempvec.Y * drift)>>4; p->velz = FLOAT2FIXED(tempvec.Z * drift)>>4; @@ -704,7 +704,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end p->y = FLOAT2FIXED(tempvec.Y); p->z = FLOAT2FIXED(tempvec.Z); pos += spiral_step; - deg += FAngle(r_rail_spiralsparsity * 14); + deg += TAngle(r_rail_spiralsparsity * 14); if (color1 == -1) { @@ -729,18 +729,18 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end // Create the inner trail. if (color2 != -1 && r_rail_trailsparsity > 0 && spawnclass == NULL) { - FVector3 trail_step = step * r_rail_trailsparsity * sparsity; + TVector3 trail_step = step * r_rail_trailsparsity * sparsity; int trail_steps = xs_FloorToInt(steps * r_rail_trailsparsity / sparsity); color2 = color2 == 0 ? -1 : ParticleColor(color2); - FVector3 diff(0, 0, 0); + TVector3 diff(0, 0, 0); pos = start; for (i = trail_steps; i; i--) { // [XA] inner trail uses a different default duration (33). int innerduration = (duration == 0) ? 33 : duration; - particle_t *p = JitterParticle (innerduration, drift); + particle_t *p = JitterParticle (innerduration, (float)drift); if (!p) return; @@ -749,14 +749,14 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end { int rnd = M_Random (); if (rnd & 1) - diff.X = clamp (diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff); + diff.X = clamp(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff); if (rnd & 2) - diff.Y = clamp (diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff); + diff.Y = clamp(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff); if (rnd & 4) - diff.Z = clamp (diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); + diff.Z = clamp(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); } - FVector3 postmp = pos + diff; + TVector3 postmp = pos + diff; p->size = 2; p->x = FLOAT2FIXED(postmp.X); @@ -791,9 +791,9 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end if (sparsity < 1) sparsity = 32; - FVector3 trail_step = (step / 3) * sparsity; + TVector3 trail_step = (step / 3) * sparsity; int trail_steps = (int)((steps * 3) / sparsity); - FVector3 diff(0, 0, 0); + TVector3 diff(0, 0, 0); pos = start; for (i = trail_steps; i; i--) @@ -802,13 +802,13 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end { int rnd = pr_railtrail(); if (rnd & 1) - diff.X = clamp (diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff); + diff.X = clamp(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff); if (rnd & 2) - diff.Y = clamp (diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff); + diff.Y = clamp(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff); if (rnd & 4) - diff.Z = clamp (diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); + diff.Z = clamp(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff); } - FVector3 postmp = pos + diff; + TVector3 postmp = pos + diff; AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE); if (thing) diff --git a/src/p_effect.h b/src/p_effect.h index 6ca9dfea9e..11116e8a3f 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -88,7 +88,7 @@ void P_RunEffects (void); void P_RunEffect (AActor *actor, int effects); -void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff = 0, int flags = 0, const PClass *spawnclass = NULL, angle_t angle = 0, int duration = 35, float sparsity = 1.0, float drift = 1.0, int SpiralOffset = 270); +void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVector3 &end, int color1, int color2, double maxdiff = 0, int flags = 0, const PClass *spawnclass = NULL, angle_t angle = 0, int duration = 35, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270); void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind); void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind); void P_DisconnectEffect (AActor *actor); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 3e17a85f35..5291101a57 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2548,7 +2548,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) if (abs(corpsehit->x - viletryx) > maxdist || abs(corpsehit->y - viletryy) > maxdist) continue; // not actually touching -#ifdef _3DFLOORS // Let's check if there are floors in between the archvile and its target sector_t *vilesec = self->Sector; sector_t *corpsec = corpsehit->Sector; @@ -2566,7 +2565,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) continue; } } -#endif corpsehit->velx = corpsehit->vely = 0; // [RH] Check against real height and radius @@ -2933,7 +2931,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) if (linetarget == NULL) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. - FVector2 xydiff(self->target->x - self->x, self->target->y - self->y); + TVector2 xydiff(self->target->x - self->x, self->target->y - self->y); double zdiff = (self->target->z + (self->target->height>>1)) - (self->z + (self->height>>1) - self->floorclip); self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI); diff --git a/src/p_local.h b/src/p_local.h index b62836c172..686e0ee134 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -475,7 +475,7 @@ void P_TraceBleed (int damage, AActor *target); // random direction version bool P_HitFloor (AActor *thing); bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true); void P_CheckSplash(AActor *self, fixed_t distance); -void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, float maxdiff = 0, int flags = 0, const PClass *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, float sparsity = 1.0, float drift = 1.0, const PClass *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun +void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, double maxdiff = 0, int flags = 0, const PClass *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, double sparsity = 1.0, double drift = 1.0, const PClass *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun enum // P_RailAttack / A_RailAttack / A_CustomRailgun / P_DrawRailTrail flags { diff --git a/src/p_map.cpp b/src/p_map.cpp index b76919a7de..d5745523c2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -249,7 +249,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) sec = tmf.thing->Sector; } -#ifdef _3DFLOORS for (unsigned int i = 0; ie->XFloor.ffloors.Size(); i++) { F3DFloor* rover = sec->e->XFloor.ffloors[i]; @@ -273,7 +272,6 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) tmf.ceilingpic = *rover->bottom.texture; } } -#endif } //========================================================================== @@ -574,6 +572,25 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) { friction = secfriction(mo->Sector); movefactor = secmovefac(mo->Sector) >> 1; + + // Check 3D floors -- might be the source of the waterlevel + for (unsigned i = 0; i < mo->Sector->e->XFloor.ffloors.Size(); i++) + { + F3DFloor *rover = mo->Sector->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_SWIMMABLE)) continue; + + if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || + mo->z < rover->bottom.plane->ZatPoint(mo->x, mo->y)) + continue; + + newfriction = secfriction(rover->model); + if (newfriction < friction || friction == ORIG_FRICTION) + { + friction = newfriction; + movefactor = secmovefac(rover->model) >> 1; + } + } } else if (var_friction && !(mo->flags & (MF_NOCLIP | MF_NOGRAVITY))) { // When the object is straddling sectors with the same @@ -584,16 +601,27 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) { sec = m->m_sector; -#ifdef _3DFLOORS // 3D floors must be checked, too for (unsigned i = 0; i < sec->e->XFloor.ffloors.Size(); i++) { F3DFloor *rover = sec->e->XFloor.ffloors[i]; if (!(rover->flags & FF_EXISTS)) continue; - if (!(rover->flags & FF_SOLID)) continue; - // Player must be on top of the floor to be affected... - if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue; + if (rover->flags & FF_SOLID) + { + // Must be standing on a solid floor + if (mo->z != rover->top.plane->ZatPoint(mo->x, mo->y)) continue; + } + else if (rover->flags & FF_SWIMMABLE) + { + // Or on or inside a swimmable floor (e.g. in shallow water) + if (mo->z > rover->top.plane->ZatPoint(mo->x, mo->y) || + (mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo->x, mo->y)) + continue; + } + else + continue; + newfriction = secfriction(rover->model); if (newfriction < friction || friction == ORIG_FRICTION) { @@ -601,7 +629,6 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) movefactor = secmovefac(rover->model); } } -#endif if (!(sec->special & FRICTION_MASK) && Terrains[TerrainTypes[sec->GetTexture(sector_t::floor)]].Friction == 0) @@ -756,14 +783,9 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) !(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP))) { secplane_t frontplane, backplane; -#ifdef _3DFLOORS // Check 3D floors as well frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz); backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz); -#else - frontplane = ld->frontsector->floorplane; - backplane = ld->backsector->floorplane; -#endif if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE) { const msecnode_t *node = tm.thing->touching_sectorlist; @@ -1424,7 +1446,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo //Added by MC: Fill the tmsector. tm.sector = newsec; -#ifdef _3DFLOORS //Check 3D floors if (!thing->IsNoClip2() && newsec->e->XFloor.ffloors.Size()) { @@ -1456,7 +1477,6 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo } } } -#endif validcount++; spechit.Clear(); @@ -1773,7 +1793,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo fzb <= mobj->z && bzb <= mobj->z) { // we must also check if some 3D floor in the backsector may be blocking -#ifdef _3DFLOORS for (unsigned int i = 0; ibacksector->e->XFloor.ffloors.Size(); i++) { F3DFloor* rover = line->backsector->e->XFloor.ffloors[i]; @@ -1788,7 +1807,6 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo goto isblocking; } } -#endif return; } } @@ -2713,7 +2731,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov const secplane_t *plane = &actor->floorsector->floorplane; fixed_t planezhere = plane->ZatPoint(actor->x, actor->y); -#ifdef _3DFLOORS for (unsigned int i = 0; ifloorsector->e->XFloor.ffloors.Size(); i++) { F3DFloor * rover = actor->floorsector->e->XFloor.ffloors[i]; @@ -2748,7 +2765,6 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov } } } -#endif if (actor->floorsector != actor->Sector) { @@ -3126,7 +3142,6 @@ struct aim_t AActor * thing_friend, *thing_other; angle_t pitch_friend, pitch_other; int flags; -#ifdef _3DFLOORS sector_t * lastsector; secplane_t * lastfloorplane; secplane_t * lastceilingplane; @@ -3134,13 +3149,11 @@ struct aim_t bool crossedffloors; bool AimTraverse3DFloors(const divline_t &trace, intercept_t * in); -#endif void AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, AActor *target = NULL); }; -#ifdef _3DFLOORS //============================================================================ // // AimTraverse3DFloors @@ -3242,7 +3255,6 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in) lastfloorplane = nextbottomplane; return true; } -#endif //============================================================================ // @@ -3295,9 +3307,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en if (toppitch >= bottompitch) return; // stop -#ifdef _3DFLOORS if (!AimTraverse3DFloors(it.Trace(), in)) return; -#endif continue; // shot continues } @@ -3336,7 +3346,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en continue; } -#ifdef _3DFLOORS // we must do one last check whether the trace has crossed a 3D floor if (lastsector == th->Sector && th->Sector->e->XFloor.ffloors.Size()) { @@ -3361,7 +3370,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en } } } -#endif // check angles to see if the thing can be aimed at @@ -3375,7 +3383,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en if (thingbottompitch < toppitch) continue; // shot under the thing -#ifdef _3DFLOORS if (crossedffloors) { // if 3D floors were in the way do an extra visibility check for safety @@ -3394,7 +3401,6 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en else return; } } -#endif // this thing can be hit! if (thingtoppitch < toppitch) @@ -3531,7 +3537,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL // Information for tracking crossed 3D floors aim.aimpitch = t1->pitch; -#ifdef _3DFLOORS aim.crossedffloors = t1->Sector->e->XFloor.ffloors.Size() != 0; aim.lastsector = t1->Sector; aim.lastfloorplane = aim.lastceilingplane = NULL; @@ -3547,7 +3552,6 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL bottomz = rover->top.plane->ZatPoint(t1->x, t1->y); if (bottomz <= t1->z) aim.lastfloorplane = rover->top.plane; } -#endif aim.AimTraverse(t1->x, t1->y, x2, y2, target); @@ -4146,12 +4150,12 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata) // // //========================================================================== -void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, int color1, int color2, float maxdiff, int railflags, const PClass *puffclass, angle_t angleoffset, angle_t pitchoffset, fixed_t distance, int duration, float sparsity, float drift, const PClass *spawnclass, int SpiralOffset) +void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, int color1, int color2, double maxdiff, int railflags, const PClass *puffclass, angle_t angleoffset, angle_t pitchoffset, fixed_t distance, int duration, double sparsity, double drift, const PClass *spawnclass, int SpiralOffset) { fixed_t vx, vy, vz; angle_t angle, pitch; fixed_t x1, y1; - FVector3 start, end; + TVector3 start, end; FTraceResults trace; fixed_t shootz; @@ -4271,11 +4275,16 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i // Spawn a decal or puff at the point where the trace ended. if (trace.HitType == TRACE_HitWall) { - SpawnShootDecal(source, trace); + AActor* puff = NULL; + if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) { - P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0); + puff = P_SpawnPuff(source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0); } + if (puff != NULL && puffDefaults->flags7 & MF7_FORCEDECAL && puff->DecalGenerator) + SpawnShootDecal(puff, trace); + else + SpawnShootDecal(source, trace); } if (thepuff != NULL) @@ -4295,9 +4304,9 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i } // Draw the slug's trail. - end.X = FIXED2FLOAT(trace.X); - end.Y = FIXED2FLOAT(trace.Y); - end.Z = FIXED2FLOAT(trace.Z); + end.X = FIXED2DBL(trace.X); + end.Y = FIXED2DBL(trace.Y); + end.Z = FIXED2DBL(trace.Z); P_DrawRailTrail(source, start, end, color1, color2, maxdiff, railflags, spawnclass, source->angle + angleoffset, duration, sparsity, drift, SpiralOffset); } @@ -5423,7 +5432,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool cpos.movemidtex = false; cpos.sector = sector; -#ifdef _3DFLOORS // Also process all sectors that have 3D floors transferred from the // changed sector. if (sector->e->XFloor.attached.Size()) @@ -5471,8 +5479,6 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool } } P_Recalculate3DFloors(sector); // Must recalculate the 3d floor and light lists -#endif - // [RH] Use different functions for the four different types of sector // movement. diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b0fc0d08ed..267e71bb9a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1316,7 +1316,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) z = mo->z; F3DFloor * ffloor=NULL; -#ifdef _3DFLOORS if (line->sidedef[side^1] != NULL) { sector_t * backsector = line->sidedef[side^1]->sector; @@ -1336,7 +1335,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) } } } -#endif DImpactDecal::StaticCreate (base->GetDecal (), x, y, z, line->sidedef[side], ffloor); @@ -2164,7 +2162,6 @@ explode: { if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded { -#ifdef _3DFLOORS unsigned i; for(i=0;iSector->e->XFloor.ffloors.Size();i++) { @@ -2175,7 +2172,6 @@ explode: if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo->x,mo->y)==mo->floorz) break; } if (i==mo->Sector->e->XFloor.ffloors.Size()) -#endif return oldfloorz; } } @@ -3567,12 +3563,8 @@ void AActor::Tick () { secplane_t floorplane; -#ifdef _3DFLOORS // Check 3D floors as well floorplane = P_FindFloorPlane(floorsector, x, y, floorz); -#else - floorplane = floorsector->floorplane; -#endif if (floorplane.c < STEEPSLOPE && floorplane.ZatPoint (x, y) <= floorz) @@ -3889,7 +3881,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) reset = true; } } -#ifdef _3DFLOORS else { // Check 3D floors as well! @@ -3923,7 +3914,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) break; } } -#endif } // some additional checks to make deep sectors like Boom's splash without setting @@ -5371,7 +5361,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z } #endif -#ifdef _3DFLOORS for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) { F3DFloor * rover = sec->e->XFloor.ffloors[i]; @@ -5388,7 +5377,6 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z planez = rover->bottom.plane->ZatPoint(x, y); if (planez < z && !(planez < thing->floorz)) return false; } -#endif hsec = sec->GetHeightSec(); if (hsec == NULL || !(hsec->MoreFlags & SECF_CLIPFAKEPLANES)) { @@ -5398,9 +5386,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z { terrainnum = TerrainTypes[hsec->GetTexture(sector_t::floor)]; } -#ifdef _3DFLOORS foundone: -#endif int splashnum = Terrains[terrainnum].Splash; bool smallsplash = false; @@ -5503,7 +5489,6 @@ bool P_HitFloor (AActor *thing) break; } -#ifdef _3DFLOORS // Check 3D floors for(unsigned int i=0;im_sector->e->XFloor.ffloors.Size();i++) { @@ -5517,7 +5502,6 @@ bool P_HitFloor (AActor *thing) } } } -#endif } if (m == NULL || m->m_sector->GetHeightSec() != NULL) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index fb6b34b53d..14b19348e6 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2519,7 +2519,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps } break; -#ifdef _3DFLOORS case Sector_Set3DFloor: if (msd->toptexture[0]=='#') { @@ -2534,7 +2533,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps SetTexture(sd, side_t::mid, msd->midtexture, missingtex); SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex); break; -#endif case TranslucentLine: // killough 4/11/98: apply translucency to 2s normal texture if (checktranmap) diff --git a/src/p_sight.cpp b/src/p_sight.cpp index ef4dfacd0e..135698b8bc 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -127,7 +127,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) if (topslope <= bottomslope) return false; // stop -#ifdef _3DFLOORS // now handle 3D-floors if(li->frontsector->e->XFloor.ffloors.Size() || li->backsector->e->XFloor.ffloors.Size()) { @@ -219,7 +218,6 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) lastztop= FixedMul (topslope, in->frac) + sightzstart; lastzbottom= FixedMul (bottomslope, in->frac) + sightzstart; -#endif return true; // keep going } @@ -401,7 +399,6 @@ bool SightCheck::P_SightTraverseIntercepts () } } -#ifdef _3DFLOORS if (lastsector==seeingthing->Sector && lastsector->e->XFloor.ffloors.Size()) { // we must do one last check whether the trace has crossed a 3D floor in the last sector @@ -424,7 +421,6 @@ bool SightCheck::P_SightTraverseIntercepts () } } -#endif return true; // everything was traversed } @@ -453,7 +449,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_ validcount++; intercepts.Clear (); -#ifdef _3DFLOORS // for FF_SEETHROUGH the following rule applies: // If the viewer is in an area without FF_SEETHROUGH he can only see into areas without this flag // If the viewer is in an area with FF_SEETHROUGH he can only see into areas with this flag @@ -472,7 +467,6 @@ bool SightCheck::P_SightPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_ break; } } -#endif if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0) x1 += FRACUNIT; // don't side exactly on a line diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 42a7b9ca46..9bc0d4a9bc 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -718,12 +718,6 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu void P_PlayerOnSpecialFlat (player_t *player, int floorType) { - if (player->mo->z > player->mo->Sector->floorplane.ZatPoint ( - player->mo->x, player->mo->y) && - !player->mo->waterlevel) - { // Player is not touching the floor - return; - } if (Terrains[floorType].DamageAmount && !(level.time & Terrains[floorType].DamageTimeMask)) { @@ -738,12 +732,13 @@ void P_PlayerOnSpecialFlat (player_t *player, int floorType) } } + int damage = 0; if (ironfeet == NULL) { - P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, + damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, Terrains[floorType].DamageMOD); } - if (Terrains[floorType].Splash != -1) + if (damage > 0 && Terrains[floorType].Splash != -1) { S_Sound (player->mo, CHAN_AUTO, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 5aeff7b469..1ca4654b57 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -177,11 +177,11 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) if ((TexMan.FindSwitch(side->GetTexture(side_t::top))) != NULL) { - return (user->z + user->height >= open.top); + return (user->z + user->height > open.top); } else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL) { - return (user->z <= open.bottom); + return (user->z < open.bottom); } else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL) { @@ -194,7 +194,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) else { // no switch found. Check whether the player can touch either top or bottom texture - return (user->z + user->height >= open.top) || (user->z <= open.bottom); + return (user->z + user->height > open.top) || (user->z < open.bottom); } } diff --git a/src/p_tags.cpp b/src/p_tags.cpp index c08caec8fb..99796e2691 100644 --- a/src/p_tags.cpp +++ b/src/p_tags.cpp @@ -98,7 +98,7 @@ void FTagManager::AddSectorTag(int sector, int tag) void FTagManager::RemoveSectorTags(int sect) { - if (startForSector.Size() > 0) + if (startForSector.Size() > sect) { int start = startForSector[sect]; if (start >= 0) diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 26852269ab..07d23294b8 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -104,7 +104,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector, res.Crossed3DWater = NULL; */ -#ifdef _3DFLOORS // Do a 3D floor check in the starting sector TDeletingArray &ff = sector->e->XFloor.ffloors; @@ -174,7 +173,6 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector, } } } -#endif // check for overflows and clip if necessary SQWORD xd = (SQWORD)x + ( ( SQWORD(vx) * SQWORD(maxDist) )>>16); @@ -257,7 +255,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) fixed_t dist; // Deal with splashes in 3D floors -#ifdef _3DFLOORS if (CurSector->e->XFloor.ffloors.Size()) { for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) @@ -274,7 +271,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } } } -#endif if (in->isaline) { @@ -381,7 +377,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } else { // made it past the wall -#ifdef _3DFLOORS // check for 3D floors first if (entersector->e->XFloor.ffloors.Size()) { @@ -435,9 +430,6 @@ bool FTraceInfo::TraceTraverse (int ptflags) } } } -#endif - - Results->HitType = TRACE_HitNone; if (TraceFlags & TRACE_PCross) @@ -450,9 +442,7 @@ bool FTraceInfo::TraceTraverse (int ptflags) P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_Impact); } } -#ifdef _3DFLOORS cont: -#endif if (Results->HitType != TRACE_HitNone) { diff --git a/src/p_user.cpp b/src/p_user.cpp index 5f9a69c3a0..0617e5d6a1 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2535,7 +2535,13 @@ void P_PlayerThink (player_t *player) { P_PlayerInSpecialSector (player); } - P_PlayerOnSpecialFlat (player, P_GetThingFloorType (player->mo)); + if (player->mo->z <= player->mo->Sector->floorplane.ZatPoint( + player->mo->x, player->mo->y) || + player->mo->waterlevel) + { + // Player must be touching the floor + P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo)); + } if (player->mo->velz <= -player->mo->FallingScreamMinSpeed && player->mo->velz >= -player->mo->FallingScreamMaxSpeed && !player->morphTics && player->mo->waterlevel == 0) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 29e6bf4d4b..410a106f50 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -339,6 +339,7 @@ VideoModes[] = { 1600, 900 }, // 16:9 { 1600, 1000 }, // 16:10 { 1600, 1200 }, + { 1680, 1050 }, // 16:10 { 1920, 1080 }, { 1920, 1200 }, { 2048, 1536 }, diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index 76191e1a92..9da52c2dd3 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -178,6 +178,7 @@ static MiniModeInfo WinModes[] = { 1600, 900 }, // 16:9 { 1600, 1000 }, // 16:10 { 1600, 1200 }, + { 1680, 1050 }, // 16:10 { 1920, 1080 }, { 1920, 1200 }, { 2048, 1536 }, diff --git a/src/r_segs.cpp b/src/r_segs.cpp index cf00abc452..7bcfec13a2 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -557,8 +557,25 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) MaskedSWall = (fixed_t *)(openings + ds->swall) - ds->x1; // find positioning - xscale = FixedMul(rw_pic->xScale, sidedef->GetTextureXScale(side_t::mid)); - yscale = FixedMul(rw_pic->yScale, sidedef->GetTextureYScale(side_t::mid)); + side_t *scaledside; + side_t::ETexpart scaledpart; + if (rover->flags & FF_UPPERTEXTURE) + { + scaledside = curline->sidedef; + scaledpart = side_t::top; + } + else if (rover->flags & FF_LOWERTEXTURE) + { + scaledside = curline->sidedef; + scaledpart = side_t::bottom; + } + else + { + scaledside = rover->master->sidedef[0]; + scaledpart = side_t::mid; + } + xscale = FixedMul(rw_pic->xScale, scaledside->GetTextureXScale(scaledpart)); + yscale = FixedMul(rw_pic->yScale, scaledside->GetTextureYScale(scaledpart)); // encapsulate the lifetime of rowoffset fixed_t rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); dc_texturemid = rover->model->GetPlaneTexZ(sector_t::ceiling); diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 447de49f98..662e426e66 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -924,6 +924,8 @@ void OpenALSoundRenderer::SetSfxVolume(float volume) schan = schan->NextChan; } + alProcessUpdatesSOFT(); + getALError(); } diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 0290a293fa..b9f4382a63 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -395,6 +395,11 @@ void FTextureManager::ParseAnim (FScanner &sc, int usetype) } else if (sc.Compare ("range")) { + if (picnum.Exists() && Texture(picnum)->Name.IsEmpty()) + { + // long texture name: We cannot do ranged anims on these because they have no defined order + sc.ScriptError ("You cannot use \"range\" for long texture names."); + } if (defined == 2) { sc.ScriptError ("You cannot use \"pic\" and \"range\" together in a single animation."); @@ -456,12 +461,20 @@ FAnimDef *FTextureManager::ParseRangeAnim (FScanner &sc, FTextureID picnum, int type = FAnimDef::ANIM_Forward; framenum = ParseFramenum (sc, picnum, usetype, missing); + ParseTime (sc, min, max); - if (framenum == picnum || !picnum.Exists()) + if (framenum == picnum || !picnum.Exists() || !framenum.Exists()) { return NULL; // Animation is only one frame or does not exist } + + if (Texture(framenum)->Name.IsEmpty()) + { + // long texture name: We cannot do ranged anims on these because they have no defined order + sc.ScriptError ("You cannot use \"range\" for long texture names."); + } + if (framenum < picnum) { type = FAnimDef::ANIM_Backward; @@ -570,7 +583,7 @@ void FTextureManager::ParseTime (FScanner &sc, DWORD &min, DWORD &max) void FTextureManager::ParseWarp(FScanner &sc) { - const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny | TEXMAN_ShortNameOnly; + const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny; bool isflat = false; bool type2 = sc.Compare ("warp2"); // [GRB] sc.MustGetString (); @@ -591,8 +604,16 @@ void FTextureManager::ParseWarp(FScanner &sc) FTextureID picnum = CheckForTexture (sc.String, isflat ? FTexture::TEX_Flat : FTexture::TEX_Wall, texflags); if (picnum.isValid()) { + FTexture *warper = Texture(picnum); + if (warper->Name.IsEmpty()) + { + // long texture name: We cannot do warps on these due to the way the texture manager implements warping as a texture replacement. + sc.ScriptError ("You cannot use \"warp\" for long texture names."); + } + + // don't warp a texture more than once if (!warper->bWarped) { diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 15d8291fc8..54bbe68d35 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1502,14 +1502,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack) ACTION_PARAM_COLOR(Color1, 3); ACTION_PARAM_COLOR(Color2, 4); ACTION_PARAM_INT(Flags, 5); - ACTION_PARAM_FLOAT(MaxDiff, 6); + ACTION_PARAM_DOUBLE(MaxDiff, 6); ACTION_PARAM_CLASS(PuffType, 7); ACTION_PARAM_ANGLE(Spread_XY, 8); ACTION_PARAM_ANGLE(Spread_Z, 9); ACTION_PARAM_FIXED(Range, 10); ACTION_PARAM_INT(Duration, 11); - ACTION_PARAM_FLOAT(Sparsity, 12); - ACTION_PARAM_FLOAT(DriftSpeed, 13); + ACTION_PARAM_DOUBLE(Sparsity, 12); + ACTION_PARAM_DOUBLE(DriftSpeed, 13); ACTION_PARAM_CLASS(SpawnClass, 14); ACTION_PARAM_FIXED(Spawnofs_Z, 15); ACTION_PARAM_INT(SpiralOffset, 16); @@ -1566,14 +1566,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) ACTION_PARAM_COLOR(Color2, 3); ACTION_PARAM_INT(Flags, 4); ACTION_PARAM_INT(aim, 5); - ACTION_PARAM_FLOAT(MaxDiff, 6); + ACTION_PARAM_DOUBLE(MaxDiff, 6); ACTION_PARAM_CLASS(PuffType, 7); ACTION_PARAM_ANGLE(Spread_XY, 8); ACTION_PARAM_ANGLE(Spread_Z, 9); ACTION_PARAM_FIXED(Range, 10); ACTION_PARAM_INT(Duration, 11); - ACTION_PARAM_FLOAT(Sparsity, 12); - ACTION_PARAM_FLOAT(DriftSpeed, 13); + ACTION_PARAM_DOUBLE(Sparsity, 12); + ACTION_PARAM_DOUBLE(DriftSpeed, 13); ACTION_PARAM_CLASS(SpawnClass, 14); ACTION_PARAM_FIXED(Spawnofs_Z, 15); ACTION_PARAM_INT(SpiralOffset, 16); @@ -1612,7 +1612,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) if (linetarget == NULL && aim) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. - FVector2 xydiff(self->target->x - self->x, self->target->y - self->y); + TVector2 xydiff(self->target->x - self->x, self->target->y - self->y); double zdiff = (self->target->z + (self->target->height>>1)) - (self->z + (self->height>>1) - self->floorclip); self->pitch = int(atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI); diff --git a/tools/zipdir/zipdir.c b/tools/zipdir/zipdir.c index db6a57e1ef..ae354af633 100644 --- a/tools/zipdir/zipdir.c +++ b/tools/zipdir/zipdir.c @@ -804,7 +804,7 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update) if (i == num_files) { // Write central directory. - dirend.DirectoryOffset = ftell(zip); + dirend.DirectoryOffset = LittleLong(ftell(zip)); for (i = 0; i < num_files; ++i) { write_central_dir(zip, sorted + i); @@ -814,8 +814,8 @@ void write_zip(const char *zipname, dir_tree_t *trees, int update) dirend.DiskNumber = 0; dirend.FirstDisk = 0; dirend.NumEntriesOnAllDisks = dirend.NumEntries = LittleShort(i); - dirend.DirectorySize = LittleLong(ftell(zip) - dirend.DirectoryOffset); - dirend.DirectoryOffset = LittleLong(dirend.DirectoryOffset); + // In this case LittleLong(dirend.DirectoryOffset) is undoing the transformation done above. + dirend.DirectorySize = LittleLong(ftell(zip) - LittleLong(dirend.DirectoryOffset)); dirend.ZipCommentLength = 0; if (fwrite(&dirend, sizeof(dirend), 1, zip) != 1) { @@ -1405,7 +1405,7 @@ BYTE *find_central_dir(FILE *fin) if (pos_found == 0 || fseek(fin, pos_found, SEEK_SET) != 0 || fread(&eod, sizeof(eod), 1, fin) != 1 || - fseek(fin, LittleShort(eod.DirectoryOffset), SEEK_SET) != 0) + fseek(fin, LittleLong(eod.DirectoryOffset), SEEK_SET) != 0) { return NULL; } diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index 9209f88a00..f8303c3520 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -386,6 +386,7 @@ D62DCA9EC226DE49108D5DD9271F7631 // Cheogsh 2 map04 setthingz 1649 528 } +E89CCC7E155F1032F693359CC219BE6C // hexen.wad map30 B9DFF13207EACAC675C71D82624D0007 // XtheaterIII map01 { DisablePushWindowCheck diff --git a/wadsrc/static/language.eng b/wadsrc/static/language.eng new file mode 100644 index 0000000000..172cd2b4f9 --- /dev/null +++ b/wadsrc/static/language.eng @@ -0,0 +1,25 @@ +/* British English */ + +[eng] + +GOTARMOR = "Picked up the armour."; +GOTMEGA = "Picked up the MegaArmour!"; +GOTARMBONUS = "Picked up an armour bonus."; + +SCORE_COLOR = "COLOUR"; + +TAG_SHADOWARMOR = "Shadow Armour"; +TAG_METALARMOR = "Metal Armour"; +TAG_LEATHER = "Leather Armour"; +TAG_ARMORER = "Armourer"; + +TXT_ARMOR1 = "MESH ARMOUR"; + +TXT_METALARMOR = "You picked up the Metal Armour."; +TXT_LEATHERARMOR = "You picked up the Leather Armour."; +TXT_SHADOWARMOR = "You picked up the Shadow armour."; + +GOTCHEXARMOR = "Picked up the Chex(R) Armour."; +GOTSUPERCHEXARMOR = "Picked up the Super Chex(R) Armour!"; + +OB_BIPEDICUS2 = "%o was slimed by an armoured bipedicus.";