diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index a70d47e5f..87600541c 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -390,7 +390,9 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double double srcwidth = img->GetDisplayWidthDouble(); double srcheight = img->GetDisplayHeightDouble(); int autoaspect = parms->fsscalemode; - aspect = autoaspect == 0 || (srcwidth == 320 && srcheight == 200) || (srcwidth == 640 && srcheight == 400)? 1.333 : srcwidth / srcheight; + if (srcheight == 200) aspect = srcwidth / 240.; + else if (srcheight == 400) aspect = srcwidth / 480; + else aspect = srcwidth / srcheight; parms->x = parms->y = 0; parms->keepratio = true; auto screenratio = ActiveRatio(GetWidth(), GetHeight()); diff --git a/src/common/console/c_bind.cpp b/src/common/console/c_bind.cpp index f4802b1e5..609f2bf86 100644 --- a/src/common/console/c_bind.cpp +++ b/src/common/console/c_bind.cpp @@ -720,6 +720,7 @@ void C_SetDefaultKeys(const char* baseconfig) ReadBindings(lump, true); } + lastlump = 0; while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1) { ReadBindings(lump, false); diff --git a/src/common/utility/cmdlib.cpp b/src/common/utility/cmdlib.cpp index 3e108492d..dac58292a 100644 --- a/src/common/utility/cmdlib.cpp +++ b/src/common/utility/cmdlib.cpp @@ -73,7 +73,7 @@ static inline bool IsSeperator (int c) if (c == '/') return true; #ifdef _WIN32 - if (c == '\\' || c == ':') + if (c == '\\') return true; #endif return false; diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 21c989886..a4876ac10 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -263,6 +263,8 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize, // Look for IWAD definition lump // //========================================================================== +extern const char* iwad_folders[13]; +extern const char* iwad_reserved[12]; FIWadManager::FIWadManager(const char *firstfn, const char *optfn) { @@ -281,10 +283,6 @@ FIWadManager::FIWadManager(const char *firstfn, const char *optfn) ParseIWadInfo("IWADINFO", (const char*)data.Data(), data.Size()); } } - if (mIWadNames.Size() == 0 || mIWadInfos.Size() == 0) - { - I_FatalError("No IWAD definitions found"); - } } @@ -352,7 +350,13 @@ int FIWadManager::CheckIWADInfo(const char* fn) { FileSystem check; - check.InitSingleFile(fn, true); + LumpFilterInfo lfi; + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + + TArray filenames; + filenames.Push(fn); + check.InitMultipleFiles(filenames, true, &lfi); if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("IWADINFO"); @@ -372,6 +376,9 @@ int FIWadManager::CheckIWADInfo(const char* fn) return i; } } + + mOrderNames.Push(result.Name); + return mIWadInfos.Push(result); } catch (CRecoverableError & err) { diff --git a/src/d_main.cpp b/src/d_main.cpp index 9282f0fdb..bf2eb02df 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -185,6 +185,9 @@ extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop extern bool insave; extern TDeletingArray LightDefaults; +const char* iwad_folders[13] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; +const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo" "maps/" }; + CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL) { @@ -1854,8 +1857,12 @@ static FString CheckGameInfo(TArray & pwads) { FileSystem check; + LumpFilterInfo lfi; + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + // Open the entire list as a temporary file system and look for a GAMEINFO lump. The last one will automatically win. - check.InitMultipleFiles(pwads, true); + check.InitMultipleFiles(pwads, true, &lfi); if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("GAMEINFO"); @@ -2993,11 +3000,8 @@ static int D_DoomMain_Internal (void) } lfi.gameTypeFilter.Push(FStringf("game-%s", GameTypeName())); - static const char* folders[] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; - for (auto p : folders) lfi.reservedFolders.Push(p); - - static const char* reserved[] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "maps/" }; - for (auto p : reserved) lfi.requiredPrefixes.Push(p); + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); lfi.postprocessFunc = [&]() { diff --git a/src/maploader/specials.cpp b/src/maploader/specials.cpp index 64f3ea7b8..240b0818b 100644 --- a/src/maploader/specials.cpp +++ b/src/maploader/specials.cpp @@ -943,7 +943,8 @@ int MapLoader::Set3DFloor(line_t * line, int param, int param2, int alpha) // if flooding is used the floor must be non-solid and is automatically made shootthrough and seethrough if ((param2 & 128) && !(flags & FF_SOLID)) flags |= FF_FLOOD | FF_SEETHROUGH | FF_SHOOTTHROUGH; if (param2 & 512) flags |= FF_FADEWALLS; - if (param2&1024) flags |= FF_RESET; + if (param2 & 1024) flags |= FF_RESET; + if (param2 & 2048) flags |= FF_NODAMAGE; FTextureID tex = line->sidedef[0]->GetTexture(side_t::top); if (!tex.Exists() && alpha < 255) { @@ -970,7 +971,7 @@ int MapLoader::Set3DFloor(line_t * line, int param, int param2, int alpha) void MapLoader::Spawn3DFloors () { - static int flagvals[] = {512, 2+512, 512+1024}; + static int flagvals[] = {512+2048, 2+512+2048, 512+1024+2048}; for (auto &line : Level->lines) { diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 6811ef4b8..25bc4b16b 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -504,7 +504,6 @@ unsigned FSavegameManager::ExtractSaveData(int index) { delete SavePic; SavePic = nullptr; - SavePicData.Clear(); } } } @@ -536,7 +535,6 @@ void FSavegameManager::UnloadSaveData() SaveCommentString = ""; SavePic = nullptr; - SavePicData.Clear(); } DEFINE_ACTION_FUNCTION(FSavegameManager, UnloadSaveData) diff --git a/src/menu/menu.h b/src/menu/menu.h index 98fd2addb..ce17a188b 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -72,7 +72,6 @@ private: FSaveGameNode NewSaveNode; int LastSaved = -1; int LastAccessed = -1; - TArray SavePicData; FTexture *SavePic = nullptr; public: diff --git a/src/playsim/p_3dfloors.cpp b/src/playsim/p_3dfloors.cpp index 7d7c60889..ece17634b 100644 --- a/src/playsim/p_3dfloors.cpp +++ b/src/playsim/p_3dfloors.cpp @@ -217,10 +217,11 @@ void P_PlayerOnSpecial3DFloor(player_t* player) // Player must be on top of the floor to be affected... if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue; } - else + else { //Water and DEATH FOG!!! heh - if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || + if ((rover->flags & FF_NODAMAGE) || + player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo)) continue; } diff --git a/src/playsim/p_3dfloors.h b/src/playsim/p_3dfloors.h index f0b1e87fd..05d222137 100644 --- a/src/playsim/p_3dfloors.h +++ b/src/playsim/p_3dfloors.h @@ -23,7 +23,7 @@ typedef enum FF_UPPERTEXTURE = 0x20000, FF_LOWERTEXTURE = 0x40000, FF_THINFLOOR = 0x80000, // EDGE - FF_SCROLLY = 0x100000, // EDGE - not yet implemented!!! + FF_NODAMAGE = 0x100000, // no damage transfers FF_FIX = 0x200000, // use floor of model sector as floor and floor of real sector as ceiling FF_INVERTSECTOR = 0x400000, // swap meaning of sector planes FF_DYNAMIC = 0x800000, // created by partitioning another 3D-floor due to overlap diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index 5a3a67996..121e3402c 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -3911,6 +3911,13 @@ int P_FindLineSpecial (const char *string, int *min_args, int *max_args) max = mid - 1; } } + // Alias for ZScript. Check here to have universal support everywhere. + if (!stricmp(string, "TeleportSpecial")) + { + if (min_args != NULL) *min_args = 1; + if (max_args != NULL) *max_args = 3; + return Teleport; + } return 0; } diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 3214be35a..a23e71ebb 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -5000,9 +5000,12 @@ void StaticPointerSubstitution(AActor* old, AActor* notOld) if (old == nullptr) return; - // This is only allowed to replace players. For everything else the results are undefined. - if (!old->IsKindOf(NAME_PlayerPawn) || (notOld != nullptr && !notOld->IsKindOf(NAME_PlayerPawn))) return; - + // This is only allowed to replace players or swap out morphed monsters + if (!old->IsKindOf(NAME_PlayerPawn) || (notOld != nullptr && !notOld->IsKindOf(NAME_PlayerPawn))) + { + if (notOld == nullptr) return; + if (!old->IsKindOf(NAME_MorphedMonster) && !notOld->IsKindOf(NAME_MorphedMonster)) return; + } // Go through all objects. i = 0; DObject* last = 0; for (probe = GC::Root; probe != NULL; probe = probe->ObjNext) diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index b5611cb00..c7442a156 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -1230,7 +1230,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t * z1=z-scalefac; z2=z+scalefac; - depth = FloatToFixed((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin); + depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin); actor=nullptr; this->particle=particle; diff --git a/src/scripting/vmthunks_actors.cpp b/src/scripting/vmthunks_actors.cpp index 5bb73f244..a99554ab8 100644 --- a/src/scripting/vmthunks_actors.cpp +++ b/src/scripting/vmthunks_actors.cpp @@ -1614,6 +1614,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, Substitute, StaticPointerSubstitution) return 0; } +DEFINE_ACTION_FUNCTION_NATIVE(_PlayerPawn, Substitute, StaticPointerSubstitution) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_OBJECT(replace, AActor); + StaticPointerSubstitution(self, replace); + return 0; +} + +DEFINE_ACTION_FUNCTION_NATIVE(_MorphedMonster, Substitute, StaticPointerSubstitution) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_OBJECT(replace, AActor); + StaticPointerSubstitution(self, replace); + return 0; +} + DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetSpawnableType, P_GetSpawnableType) { PARAM_PROLOGUE; diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 9638d9e5f..bbd89dd44 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -461,7 +461,7 @@ class Actor : Thinker native virtual native void Die(Actor source, Actor inflictor, int dmgflags = 0, Name MeansOfDeath = 'none'); virtual native bool Slam(Actor victim); virtual native void Touch(Actor toucher); - native void Substitute(Actor replacement); + private native void Substitute(Actor replacement); native ui void DisplayNameTag(); // Called by inventory items to see if this actor is capable of touching them. diff --git a/wadsrc/static/zscript/actors/player/player_morph.zs b/wadsrc/static/zscript/actors/player/player_morph.zs index 66fd0f1d8..391be4a06 100644 --- a/wadsrc/static/zscript/actors/player/player_morph.zs +++ b/wadsrc/static/zscript/actors/player/player_morph.zs @@ -1,5 +1,7 @@ extend class PlayerPawn { + private native void Substitute(PlayerPawn replacement); + //=========================================================================== // // EndAllPowerupEffects @@ -503,6 +505,8 @@ class MorphedMonster : Actor +FLOORCLIP } + private native void Substitute(Actor replacement); + override void OnDestroy () { if (UnmorphedMe != NULL) diff --git a/wadsrc/static/zscript/mapdata.zs b/wadsrc/static/zscript/mapdata.zs index 1ac5f12de..b681711d4 100644 --- a/wadsrc/static/zscript/mapdata.zs +++ b/wadsrc/static/zscript/mapdata.zs @@ -234,7 +234,8 @@ struct F3DFloor native play FF_UPPERTEXTURE = 0x20000, FF_LOWERTEXTURE = 0x40000, FF_THINFLOOR = 0x80000, // EDGE - FF_SCROLLY = 0x100000, // EDGE - not yet implemented!!! + FF_SCROLLY = 0x100000, // old leftover definition + FF_NODAMAGE = 0x100000, // no damage transfers FF_FIX = 0x200000, // use floor of model sector as floor and floor of real sector as ceiling FF_INVERTSECTOR = 0x400000, // swap meaning of sector planes FF_DYNAMIC = 0x800000, // created by partitioning another 3D-floor due to overlap