diff --git a/CMakeLists.txt b/CMakeLists.txt index 40b02f4a17..f3121f2a46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") cmake_minimum_required(VERSION 3.7.2) -project("Crispy Doom" VERSION 5.10.1 LANGUAGES C) +project("Crispy Doom" VERSION 5.10.3 LANGUAGES C) # Autotools variables set(top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/README.md b/README.md index 750569f6e4..bde892d989 100644 --- a/README.md +++ b/README.md @@ -242,9 +242,61 @@ After successful compilation the resulting binaries can be found in the `src/` d ## News +### Crispy Doom 5.10.3 + +Crispy Doom 5.10.3 is released on Aug 17, 2021. It is a bug-fix release fixing a regression in savegame restoring introduced by the A11Y features from the 5.10.2 release. + +**New Features and Improvements** + + * The translucency map is now always recalculated and no more loaded from a file or lump. + * Autoload directories are now also supported for "sideloaded" PWADs - i.e. nerve.wad, masterlevels.wad and sigil.wad (thanks @Raddatoons). + +**Bug Fixes** + + * Rendered sector lightlevels are now saved in savegames if they are different from the logical lightlevels, fixing a regression intruduced with A11Y support (thanks Alaux). + * The green color translation range has been fine-tuned so that light-blue isn't preferred over green anymore (thanks maxmanium). + * The CMake build system has been updated for A11Y (thanks @vanfanel). + +Crispy Doom 5.10.3 is based on Chocolate Doom 3.0.1 and has merged all changes to the Chocolate Doom master branch up to commit [`3524a67d`](https://github.com/chocolate-doom/chocolate-doom/commit/3524a67dd3c7d48a172c83d3ae170a7176fb3cfa). + +### Crispy Doom 5.10.2 + +Crispy Doom 5.10.2 is released on Aug 10, 2021. It is a minor release introducing basic accessibility features and accumulated fixes since the previous release. + +**New Features and Improvements** + + * Smooth automap rotation and srolling have been implemented (by @JNechaevsky). + * Autoload directories for PWADs are now supported (thanks @OpenRift412 for the suggestion and @rfomin for the prior implementation in Woof!). + * Basic accessibility features have been added and can be toggled in the Accessibility menu of the setup tool: + * Flickering Sector Lighting (disables sectors changing their light levels) + * Weapon Flash Lighting (disables weapon flashes changing the ambient light levels) + * Weapon Flash Sprite (disables rendering of weapon flashes sprites) + * Palette Changes (disables palette changes upon damage, item pickup, or when wearing the radiation suit) + * Invulnerability Colormap (disables colormap changes during invulnerability) + +**Bug Fixes** + + * In NRFTL the TITLEPIC is only replaced with the INTERPIC if the former is from the IWAD (thanks @OpenRift412). + * Overlaid automap remainings are now cleared from the demo loop (by @JNechaevsky). + * Adjusting of the BLOCKMAP boundaries to match the Vanilla algorithm has been reverted. Although this was done in the Vanilla algorithm, it doesn't match what's done in the algorithms used by MBF and Boom - and thus PrBoom+ which uses the latter. This fixes sync for one demo reported by galileo31dos01 on 5L1C.wad MAP01. + * The Compatibility menu has been removed from the setup tool, it is obsolete for all games now. + * The translucency table is now always calculated at gamma level 0, fixing potentially incorrect entries (by @JNechaevsky). + * The episode menu is now rendered with the HUD font if the graphics are both from an IWAD and if the patch width for "Hell on Earth" is longer than "No Rest for the Living" (thanks thanks @hackneyed-one). + * Automap rotation variables are now properly initialized, preventing line shaking (by @JNechaevsky). + +**Crispy Heretic** + + * The `-demoext` parameter (even though enabled by default) only applies to demos loaded on the command line. + +**Crispy Hexen** + + * Hexen: Restore pointers to `mobj_t` with garbage identity as `NULL` pointers (by @Dasperal). + +Crispy Doom 5.10.2 is based on Chocolate Doom 3.0.1 and has merged all changes to the Chocolate Doom master branch up to commit [`3524a67d`](https://github.com/chocolate-doom/chocolate-doom/commit/3524a67dd3c7d48a172c83d3ae170a7176fb3cfa). + ### Crispy Doom 5.10.1 -Crispy Doom 5.10.1 is currently under development. +Crispy Doom 5.10.1 is released on Mar 24, 2021. It is a minor release containing the accumulated fixes of the past weeks. **New Features and Improvements** @@ -268,7 +320,7 @@ Crispy Doom 5.10.1 is currently under development. * There are now separate mouse sensitivities for turn, strafe and y-axis. * Heretic now has a "demowarp" feature, i.e. support for using both `-playdemo` and `-warp` on the command line (thanks @thom-wye). -Crispy Doom 5.10.1 is based on Chocolate Doom 3.0.1 and has merged all changes to the Chocolate Doom master branch up to commit [`d5b1a695`](https://github.com/chocolate-doom/chocolate-doom/commit/d5b1a695090eb49da3a4277686a30920cd5de046). +Crispy Doom 5.10.1 is based on Chocolate Doom 3.0.1 and has merged all changes to the Chocolate Doom master branch up to commit [`5003ab52`](https://github.com/chocolate-doom/chocolate-doom/commit/5003ab5283ff27c951c97b064c26cdde2bb0f427). ### Crispy Doom 5.10.0 diff --git a/configure.ac b/configure.ac index 8e6922cf56..cd3dfe13c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(Crispy Doom, 5.10.1, +AC_INIT(Crispy Doom, 5.10.3, fabian@greffrath.com, crispy-doom) PACKAGE_SHORTNAME=${PACKAGE_NAME% Doom} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b9b9fb41a0..c05fdc767e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,6 +38,7 @@ target_link_libraries("${PROGRAM_PREFIX}server" SDL2::SDL2main SDL2::net) # Source files used by the game binaries (chocolate-doom, etc.) set(GAME_SOURCE_FILES + a11y.c a11y.h aes_prng.c aes_prng.h d_event.c d_event.h doomkeys.h diff --git a/src/Makefile.am b/src/Makefile.am index c646fff68d..6b4dbb0cfb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,7 @@ z_native.c z_zone.h # Source files used by the game binaries (chocolate-doom, etc.) GAME_SOURCE_FILES=\ +a11y.c a11y.h \ aes_prng.c aes_prng.h \ d_event.c d_event.h \ doomkeys.h \ diff --git a/src/a11y.c b/src/a11y.c new file mode 100644 index 0000000000..8baff3e82a --- /dev/null +++ b/src/a11y.c @@ -0,0 +1,24 @@ +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005-2014 Simon Howard +// Copyright(C) 2021 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// DESCRIPTION: +// Accessibility specific variables. +// + +int a11y_sector_lighting = 1; +int a11y_weapon_flash = 1; +int a11y_weapon_pspr = 1; +int a11y_palette_changes = 1; +int a11y_invul_colormap = 1; diff --git a/src/a11y.h b/src/a11y.h new file mode 100644 index 0000000000..b9e099d13a --- /dev/null +++ b/src/a11y.h @@ -0,0 +1,32 @@ +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005-2014 Simon Howard +// Copyright(C) 2021 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// DESCRIPTION: +// Accessibility specific variables. +// + + +#ifndef __A11Y_H__ +#define __A11Y_H__ + +extern int a11y_sector_lighting; +extern int a11y_weapon_flash; +extern int a11y_weapon_pspr; +extern int a11y_palette_changes; +extern int a11y_invul_colormap; + +// [crispy] A11Y number of player sprites to draw +extern int numrpsprites; +#endif diff --git a/src/crispy.c b/src/crispy.c index 358faf9388..54c82197b7 100644 --- a/src/crispy.c +++ b/src/crispy.c @@ -24,7 +24,6 @@ static crispy_t crispy_s = { 0, .extautomap = 1, - .extsaveg = 1, #ifdef __WIIU__ // High resolution can lag on Wii U... // But, lets enable smooth framerate and widescreen by default diff --git a/src/crispy.h b/src/crispy.h index 97c4192239..2de0362fcf 100644 --- a/src/crispy.h +++ b/src/crispy.h @@ -54,7 +54,6 @@ typedef struct int demotimerdir; int demobar; int extautomap; - int extsaveg; int flipcorpses; int freeaim; int freelook; diff --git a/src/doom/am_map.c b/src/doom/am_map.c index 58b0e0acba..8c207721c7 100644 --- a/src/doom/am_map.c +++ b/src/doom/am_map.c @@ -529,6 +529,15 @@ void AM_initVariables(void) m_x = plr->mo->x - m_w/2; m_y = plr->mo->y - m_h/2; + + // [JN] Predefine rotation variables for AM_rotatePoint. + mapcenter.x = m_x + m_w / 2; + mapcenter.y = m_y + m_h / 2; + if (!(!followplayer && crispy->automapoverlay)) + { + mapangle = ANG90 - plr->mo->angle; + } + AM_changeWindowLoc(); // for saving & restoring diff --git a/src/doom/d_main.c b/src/doom/d_main.c index eec6183c05..2d6ed463fc 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -62,6 +62,7 @@ #include "i_video.h" #include "g_game.h" +#include "a11y.h" // [crispy] A11Y #include "hu_stuff.h" #include "wi_stuff.h" @@ -413,6 +414,11 @@ void D_BindVariables(void) // [crispy] unconditionally disable savegame and demo limits // M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit); // M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit); + M_BindIntVariable("a11y_sector_lighting", &a11y_sector_lighting); + M_BindIntVariable("a11y_weapon_flash", &a11y_weapon_flash); + M_BindIntVariable("a11y_weapon_pspr", &a11y_weapon_pspr); + M_BindIntVariable("a11y_palette_changes", &a11y_palette_changes); + M_BindIntVariable("a11y_invul_colormap", &a11y_invul_colormap); M_BindIntVariable("show_endoom", &show_endoom); M_BindIntVariable("show_diskicon", &show_diskicon); @@ -446,7 +452,6 @@ void D_BindVariables(void) M_BindIntVariable("crispy_demotimer", &crispy->demotimer); M_BindIntVariable("crispy_demotimerdir", &crispy->demotimerdir); M_BindIntVariable("crispy_extautomap", &crispy->extautomap); - M_BindIntVariable("crispy_extsaveg", &crispy->extsaveg); M_BindIntVariable("crispy_flipcorpses", &crispy->flipcorpses); M_BindIntVariable("crispy_freeaim", &crispy->freeaim); M_BindIntVariable("crispy_freelook", &crispy->freelook); diff --git a/src/doom/d_pwad.c b/src/doom/d_pwad.c index aa56cdec0a..4c4c1a7c80 100644 --- a/src/doom/d_pwad.c +++ b/src/doom/d_pwad.c @@ -21,9 +21,11 @@ #include #include "doomstat.h" -#include "deh_str.h" +#include "deh_main.h" #include "d_iwad.h" +#include "m_config.h" #include "m_misc.h" +#include "w_main.h" #include "w_wad.h" extern char *iwadfile; @@ -33,6 +35,7 @@ void D_LoadSigilWad (void) { int i, j; char *sigil_wad = NULL, *sigil_shreds = NULL; + char *sigil_basename, *autoload_dir; char *dirname; const char *const sigil_wads[] = { @@ -119,6 +122,7 @@ void D_LoadSigilWad (void) printf(" [Sigil] adding %s\n", sigil_wad); W_AddFile(sigil_wad); + sigil_basename = M_StringDuplicate(M_BaseName(sigil_wad)); free(sigil_wad); // [crispy] load SIGIL_SHREDS.WAD @@ -157,12 +161,19 @@ void D_LoadSigilWad (void) { j = W_CheckNumForName(sigil_lumps[i].name); - if (j != -1 && !strncasecmp(W_WadNameForLump(lumpinfo[j]), "SIGIL", 5)) + if (j != -1 && !strcasecmp(W_WadNameForLump(lumpinfo[j]), sigil_basename)) { memcpy(lumpinfo[j]->name, sigil_lumps[i].new_name, 8); } } + // [crispy] load WAD and DEH files from autoload directories + autoload_dir = M_GetAutoloadDir(sigil_basename, false); + W_AutoLoadWADs(autoload_dir); + DEH_AutoLoadPatches(autoload_dir); + free(autoload_dir); + free(sigil_basename); + // [crispy] regenerate the hashtable W_GenerateHashTable(); } @@ -197,6 +208,8 @@ static boolean CheckNerveLoaded (void) // [crispy] auto-load NERVE.WAD if available static void CheckLoadNerve (void) { + const char *nerve_basename; + char *autoload_dir; int i, j; static const struct { @@ -232,6 +245,7 @@ static void CheckLoadNerve (void) printf(" [No Rest for the Living] adding %s\n", crispy->havenerve); W_AddFile(crispy->havenerve); + nerve_basename = M_BaseName(crispy->havenerve); // [crispy] add indicators to level and level name patch lump names for (i = 0; i < 9; i++) @@ -258,6 +272,12 @@ static void CheckLoadNerve (void) } } + // [crispy] load WAD and DEH files from autoload directories + autoload_dir = M_GetAutoloadDir(nerve_basename, false); + W_AutoLoadWADs(autoload_dir); + DEH_AutoLoadPatches(autoload_dir); + free(autoload_dir); + // [crispy] regenerate the hashtable W_GenerateHashTable(); @@ -295,6 +315,8 @@ static boolean CheckMasterlevelsLoaded (void) // [crispy] auto-load the single MASTERLEVELS.WAD if available static boolean CheckLoadMasterlevels (void) { + const char *master_basename; + char *autoload_dir; int i, j; if (strrchr(iwadfile, DIR_SEPARATOR) != NULL) @@ -322,6 +344,7 @@ static boolean CheckLoadMasterlevels (void) printf(" [The Master Levels] adding %s\n", crispy->havemaster); W_AddFile(crispy->havemaster); + master_basename = M_BaseName(crispy->havemaster); // [crispy] add indicators to level and level name patch lump names for (i = 0; i < 21; i++) @@ -346,6 +369,12 @@ static boolean CheckLoadMasterlevels (void) strcat(lumpinfo[j]->name, "M"); } + // [crispy] load WAD and DEH files from autoload directories + autoload_dir = M_GetAutoloadDir(master_basename, false); + W_AutoLoadWADs(autoload_dir); + DEH_AutoLoadPatches(autoload_dir); + free(autoload_dir); + // [crispy] regenerate the hashtable W_GenerateHashTable(); diff --git a/src/doom/g_game.c b/src/doom/g_game.c index ea6680ded3..11c3442252 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -2220,12 +2220,10 @@ void G_DoLoadGame (void) I_Error("Could not load savegame %s", savename); } - // [crispy] read extended savegame data - if (crispy->extsaveg) - { - // [crispy] first pass, read "savewadfilename" - P_ReadExtendedSaveGameData(0); - } + // [crispy] read extended savegame data, + // first pass: read "savewadfilename" + P_ReadExtendedSaveGameData(0); + // [crispy] check if WAD file is valid to restore saved map if (savewadfilename) { @@ -2277,10 +2275,7 @@ void G_DoLoadGame (void) I_Error ("Bad savegame"); // [crispy] read more extended savegame data - if (crispy->extsaveg) - { - P_ReadExtendedSaveGameData(1); - } + P_ReadExtendedSaveGameData(1); fclose(save_stream); #ifdef __WIIU__ @@ -2378,10 +2373,7 @@ void G_DoSaveGame (void) P_WriteSaveGameEOF(); // [crispy] write extended savegame data - if (crispy->extsaveg) - { - P_WriteExtendedSaveGameData(); - } + P_WriteExtendedSaveGameData(); // [crispy] unconditionally disable savegame and demo limits /* diff --git a/src/doom/m_crispy.c b/src/doom/m_crispy.c index 2cb4af5461..37f08360ab 100644 --- a/src/doom/m_crispy.c +++ b/src/doom/m_crispy.c @@ -284,12 +284,6 @@ void M_CrispyToggleExtAutomap(int choice) crispy->extautomap = !crispy->extautomap; } -void M_CrispyToggleExtsaveg(int choice) -{ - choice = 0; - crispy->extsaveg = !crispy->extsaveg; -} - void M_CrispyToggleFlipcorpses(int choice) { if (gameversion == exe_chex) diff --git a/src/doom/m_crispy.h b/src/doom/m_crispy.h index 3cfeacbe1e..94b4add0aa 100644 --- a/src/doom/m_crispy.h +++ b/src/doom/m_crispy.h @@ -59,7 +59,6 @@ extern void M_CrispyToggleDemoTimer(int choice); extern void M_CrispyToggleDemoTimerDir(int choice); extern void M_CrispyToggleDemoUseTimer(int choice); extern void M_CrispyToggleExtAutomap(int choice); -extern void M_CrispyToggleExtsaveg(int choice); extern void M_CrispyToggleFlipcorpses(int choice); extern void M_CrispyToggleFreeaim(int choice); extern void M_CrispyToggleFreelook(int choice); diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index 34843c3858..58fb34d110 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -1544,7 +1544,6 @@ static void M_DrawCrispness3(void) M_DrawCrispnessItem(crispness_weaponsquat, "Squat weapon down on impact", crispy->weaponsquat, true); M_DrawCrispnessItem(crispness_pitch, "Weapon Recoil Pitch", crispy->pitch, true); M_DrawCrispnessItem(crispness_neghealth, "Negative Player Health", crispy->neghealth, true); -// M_DrawCrispnessItem(crispness_extsaveg, "Extended Savegames", crispy->extsaveg, true); M_DrawCrispnessSeparator(crispness_sep_crosshair, "Crosshair"); diff --git a/src/doom/p_enemy.c b/src/doom/p_enemy.c index 7b6c50cb2c..cc36c07f9b 100644 --- a/src/doom/p_enemy.c +++ b/src/doom/p_enemy.c @@ -1565,10 +1565,6 @@ A_PainShootSkull return; } - // [crispy] Lost Souls bleed Puffs - if (crispy->coloredblood) - newmobj->flags |= MF_NOBLOOD; - newmobj->target = actor->target; A_SkullAttack (newmobj); } diff --git a/src/doom/p_extsaveg.c b/src/doom/p_extsaveg.c index ffc1526dce..3ea98fd8b5 100644 --- a/src/doom/p_extsaveg.c +++ b/src/doom/p_extsaveg.c @@ -235,6 +235,40 @@ static void P_ReadOldSpecial (const char *key) } } +// sector->rlightlevel + +static void P_WriteRLightlevel (const char *key) +{ + int i; + sector_t *sector; + + for (i = 0, sector = sectors; i < numsectors; i++, sector++) + { + if (sector->rlightlevel != sector->lightlevel) + { + M_snprintf(line, MAX_LINE_LEN, "%s %d %d\n", + key, + i, + (int)sector->rlightlevel); + fputs(line, save_stream); + } + } +} + +static void P_ReadRLightlevel (const char *key) +{ + int sector, rlightlevel; + + if (sscanf(line, "%s %d %d\n", + string, + §or, + &rlightlevel) == 3 && + !strncmp(string, key, MAX_STRING_LEN)) + { + sectors[sector].rlightlevel = (short)rlightlevel; + } +} + // buttonlist[] extern void P_StartButton (line_t *line, bwhere_e w, int texture, int time); @@ -449,6 +483,7 @@ static const extsavegdata_t extsavegdata[] = {"fireflicker", P_WriteFireFlicker, P_ReadFireFlicker, 1}, {"soundtarget", P_WriteSoundTarget, P_ReadSoundTarget, 1}, {"oldspecial", P_WriteOldSpecial, P_ReadOldSpecial, 1}, + {"rlightlevel", P_WriteRLightlevel, P_ReadRLightlevel, 1}, {"button", P_WriteButton, P_ReadButton, 1}, {"braintarget", P_WriteBrainTarget, P_ReadBrainTarget, 1}, {"markpoints", P_WriteMarkPoints, P_ReadMarkPoints, 1}, diff --git a/src/doom/p_lights.c b/src/doom/p_lights.c index 863338dcf3..96ddacc8d1 100644 --- a/src/doom/p_lights.c +++ b/src/doom/p_lights.c @@ -28,6 +28,7 @@ // State. #include "r_state.h" +#include "a11y.h" // [crispy] A11Y // // FIRELIGHT FLICKER @@ -51,6 +52,10 @@ void T_FireFlicker (fireflicker_t* flick) flick->sector->lightlevel = flick->maxlight - amount; flick->count = 4; + + // [crispy] A11Y + if (a11y_sector_lighting) + flick->sector->rlightlevel = flick->sector->lightlevel; } @@ -104,6 +109,9 @@ void T_LightFlash (lightflash_t* flash) flash->count = (P_Random()&flash->maxtime)+1; } + // [crispy] A11Y + if (a11y_sector_lighting) + flash->sector->rlightlevel = flash->sector->lightlevel; } @@ -161,6 +169,9 @@ void T_StrobeFlash (strobe_t* flash) flash->count =flash->darktime; } + // [crispy] A11Y + if (a11y_sector_lighting) + flash->sector->rlightlevel = flash->sector->lightlevel; } @@ -252,6 +263,8 @@ void EV_TurnTagLightsOff(line_t* line) min = tsec->lightlevel; } sector->lightlevel = min; + // [crispy] A11Y + sector->rlightlevel = sector->lightlevel; } } } @@ -295,6 +308,8 @@ EV_LightTurnOn } } sector-> lightlevel = bright; + // [crispy] A11Y + sector->rlightlevel = sector->lightlevel; } } } @@ -328,6 +343,10 @@ void T_Glow(glow_t* g) } break; } + + // [crispy] A11Y + if (a11y_sector_lighting) + g->sector->rlightlevel = g->sector->lightlevel; } diff --git a/src/doom/p_map.c b/src/doom/p_map.c index 482b833b32..364b58a141 100644 --- a/src/doom/p_map.c +++ b/src/doom/p_map.c @@ -1529,12 +1529,6 @@ boolean PIT_ChangeSector (mobj_t* thing) { P_SetMobjState (thing, S_GIBS); - // [crispy] no blood, no giblets - if (crispy->coloredblood && (thing->flags & MF_NOBLOOD)) - { - thing->sprite = SPR_TNT1; - } - if (gameversion > exe_doom_1_2) thing->flags &= ~MF_SOLID; thing->height = 0; @@ -1571,18 +1565,13 @@ boolean PIT_ChangeSector (mobj_t* thing) // spray blood in a random direction mo = P_SpawnMobj (thing->x, thing->y, - // [crispy] Lost Souls and Barrels bleed Puffs - thing->z + thing->height/2, (thing->flags & MF_NOBLOOD) ? MT_PUFF : MT_BLOOD); + thing->z + thing->height/2, MT_BLOOD); mo->momx = P_SubRandom() << 12; mo->momy = P_SubRandom() << 12; // [crispy] connect blood object with the monster that bleeds it mo->target = thing; - - // [crispy] Spectres bleed spectre blood - if (crispy->coloredblood) - mo->flags |= (thing->flags & MF_SHADOW); } // keep checking (crush other things) diff --git a/src/doom/p_mobj.c b/src/doom/p_mobj.c index 35feb8bb91..79d0379e0a 100644 --- a/src/doom/p_mobj.c +++ b/src/doom/p_mobj.c @@ -1052,10 +1052,6 @@ void P_SpawnMapThing (mapthing_t* mthing) mobj->health = 1000 + musid; } - // [crispy] Lost Souls bleed Puffs - if (crispy->coloredblood && i == MT_SKULL) - mobj->flags |= MF_NOBLOOD; - // [crispy] randomly colorize space marine corpse objects if (!netgame && crispy->coloredblood && (mobj->info->spawnstate == S_PLAY_DIE7 || @@ -1149,10 +1145,6 @@ P_SpawnBlood // [crispy] connect blood object with the monster that bleeds it th->target = target; - - // [crispy] Spectres bleed spectre blood - if (crispy->coloredblood) - th->flags |= (target->flags & MF_SHADOW); } diff --git a/src/doom/p_pspr.c b/src/doom/p_pspr.c index 9e2e34a086..b2ed74a2d4 100644 --- a/src/doom/p_pspr.c +++ b/src/doom/p_pspr.c @@ -34,6 +34,7 @@ #include "sounds.h" #include "p_pspr.h" +#include "a11y.h" // [crispy] A11Y #define LOWERSPEED FRACUNIT*6 #define RAISESPEED FRACUNIT*6 @@ -968,6 +969,9 @@ void P_SetupPsprites (player_t* player) // spawn the gun player->pendingweapon = player->readyweapon; P_BringUpWeapon (player); + + // [crispy] A11Y + numrpsprites = a11y_weapon_pspr ? NUMPSPRITES : (NUMPSPRITES - 1); } diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index a0de554405..77b464c384 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -382,6 +382,8 @@ void P_LoadSectors (int lump) ss->floorpic = R_FlatNumForName(ms->floorpic); ss->ceilingpic = R_FlatNumForName(ms->ceilingpic); ss->lightlevel = SHORT(ms->lightlevel); + // [crispy] A11Y light level used for rendering + ss->rlightlevel = ss->lightlevel; ss->special = SHORT(ms->special); ss->tag = SHORT(ms->tag); ss->thinglist = NULL; diff --git a/src/doom/p_user.c b/src/doom/p_user.c index 9cce828f30..8e04e5b787 100644 --- a/src/doom/p_user.c +++ b/src/doom/p_user.c @@ -28,6 +28,7 @@ #include "p_local.h" #include "doomstat.h" +#include "a11y.h" // [crispy] A11Y @@ -477,6 +478,15 @@ void P_PlayerThink (player_t* player) player->bonuscount--; + // [crispy] A11Y + if (!a11y_invul_colormap) + { + if (player->powers[pw_invulnerability] || player->powers[pw_infrared]) + player->fixedcolormap = 1; + else + player->fixedcolormap = 0; + } + else // Handling colormaps. if (player->powers[pw_invulnerability]) { diff --git a/src/doom/r_bsp.c b/src/doom/r_bsp.c index 395cb11ed7..5a449f015b 100644 --- a/src/doom/r_bsp.c +++ b/src/doom/r_bsp.c @@ -554,7 +554,7 @@ void R_Subsector (int num) frontsector->floorpic == skyflatnum && frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->floorpic, - frontsector->lightlevel); + frontsector->rlightlevel); // [crispy] A11Y } else floorplane = NULL; @@ -567,7 +567,7 @@ void R_Subsector (int num) frontsector->ceilingpic == skyflatnum && frontsector->sky & PL_SKYFLAT ? frontsector->sky : frontsector->ceilingpic, - frontsector->lightlevel); + frontsector->rlightlevel); // [crispy] A11Y } else ceilingplane = NULL; diff --git a/src/doom/r_data.c b/src/doom/r_data.c index 0690cb0ee3..f95ac0e864 100644 --- a/src/doom/r_data.c +++ b/src/doom/r_data.c @@ -1053,48 +1053,11 @@ static const int tran_filter_pct = 66; static void R_InitTranMap() { - int lump = W_CheckNumForName("TRANMAP"); - - // If a tranlucency filter map lump is present, use it - if (lump != -1) - { - // Set a pointer to the translucency filter maps. - tranmap = W_CacheLumpNum(lump, PU_STATIC); - // [crispy] loaded from a lump - printf(":"); - } - else { // Compose a default transparent filter map based on PLAYPAL. unsigned char *playpal = W_CacheLumpName("PLAYPAL", PU_STATIC); - FILE *cachefp; - char *fname = NULL; - extern char *configdir; - - struct { - unsigned char pct; - unsigned char playpal[256*3]; // [crispy] a palette has 768 bytes! - } cache; tranmap = Z_Malloc(256*256, PU_STATIC, 0); - fname = M_StringJoin(configdir, "tranmap.dat", NULL); - - // [crispy] open file readable - if ((cachefp = fopen(fname, "rb")) && - // [crispy] could read struct cache from file - fread(&cache, 1, sizeof(cache), cachefp) == sizeof(cache) && - // [crispy] same filter percents - cache.pct == tran_filter_pct && - // [crispy] same base palettes - memcmp(cache.playpal, playpal, sizeof(cache.playpal)) == 0 && - // [crispy] could read entire translucency map - fread(tranmap, 256, 256, cachefp) == 256 ) - { - // [crispy] loaded from a file - printf("."); - } - // [crispy] file not readable - else { byte *fg, *bg, blend[3], *tp = tranmap; int i, j, btmp; @@ -1127,35 +1090,9 @@ static void R_InitTranMap() *tp++ = V_GetPaletteIndex(playpal, blend[r], blend[g], blend[b]); } } - - // [crispy] file not readable, open writable - if ((cachefp = fopen(fname, "wb"))) - { - // [crispy] set filter percents - cache.pct = tran_filter_pct; - // [crispy] set base palette - memcpy(cache.playpal, playpal, sizeof(cache.playpal)); - // [crispy] go to start of file - fseek(cachefp, 0, SEEK_SET); - // [crispy] write struct cache - fwrite(&cache, 1, sizeof(cache), cachefp); - // [crispy] write translucency map - fwrite(tranmap, 256, 256, cachefp); - - // [crispy] generated and saved - printf("!"); - } - else - { - // [crispy] generated, but not saved - printf("?"); - } } - if (cachefp) - fclose(cachefp); - - free(fname); + printf("."); W_ReleaseLumpName("PLAYPAL"); } diff --git a/src/doom/r_defs.h b/src/doom/r_defs.h index e9258db705..0a601ee705 100644 --- a/src/doom/r_defs.h +++ b/src/doom/r_defs.h @@ -162,6 +162,9 @@ typedef struct // [crispy] revealed secrets short oldspecial; + + // [crispy] A11Y light level used for rendering + short rlightlevel; } sector_t; diff --git a/src/doom/r_main.c b/src/doom/r_main.c index 205045962f..436e011415 100644 --- a/src/doom/r_main.c +++ b/src/doom/r_main.c @@ -38,6 +38,7 @@ #include "r_local.h" #include "r_sky.h" #include "st_stuff.h" // [crispy] ST_refreshBackground() +#include "a11y.h" // [crispy] A11Y @@ -1038,7 +1039,13 @@ void R_SetupFrame (player_t* player) pitch = player->lookdir / MLOOKUNIT + player->recoilpitch; } + // [crispy] A11Y + if (a11y_weapon_flash) + { extralight = player->extralight; + } + else + extralight = 0; if (pitch > LOOKDIRMAX) pitch = LOOKDIRMAX; diff --git a/src/doom/r_segs.c b/src/doom/r_segs.c index 87f305d985..1a4c83d1ef 100644 --- a/src/doom/r_segs.c +++ b/src/doom/r_segs.c @@ -207,7 +207,7 @@ R_RenderMaskedSegRange backsector = curline->backsector; texnum = texturetranslation[curline->sidedef->midtexture]; - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); + lightnum = (frontsector->rlightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); // [crispy] A11Y // [crispy] smoother fake contrast lightnum += curline->fakecontrast; @@ -820,7 +820,7 @@ R_StoreWallRange // OPTIMIZE: get rid of LIGHTSEGSHIFT globally if (!fixedcolormap) { - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); + lightnum = (frontsector->rlightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); // [crispy] A11Y // [crispy] smoother fake contrast lightnum += curline->fakecontrast; diff --git a/src/doom/r_things.c b/src/doom/r_things.c index 33a6cec9fb..a2fb663f13 100644 --- a/src/doom/r_things.c +++ b/src/doom/r_things.c @@ -951,7 +951,7 @@ void R_AddSprites (sector_t* sec) // Well, now it will be done. sec->validcount = validcount; - lightnum = (sec->lightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); + lightnum = (sec->rlightlevel >> LIGHTSEGSHIFT)+(extralight * LIGHTBRIGHT); // [crispy] A11Y if (lightnum < 0) spritelights = scalelight[0]; @@ -1087,6 +1087,8 @@ void R_DrawPSprite (pspdef_t* psp, psprnum_t psprnum) // [crispy] differentiate } +// [crispy] A11Y number of player sprites to draw +int numrpsprites = NUMPSPRITES; // // R_DrawPlayerSprites @@ -1099,7 +1101,7 @@ void R_DrawPlayerSprites (void) // get light level lightnum = - (viewplayer->mo->subsector->sector->lightlevel >> LIGHTSEGSHIFT) + (viewplayer->mo->subsector->sector->rlightlevel >> LIGHTSEGSHIFT) // [crispy] A11Y +(extralight * LIGHTBRIGHT); if (lightnum < 0) @@ -1118,7 +1120,7 @@ void R_DrawPlayerSprites (void) // add all active psprites for (i=0, psp=viewplayer->psprites; - istate) diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c index 029994db87..ff3a2f9178 100644 --- a/src/doom/st_stuff.c +++ b/src/doom/st_stuff.c @@ -38,6 +38,7 @@ #include "doomkeys.h" #include "g_game.h" +#include "a11y.h" // [crispy] A11Y #include "st_stuff.h" #include "st_lib.h" @@ -1698,6 +1699,12 @@ void ST_doPaletteStuff(void) cnt = bzc; } + // [crispy] A11Y + if (!a11y_palette_changes) + { + palette = 0; + } + else if (cnt) { palette = (cnt+7)>>3; diff --git a/src/m_config.c b/src/m_config.c index bb345956f2..aa0ddf988d 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -1057,6 +1057,38 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT(vanilla_keyboard_mapping), + //! + // If zero, this disables sectors changing their light level. + // + + CONFIG_VARIABLE_INT(a11y_sector_lighting), + + //! + // If zero, this disables weapon flashes changing the ambient light + // level. + // + + CONFIG_VARIABLE_INT(a11y_weapon_flash), + + //! + // If zero, this disables rendering of weapon flashes sprites. + // + + CONFIG_VARIABLE_INT(a11y_weapon_pspr), + + //! + // If zero, this disables palette changes upon damage, item pickup, + // or when wearing the radiation suit. + // + + CONFIG_VARIABLE_INT(a11y_palette_changes), + + //! + // If zero, this disables colormap changes during invulnerability. + // + + CONFIG_VARIABLE_INT(a11y_invul_colormap), + //! // Name to use in network games for identification. This is only // used on the "waiting" screen while waiting for the game to start. @@ -2119,14 +2151,6 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT(crispy_extautomap), - //! - // @game doom - // - // Extended Savegames. - // - - CONFIG_VARIABLE_INT(crispy_extsaveg), - //! // @game doom // diff --git a/src/setup/CMakeLists.txt b/src/setup/CMakeLists.txt index 4c27a07ce5..d12d163d67 100644 --- a/src/setup/CMakeLists.txt +++ b/src/setup/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(setup STATIC + accessibility.c accessibility.h compatibility.c compatibility.h display.c display.h joystick.c joystick.h diff --git a/src/setup/Makefile.am b/src/setup/Makefile.am index 493b0b4724..fcdeaf9c92 100644 --- a/src/setup/Makefile.am +++ b/src/setup/Makefile.am @@ -6,6 +6,7 @@ AM_CFLAGS = @SDL_CFLAGS@ \ noinst_LIBRARIES = libsetup.a libsetup_a_SOURCES = \ + accessibility.c accessibility.h \ compatibility.c compatibility.h \ display.c display.h \ joystick.c joystick.h \ diff --git a/src/setup/accessibility.c b/src/setup/accessibility.c new file mode 100644 index 0000000000..dda63ae8f2 --- /dev/null +++ b/src/setup/accessibility.c @@ -0,0 +1,63 @@ +// +// Copyright(C) 2005-2014 Simon Howard +// Copyright(C) 2021 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// + +// Sound control menu + +#include + +#include "m_config.h" +#include "textscreen.h" +#include "mode.h" + +#include "accessibility.h" + +#define WINDOW_HELP_URL "https://www.chocolate-doom.org/setup-a11y" + +int a11y_sector_lighting = 1; +int a11y_weapon_flash = 1; +int a11y_weapon_pspr = 1; +int a11y_palette_changes = 1; +int a11y_invul_colormap = 1; + +void AccessibilitySettings(TXT_UNCAST_ARG(widget), void *user_data) +{ + txt_window_t *window; + + window = TXT_NewWindow("Accessibility"); + + TXT_SetWindowHelpURL(window, WINDOW_HELP_URL); + + TXT_AddWidgets(window, + TXT_NewCheckBox("Flickering Sector Lighting", + &a11y_sector_lighting), + TXT_NewCheckBox("Weapon Flash Lighting", + &a11y_weapon_flash), + TXT_NewCheckBox("Weapon Flash Sprite", + &a11y_weapon_pspr), + TXT_NewCheckBox("Palette Changes", + &a11y_palette_changes), + TXT_NewCheckBox("Invulnerability Colormap", + &a11y_invul_colormap), + NULL); +} + +void BindAccessibilityVariables(void) +{ + M_BindIntVariable("a11y_sector_lighting", &a11y_sector_lighting); + M_BindIntVariable("a11y_weapon_flash", &a11y_weapon_flash); + M_BindIntVariable("a11y_weapon_pspr", &a11y_weapon_pspr); + M_BindIntVariable("a11y_palette_changes", &a11y_palette_changes); + M_BindIntVariable("a11y_invul_colormap", &a11y_invul_colormap); +} diff --git a/src/setup/accessibility.h b/src/setup/accessibility.h new file mode 100644 index 0000000000..12f8bdad71 --- /dev/null +++ b/src/setup/accessibility.h @@ -0,0 +1,28 @@ +// +// Copyright(C) 2005-2014 Simon Howard +// Copyright(C) 2021 Fabian Greffrath +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// + +#ifndef SETUP_ACCESSIBILITY_H +#define SETUP_ACCESSIBILITY_H + +void AccessibilitySettings(void *widget, void *user_data); +void BindAccessibilityVariables(void); + +extern int a11y_sector_lighting; +extern int a11y_weapon_flash; +extern int a11y_weapon_pspr; +extern int a11y_palette_changes; +extern int a11y_invul_colormap; + +#endif /* #ifndef SETUP_ACCESSIBILITY_H */ diff --git a/src/setup/compatibility.c b/src/setup/compatibility.c index e0180cbd0f..3707c0b80a 100644 --- a/src/setup/compatibility.c +++ b/src/setup/compatibility.c @@ -67,7 +67,6 @@ void BindCompatibilityVariables(void) M_BindIntVariable("crispy_demotimer", &crispy->demotimer); M_BindIntVariable("crispy_demotimerdir", &crispy->demotimerdir); M_BindIntVariable("crispy_extautomap", &crispy->extautomap); - M_BindIntVariable("crispy_extsaveg", &crispy->extsaveg); M_BindIntVariable("crispy_flipcorpses", &crispy->flipcorpses); M_BindIntVariable("crispy_freeaim", &crispy->freeaim); M_BindIntVariable("crispy_freelook", &crispy->freelook); diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c index 5a4d02b57d..d18dec3d44 100644 --- a/src/setup/mainmenu.c +++ b/src/setup/mainmenu.c @@ -30,6 +30,7 @@ #include "setup_icon.c" #include "mode.h" +#include "accessibility.h" #include "compatibility.h" #include "display.h" #include "joystick.h" @@ -231,6 +232,8 @@ void MainMenu(void) TXT_NewButton2("Compatibility", (TxtWidgetSignalFunc) CompatibilitySettings, NULL), */ + TXT_NewButton2("Accessibility", + (TxtWidgetSignalFunc) AccessibilitySettings, NULL), GetLaunchButton(), TXT_NewStrut(0, 1), TXT_NewButton2("Start a Network Game", diff --git a/src/setup/mode.c b/src/setup/mode.c index ad0314b499..53a76d1d68 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -29,6 +29,7 @@ #include "m_controls.h" #include "m_misc.h" +#include "accessibility.h" #include "compatibility.h" #include "display.h" #include "joystick.h" @@ -188,6 +189,7 @@ void InitBindings(void) // All other variables + BindAccessibilityVariables(); BindCompatibilityVariables(); BindDisplayVariables(); BindJoystickVariables(); diff --git a/src/v_trans.c b/src/v_trans.c index e84a494dd1..3bf15a1aec 100644 --- a/src/v_trans.c +++ b/src/v_trans.c @@ -284,7 +284,7 @@ byte V_Colorize (byte *playpal, int cr, byte source, boolean keepgray109) if (cr == CR_GREEN) { // hsv.x = 135./360.; - hsv.x = (150. * hsv.z + 120. * (1. - hsv.z))/360.; + hsv.x = (145. * hsv.z + 120. * (1. - hsv.z))/360.; } else if (cr == CR_GOLD)