diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index b62437e74..4388487a5 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -307,8 +307,6 @@ Note: All fields default to false unless mentioned otherwise. leakiness = ; // Probability of leaking through radiation suit (0 = never, 256 = always), default = 0. damageterraineffect = ; // Will spawn a terrain splash when damage is inflicted. Default = false. damagehazard = ; // Changes damage model to Strife's delayed damage for the given sector. Default = false. - hurtmonsters = ; // Non-players like monsters and decorations are hurt by this sector in the same manner as player. Doesn't work with damagehazard. - harminair = ; // Actors in this sector are harmed by the damage effects of the floor even if they aren't touching it. floorterrain = ; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' ceilingterrain = ; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' floor_reflect = ; // reflectiveness of floor (OpenGL only, not functional on sloped sectors) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c54260d02..970e80c82 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1324,9 +1324,9 @@ endif() if( MSVC ) option ( CONSOLE_MODE "Compile as a console application" OFF ) if ( CONSOLE_MODE ) - set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE /ENTRY:wWinMainCRTStartup" ) + set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE" ) else() - set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /ENTRY:wWinMainCRTStartup" ) + set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS" ) endif() option( ZDOOM_GENERATE_MAPFILE "Generate .map file for debugging." OFF ) diff --git a/src/common/console/c_commandline.cpp b/src/common/console/c_commandline.cpp index 4f500ffe6..7fa9d1ff2 100644 --- a/src/common/console/c_commandline.cpp +++ b/src/common/console/c_commandline.cpp @@ -193,7 +193,7 @@ int FCommandLine::argc () return _argc; } -char *FCommandLine::operator[] (int i) +const char *FCommandLine::operator[] (int i) { if (_argv == NULL) { diff --git a/src/common/console/c_commandline.h b/src/common/console/c_commandline.h index dc5466df1..4886aa9c7 100644 --- a/src/common/console/c_commandline.h +++ b/src/common/console/c_commandline.h @@ -44,7 +44,7 @@ public: FCommandLine (const char *commandline, bool no_escapes = false); ~FCommandLine (); int argc (); - char *operator[] (int i); + const char *operator[] (int i); const char *args () { return cmd; } void Shift(); diff --git a/src/common/filesystem/source/resourcefile.cpp b/src/common/filesystem/source/resourcefile.cpp index 359eb1e8c..4b134cae5 100644 --- a/src/common/filesystem/source/resourcefile.cpp +++ b/src/common/filesystem/source/resourcefile.cpp @@ -163,6 +163,7 @@ static int nulPrintf(FSMessageLevel msg, const char* fmt, ...) FResourceFile *FResourceFile::DoOpenResourceFile(const char *filename, FileReader &file, bool containeronly, LumpFilterInfo* filter, FileSystemMessageFunc Printf, StringPool* sp) { + if (!file.isOpen()) return nullptr; if (Printf == nullptr) Printf = nulPrintf; for(auto func : funcs) { diff --git a/src/common/platform/win32/i_main.cpp b/src/common/platform/win32/i_main.cpp index d96ed2a1c..543aa7952 100644 --- a/src/common/platform/win32/i_main.cpp +++ b/src/common/platform/win32/i_main.cpp @@ -122,11 +122,22 @@ void I_SetIWADInfo() bool isConsoleApp() { - DWORD pids[2]; - DWORD num_pids = GetConsoleProcessList(pids, 2); - bool win32con_is_exclusive = (num_pids <= 1); + static bool alreadychecked = false; + static bool returnvalue; - return GetConsoleWindow() != NULL && !win32con_is_exclusive; + if (!alreadychecked) + { + DWORD pids[2]; + DWORD num_pids = GetConsoleProcessList(pids, 2); + bool win32con_is_exclusive = (num_pids <= 1); + + returnvalue = ((GetConsoleWindow() != NULL && !win32con_is_exclusive) || (GetStdHandle(STD_OUTPUT_HANDLE) != NULL)); + alreadychecked = true; + } + + //printf("isConsoleApp is %i\n", returnvalue); + + return returnvalue; } //========================================================================== @@ -152,18 +163,16 @@ int DoMain (HINSTANCE hInstance) if (isConsoleApp()) { StdOut = GetStdHandle(STD_OUTPUT_HANDLE); - BY_HANDLE_FILE_INFORMATION info; - if (!GetFileInformationByHandle(StdOut, &info) && StdOut != nullptr) + SetConsoleCP(CP_UTF8); + SetConsoleOutputCP(CP_UTF8); + + DWORD mode; + + if (GetConsoleMode(StdOut, &mode)) { - SetConsoleCP(CP_UTF8); - SetConsoleOutputCP(CP_UTF8); - DWORD mode; - if (GetConsoleMode(StdOut, &mode)) - { - if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) - FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. - } + if (SetConsoleMode(StdOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) + FancyStdOut = IsWindows10OrGreater(); // Windows 8.1 and lower do not understand ANSI formatting. } } else if (Args->CheckParm("-stdout") || Args->CheckParm("-norun")) @@ -326,8 +335,14 @@ void I_ShowFatalError(const char *msg) //========================================================================== +int wmain() +{ + return wWinMain(GetModuleHandle(0), 0, GetCommandLineW(), SW_SHOW); +} + int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int nCmdShow) { + g_hInst = hInstance; InitCommonControls(); diff --git a/src/common/platform/win32/i_system.cpp b/src/common/platform/win32/i_system.cpp index ace9c9ef2..e36a2caaa 100644 --- a/src/common/platform/win32/i_system.cpp +++ b/src/common/platform/win32/i_system.cpp @@ -102,6 +102,7 @@ // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- void DestroyCustomCursor(); +bool isConsoleApp(); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -305,6 +306,7 @@ static void PrintToStdOut(const char *cpt, HANDLE StdOut) else break; } } + DWORD bytes_written; WriteFile(StdOut, printData.GetChars(), (DWORD)printData.Len(), &bytes_written, NULL); if (terminal) diff --git a/src/common/rendering/r_videoscale.cpp b/src/common/rendering/r_videoscale.cpp index 705fe905f..bfed3ec73 100644 --- a/src/common/rendering/r_videoscale.cpp +++ b/src/common/rendering/r_videoscale.cpp @@ -248,7 +248,7 @@ CCMD (vid_scaletoheight) } } -inline bool atob(char* I) +inline bool atob(const char* I) { if (stricmp (I, "true") == 0 || stricmp (I, "1") == 0) return true; diff --git a/src/common/textures/gametexture.h b/src/common/textures/gametexture.h index e7b04afc2..2946ce61d 100644 --- a/src/common/textures/gametexture.h +++ b/src/common/textures/gametexture.h @@ -72,6 +72,7 @@ enum EGameTexFlags GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font. GTexf_NoTrim = 1024, // Don't perform trimming on this texture. GTexf_Seen = 2048, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed. + GTexf_NoMipmap = 4096, // Disable mipmapping for this texture }; struct FMaterialLayers @@ -284,6 +285,9 @@ public: void SetGlowing(PalEntry color) { flags = (flags & ~GTexf_AutoGlowing) | GTexf_Glowing; GlowColor = color; } void SetDisableBrightmap() { flags |= GTexf_BrightmapChecked; Brightmap = nullptr; } + bool isNoMipmap() const { return !!(flags & GTexf_NoMipmap); } + void SetNoMipmap(bool set) { if (set) flags |= GTexf_NoMipmap; else flags &= ~GTexf_NoMipmap; } + bool isUserContent() const; int CheckRealHeight() { return xs_RoundToInt(Base->CheckRealHeight() / ScaleY); } void SetSize(int x, int y) diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 227b98f50..99c4b6adf 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -141,30 +141,58 @@ CCMD (spray) CCMD (mapchecksum) { - MapData *map; - uint8_t cksum[16]; - - if (argv.argc() < 2) + if (argv.argc() == 1) + { //current map + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum)); + + for (size_t i = 0; i < 16; ++i) + { + Printf("%02X", level.md5[i]); + } + + Printf(" // %s %s\n", wadname, level.MapName.GetChars()); + } + else if (argv.argc() < 2) { Printf("Usage: mapchecksum ...\n"); } - for (int i = 1; i < argv.argc(); ++i) + else { - map = P_OpenMapData(argv[i], true); - if (map == NULL) + MapData *map; + uint8_t cksum[16]; + + for (int i = 1; i < argv.argc(); ++i) { - Printf("Cannot load %s as a map\n", argv[i]); - } - else - { - map->GetChecksum(cksum); - const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)); - delete map; - for (size_t j = 0; j < sizeof(cksum); ++j) + if(!strcmp(argv[i], "*")) { - Printf("%02X", cksum[j]); + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum)); + + for (size_t i = 0; i < 16; ++i) + { + Printf("%02X", level.md5[i]); + } + + Printf(" // %s %s\n", wadname, level.MapName.GetChars()); + } + else + { + map = P_OpenMapData(argv[i], true); + if (map == NULL) + { + Printf("Cannot load %s as a map\n", argv[i]); + } + else + { + map->GetChecksum(cksum); + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)); + delete map; + for (size_t j = 0; j < sizeof(cksum); ++j) + { + Printf("%02X", cksum[j]); + } + Printf(" // %s %s\n", wadname, argv[i]); + } } - Printf(" // %s %s\n", wadname, argv[i]); } } } diff --git a/src/gamedata/keysections.cpp b/src/gamedata/keysections.cpp index bcde05edd..25b71671b 100644 --- a/src/gamedata/keysections.cpp +++ b/src/gamedata/keysections.cpp @@ -100,12 +100,11 @@ CCMD (addkeysection) } // Limit the ini name to 32 chars - if (strlen (argv[2]) > 32) - argv[2][32] = 0; + FString name(argv[2], 32); for (unsigned i = 0; i < KeySections.Size(); i++) { - if (KeySections[i].mTitle.CompareNoCase(argv[2]) == 0) + if (KeySections[i].mTitle.CompareNoCase(name) == 0) { CurrentKeySection = i; return; diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index b6526cc62..453da9c41 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -504,8 +504,6 @@ enum SECMF_OVERLAPPING = 512, // floor and ceiling overlap and require special renderer action. SECMF_NOSKYWALLS = 1024, // Do not draw "sky walls" SECMF_LIFT = 2048, // For MBF monster AI - SECMF_HURTMONSTERS = 4096, // Monsters in this sector are hurt like players. - SECMF_HARMINAIR = 8192, // Actors in this sector are also hurt mid-air. }; enum diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index d2a415340..d604d6685 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -2050,14 +2050,6 @@ public: Flag(sec->Flags, SECF_HAZARD, key); break; - case NAME_hurtmonsters: - Flag(sec->MoreFlags, SECMF_HURTMONSTERS, key); - break; - - case NAME_harminair: - Flag(sec->MoreFlags, SECMF_HARMINAIR, key); - break; - case NAME_floorterrain: sec->terrainnum[sector_t::floor] = P_FindTerrain(CheckString(key)); break; diff --git a/src/namedef_custom.h b/src/namedef_custom.h index 661de6665..eebb8ca3a 100644 --- a/src/namedef_custom.h +++ b/src/namedef_custom.h @@ -812,8 +812,6 @@ xx(damageinterval) xx(leakiness) xx(damageterraineffect) xx(damagehazard) -xx(hurtmonsters) -xx(harminair) xx(floorterrain) xx(ceilingterrain) xx(floor_reflect) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 7da50fc52..024c07b62 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -443,9 +443,7 @@ enum ActorFlag9 MF9_SHADOWBLOCK = 0x00000004, // [inkoalawetrust] Actors in the line of fire with this flag trigger the MF_SHADOW aiming penalty. MF9_SHADOWAIMVERT = 0x00000008, // [inkoalawetrust] Monster aim is also offset vertically when aiming at shadow actors. MF9_DECOUPLEDANIMATIONS = 0x00000010, // [RL0] Decouple model animations from states - MF9_NOSECTORDAMAGE = 0x00000020, // [inkoalawetrust] Actor ignores any sector-based damage (i.e damaging floors, NOT crushers) MF9_ISPUFF = 0x00000040, // [AA] Set on actors by P_SpawnPuff - MF9_FORCESECTORDAMAGE = 0x00000080, // [inkoalawetrust] Actor ALWAYS takes hurt floor damage if there's any. Even if the floor doesn't have SECMF_HURTMONSTERS. }; // --- mobj.renderflags --- @@ -504,10 +502,9 @@ enum ActorRenderFlag2 RF2_FLIPSPRITEOFFSETX = 0x0010, RF2_FLIPSPRITEOFFSETY = 0x0020, RF2_CAMFOLLOWSPLAYER = 0x0040, // Matches the cam's base position and angles to the main viewpoint. - RF2_NOMIPMAP = 0x0080, // [Nash] forces no mipmapping on sprites. Useful for tiny sprites that need to remain visually crisp - RF2_ISOMETRICSPRITES = 0x0100, - RF2_SQUAREPIXELS = 0x0200, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling - RF2_STRETCHPIXELS = 0x0400, // don't apply SQUAREPIXELS for ROLLSPRITES + RF2_ISOMETRICSPRITES = 0x0080, + RF2_SQUAREPIXELS = 0x0100, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling + RF2_STRETCHPIXELS = 0x0200, // don't apply SQUAREPIXELS for ROLLSPRITES }; // This translucency value produces the closest match to Heretic's TINTTAB. diff --git a/src/playsim/p_3dfloors.cpp b/src/playsim/p_3dfloors.cpp index 505bfa794..dd5a2bb0a 100644 --- a/src/playsim/p_3dfloors.cpp +++ b/src/playsim/p_3dfloors.cpp @@ -198,15 +198,15 @@ void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flags, int //========================================================================== // -// P_ActorOnSpecial3DFloor -// Checks to see if an actor is standing on or is inside a 3D floor (water) +// P_PlayerOnSpecial3DFloor +// Checks to see if a player is standing on or is inside a 3D floor (water) // and applies any specials.. // //========================================================================== -void P_ActorOnSpecial3DFloor(AActor* victim) +void P_PlayerOnSpecial3DFloor(player_t* player) { - for(auto rover : victim->Sector->e->XFloor.ffloors) + for(auto rover : player->mo->Sector->e->XFloor.ffloors) { if (!(rover->flags & FF_EXISTS)) continue; if (rover->flags & FF_FIX) continue; @@ -215,22 +215,22 @@ void P_ActorOnSpecial3DFloor(AActor* victim) if(rover->flags & FF_SOLID) { // Player must be on top of the floor to be affected... - if(victim->Z() != rover->top.plane->ZatPoint(victim)) continue; + if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue; } else { //Water and DEATH FOG!!! heh if ((rover->flags & FF_NODAMAGE) || - victim->Z() > rover->top.plane->ZatPoint(victim) || - victim->Top() < rover->bottom.plane->ZatPoint(victim)) + player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || + player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo)) continue; } // Apply sector specials - P_ActorInSpecialSector(victim, rover->model); + P_PlayerInSpecialSector(player, rover->model); // Apply flat specials (using the ceiling!) - P_ActorOnSpecialFlat(victim, rover->model->GetTerrain(rover->top.isceiling)); + P_PlayerOnSpecialFlat(player, rover->model->GetTerrain(rover->top.isceiling)); break; } diff --git a/src/playsim/p_3dfloors.h b/src/playsim/p_3dfloors.h index 2dba7f713..05d222137 100644 --- a/src/playsim/p_3dfloors.h +++ b/src/playsim/p_3dfloors.h @@ -113,7 +113,8 @@ struct lightlist_t -void P_ActorOnSpecial3DFloor(AActor* victim); +class player_t; +void P_PlayerOnSpecial3DFloor(player_t* player); bool P_CheckFor3DFloorHit(AActor * mo, double z, bool trigger); bool P_CheckFor3DCeilingHit(AActor * mo, double z, bool trigger); diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 4884739f2..735a87e81 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -69,8 +69,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, }; class DVisualThinker; diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 55f501488..f87c28654 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -464,12 +464,6 @@ static int P_IsUnderDamage(AActor* actor) dir |= cl->getDirection(); } // Q: consider crushing 3D floors too? - // [inkoalawetrust] Check for sectors that can harm the actor. - if (!(actor->flags9 & MF9_NOSECTORDAMAGE) && seclist->m_sector->damageamount > 0) - { - if (seclist->m_sector->MoreFlags & SECMF_HARMINAIR || actor->isAtZ(seclist->m_sector->LowestFloorAt(actor)) || actor->waterlevel) - return (actor->player || (actor->player == nullptr && seclist->m_sector->MoreFlags & SECMF_HURTMONSTERS)) ? -1 : 0; - } } return dir; } diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index cfd40325d..1b9422baf 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -4435,18 +4435,6 @@ void AActor::Tick () // must have been removed if (ObjectFlags & OF_EuthanizeMe) return; } - //[inkoalawetrust] Genericized level damage handling that makes sector, 3D floor, and TERRAIN flat damage affect monsters and other NPCs too. - bool afsdnope = !!(flags9 & MF9_NOSECTORDAMAGE); - bool afsdforce = !!(flags9 & MF9_FORCESECTORDAMAGE); - bool sfhurtmonsters = !!(Sector->MoreFlags & SECMF_HURTMONSTERS); - bool isplayer = (player != nullptr) && (this == player->mo); - if ((!afsdnope || afsdforce) && (isplayer || sfhurtmonsters || afsdforce)) - { - P_ActorOnSpecial3DFloor(this); - P_ActorInSpecialSector(this,Sector); - if (!isAbove(Sector->floorplane.ZatPoint(this)) || waterlevel) // Actor must be touching the floor for TERRAIN flats. - P_ActorOnSpecialFlat(this, P_GetThingFloorType(this)); - } if (tics != -1) { diff --git a/src/playsim/p_spec.cpp b/src/playsim/p_spec.cpp index 9c3fde6f4..6ffc2d9af 100644 --- a/src/playsim/p_spec.cpp +++ b/src/playsim/p_spec.cpp @@ -100,7 +100,7 @@ #include "c_console.h" #include "p_spec_thinkers.h" -static FRandom pr_actorinspecialsector ("ActorInSpecialSector"); +static FRandom pr_playerinspecialsector ("PlayerInSpecialSector"); EXTERN_CVAR(Bool, cl_predict_specials) EXTERN_CVAR(Bool, forcewater) @@ -419,18 +419,22 @@ bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType) } // -// P_ActorInSpecialSector +// P_PlayerInSpecialSector // Called every tic frame -// that the actor origin is in a special sector +// that the player origin is in a special sector // -void P_ActorInSpecialSector (AActor *victim, sector_t * sector) +void P_PlayerInSpecialSector (player_t *player, sector_t * sector) { if (sector == NULL) - sector = victim->Sector; - - // Falling, not all the way down yet? - if (!(sector->MoreFlags & SECMF_HARMINAIR) && !victim->isAtZ(sector->LowestFloorAt(victim)) && !victim->waterlevel) - return; + { + // Falling, not all the way down yet? + sector = player->mo->Sector; + if (!player->mo->isAtZ(sector->LowestFloorAt(player->mo)) + && !player->mo->waterlevel) + { + return; + } + } // Has hit ground. @@ -441,7 +445,7 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) if (sector->damageinterval <= 0) sector->damageinterval = 32; // repair invalid damageinterval values - if (victim->player && sector->Flags & (SECF_EXIT1 | SECF_EXIT2)) + if (sector->Flags & (SECF_EXIT1 | SECF_EXIT2)) { for (int i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) @@ -460,7 +464,7 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) // different damage types yet, so that's not happening for now. // [MK] account for subclasses that may have "Full" protection (i.e.: prevent leaky damage) int ironfeet = 0; - for (auto i = victim->Inventory; i != NULL; i = i->Inventory) + for (auto i = player->mo->Inventory; i != NULL; i = i->Inventory) { if (i->IsKindOf(NAME_PowerIronFeet)) { @@ -472,28 +476,28 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) } } - if (victim->player && sector->Flags & SECF_ENDGODMODE) victim->player->cheats &= ~CF_GODMODE; - if ((ironfeet == 0 || (ironfeet < 2 && pr_actorinspecialsector() < sector->leakydamage))) + if (sector->Flags & SECF_ENDGODMODE) player->cheats &= ~CF_GODMODE; + if ((ironfeet == 0 || (ironfeet < 2 && pr_playerinspecialsector() < sector->leakydamage))) { - if (victim->player && sector->Flags & SECF_HAZARD) + if (sector->Flags & SECF_HAZARD) { - victim->player->hazardcount += sector->damageamount; - victim->player->hazardtype = sector->damagetype; - victim->player->hazardinterval = sector->damageinterval; + player->hazardcount += sector->damageamount; + player->hazardtype = sector->damagetype; + player->hazardinterval = sector->damageinterval; } else if (Level->time % sector->damageinterval == 0) { - if (!(victim->player && victim->player->cheats & (CF_GODMODE | CF_GODMODE2))) + if (!(player->cheats & (CF_GODMODE | CF_GODMODE2))) { - P_DamageMobj(victim, NULL, NULL, sector->damageamount, sector->damagetype); + P_DamageMobj(player->mo, NULL, NULL, sector->damageamount, sector->damagetype); } - if (victim->player && (sector->Flags & SECF_ENDLEVEL) && victim->player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) + if ((sector->Flags & SECF_ENDLEVEL) && player->health <= 10 && (!deathmatch || !(dmflags & DF_NO_EXIT))) { Level->ExitLevel(0, false); } if (sector->Flags & SECF_DMGTERRAINFX) { - P_HitWater(victim, victim->Sector, victim->Pos(), false, true, true); + P_HitWater(player->mo, player->mo->Sector, player->mo->Pos(), false, true, true); } } } @@ -502,14 +506,14 @@ void P_ActorInSpecialSector (AActor *victim, sector_t * sector) { if (Level->time % sector->damageinterval == 0) { - P_GiveBody(victim, -sector->damageamount, 100); + P_GiveBody(player->mo, -sector->damageamount, 100); } } - if (victim->player && sector->isSecret()) + if (sector->isSecret()) { sector->ClearSecret(); - P_GiveSecret(Level, victim, true, true, sector->Index()); + P_GiveSecret(Level, player->mo, true, true, sector->Index()); } } @@ -648,13 +652,13 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret) //============================================================================ // -// P_ActorOnSpecialFlat +// P_PlayerOnSpecialFlat // //============================================================================ -void P_ActorOnSpecialFlat (AActor *victim, int floorType) +void P_PlayerOnSpecialFlat (player_t *player, int floorType) { - auto Level = victim->Level; + auto Level = player->mo->Level; if (Terrains[floorType].DamageAmount && !(Level->time % (Terrains[floorType].DamageTimeMask+1))) @@ -664,7 +668,7 @@ void P_ActorOnSpecialFlat (AActor *victim, int floorType) if (Terrains[floorType].AllowProtection) { auto pitype = PClass::FindActor(NAME_PowerIronFeet); - for (ironfeet = victim->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) + for (ironfeet = player->mo->Inventory; ironfeet != NULL; ironfeet = ironfeet->Inventory) { if (ironfeet->IsKindOf (pitype)) break; @@ -674,18 +678,20 @@ void P_ActorOnSpecialFlat (AActor *victim, int floorType) int damage = 0; if (ironfeet == NULL) { - damage = P_DamageMobj (victim, NULL, NULL, Terrains[floorType].DamageAmount, + damage = P_DamageMobj (player->mo, NULL, NULL, Terrains[floorType].DamageAmount, Terrains[floorType].DamageMOD); } if (damage > 0 && Terrains[floorType].Splash != -1) { - S_Sound (victim, CHAN_AUTO, 0, + S_Sound (player->mo, CHAN_AUTO, 0, Splashes[Terrains[floorType].Splash].NormalSplashSound, 1, ATTN_IDLE); } } } + + // // P_UpdateSpecials // Animate planes, scroll walls, etc. diff --git a/src/playsim/p_spec.h b/src/playsim/p_spec.h index ebb5d93f9..cc7d990a9 100644 --- a/src/playsim/p_spec.h +++ b/src/playsim/p_spec.h @@ -90,8 +90,8 @@ bool P_ActivateLine (line_t *ld, AActor *mo, int side, int activationType, DVect bool P_TestActivateLine (line_t *ld, AActor *mo, int side, int activationType, DVector3 *optpos = NULL); bool P_PredictLine (line_t *ld, AActor *mo, int side, int activationType); -void P_ActorInSpecialSector (AActor *victim, sector_t * sector=NULL); -void P_ActorOnSpecialFlat (AActor *victim, int floorType); +void P_PlayerInSpecialSector (player_t *player, sector_t * sector=NULL); +void P_PlayerOnSpecialFlat (player_t *player, int floorType); void P_SectorDamage(FLevelLocals *Level, int tag, int amount, FName type, PClassActor *protectClass, int flags); void P_SetSectorFriction (FLevelLocals *level, int tag, int amount, bool alterFlag); double FrictionToMoveFactor(double friction); diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index a98a7c523..d3294ffd6 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -1204,6 +1204,15 @@ DEFINE_ACTION_FUNCTION(APlayerPawn, CheckMusicChange) void P_CheckEnvironment(player_t *player) { + P_PlayerOnSpecial3DFloor(player); + P_PlayerInSpecialSector(player); + + if (!player->mo->isAbove(player->mo->Sector->floorplane.ZatPoint(player->mo)) || + player->mo->waterlevel) + { + // Player must be touching the floor + P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo)); + } if (player->mo->Vel.Z <= -player->mo->FloatVar(NAME_FallingScreamMinSpeed) && player->mo->Vel.Z >= -player->mo->FloatVar(NAME_FallingScreamMaxSpeed) && player->mo->alternative == nullptr && player->mo->waterlevel == 0) diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index fc8d5961c..35dc221ab 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -1287,6 +1287,7 @@ class GLDefsParser bool disable_fullbright_specified = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; UserShaderDesc usershader; TArray texNameList; @@ -1336,6 +1337,10 @@ class GLDefsParser // only affects textures defined in the IWAD. iwad = true; } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("glossiness")) { sc.MustGetFloat(); @@ -1484,6 +1489,8 @@ class GLDefsParser if (!useme) return; } + tex->SetNoMipmap(no_mipmap); + FGameTexture **bindings[6] = { &mlay.Brightmap, @@ -1743,6 +1750,7 @@ class GLDefsParser bool disable_fullbright = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; int maplump = -1; UserShaderDesc desc; desc.shaderType = SHADER_Default; @@ -1785,6 +1793,10 @@ class GLDefsParser if (!found) sc.ScriptError("Unknown material type '%s' specified\n", sc.String); } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("speed")) { sc.MustGetFloat(); @@ -1849,6 +1861,8 @@ class GLDefsParser return; } + tex->SetNoMipmap(no_mipmap); + int firstUserTexture; switch (desc.shaderType) { diff --git a/src/rendering/hwrenderer/scene/hw_bsp.cpp b/src/rendering/hwrenderer/scene/hw_bsp.cpp index 45aa185c2..cbf6a4bd6 100644 --- a/src/rendering/hwrenderer/scene/hw_bsp.cpp +++ b/src/rendering/hwrenderer/scene/hw_bsp.cpp @@ -994,7 +994,7 @@ void HWDrawInfo::RenderOrthoNoFog(FRenderState& state) double vxdbl = Viewpoint.camera->X(); double vydbl = Viewpoint.camera->Y(); double ext = Viewpoint.camera->ViewPos->Offset.Length() ? - 3.0 * Viewpoint.camera->ViewPos->Offset.Length() : 100.0; + 3.0 * Viewpoint.camera->ViewPos->Offset.Length() * tan (Viewpoint.FieldOfView.Radians()*0.5) : 100.0; FBoundingBox viewbox(vxdbl, vydbl, ext); for (unsigned int kk = 0; kk < Level->subsectors.Size(); kk++) diff --git a/src/rendering/hwrenderer/scene/hw_drawstructs.h b/src/rendering/hwrenderer/scene/hw_drawstructs.h index 1fa1b8daf..08994582b 100644 --- a/src/rendering/hwrenderer/scene/hw_drawstructs.h +++ b/src/rendering/hwrenderer/scene/hw_drawstructs.h @@ -410,8 +410,6 @@ public: TArray *lightlist; DRotator Angles; - bool nomipmap; // force the sprite to have no mipmaps (ensures tiny sprites in the distance stay crisp) - void SplitSprite(HWDrawInfo *di, FRenderState& state, sector_t * frontsector, bool translucent); void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight); bool CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp); diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 40ca47848..d1bc36289 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -227,7 +227,12 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) state.SetFog(0, 0); } - int clampmode = nomipmap ? CLAMP_XY_NOMIP : CLAMP_XY; + int clampmode = CLAMP_XY; + + if (texture && texture->isNoMipmap()) + { + clampmode = CLAMP_XY_NOMIP; + } uint32_t spritetype = actor? uint32_t(actor->renderflags & RF_SPRITETYPEMASK) : 0; if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, clampmode, translation, OverrideShader); @@ -849,8 +854,6 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto return; } - nomipmap = (thing->renderflags2 & RF2_NOMIPMAP); - // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. if ((!r_debug_disable_vis_filter && !!(thing->RenderRequired & ~r_renderercaps)) || @@ -1471,7 +1474,6 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, FRenderState& state, particle_t * actor = nullptr; this->particle = particle; fullbright = particle->flags & SPF_FULLBRIGHT; - nomipmap = particle->flags & SPF_NOMIPMAP; if (di->isFullbrightScene()) { diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 3e40c3a0c..b7b6b452b 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -704,7 +704,7 @@ void FRenderViewpoint::SetViewAngle(const FViewWindow& viewWindow) HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees()); if (IsOrtho() && (camera->ViewPos->Offset.XY().Length() > 0.0)) - ScreenProj = 1.34396 / camera->ViewPos->Offset.Length(); // [DVR] Estimated. +/-1 should be top/bottom of screen. + ScreenProj = 1.34396 / camera->ViewPos->Offset.Length() / tan (FieldOfView.Radians()*0.5); // [DVR] Estimated. +/-1 should be top/bottom of screen. } diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 90ba65f00..dc7fcacc3 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -351,9 +351,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF9, SHADOWBLOCK, AActor, flags9), DEFINE_FLAG(MF9, SHADOWAIMVERT, AActor, flags9), DEFINE_FLAG(MF9, DECOUPLEDANIMATIONS, AActor, flags9), - DEFINE_FLAG(MF9, NOSECTORDAMAGE, AActor, flags9), DEFINE_PROTECTED_FLAG(MF9, ISPUFF, AActor, flags9), //[AA] was spawned by SpawnPuff - DEFINE_FLAG(MF9, FORCESECTORDAMAGE, AActor, flags9), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), @@ -385,7 +383,6 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(RF2, FLIPSPRITEOFFSETX, AActor, renderflags2), DEFINE_FLAG(RF2, FLIPSPRITEOFFSETY, AActor, renderflags2), DEFINE_FLAG(RF2, CAMFOLLOWSPLAYER, AActor, renderflags2), - DEFINE_FLAG(RF2, NOMIPMAP, AActor, renderflags2), DEFINE_FLAG(RF2, ISOMETRICSPRITES, AActor, renderflags2), DEFINE_FLAG(RF2, SQUAREPIXELS, AActor, renderflags2), diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 6dab20a22..e7cdf917b 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -853,7 +853,7 @@ class Actor : Thinker native native bool LookForPlayers(bool allaround, LookExParams params = null); native bool TeleportMove(Vector3 pos, bool telefrag, bool modifyactor = true); native clearscope double DistanceBySpeed(Actor other, double speed) const; - native clearscope name GetSpecies(); + native name GetSpecies(); native void PlayActiveSound(); native void Howl(); native void DrawSplash (int count, double angle, int kind); diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 5fbcf0467..ebcb85f39 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -722,8 +722,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG }; diff --git a/wadsrc/static/zscript/mapdata.zs b/wadsrc/static/zscript/mapdata.zs index 06a7bf3ea..5d45563eb 100644 --- a/wadsrc/static/zscript/mapdata.zs +++ b/wadsrc/static/zscript/mapdata.zs @@ -435,11 +435,6 @@ struct Sector native play SECMF_UNDERWATERMASK = 32+64, SECMF_DRAWN = 128, // sector has been drawn at least once SECMF_HIDDEN = 256, // Do not draw on textured automap - SECMF_OVERLAPPING = 512, // floor and ceiling overlap and require special renderer action. - SECMF_NOSKYWALLS = 1024, // Do not draw "sky walls" - SECMF_LIFT = 2048, // For MBF monster AI - SECMF_HURTMONSTERS = 4096, // Monsters in this sector are hurt like players. - SECMF_HARMINAIR = 8192, // Actors in this sector are also hurt mid-air. } native uint16 MoreFlags; @@ -457,9 +452,6 @@ struct Sector native play SECF_ENDLEVEL = 512, // ends level when health goes below 10 SECF_HAZARD = 1024, // Change to Strife's delayed damage handling. SECF_NOATTACK = 2048, // monsters cannot start attacks in this sector. - SECF_EXIT1 = 4096, - SECF_EXIT2 = 8192, - SECF_KILLMONSTERS = 16384,// Monsters in this sector are instantly killed. SECF_WASSECRET = 1 << 30, // a secret that was discovered SECF_SECRET = 1 << 31, // a secret sector