From a38a6a9dc0463ba255e2d014e2e81a1fb8cfa137 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 13 Nov 2020 20:49:18 +0000 Subject: [PATCH 001/160] Split off actual skin-setting code from SetPlayerSkinByNum so that both SetPlayerSkin and SetPlayerSkinByNum can call it, rather than to each other --- src/r_skins.c | 160 ++++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 76 deletions(-) diff --git a/src/r_skins.c b/src/r_skins.c index 25904e95e..dab282d26 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -216,6 +216,85 @@ INT32 R_SkinAvailable(const char *name) return -1; } +// Auxillary function that actually sets the skin +static void SetSkin(player_t *player, INT32 skinnum) +{ + skin_t *skin = &skins[skinnum]; + UINT16 newcolor = 0; + + player->skin = skinnum; + + player->camerascale = skin->camerascale; + player->shieldscale = skin->shieldscale; + + player->charability = (UINT8)skin->ability; + player->charability2 = (UINT8)skin->ability2; + + player->charflags = (UINT32)skin->flags; + + player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; + player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; + player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; + player->followitem = skin->followitem; + + if (((player->powers[pw_shield] & SH_NOSTACK) == SH_PINK) && (player->revitem == MT_LHRT || player->spinitem == MT_LHRT || player->thokitem == MT_LHRT)) // Healers can't keep their buff. + player->powers[pw_shield] &= SH_STACK; + + player->actionspd = skin->actionspd; + player->mindash = skin->mindash; + player->maxdash = skin->maxdash; + + player->normalspeed = skin->normalspeed; + player->runspeed = skin->runspeed; + player->thrustfactor = skin->thrustfactor; + player->accelstart = skin->accelstart; + player->acceleration = skin->acceleration; + + player->jumpfactor = skin->jumpfactor; + + player->height = skin->height; + player->spinheight = skin->spinheight; + + if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) + { + if (player == &players[consoleplayer]) + CV_StealthSetValue(&cv_playercolor, skin->prefcolor); + else if (player == &players[secondarydisplayplayer]) + CV_StealthSetValue(&cv_playercolor2, skin->prefcolor); + player->skincolor = newcolor = skin->prefcolor; + if (player->bot && botingame) + { + botskin = (UINT8)(skinnum + 1); + botcolor = skin->prefcolor; + } + } + + if (player->followmobj) + { + P_RemoveMobj(player->followmobj); + P_SetTarget(&player->followmobj, NULL); + } + + if (player->mo) + { + fixed_t radius = FixedMul(skin->radius, player->mo->scale); + if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin. + { + skin = &skins[DEFAULTNIGHTSSKIN]; + player->followitem = skin->followitem; + if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) + newcolor = skin->prefcolor; // will be updated in thinker to flashing + } + player->mo->skin = skin; + if (newcolor) + player->mo->color = newcolor; + P_SetScale(player->mo, player->mo->scale); + player->mo->radius = radius; + + P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames + } +} + // network code calls this when a 'skin change' is received void SetPlayerSkin(INT32 playernum, const char *skinname) { @@ -224,7 +303,7 @@ void SetPlayerSkin(INT32 playernum, const char *skinname) if ((i != -1) && R_SkinUsable(playernum, i)) { - SetPlayerSkinByNum(playernum, i); + SetSkin(playernum, i); return; } @@ -233,7 +312,7 @@ void SetPlayerSkin(INT32 playernum, const char *skinname) else if(server || IsPlayerAdmin(consoleplayer)) CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname); - SetPlayerSkinByNum(playernum, 0); + SetSkin(player, 0); } // Same as SetPlayerSkin, but uses the skin #. @@ -241,82 +320,10 @@ void SetPlayerSkin(INT32 playernum, const char *skinname) void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) { player_t *player = &players[playernum]; - skin_t *skin = &skins[skinnum]; - UINT16 newcolor = 0; if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists! { - player->skin = skinnum; - - player->camerascale = skin->camerascale; - player->shieldscale = skin->shieldscale; - - player->charability = (UINT8)skin->ability; - player->charability2 = (UINT8)skin->ability2; - - player->charflags = (UINT32)skin->flags; - - player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; - player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; - player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; - player->followitem = skin->followitem; - - if (((player->powers[pw_shield] & SH_NOSTACK) == SH_PINK) && (player->revitem == MT_LHRT || player->spinitem == MT_LHRT || player->thokitem == MT_LHRT)) // Healers can't keep their buff. - player->powers[pw_shield] &= SH_STACK; - - player->actionspd = skin->actionspd; - player->mindash = skin->mindash; - player->maxdash = skin->maxdash; - - player->normalspeed = skin->normalspeed; - player->runspeed = skin->runspeed; - player->thrustfactor = skin->thrustfactor; - player->accelstart = skin->accelstart; - player->acceleration = skin->acceleration; - - player->jumpfactor = skin->jumpfactor; - - player->height = skin->height; - player->spinheight = skin->spinheight; - - if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) - { - if (playernum == consoleplayer) - CV_StealthSetValue(&cv_playercolor, skin->prefcolor); - else if (playernum == secondarydisplayplayer) - CV_StealthSetValue(&cv_playercolor2, skin->prefcolor); - player->skincolor = newcolor = skin->prefcolor; - if (player->bot && botingame) - { - botskin = (UINT8)(skinnum + 1); - botcolor = skin->prefcolor; - } - } - - if (player->followmobj) - { - P_RemoveMobj(player->followmobj); - P_SetTarget(&player->followmobj, NULL); - } - - if (player->mo) - { - fixed_t radius = FixedMul(skin->radius, player->mo->scale); - if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin. - { - skin = &skins[DEFAULTNIGHTSSKIN]; - player->followitem = skin->followitem; - if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback)) - newcolor = skin->prefcolor; // will be updated in thinker to flashing - } - player->mo->skin = skin; - if (newcolor) - player->mo->color = newcolor; - P_SetScale(player->mo, player->mo->scale); - player->mo->radius = radius; - - P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames - } + SetSkin(player, skinnum); return; } @@ -324,7 +331,8 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) CONS_Alert(CONS_WARNING, M_GetText("Requested skin %d not found\n"), skinnum); else if(server || IsPlayerAdmin(consoleplayer)) CONS_Alert(CONS_WARNING, "Player %d (%s) skin %d not found\n", playernum, player_names[playernum], skinnum); - SetPlayerSkinByNum(playernum, 0); // not found put the sonic skin + + SetSkin(player, 0); // not found put the sonic skin } // From b2544395926ed4c5f7ec02a91e486feb6ba5b78d Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Wed, 2 Dec 2020 00:17:57 -0500 Subject: [PATCH 002/160] Update hw_light.c --- src/hardware/hw_light.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 987d70c69..76fecd7aa 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -340,6 +340,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BMCH &lspr[NOLIGHT], // SPR_SMCE &lspr[NOLIGHT], // SPR_BMCE + &lspr[NOLIGHT], // SPR_BSPB &lspr[NOLIGHT], // SPR_YSPB &lspr[NOLIGHT], // SPR_RSPB &lspr[REDBALL_L], // SPR_SFBR From c98108df2764e1cdcd8537655d3b479be1b3b4ea Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Thu, 3 Dec 2020 00:46:28 +0000 Subject: [PATCH 003/160] Revert "Update hw_light.c" This reverts commit b2544395926ed4c5f7ec02a91e486feb6ba5b78d --- src/hardware/hw_light.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 76fecd7aa..987d70c69 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -340,7 +340,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BMCH &lspr[NOLIGHT], // SPR_SMCE &lspr[NOLIGHT], // SPR_BMCE - &lspr[NOLIGHT], // SPR_BSPB &lspr[NOLIGHT], // SPR_YSPB &lspr[NOLIGHT], // SPR_RSPB &lspr[REDBALL_L], // SPR_SFBR From 2017eb4d9ed67f880c9c418561073c358762c679 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 2 Dec 2020 16:57:08 -0300 Subject: [PATCH 004/160] Fix polyobject segs messing with 3D floors they shouldn't be --- src/r_segs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_segs.c b/src/r_segs.c index 1ed1f0285..7c913e023 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1477,10 +1477,18 @@ static void R_RenderSegLoop (void) } for (i = 0; i < numffloors; i++) + { + if (curline->polyseg && (ffloor[i].polyobj != curline->polyseg)) + continue; + ffloor[i].f_frac += ffloor[i].f_step; + } for (i = 0; i < numbackffloors; i++) { + if (curline->polyseg && (ffloor[i].polyobj != curline->polyseg)) + continue; + ffloor[i].f_clip[rw_x] = ffloor[i].c_clip[rw_x] = (INT16)((ffloor[i].b_frac >> HEIGHTBITS) & 0xFFFF); ffloor[i].b_frac += ffloor[i].b_step; } From f79ded7c0b86a6d8e9c23f8fb0ec2c417c03752a Mon Sep 17 00:00:00 2001 From: katsy Date: Thu, 10 Dec 2020 20:52:06 -0500 Subject: [PATCH 005/160] scale minimum dashmode thok on actionspd, not normalspeed --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..c760d52ec 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5289,7 +5289,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) fixed_t actionspd = player->actionspd; if (player->charflags & SF_DASHMODE) - actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale)); + actionspd = max(player->actionspd, FixedDiv(player->speed, player->mo->scale)); if (player->mo->eflags & MFE_UNDERWATER) actionspd >>= 1; From ab156e17091479257fd6fc6287c7973a73d7329b Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 11 Dec 2020 23:11:15 -0500 Subject: [PATCH 006/160] Remove music slot compatibility --- src/deh_lua.c | 27 ------------- src/deh_soc.c | 100 ---------------------------------------------- src/deh_soc.h | 5 +-- src/doomdef.h | 4 -- src/lua_baselib.c | 67 +------------------------------ src/s_sound.c | 39 ++---------------- src/s_sound.h | 6 --- 7 files changed, 5 insertions(+), 243 deletions(-) diff --git a/src/deh_lua.c b/src/deh_lua.c index e6a436421..51632079b 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -25,10 +25,6 @@ #include "deh_lua.h" #include "deh_tables.h" -#ifdef MUSICSLOT_COMPATIBILITY -#include "deh_soc.h" // for get_mus -#endif - // freeslot takes a name (string only!) // and allocates it to the appropriate free slot. // Returns the slot number allocated for it or nil if failed. @@ -430,29 +426,6 @@ static inline int lib_getenum(lua_State *L) if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); return 0; } -#ifdef MUSICSLOT_COMPATIBILITY - else if (!mathlib && fastncmp("mus_",word,4)) { - p = word+4; - if ((i = get_mus(p, false)) == 0) - return 0; - lua_pushinteger(L, i); - return 1; - } - else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS! - p = word+4; - if ((i = get_mus(p, false)) == 0) - return luaL_error(L, "music '%s' could not be found.\n", word); - lua_pushinteger(L, i); - return 1; - } - else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) { - p = word+2; - if ((i = get_mus(p, false)) == 0) - return luaL_error(L, "music '%s' could not be found.\n", word); - lua_pushinteger(L, i); - return 1; - } -#endif else if (!mathlib && fastncmp("pw_",word,3)) { p = word+3; for (i = 0; i < NUMPOWERS; i++) diff --git a/src/deh_soc.c b/src/deh_soc.c index 5b12ea1b0..2cd872378 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1574,19 +1574,6 @@ void readlevelheader(MYFILE *f, INT32 num) sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num)); } } -#ifdef MUSICSLOT_COMPATIBILITY - else if (fastcmp(word, "MUSICSLOT")) - { - i = get_mus(word2, true); - if (i && i <= 1035) - snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i)); - else if (i && i <= 1050) - strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7); - else - mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string - mapheaderinfo[num-1]->musname[6] = 0; - } -#endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICPOS")) @@ -1964,19 +1951,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); cutscenes[num]->scene[scenenum].musswitch[6] = 0; } -#ifdef MUSICSLOT_COMPATIBILITY - else if (fastcmp(word, "MUSICSLOT")) - { - i = get_mus(word2, true); - if (i && i <= 1035) - snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i)); - else if (i && i <= 1050) - strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7); - else - cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string - cutscenes[num]->scene[scenenum].musswitch[6] = 0; - } -#endif else if (fastcmp(word, "MUSICTRACK")) { cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; @@ -2239,19 +2213,6 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7); textprompts[num]->page[pagenum].musswitch[6] = 0; } -#ifdef MUSICSLOT_COMPATIBILITY - else if (fastcmp(word, "MUSICSLOT")) - { - i = get_mus(word2, true); - if (i && i <= 1035) - snprintf(textprompts[num]->page[pagenum].musswitch, 7, "%sM", G_BuildMapName(i)); - else if (i && i <= 1050) - strncpy(textprompts[num]->page[pagenum].musswitch, compat_special_music_slots[i - 1036], 7); - else - textprompts[num]->page[pagenum].musswitch[0] = 0; // becomes empty string - textprompts[num]->page[pagenum].musswitch[6] = 0; - } -#endif else if (fastcmp(word, "MUSICTRACK")) { textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; @@ -2577,20 +2538,6 @@ void readmenu(MYFILE *f, INT32 num) menupres[num].musname[6] = 0; titlechanged = true; } -#ifdef MUSICSLOT_COMPATIBILITY - else if (fastcmp(word, "MUSICSLOT")) - { - value = get_mus(word2, true); - if (value && value <= 1035) - snprintf(menupres[num].musname, 7, "%sM", G_BuildMapName(value)); - else if (value && value <= 1050) - strncpy(menupres[num].musname, compat_special_music_slots[value - 1036], 7); - else - menupres[num].musname[0] = 0; // becomes empty string - menupres[num].musname[6] = 0; - titlechanged = true; - } -#endif else if (fastcmp(word, "MUSICTRACK")) { menupres[num].mustrack = ((UINT16)value - 1); @@ -4178,46 +4125,6 @@ sfxenum_t get_sfx(const char *word) return sfx_None; } -#ifdef MUSICSLOT_COMPATIBILITY -UINT16 get_mus(const char *word, UINT8 dehacked_mode) -{ // Returns the value of MUS_ enumerations - UINT16 i; - char lumptmp[4]; - - if (*word >= '0' && *word <= '9') - return atoi(word); - if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z') - return (UINT16)M_MapNumber(word[0], word[1]); - - if (fastncmp("MUS_",word,4)) - word += 4; // take off the MUS_ - else if (fastncmp("O_",word,2) || fastncmp("D_",word,2)) - word += 2; // take off the O_ or D_ - - strncpy(lumptmp, word, 4); - lumptmp[3] = 0; - if (fasticmp("MAP",lumptmp)) - { - word += 3; - if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z') - return (UINT16)M_MapNumber(word[0], word[1]); - else if ((i = atoi(word))) - return i; - - word -= 3; - if (dehacked_mode) - deh_warning("Couldn't find music named 'MUS_%s'",word); - return 0; - } - for (i = 0; compat_special_music_slots[i][0]; ++i) - if (fasticmp(word, compat_special_music_slots[i])) - return i + 1036; - if (dehacked_mode) - deh_warning("Couldn't find music named 'MUS_%s'",word); - return 0; -} -#endif - hudnum_t get_huditem(const char *word) { // Returns the value of HUD_ enumerations hudnum_t i; @@ -4448,13 +4355,6 @@ static fixed_t find_const(const char **rword) free(word); return r; } -#ifdef MUSICSLOT_COMPATIBILITY - else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) { - r = get_mus(word, true); - free(word); - return r; - } -#endif else if (fastncmp("PW_",word,3)) { r = get_power(word); free(word); diff --git a/src/deh_soc.h b/src/deh_soc.h index 2bcb52e70..0082e0e70 100644 --- a/src/deh_soc.h +++ b/src/deh_soc.h @@ -43,7 +43,7 @@ #include "info.h" #include "dehacked.h" -#include "doomdef.h" // MUSICSLOT_COMPATIBILITY, HWRENDER +#include "doomdef.h" // HWRENDER // Crazy word-reading stuff /// \todo Put these in a seperate file or something. @@ -52,9 +52,6 @@ statenum_t get_state(const char *word); spritenum_t get_sprite(const char *word); playersprite_t get_sprite2(const char *word); sfxenum_t get_sfx(const char *word); -#ifdef MUSICSLOT_COMPATIBILITY -UINT16 get_mus(const char *word, UINT8 dehacked_mode); -#endif hudnum_t get_huditem(const char *word); menutype_t get_menutype(const char *word); //INT16 get_gametype(const char *word); diff --git a/src/doomdef.h b/src/doomdef.h index d0b7ea0c2..3958d85d0 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -607,10 +607,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) //#define REDSANALOG -/// Backwards compatibility with musicslots. -/// \note You should leave this enabled unless you're working with a future SRB2 version. -#define MUSICSLOT_COMPATIBILITY - /// Experimental attempts at preventing MF_PAPERCOLLISION objects from getting stuck in walls. //#define PAPER_COLLISIONCORRECTION diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 515f6f0ba..3836fffb8 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2803,46 +2803,13 @@ static int lib_sStopSoundByID(lua_State *L) static int lib_sChangeMusic(lua_State *L) { -#ifdef MUSICSLOT_COMPATIBILITY - const char *music_name; - UINT32 music_num, position, prefadems, fadeinms; - char music_compat_name[7]; + UINT32 position, prefadems, fadeinms; - boolean looping; - player_t *player = NULL; - UINT16 music_flags = 0; - //NOHUD - - if (lua_isnumber(L, 1)) - { - music_num = (UINT32)luaL_checkinteger(L, 1); - music_flags = (UINT16)(music_num & 0x0000FFFF); - if (music_flags && music_flags <= 1035) - snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags)); - else if (music_flags && music_flags <= 1050) - strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7); - else - music_compat_name[0] = 0; // becomes empty string - music_compat_name[6] = 0; - music_name = (const char *)&music_compat_name; - music_flags = 0; - } - else - { - music_num = 0; - music_name = luaL_checkstring(L, 1); - } - - looping = (boolean)lua_opttrueboolean(L, 2); - -#else const char *music_name = luaL_checkstring(L, 1); boolean looping = (boolean)lua_opttrueboolean(L, 2); player_t *player = NULL; UINT16 music_flags = 0; - //NOHUD -#endif if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) { player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); @@ -2850,13 +2817,7 @@ static int lib_sChangeMusic(lua_State *L) return LUA_ErrInvalid(L, "player_t"); } -#ifdef MUSICSLOT_COMPATIBILITY - if (music_num) - music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16); - else -#endif music_flags = (UINT16)luaL_optinteger(L, 4, 0); - position = (UINT32)luaL_optinteger(L, 5, 0); prefadems = (UINT32)luaL_optinteger(L, 6, 0); fadeinms = (UINT32)luaL_optinteger(L, 7, 0); @@ -3153,33 +3114,7 @@ static int lib_sMusicExists(lua_State *L) { boolean checkMIDI = lua_opttrueboolean(L, 2); boolean checkDigi = lua_opttrueboolean(L, 3); -#ifdef MUSICSLOT_COMPATIBILITY - const char *music_name; - UINT32 music_num; - char music_compat_name[7]; - UINT16 music_flags = 0; - NOHUD - if (lua_isnumber(L, 1)) - { - music_num = (UINT32)luaL_checkinteger(L, 1); - music_flags = (UINT16)(music_num & 0x0000FFFF); - if (music_flags && music_flags <= 1035) - snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags)); - else if (music_flags && music_flags <= 1050) - strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7); - else - music_compat_name[0] = 0; // becomes empty string - music_compat_name[6] = 0; - music_name = (const char *)&music_compat_name; - } - else - { - music_num = 0; - music_name = luaL_checkstring(L, 1); - } -#else const char *music_name = luaL_checkstring(L, 1); -#endif NOHUD lua_pushboolean(L, S_MusicExists(music_name, checkMIDI, checkDigi)); return 1; diff --git a/src/s_sound.c b/src/s_sound.c index 36bd454c1..ecce7e9c4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1354,28 +1354,6 @@ void S_InitSfxChannels(INT32 sfxVolume) /// Music /// ------------------------ -#ifdef MUSICSLOT_COMPATIBILITY -const char *compat_special_music_slots[16] = -{ - "_title", // 1036 title screen - "_intro", // 1037 intro - "_clear", // 1038 level clear - "_inv", // 1039 invincibility - "_shoes", // 1040 super sneakers - "_minv", // 1041 Mario invincibility - "_drown", // 1042 drowning - "_gover", // 1043 game over - "_1up", // 1044 extra life - "_conti", // 1045 continue screen - "_super", // 1046 Super Sonic - "_chsel", // 1047 character select - "_creds", // 1048 credits - "_inter", // 1049 Race Results - "_stjr", // 1050 Sonic Team Jr. Presents - "" -}; -#endif - static char music_name[7]; // up to 6-character name static void *music_data; static UINT16 music_flags; @@ -2465,7 +2443,7 @@ void S_StartEx(boolean reset) static void Command_Tunes_f(void) { const char *tunearg; - UINT16 tunenum, track = 0; + UINT16 track = 0; UINT32 position = 0; const size_t argc = COM_Argc(); @@ -2481,7 +2459,6 @@ static void Command_Tunes_f(void) } tunearg = COM_Argv(1); - tunenum = (UINT16)atoi(tunearg); track = 0; if (!strcasecmp(tunearg, "-show")) @@ -2500,24 +2477,14 @@ static void Command_Tunes_f(void) tunearg = mapheaderinfo[gamemap-1]->musname; track = mapheaderinfo[gamemap-1]->mustrack; } - else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') - tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); - if (tunenum && tunenum >= 1036) - { - CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n")); - return; - } - if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case + if (strlen(tunearg) > 6) // This is automatic -- just show the error just in case CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n")); if (argc > 2) track = (UINT16)atoi(COM_Argv(2))-1; - if (tunenum) - snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum)); - else - strncpy(mapmusname, tunearg, 7); + strncpy(mapmusname, tunearg, 7); if (argc > 4) position = (UINT32)atoi(COM_Argv(4)); diff --git a/src/s_sound.h b/src/s_sound.h index 4ac3c70bf..ab2c411c0 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -319,10 +319,4 @@ void S_StopSoundByNum(sfxenum_t sfxnum); #define S_StartScreamSound S_StartSound #endif -#ifdef MUSICSLOT_COMPATIBILITY -// For compatibility with code/scripts relying on older versions -// This is a list of all the "special" slot names and their associated numbers -extern const char *compat_special_music_slots[16]; -#endif - #endif From c5474436af67408342e8dce0ec996d62c9a4c21c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 7 Nov 2020 19:47:50 -0500 Subject: [PATCH 007/160] Use FixedHypot over P_AproxDistance Not convinced that the small speed benefit from P_AproxDistance is worth the "aproximate"[sic] results it gives. Let's instead try a define to replace it with FixedHypot. In Lua, the function gives a deprecated warning. Inspired by the hyperwall fix for vanilla, except for everything. From little testing, actively improves waypoint checks, bumping, speed checks, wall collisions, Jawz targetting, Lightning Shield attacks, so on. The only way I see this as a potential downgrade is A_Look (and related functions) getting slower, which are barely used in Kart. --- src/lua_baselib.c | 3 ++- src/p_maputl.c | 13 ------------- src/p_maputl.h | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 515f6f0ba..7b2e42bd5 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -427,7 +427,8 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushfixed(L, P_AproxDistance(dx, dy)); + LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); + lua_pushfixed(L, FixedHypot(dx, dy)); return 1; } diff --git a/src/p_maputl.c b/src/p_maputl.c index 90718a41c..83905a418 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -24,19 +24,6 @@ #include "p_slopes.h" #include "z_zone.h" -// -// P_AproxDistance -// Gives an estimation of distance (not exact) -// -fixed_t P_AproxDistance(fixed_t dx, fixed_t dy) -{ - dx = abs(dx); - dy = abs(dy); - if (dx < dy) - return dx + dy - (dx>>1); - return dx + dy - (dy>>1); -} - // // P_ClosestPointOnLine // Finds the closest point on a given line to the supplied point diff --git a/src/p_maputl.h b/src/p_maputl.h index 08b606833..df90ab4b4 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy); +#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); From e19196a86e5347edf7f25b335214cede978b91b8 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 7 Nov 2020 23:56:46 -0500 Subject: [PATCH 008/160] Use R_PointToDist2 instead Apparently overflows less often Actually, lets just fix FixedHypot instead. Now FixedHypot uses the code from R_PointToDist2, and R_PointToDist2 just calls FixedHypot. Ultimately, this branch was intended to get rid of a redundant way to retrieve distance and replace it with the one that was actually good at its job. So consolidating FixedHypot and R_PointToDist2 together is just an extension of that. --- src/m_fixed.c | 40 ++++++++++++++++++++++++++++------------ src/r_main.c | 24 +----------------------- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/m_fixed.c b/src/m_fixed.c index eb10fd5f8..09d6936f2 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -18,8 +18,10 @@ #define HAVE_SQRTF #endif #endif + #include "doomdef.h" #include "m_fixed.h" +#include "tables.h" // ANGLETOFINESHIFT #ifdef __USE_C_FIXEDMUL__ @@ -105,20 +107,34 @@ fixed_t FixedSqrt(fixed_t x) fixed_t FixedHypot(fixed_t x, fixed_t y) { - fixed_t ax, yx, yx2, yx1; - if (abs(y) > abs(x)) // |y|>|x| + // Moved the code from R_PointToDist2 to here, + // since R_PointToDist2 did the same thing, + // except less prone to overflowing. + + angle_t angle; + fixed_t dist; + + x = abs(x); + y = abs(y); + + if (y > x) { - ax = abs(y); // |y| => ax - yx = FixedDiv(x, y); // (x/y) + fixed_t temp; + + temp = x; + x = y; + y = temp; } - else // |x|>|y| - { - ax = abs(x); // |x| => ax - yx = FixedDiv(y, x); // (x/y) - } - yx2 = FixedMul(yx, yx); // (x/y)^2 - yx1 = FixedSqrt(1 * FRACUNIT + yx2); // (1 + (x/y)^2)^1/2 - return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) + + if (!y) + return x; + + angle = (tantoangle[FixedDiv(y, x)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; + + // use as cosine + dist = FixedDiv(x, FINESINE(angle)); + + return dist; } vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) diff --git a/src/r_main.c b/src/r_main.c index f82fb589e..f6c05e312 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -357,29 +357,7 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1) { - angle_t angle; - fixed_t dx, dy, dist; - - dx = abs(px1 - px2); - dy = abs(py1 - py2); - - if (dy > dx) - { - fixed_t temp; - - temp = dx; - dx = dy; - dy = temp; - } - if (!dy) - return dx; - - angle = (tantoangle[FixedDiv(dy, dx)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; - - // use as cosine - dist = FixedDiv(dx, FINESINE(angle)); - - return dist; + return FixedHypot(px1 - px2, py1 - py2); } // Little extra utility. Works in the same way as R_PointToAngle2 From 75633bde5039106c5f916ca2b4d1bde11d274be9 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 12 Dec 2020 14:53:54 -0800 Subject: [PATCH 009/160] Replace all instances of P_AproxDistance with FixedHypot --- src/b_bot.c | 10 +-- src/g_game.c | 2 +- src/p_ceilng.c | 4 +- src/p_enemy.c | 172 ++++++++++++++++++++++++------------------------ src/p_floor.c | 10 +-- src/p_inter.c | 20 +++--- src/p_map.c | 10 +-- src/p_maputl.h | 1 - src/p_mobj.c | 78 +++++++++++----------- src/p_polyobj.c | 2 +- src/p_setup.c | 2 +- src/p_slopes.c | 2 +- src/p_spec.c | 58 ++++++++-------- src/p_user.c | 56 ++++++++-------- src/r_things.c | 4 +- src/s_sound.c | 4 +- src/st_stuff.c | 2 +- 17 files changed, 218 insertions(+), 219 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index d3635f32c..abe69caeb 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -54,11 +54,11 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) boolean _2d = (tails->flags2 & MF2_TWOD) || twodlevel; fixed_t scale = tails->scale; - fixed_t dist = P_AproxDistance(sonic->x - tails->x, sonic->y - tails->y); + fixed_t dist = FixedHypot(sonic->x - tails->x, sonic->y - tails->y); fixed_t zdist = flip * (sonic->z - tails->z); angle_t ang = sonic->angle; - fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy); - fixed_t bmom = P_AproxDistance(tails->momx, tails->momy); + fixed_t pmom = FixedHypot(sonic->momx, sonic->momy); + fixed_t bmom = FixedHypot(tails->momx, tails->momy); fixed_t followmax = 128 * 8 * scale; // Max follow distance before AI begins to enter "panic" state fixed_t followthres = 92 * scale; // Distance that AI will try to reach fixed_t followmin = 32 * scale; @@ -81,7 +81,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) { boolean isrelevant = (sonic->player->powers[pw_carry] == CR_MACESPIN || sonic->player->powers[pw_carry] == CR_GENERIC); - dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); + dist = FixedHypot(tails->x-sonic->x, tails->y-sonic->y); if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant) cmd->buttons |= BT_JUMP; if (isrelevant) @@ -496,7 +496,7 @@ boolean B_CheckRespawn(player_t *player) } // If you can't see Sonic, I guess we should? - if (!P_CheckSight(sonic, tails) && P_AproxDistance(P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y), tails->z-sonic->z) > FixedMul(1024*FRACUNIT, tails->scale)) + if (!P_CheckSight(sonic, tails) && FixedHypot(FixedHypot(tails->x-sonic->x, tails->y-sonic->y), tails->z-sonic->z) > FixedMul(1024*FRACUNIT, tails->scale)) return true; return false; } diff --git a/src/g_game.c b/src/g_game.c index 6171c7b72..3f8d573c8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1423,7 +1423,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) newtarget = P_SpawnMobj(ticcmd_ztargetfocus[forplayer]->x, ticcmd_ztargetfocus[forplayer]->y, ticcmd_ztargetfocus[forplayer]->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]); - if (P_AproxDistance( + if (FixedHypot( player->mo->x - ticcmd_ztargetfocus[forplayer]->x, player->mo->y - ticcmd_ztargetfocus[forplayer]->y ) > 50*player->mo->scale) diff --git a/src/p_ceilng.c b/src/p_ceilng.c index f12499d5c..2168d1d78 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -468,7 +468,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) // Linedef executor excellence case moveCeilingByFrontSector: - ceiling->speed = P_AproxDistance(line->dx, line->dy); + ceiling->speed = FixedHypot(line->dx, line->dy); ceiling->speed = FixedDiv(ceiling->speed,8*FRACUNIT); if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up { @@ -547,7 +547,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) */ case bounceCeiling: - ceiling->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous + ceiling->speed = FixedHypot(line->dx, line->dy); // same speed as elevateContinuous ceiling->speed = FixedDiv(ceiling->speed,4*FRACUNIT); ceiling->origspeed = ceiling->speed; if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up diff --git a/src/p_enemy.c b/src/p_enemy.c index 203e04af1..0d94f2a7e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -334,7 +334,7 @@ boolean P_CheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); + dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); if (dist >= FixedMul(MELEERANGE - 20*FRACUNIT, actor->scale) + pl->radius) return false; @@ -360,7 +360,7 @@ boolean P_JetbCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); + dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); if (dist >= (actor->radius + pl->radius)*2) return false; @@ -389,7 +389,7 @@ boolean P_FaceStabCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); + dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); if (dist >= (actor->radius + pl->radius)*4) return false; @@ -413,7 +413,7 @@ boolean P_SkimCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); + dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); if (dist >= FixedMul(MELEERANGE - 20*FRACUNIT, actor->scale) + pl->radius) return false; @@ -449,7 +449,7 @@ boolean P_CheckMissileRange(mobj_t *actor) return false; // OPTIMIZE: get this from a global checksight - dist = P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale); + dist = FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale); if (!actor->info->meleestate) dist -= FixedMul(128*FRACUNIT, actor->scale); // no melee attack, so fire more @@ -750,7 +750,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed continue; // Ignore uncontrolled bodies if (dist > 0 - && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) + && FixedHypot(FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) continue; // Too far away if (!allaround) @@ -758,7 +758,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed an = R_PointToAngle2(actor->x, actor->y, player->mo->x, player->mo->y) - actor->angle; if (an > ANGLE_90 && an < ANGLE_270) { - dist = P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y); + dist = FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y); // if real close, react anyway if (dist > FixedMul(MELEERANGE, actor->scale)) continue; // behind back @@ -821,7 +821,7 @@ static boolean P_LookForShield(mobj_t *actor) continue; if ((player->powers[pw_shield] & SH_PROTECTELECTRIC) - && (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) + && (FixedHypot(FixedHypot(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) { P_SetTarget(&actor->tracer, player->mo); @@ -1548,8 +1548,8 @@ void A_PointyThink(mobj_t *actor) } else { - if (P_AproxDistance(players[i].mo->x - actor->x, players[i].mo->y - actor->y) < - P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y)) + if (FixedHypot(players[i].mo->x - actor->x, players[i].mo->y - actor->y) < + FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y)) player = &players[i]; } } @@ -1561,7 +1561,7 @@ void A_PointyThink(mobj_t *actor) P_SetTarget(&actor->target, player->mo); A_FaceTarget(actor); - if (P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y) < P_AproxDistance(player->mo->x + player->mo->momx - actor->x, player->mo->y + player->mo->momy - actor->y)) + if (FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y) < FixedHypot(player->mo->x + player->mo->momx - actor->x, player->mo->y + player->mo->momy - actor->y)) sign = -1; // Player is moving away else sign = 1; // Player is moving closer @@ -1638,7 +1638,7 @@ static void P_ParabolicMove(mobj_t *actor, fixed_t x, fixed_t y, fixed_t z, fixe y -= actor->y; z -= actor->z; - dh = P_AproxDistance(x, y); + dh = FixedHypot(x, y); actor->momx = FixedMul(FixedDiv(x, dh), speed); actor->momy = FixedMul(FixedDiv(y, dh), speed); @@ -1706,7 +1706,7 @@ void A_HoodThink(mobj_t *actor) } dx = (actor->target->x - actor->x), dy = (actor->target->y - actor->y), dz = (actor->target->z - actor->z); - dm = P_AproxDistance(dx, dy); + dm = FixedHypot(dx, dy); // Target dangerously close to robohood, retreat then. if ((dm < 256<target || !crab->info->missilestate || (statenum_t)(crab->state-states) == crab->info->missilestate) return; - if (((ang + ANG1) < ANG2) || P_AproxDistance(crab->x - crab->target->x, crab->y - crab->target->y) < 333*crab->scale) + if (((ang + ANG1) < ANG2) || FixedHypot(crab->x - crab->target->x, crab->y - crab->target->y) < 333*crab->scale) P_SetMobjState(crab, crab->info->missilestate); } @@ -2703,7 +2703,7 @@ void A_LobShot(mobj_t *actor) shot->angle = an = actor->angle; an >>= ANGLETOFINESHIFT; - dist = P_AproxDistance(actor->target->x - shot->x, actor->target->y - shot->y); + dist = FixedHypot(actor->target->x - shot->x, actor->target->y - shot->y); horizontal = dist / airtime; vertical = FixedMul((gravity*airtime)/2, shot->scale); @@ -2721,7 +2721,7 @@ void A_LobShot(mobj_t *actor) diff = actor->z - actor->target->z; { - launchhyp = P_AproxDistance(horizontal, vertical); + launchhyp = FixedHypot(horizontal, vertical); orig = FixedMul(FixedDiv(vertical, horizontal), diff); @@ -3325,7 +3325,7 @@ void A_SkullAttack(mobj_t *actor) S_StartSound(actor, actor->info->activesound); A_FaceTarget(actor); - dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y); + dist = FixedHypot(dest->x - actor->x, dest->y - actor->y); if (locvar1 == 1) actor->angle += ANGLE_180; @@ -3443,7 +3443,7 @@ void A_BossZoom(mobj_t *actor) an = actor->angle >> ANGLETOFINESHIFT; actor->momx = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINECOSINE(an)); actor->momy = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINESINE(an)); - dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y); + dist = FixedHypot(dest->x - actor->x, dest->y - actor->y); dist = dist / FixedMul(actor->info->speed*5*FRACUNIT, actor->scale); if (dist < 1) @@ -3599,7 +3599,7 @@ void A_1upThinker(mobj_t *actor) if ((netgame || multiplayer) && players[i].playerstate != PST_LIVE) continue; - temp = P_AproxDistance(players[i].mo->x-actor->x, players[i].mo->y-actor->y); + temp = FixedHypot(players[i].mo->x-actor->x, players[i].mo->y-actor->y); if (temp < dist) { @@ -4144,8 +4144,8 @@ bossjustdie: // If this one's further then the last one, don't go for it. if (mo->target && - P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > - P_AproxDistance(P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) + FixedHypot(FixedHypot(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > + FixedHypot(FixedHypot(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) continue; // Otherwise... Do! @@ -4536,7 +4536,7 @@ void A_BubbleSpawn(mobj_t *actor) // Don't spawn bubbles unless a player is relatively close by (var1). for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x-target->x, actor->y-target->y)>>FRACBITS; + dist = FixedHypot(actor->x-target->x, actor->y-target->y)>>FRACBITS; if (dist > FixedMul((locvar2 & 65535), actor->scale)) return; @@ -4800,7 +4800,7 @@ void A_FishJump(mobj_t *actor) // Don't spawn trail unless a player is nearby. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) + && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) break; // Stop looking. if (i < MAXPLAYERS) { @@ -4905,7 +4905,7 @@ void A_ThrownRing(mobj_t *actor) // magnetic player. If he gets too far away, make // sure to stop the attraction! if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC) - && P_AproxDistance(P_AproxDistance(actor->tracer->x-actor->x, + && FixedHypot(FixedHypot(actor->tracer->x-actor->x, actor->tracer->y-actor->y), actor->tracer->z-actor->z) > FixedMul(RING_DIST/4, actor->tracer->scale))) { P_SetTarget(&actor->tracer, NULL); @@ -4964,7 +4964,7 @@ void A_ThrownRing(mobj_t *actor) continue; } - dist = P_AproxDistance(P_AproxDistance(player->mo->x-actor->x, + dist = FixedHypot(FixedHypot(player->mo->x-actor->x, player->mo->y-actor->y), player->mo->z-actor->z); // check distance @@ -5345,7 +5345,7 @@ void A_JetChase(mobj_t *actor) return; // got a new target // If the player is over 3072 fracunits away, then look for another player - if (P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), + if (FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z) > FixedMul(3072*FRACUNIT, actor->scale) && P_LookForPlayers(actor, true, false, FixedMul(3072*FRACUNIT, actor->scale))) { return; // got a new target @@ -5460,7 +5460,7 @@ void A_JetgShoot(mobj_t *actor) if (actor->reactiontime) return; - dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); + dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); if (dist > FixedMul(actor->info->painchance*FRACUNIT, actor->scale)) return; @@ -5497,7 +5497,7 @@ void A_ShootBullet(mobj_t *actor) if (!actor->target) return; - dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); + dist = FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); if (dist > FixedMul(actor->info->painchance*FRACUNIT, actor->scale)) return; @@ -5522,7 +5522,7 @@ static boolean PIT_MinusCarry(mobj_t *thing) if (!(thing->flags & (MF_PUSHABLE|MF_ENEMY))) return true; - if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) + if (FixedHypot(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) return true; if (abs(thing->z - minus->z) > minus->height) @@ -5566,7 +5566,7 @@ void A_MinusDigging(mobj_t *actor) P_TryMove(par, x, y, false); // If close enough, prepare to attack - if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2) + if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2) { P_SetMobjState(actor, actor->info->meleestate); P_TryMove(actor, actor->target->x, actor->target->y, false); @@ -5858,7 +5858,7 @@ void A_DetonChase(mobj_t *actor) } }*/ // movedir is up/down angle: how much it has to go up as it goes over to the player - xydist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + xydist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); exact = R_PointToAngle2(0, 0, xydist, actor->tracer->z - actor->z); actor->movedir = exact; /*if (exact != actor->movedir) @@ -5880,7 +5880,7 @@ void A_DetonChase(mobj_t *actor) // check for melee attack if (actor->tracer) { - if (P_AproxDistance(actor->tracer->x-actor->x, actor->tracer->y-actor->y) < actor->radius+actor->tracer->radius) + if (FixedHypot(actor->tracer->x-actor->x, actor->tracer->y-actor->y) < actor->radius+actor->tracer->radius) { if (!((actor->tracer->z > actor->z + actor->height) || (actor->z > actor->tracer->z + actor->tracer->height))) { @@ -5891,7 +5891,7 @@ void A_DetonChase(mobj_t *actor) } // chase towards player - if ((dist = P_AproxDistance(xydist, actor->tracer->z-actor->z)) + if ((dist = FixedHypot(xydist, actor->tracer->z-actor->z)) > FixedMul((actor->info->painchance << FRACBITS), actor->scale)) { P_SetTarget(&actor->tracer, NULL); // Too far away @@ -5933,7 +5933,7 @@ void A_DetonChase(mobj_t *actor) actor->momy = FixedMul(xyspeed, FINESINE(exact)); // Variable re-use - xyspeed = (P_AproxDistance(actor->tracer->x - actor->x, P_AproxDistance(actor->tracer->y - actor->y, actor->tracer->z - actor->z))>>(FRACBITS+6)); + xyspeed = (FixedHypot(actor->tracer->x - actor->x, FixedHypot(actor->tracer->y - actor->y, actor->tracer->z - actor->z))>>(FRACBITS+6)); if (xyspeed < 1) xyspeed = 1; @@ -6081,7 +6081,7 @@ void A_UnidusBall(mobj_t *actor) if (actor->movecount) { - if (P_AproxDistance(actor->momx, actor->momy) < FixedMul(actor->info->damage/2, actor->scale)) + if (FixedHypot(actor->momx, actor->momy) < FixedMul(actor->info->damage/2, actor->scale)) P_ExplodeMissile(actor); return; } @@ -6113,7 +6113,7 @@ void A_UnidusBall(mobj_t *actor) if (locvar1 == 1 && canthrow) { - if (P_AproxDistance(actor->target->target->x - actor->target->x, actor->target->target->y - actor->target->y) > FixedMul(MISSILERANGE>>1, actor->scale) + if (FixedHypot(actor->target->target->x - actor->target->x, actor->target->target->y - actor->target->y) > FixedMul(MISSILERANGE>>1, actor->scale) || !P_CheckSight(actor, actor->target->target)) return; @@ -6188,7 +6188,7 @@ void A_RockSpawn(mobj_t *actor) return; } - dist = P_AproxDistance(line->dx, line->dy)/16; + dist = FixedHypot(line->dx, line->dy)/16; if (dist < 1) dist = 1; @@ -6354,7 +6354,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) return; } - dist = P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y); + dist = FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y); if (actor->target->player && (!hovermode || actor->reactiontime <= 2*TICRATE)) { @@ -6391,7 +6391,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) { fixed_t mom; P_Thrust(actor, actor->angle, 2*actor->scale); - mom = P_AproxDistance(actor->momx, actor->momy); + mom = FixedHypot(actor->momx, actor->momy); if (mom > 20*actor->scale) { mom += 20*actor->scale; @@ -6479,7 +6479,7 @@ void A_RingExplode(mobj_t *actor) if (mo2 == actor) // Don't explode yourself! Endless loop! continue; - if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > FixedMul(actor->info->painchance, actor->scale)) + if (FixedHypot(FixedHypot(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > FixedMul(actor->info->painchance, actor->scale)) continue; if (mo2->flags & MF_SHOOTABLE) @@ -7078,7 +7078,7 @@ nomissile: } // chase towards player - if (P_AproxDistance(actor->target->x-actor->x, actor->target->y-actor->y) > actor->radius+actor->target->radius) + if (FixedHypot(actor->target->x-actor->x, actor->target->y-actor->y) > actor->radius+actor->target->radius) { if (--actor->movecount < 0 || !P_Move(actor, actor->info->speed)) P_NewChaseDir(actor); @@ -7317,7 +7317,7 @@ void A_Boss7Chase(mobj_t *actor) // Self-adjust if stuck on the edge if (actor->tracer) { - if (P_AproxDistance(actor->x - actor->tracer->x, actor->y - actor->tracer->y) > 128*FRACUNIT - actor->radius) + if (FixedHypot(actor->x - actor->tracer->x, actor->y - actor->tracer->y) > 128*FRACUNIT - actor->radius) P_InstaThrust(actor, R_PointToAngle2(actor->x, actor->y, actor->tracer->x, actor->tracer->y), FRACUNIT); } @@ -7353,7 +7353,7 @@ void A_Boss7Chase(mobj_t *actor) if (players[i].mo->health <= 0) continue; - if (P_AproxDistance(players[i].mo->x - actor->x, players[i].mo->y - actor->y) > actor->radius) + if (FixedHypot(players[i].mo->x - actor->x, players[i].mo->y - actor->y) > actor->radius) continue; if (players[i].mo->z > actor->z + actor->height - 2*FRACUNIT @@ -7476,7 +7476,7 @@ void A_Boss2PogoSFX(mobj_t *actor) } // Boing! - if (P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(256*FRACUNIT, actor->scale)) + if (FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(256*FRACUNIT, actor->scale)) { actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); P_InstaThrust(actor, actor->angle, FixedMul(actor->info->speed, actor->scale)); @@ -7509,7 +7509,7 @@ void A_Boss2PogoTarget(mobj_t *actor) return; if (!actor->target || !(actor->target->flags & MF_SHOOTABLE) || (actor->target->player && actor->target->player->powers[pw_flashing]) - || P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) >= FixedMul(512*FRACUNIT, actor->scale)) + || FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) >= FixedMul(512*FRACUNIT, actor->scale)) { // look for a new target if (P_LookForPlayers(actor, true, false, 512*FRACUNIT)) @@ -7530,7 +7530,7 @@ void A_Boss2PogoTarget(mobj_t *actor) P_InstaThrust(actor, actor->angle+ANGLE_180, FixedMul(FixedMul(actor->info->speed,(locvar2)), actor->scale)); // Move at wandering speed } // Try to land on top of the player. - else if (P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(512*FRACUNIT, actor->scale)) + else if (FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(512*FRACUNIT, actor->scale)) { fixed_t airtime, gravityadd, zoffs; @@ -7558,7 +7558,7 @@ void A_Boss2PogoTarget(mobj_t *actor) airtime = FixedDiv((-actor->momz - FixedSqrt(FixedMul(actor->momz,actor->momz)+zoffs)), gravityadd)<<1; // to try and land on their head rather than on their feet actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); - P_InstaThrust(actor, actor->angle, FixedDiv(P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y), airtime)); + P_InstaThrust(actor, actor->angle, FixedDiv(FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y), airtime)); } // Wander semi-randomly towards the player to get closer. else @@ -7629,7 +7629,7 @@ void A_TurretFire(mobj_t *actor) while (P_SupermanLook4Players(actor) && count < MAXPLAYERS) { - if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < dist) + if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < dist) { actor->flags2 |= MF2_FIRING; actor->extravalue1 = locvar1; @@ -7667,7 +7667,7 @@ void A_SuperTurretFire(mobj_t *actor) while (P_SupermanLook4Players(actor) && count < MAXPLAYERS) { - if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < dist) + if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < dist) { actor->flags2 |= MF2_FIRING; actor->flags2 |= MF2_SUPERFIRE; @@ -7788,7 +7788,7 @@ void A_BuzzFly(mobj_t *actor) } // If the player is over 3072 fracunits away, then look for another player - if (P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), + if (FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z) > FixedMul(3072*FRACUNIT, actor->scale)) { if (multiplayer || netgame) @@ -7807,7 +7807,7 @@ void A_BuzzFly(mobj_t *actor) else realspeed = FixedMul(actor->info->speed, actor->scale); - dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, + dist = FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); if (dist < 1) @@ -8165,7 +8165,7 @@ void A_Boss3Path(mobj_t *actor) if (actor->target->x == actor->x && actor->target->y == actor->y) { - dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z + actor->movefactor - actor->z); + dist = FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z + actor->movefactor - actor->z); if (dist < 1) dist = 1; @@ -9575,7 +9575,7 @@ void A_SetObjectTypeState(mobj_t *actor) if (mo2->type == (mobjtype_t)loc2lw) { - dist = P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y); + dist = FixedHypot(mo2->x - actor->x, mo2->y - actor->y); if (mo2->health > 0) { @@ -10081,9 +10081,9 @@ void A_CheckRange(mobj_t *actor) return; if (!(locvar1 >> 16)) //target - dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); + dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); else //tracer - dist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + dist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); if (dist <= FixedMul((locvar1 & 65535)*FRACUNIT, actor->scale)) P_SetMobjState(actor, locvar2); @@ -10145,16 +10145,16 @@ void A_CheckTrueRange(mobj_t *actor) if (!(locvar1 >> 16)) // target { height = actor->target->z - actor->z; - dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); + dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); } else // tracer { height = actor->tracer->z - actor->z; - dist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + dist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); } - l = P_AproxDistance(dist, height); + l = FixedHypot(dist, height); if (l <= FixedMul((locvar1 & 65535)*FRACUNIT, actor->scale)) P_SetMobjState(actor, locvar2); @@ -10199,7 +10199,7 @@ void A_CheckThingCount(mobj_t *actor) if (mo2->type == (mobjtype_t)loc1up) { - dist = P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y); + dist = FixedHypot(mo2->x - actor->x, mo2->y - actor->y); if (loc2up == 0) count++; @@ -10808,7 +10808,7 @@ void A_HomingChase(mobj_t *actor) actor->angle = R_PointToAngle2(actor->x, actor->y, dest->x, dest->y); - dist = P_AproxDistance(P_AproxDistance(dest->x - actor->x, dest->y - actor->y), dest->z - actor->z); + dist = FixedHypot(FixedHypot(dest->x - actor->x, dest->y - actor->y), dest->z - actor->z); if (dist < 1) dist = 1; @@ -11394,14 +11394,14 @@ void A_BrakLobShot(mobj_t *actor) g = gravity; // Look up distance between actor and its target - x = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); + x = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); if (!aimDirect) { // Distance should actually be a third of the way over x = FixedDiv(x, 3<x + P_ReturnThrustX(actor, actor->angle, x); newTargetY = actor->y + P_ReturnThrustY(actor, actor->angle, x); - x = P_AproxDistance(newTargetX - actor->x, newTargetY - actor->y); + x = FixedHypot(newTargetX - actor->x, newTargetY - actor->y); // Look up height difference between actor and the ground 1/3 of the way to its target y = P_FloorzAtPos(newTargetX, newTargetY, actor->target->z, actor->target->height) - (actor->z + FixedMul(locvar2*FRACUNIT, actor->scale)); } @@ -11753,7 +11753,7 @@ void A_FlickyCenter(mobj_t *actor) P_LookForPlayers(actor, true, false, actor->extravalue1); - if (actor->target && P_AproxDistance(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1) + if (actor->target && FixedHypot(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1) { actor->extravalue2 = 1; P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); @@ -11809,7 +11809,7 @@ void A_FlickyAim(mobj_t *actor) if ((actor->momx == actor->momy && actor->momy == 0) || (actor->target && P_IsFlickyCenter(actor->target->type) && actor->target->extravalue1 && (actor->target->flags & MF_SLIDEME) - && P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) >= actor->target->extravalue1)) + && FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) >= actor->target->extravalue1)) flickyhitwall = true; P_InternalFlickyBubble(actor); @@ -11831,12 +11831,12 @@ void A_FlickyAim(mobj_t *actor) actor->movedir *= -1; posvar = ((R_PointToAngle2(actor->target->x, actor->target->y, actor->x, actor->y) + actor->movedir*locvar1) >> ANGLETOFINESHIFT) & FINEMASK; - chasevar = FixedSqrt(max(FRACUNIT, P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y) - locvar2)) + locvar2; + chasevar = FixedSqrt(max(FRACUNIT, FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y) - locvar2)) + locvar2; chasex = actor->target->x + FixedMul(FINECOSINE(posvar), chasevar); chasey = actor->target->y + FixedMul(FINESINE(posvar), chasevar); - if (P_AproxDistance(chasex - actor->x, chasey - actor->y)) + if (FixedHypot(chasex - actor->x, chasey - actor->y)) actor->angle = R_PointToAngle2(actor->x, actor->y, chasex, chasey); } else if (flickyhitwall) @@ -11878,7 +11878,7 @@ void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fi targetdist = 16*FRACUNIT; //Default! if (actor->target && abs(chasez - actor->z) > targetdist) - targetdist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); + targetdist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); if (actor->target && P_IsFlickyCenter(actor->target->type) @@ -11956,7 +11956,7 @@ void A_FlickyCoast(mobj_t *actor) actor->momy = (11*actor->momy)/12; actor->momz = (11*actor->momz)/12; - if (P_AproxDistance(P_AproxDistance(actor->momx, actor->momy), actor->momz) < locvar1) + if (FixedHypot(FixedHypot(actor->momx, actor->momy), actor->momz) < locvar1) P_SetMobjState(actor, locvar2); return; @@ -12220,7 +12220,7 @@ void A_Boss5Jump(mobj_t *actor) g = gravity; // Look up distance between actor and its tracer - x = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + x = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); // Look up height difference between actor and its tracer y = actor->tracer->z - actor->z; @@ -12341,7 +12341,7 @@ void A_MineExplode(mobj_t *actor) actor->z+P_RandomRange(((actor->eflags & MFE_UNDERWATER) ? -dist : 0), dist)*FRACUNIT, type); fixed_t dx = b->x - actor->x, dy = b->y - actor->y, dz = b->z - actor->z; - fixed_t dm = P_AproxDistance(dz, P_AproxDistance(dy, dx)); + fixed_t dm = FixedHypot(dz, FixedHypot(dy, dx)); b->momx = FixedDiv(dx, dm)*3; b->momy = FixedDiv(dy, dm)*3; b->momz = FixedDiv(dz, dm)*3; @@ -12373,7 +12373,7 @@ void A_MineRange(mobj_t *actor) if (!actor->target) return; - dm = P_AproxDistance(actor->z - actor->target->z, P_AproxDistance(actor->y - actor->target->y, actor->x - actor->target->x)); + dm = FixedHypot(actor->z - actor->target->z, FixedHypot(actor->y - actor->target->y, actor->x - actor->target->x)); if ((dm>>FRACBITS) < locvar1) P_SetMobjState(actor, actor->info->meleestate); } @@ -12499,7 +12499,7 @@ void A_MultiShotDist(mobj_t *actor) // Don't spawn dust unless a player is relatively close by (var1). for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (1600<x - players[i].mo->x, actor->y - players[i].mo->y) < (1600<tracer && - P_AproxDistance(P_AproxDistance(actor->x - mo2->x, actor->y - mo2->y), actor->z - mo2->z) > - P_AproxDistance(P_AproxDistance(actor->x - actor->tracer->x, actor->y - actor->tracer->y), actor->z - actor->tracer->z)) + FixedHypot(FixedHypot(actor->x - mo2->x, actor->y - mo2->y), actor->z - mo2->z) > + FixedHypot(FixedHypot(actor->x - actor->tracer->x, actor->y - actor->tracer->y), actor->z - actor->tracer->z)) continue; // Otherwise... Do! @@ -13047,7 +13047,7 @@ void A_Boss5CheckOnGround(mobj_t *actor) P_SetMobjState(actor, locvar1); } - if (actor->tracer && P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y) < 2*actor->radius) + if (actor->tracer && FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y) < 2*actor->radius) { actor->momx = (4*actor->momx)/5; actor->momy = (4*actor->momy)/5; @@ -13507,7 +13507,7 @@ static boolean PIT_TNTExplode(mobj_t *nearby) dx = nearby->x - barrel->x; dy = nearby->y - barrel->y; dz = nearby->z - barrel->z + (nearby->height - barrel->height/2)/2; - dm = P_AproxDistance(P_AproxDistance(dx, dy), dz); + dm = FixedHypot(FixedHypot(dx, dy), dz); if (dm >= exploderadius || !P_CheckSight(barrel, nearby)) // out of range or not visible return true; @@ -13910,7 +13910,7 @@ void A_SnapperThinker(mobj_t *actor) // Look for nearby, valid players to chase angrily at. if ((actor->target || P_LookForPlayers(actor, true, false, 1024*FRACUNIT)) - && P_AproxDistance(actor->target->x - xs, actor->target->y - ys) < 2048*FRACUNIT + && FixedHypot(actor->target->x - xs, actor->target->y - ys) < 2048*FRACUNIT && abs(actor->target->z - actor->z) < 80*FRACUNIT && P_CheckSight(actor, actor->target)) { @@ -13925,7 +13925,7 @@ void A_SnapperThinker(mobj_t *actor) y1 = ys; } - dist = P_AproxDistance(x1 - x0, y1 - y0); + dist = FixedHypot(x1 - x0, y1 - y0); // The snapper either chases what it considers to be a nearby player, or instead decides to go back to its spawnpoint. if (chasing || dist > 32*FRACUNIT) @@ -14110,7 +14110,7 @@ void A_LavafallRocks(mobj_t *actor) // Don't spawn rocks unless a player is relatively close by. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed >> 1)) + && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed >> 1)) break; // Stop looking. if (i < MAXPLAYERS) @@ -14144,7 +14144,7 @@ void A_LavafallLava(mobj_t *actor) // Don't spawn lava unless a player is nearby. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) + && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) break; // Stop looking. if (i >= MAXPLAYERS) @@ -14274,7 +14274,7 @@ void A_RolloutSpawn(mobj_t *actor) if (!(actor->target) || P_MobjWasRemoved(actor->target) - || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) + || FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; @@ -14302,7 +14302,7 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; // number of frames the mobj cycles through fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); // used to calculate when to change frame - fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); + fixed_t speed = FixedHypot(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); if (LUA_CallAction(A_ROLLOUTROCK, actor)) @@ -14344,7 +14344,7 @@ void A_RolloutRock(mobj_t *actor) actor->momy = FixedMul(actor->momy, locvar1); } - speed = P_AproxDistance(actor->momx, actor->momy); // recalculate speed for visual rolling + speed = FixedHypot(actor->momx, actor->momy); // recalculate speed for visual rolling if (speed < actor->scale >> 1) // stop moving if speed is insignificant { @@ -14466,7 +14466,7 @@ void A_DragonSegment(mobj_t *actor) return; } - dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z); + dist = FixedHypot(FixedHypot(actor->x - target->x, actor->y - target->y), actor->z - target->z); radius = actor->radius + target->radius; hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y); zangle = R_PointToAngle2(0, target->z, dist, actor->z); diff --git a/src/p_floor.c b/src/p_floor.c index 7c26065b5..de8f5d4e8 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1164,7 +1164,7 @@ void T_ThwompSector(thwomp_t *thwomp) if (players[i].mo->z > thwomp->sector->ceilingheight) continue; - if (P_AproxDistance(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96*FRACUNIT) + if (FixedHypot(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96*FRACUNIT) continue; thwomp->direction = -1; @@ -1892,7 +1892,7 @@ void EV_DoFloor(line_t *line, floor_e floortype) // Linedef executor command, linetype 106. // Line length = speed, front sector floor = destination height. case moveFloorByFrontSector: - dofloor->speed = P_AproxDistance(line->dx, line->dy); + dofloor->speed = FixedHypot(line->dx, line->dy); dofloor->speed = FixedDiv(dofloor->speed,8*FRACUNIT); dofloor->floordestheight = line->frontsector->floorheight; @@ -1958,7 +1958,7 @@ void EV_DoFloor(line_t *line, floor_e floortype) // Linetypes 2/3. // Move floor up and down indefinitely like the old elevators. case bounceFloor: - dofloor->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous + dofloor->speed = FixedHypot(line->dx, line->dy); // same speed as elevateContinuous dofloor->speed = FixedDiv(dofloor->speed,4*FRACUNIT); dofloor->origspeed = dofloor->speed; // it gets slowed down at the top and bottom dofloor->floordestheight = line->frontsector->floorheight; @@ -2104,7 +2104,7 @@ void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) case elevateContinuous: if (customspeed) { - elevator->origspeed = P_AproxDistance(line->dx, line->dy); + elevator->origspeed = FixedHypot(line->dx, line->dy); elevator->origspeed = FixedDiv(elevator->origspeed,4*FRACUNIT); elevator->speed = elevator->origspeed; } @@ -2266,7 +2266,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) if (flags & ML_EFFECT1) { - P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(P_AproxDistance(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor)); + P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(FixedHypot(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor)); P_SetObjectMomZ(spawned, FixedDiv((c - bottomz), heightfactor), false); } diff --git a/src/p_inter.c b/src/p_inter.c index e9a16a3dd..be4133af5 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1002,7 +1002,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) x = (x/count)<x - x, special->y - y), special->z - z); + gatherradius = FixedHypot(FixedHypot(special->x - x, special->y - y), special->z - z); P_RemoveMobj(special); if (player->powers[pw_nights_superloop]) @@ -1028,7 +1028,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) mo2 = (mobj_t *)th; - if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius) + if (FixedHypot(FixedHypot(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius) continue; if (mo2->flags & MF_SHOOTABLE) @@ -1450,8 +1450,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) fixed_t touchx, touchy, touchspeed; angle_t angle; - if (P_AproxDistance(toucher->x-special->x, toucher->y-special->y) > - P_AproxDistance((toucher->x-toucher->momx)-special->x, (toucher->y-toucher->momy)-special->y)) + if (FixedHypot(toucher->x-special->x, toucher->y-special->y) > + FixedHypot((toucher->x-toucher->momx)-special->x, (toucher->y-toucher->momy)-special->y)) { touchx = toucher->x + toucher->momx; touchy = toucher->y + toucher->momy; @@ -1463,7 +1463,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } angle = R_PointToAngle2(special->x, special->y, touchx, touchy); - touchspeed = P_AproxDistance(toucher->momx, toucher->momy); + touchspeed = FixedHypot(toucher->momx, toucher->momy); toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed); @@ -1509,7 +1509,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_EGGSHIELD: { angle_t angle = R_PointToAngle2(special->x, special->y, toucher->x, toucher->y) - special->angle; - fixed_t touchspeed = P_AproxDistance(toucher->momx, toucher->momy); + fixed_t touchspeed = FixedHypot(toucher->momx, toucher->momy); if (touchspeed < special->scale) touchspeed = special->scale; @@ -1590,7 +1590,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { special->momx = toucher->momx; special->momy = toucher->momy; - special->momz = P_AproxDistance(toucher->momx, toucher->momy)/4; + special->momz = FixedHypot(toucher->momx, toucher->momy)/4; if (toucher->momz > 0) special->momz += toucher->momz/8; @@ -1762,7 +1762,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = toucher->tracer->momx/2; toucher->momy = toucher->tracer->momy/2; - toucher->momz = toucher->tracer->momz + P_AproxDistance(toucher->tracer->momx, toucher->tracer->momy)/2; + toucher->momz = toucher->tracer->momz + FixedHypot(toucher->tracer->momx, toucher->tracer->momy)/2; P_ResetPlayer(player); player->pflags &= ~PF_APPLYAUTOBRAKE; P_SetPlayerMobjState(toucher, S_PLAY_FALL); @@ -2666,7 +2666,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget case MT_BUGGLE: if (inflictor && inflictor->player // did a player kill you? Spawn relative to the player so they're bound to get it - && P_AproxDistance(inflictor->x - target->x, inflictor->y - target->y) <= inflictor->radius + target->radius + FixedMul(8*FRACUNIT, inflictor->scale) // close enough? + && FixedHypot(inflictor->x - target->x, inflictor->y - target->y) <= inflictor->radius + target->radius + FixedMul(8*FRACUNIT, inflictor->scale) // close enough? && inflictor->z <= target->z + target->height + FixedMul(8*FRACUNIT, inflictor->scale) && inflictor->z + inflictor->height >= target->z - FixedMul(8*FRACUNIT, inflictor->scale)) mo = P_SpawnMobj(inflictor->x + inflictor->momx, inflictor->y + inflictor->momy, inflictor->z + (inflictor->height / 2) + inflictor->momz, MT_EXTRALARGEBUBBLE); @@ -3305,7 +3305,7 @@ static void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, I // to recover if (inflictor->flags2 & MF2_SCATTER && source) { - fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); + fixed_t dist = FixedHypot(FixedHypot(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; diff --git a/src/p_map.c b/src/p_map.c index b934e3255..63fdebbbd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -776,7 +776,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SOLID) S_StartSound(tmthing, thing->info->deathsound); for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext) - if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) + if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || FixedHypot(FixedHypot(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) P_KillMobj(iter, tmthing, tmthing, 0); } else @@ -815,7 +815,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SOLID) S_StartSound(tmthing, thing->info->deathsound); for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext) - if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) + if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || FixedHypot(FixedHypot(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) P_KillMobj(iter, tmthing, tmthing, 0); return true; } @@ -3061,7 +3061,7 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam) lineangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT; - movelen = P_AproxDistance(tmxmove, tmymove); + movelen = FixedHypot(tmxmove, tmymove); newlen = FixedMul(movelen, FINECOSINE(deltaangle)); tmxmove = FixedMul(newlen, FINECOSINE(lineangle)); @@ -3147,7 +3147,7 @@ static void P_HitBounceLine(line_t *ld) lineangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT; - movelen = P_AproxDistance(tmxmove, tmymove); + movelen = FixedHypot(tmxmove, tmymove); tmxmove = FixedMul(movelen, FINECOSINE(deltaangle)); tmymove = FixedMul(movelen, FINESINE(deltaangle)); @@ -4074,7 +4074,7 @@ static boolean PIT_RadiusAttack(mobj_t *thing) dy = abs(thing->y - bombspot->y); dz = abs(thing->z + (thing->height>>1) - bombspot->z); - dist = P_AproxDistance(P_AproxDistance(dx, dy), dz); + dist = FixedHypot(FixedHypot(dx, dy), dz); dist -= thing->radius; if (dist < 0) diff --git a/src/p_maputl.h b/src/p_maputl.h index df90ab4b4..9bc00fa17 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,6 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); diff --git a/src/p_mobj.c b/src/p_mobj.c index a1edcfe77..c539db6d2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1736,7 +1736,7 @@ static void P_PushableCheckBustables(mobj_t *mo) // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector); + P_LinedefExecute((INT16)(FixedHypot(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector); goto bustupdone; } @@ -2512,7 +2512,7 @@ boolean P_ZMovement(mobj_t *mo) // float down towards target if too close if (!(mo->flags2 & MF2_SKULLFLY) && !(mo->flags2 & MF2_INFLOAT)) { - dist = P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y); + dist = FixedHypot(mo->x - mo->target->x, mo->y - mo->target->y); delta = (mo->target->z + (mo->height>>1)) - mo->z; @@ -3662,11 +3662,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled P_ResetCamera(player, thiscam); else { - fixed_t camspeed = P_AproxDistance(thiscam->momx, thiscam->momy); + fixed_t camspeed = FixedHypot(thiscam->momx, thiscam->momy); P_SlideCameraMove(thiscam); - if (!resetcalled && P_AproxDistance(thiscam->momx, thiscam->momy) == camspeed) + if (!resetcalled && FixedHypot(thiscam->momx, thiscam->momy) == camspeed) { P_ResetCamera(player, thiscam); resetcalled = true; @@ -4149,7 +4149,7 @@ boolean P_BossTargetPlayer(mobj_t *actor, boolean closest) if (closest) { - dist = P_AproxDistance(actor->x - player->mo->x, actor->y - player->mo->y); + dist = FixedHypot(actor->x - player->mo->x, actor->y - player->mo->y); if (!lastdist || dist < lastdist) { lastdist = dist+1; @@ -4518,7 +4518,7 @@ static void P_Boss3Thinker(mobj_t *mobj) if (mobj->tracer->x == mobj->x && mobj->tracer->y == mobj->y) { // apply ambush for old routing, otherwise whack a mole only - dist = P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z + mobj->movefactor - mobj->z); + dist = FixedHypot(FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z + mobj->movefactor - mobj->z); if (dist < 1) dist = 1; @@ -5042,7 +5042,7 @@ static void P_Boss5Thinker(mobj_t *mobj) } if (mobj->state == &states[mobj->info->xdeathstate]) mobj->momz -= (2*FRACUNIT)/3; - else if (mobj->tracer && P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y) < 2*mobj->radius) + else if (mobj->tracer && FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y) < 2*mobj->radius) mobj->flags &= ~MF_NOCLIP; } else @@ -5168,7 +5168,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (players[i].mo->health <= 0) continue; - if (P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > (mobj->radius + players[i].mo->radius)) + if (FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > (mobj->radius + players[i].mo->radius)) continue; if (players[i].mo->z > mobj->z + mobj->height - FRACUNIT @@ -5272,7 +5272,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (mobj->health <= mobj->info->damage && !(mo2->spawnpoint->options & 7)) continue; // don't jump to center - dist = P_AproxDistance(players[i].mo->x - mo2->x, players[i].mo->y - mo2->y); + dist = FixedHypot(players[i].mo->x - mo2->x, players[i].mo->y - mo2->y); if (!(closestNum == -1 || dist < closestdist)) continue; @@ -5345,7 +5345,7 @@ static void P_Boss7Thinker(mobj_t *mobj) an = mobj->angle; an >>= ANGLETOFINESHIFT; - dist = P_AproxDistance(hitspot->x - mobj->x, hitspot->y - mobj->y); + dist = FixedHypot(hitspot->x - mobj->x, hitspot->y - mobj->y); horizontal = dist / airtime; vertical = (gravity*airtime)/2; @@ -5396,7 +5396,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (players[i].mo->health <= 0) continue; - if (P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > mobj->radius*4) + if (FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > mobj->radius*4) continue; if (players[i].mo->z > mobj->z + 128*FRACUNIT) @@ -5650,14 +5650,14 @@ static void P_Boss9Thinker(mobj_t *mobj) // Spawn energy particles for (spawner = mobj->hnext; spawner; spawner = spawner->hnext) { - dist = P_AproxDistance(spawner->x - mobj->x, spawner->y - mobj->y); + dist = FixedHypot(spawner->x - mobj->x, spawner->y - mobj->y); if (P_RandomRange(1,(dist>>FRACBITS)/16) == 1) break; } if (spawner && dist) { mobj_t *missile = P_SpawnMissile(spawner, mobj, MT_MSGATHER); - missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy)); + missile->fuse = (dist/FixedHypot(missile->momx, missile->momy)); if (missile->fuse > mobj->fuse) P_RemoveMobj(missile); @@ -6089,7 +6089,7 @@ nodanger: mobj->flags2 |= MF2_INVERTAIMABLE; // Move normally: Approach the player using normal thrust and simulated friction. - dist = P_AproxDistance(mobj->x-mobj->target->x, mobj->y-mobj->target->y); + dist = FixedHypot(mobj->x-mobj->target->x, mobj->y-mobj->target->y); P_Thrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), -3*FRACUNIT/8); if (dist < 64*FRACUNIT && !(mobj->target->player && mobj->target->player->homing)) P_Thrust(mobj, mobj->angle, -4*FRACUNIT); @@ -6097,7 +6097,7 @@ nodanger: P_Thrust(mobj, mobj->angle, FRACUNIT); else P_Thrust(mobj, mobj->angle + ANGLE_90, FINECOSINE((((angle_t)(leveltime*ANG1))>>ANGLETOFINESHIFT) & FINEMASK)>>1); - mobj->momz += P_AproxDistance(mobj->momx, mobj->momy)/12; // Move up higher the faster you're going. + mobj->momz += FixedHypot(mobj->momx, mobj->momy)/12; // Move up higher the faster you're going. } } } @@ -6303,7 +6303,7 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb mobj->angle = R_PointToAngle2(mobj->x, mobj->y, x, y); // change slope - dist = P_AproxDistance(P_AproxDistance(x - mobj->x, y - mobj->y), z - mobj->z); + dist = FixedHypot(FixedHypot(x - mobj->x, y - mobj->y), z - mobj->z); if (dist < 1) dist = 1; @@ -6377,7 +6377,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y fixed_t tx = dest->x; fixed_t ty = dest->y; fixed_t tz = dest->z + (dest->height/2); // Aim for center - fixed_t xydist = P_AproxDistance(tx - source->x, ty - source->y); + fixed_t xydist = FixedHypot(tx - source->x, ty - source->y); if (!dest || dest->health <= 0 || !dest->player || !source->tracer) return; @@ -6386,7 +6386,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y source->angle = R_PointToAngle2(source->x, source->y, tx, ty); // change slope - dist = P_AproxDistance(xydist, tz - source->z); + dist = FixedHypot(xydist, tz - source->z); if (dist < 1) dist = 1; @@ -6412,9 +6412,9 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y else { if (nightsgrab) - speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); + speedmul = FixedHypot(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); else - speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); + speedmul = FixedHypot(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); source->momx = FixedMul(FixedDiv(tx - source->x, dist), speedmul); source->momy = FixedMul(FixedDiv(ty - source->y, dist), speedmul); @@ -6422,7 +6422,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y } // Instead of just unsetting NOCLIP like an idiot, let's check the distance to our target. - ndist = P_AproxDistance(P_AproxDistance(tx - (source->x+source->momx), + ndist = FixedHypot(FixedHypot(tx - (source->x+source->momx), ty - (source->y+source->momy)), tz - (source->z+source->momz)); @@ -7073,7 +7073,7 @@ static void P_MaceSceneryThink(mobj_t *mobj) // The below is selected based on CEZ2's first room. I promise you it is a coincidence that it looks like the weed number. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && P_AproxDistance(P_AproxDistance(mobj->x - players[i].mo->x, mobj->y - players[i].mo->y), mobj->z - players[i].mo->z) < (4200 << FRACBITS)) + && FixedHypot(FixedHypot(mobj->x - players[i].mo->x, mobj->y - players[i].mo->y), mobj->z - players[i].mo->z) < (4200 << FRACBITS)) break; // Stop looking. if (i == MAXPLAYERS) { @@ -8049,7 +8049,7 @@ static boolean P_MobjBossThink(mobj_t *mobj) { if (mobj->target) { - mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, P_AproxDistance(mobj->x - mobj->target->x, mobj->y - mobj->target->y)), mobj->scale << 1); + mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, FixedHypot(mobj->x - mobj->target->x, mobj->y - mobj->target->y)), mobj->scale << 1); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); } else @@ -8293,7 +8293,7 @@ static void P_ArrowThink(mobj_t *mobj) 0------dist(momx,momy) */ - fixed_t dist = P_AproxDistance(mobj->momx, mobj->momy); + fixed_t dist = FixedHypot(mobj->momx, mobj->momy); angle_t angle = R_PointToAngle2(0, 0, dist, mobj->momz); if (angle > ANG20 && angle <= ANGLE_180) @@ -8575,7 +8575,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) continue; if (players[i].mo->z + players[i].mo->height < mobj->z - 8*mobj->scale) continue; - compdist = P_AproxDistance( + compdist = FixedHypot( players[i].mo->x + players[i].mo->momx - basex, players[i].mo->y + players[i].mo->momy - basey); if (compdist >= dist) @@ -8590,7 +8590,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) mobj->frame = 3 + ((leveltime & 2) >> 1); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - if (P_AproxDistance( + if (FixedHypot( mobj->x - basex, mobj->y - basey) < mobj->scale) @@ -8621,7 +8621,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) if (!didmove) { - if (P_AproxDistance(mobj->x - basex, mobj->y - basey) < mobj->scale) + if (FixedHypot(mobj->x - basex, mobj->y - basey) < mobj->scale) P_TeleportMove(mobj, basex, basey, mobj->z); else P_TeleportMove(mobj, @@ -9011,7 +9011,7 @@ static void P_PyreFlyThink(mobj_t *mobj) { //Aim for player z position. If too close to floor/ceiling, aim just above/below them. fixed_t destz = min(max(mobj->target->z, mobj->target->floorz + 70*FRACUNIT), mobj->target->ceilingz - 80*FRACUNIT - mobj->height); - fixed_t dist = P_AproxDistance(hdist, destz - mobj->z); + fixed_t dist = FixedHypot(hdist, destz - mobj->z); P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT); mobj->momz = FixedMul(FixedDiv(destz - mobj->z, dist), 2*FRACUNIT); } @@ -9113,7 +9113,7 @@ static void P_PterabyteThink(mobj_t *mobj) var1 = 2*mobj->info->speed; var2 = 1; A_HomingChase(mobj); - if (P_AproxDistance(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) + if (FixedHypot(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) { mobj->extravalue1 -= 2; mobj->momx = mobj->momy = mobj->momz = 0; @@ -9138,7 +9138,7 @@ static void P_DragonbomberThink(mobj_t *mobj) { mobj_t *mine = P_SpawnMobjFromMobj(segment, 0, 0, 0, segment->info->painchance); mine->angle = segment->angle; - P_InstaThrust(mine, mobj->angle, P_AproxDistance(mobj->momx, mobj->momy) >> 1); + P_InstaThrust(mine, mobj->angle, FixedHypot(mobj->momx, mobj->momy) >> 1); P_SetObjectMomZ(mine, -2*FRACUNIT, true); S_StartSound(mine, mine->info->seesound); P_SetMobjState(segment, segment->info->raisestate); @@ -9148,7 +9148,7 @@ static void P_DragonbomberThink(mobj_t *mobj) } if (mobj->target) // Are we chasing a player? { - fixed_t dist = P_AproxDistance(mobj->x - mobj->target->x, mobj->y - mobj->target->y); + fixed_t dist = FixedHypot(mobj->x - mobj->target->x, mobj->y - mobj->target->y); if (dist > 2000*mobj->scale) // Not anymore! P_SetTarget(&mobj->target, NULL); else @@ -9256,7 +9256,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->eflags |= MFE_UNDERWATER; //P_MobjCheckWater(mobj); // solely for MFE_UNDERWATER for A_FlickySpawn { if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0 - && P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16) + && FixedHypot(FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16) { var1 = mobj->info->speed; var2 = 1; @@ -9391,7 +9391,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (playeringame[i] && players[i].mo && players[i].mare == mobj->threshold && players[i].spheres > 0) { - fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); + fixed_t dist = FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); if (dist < shortest) { P_SetTarget(&mobj->target, players[i].mo); @@ -9422,7 +9422,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_KoopaThinker(mobj); break; case MT_FIREBALL: - if (P_AproxDistance(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them + if (FixedHypot(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them { P_KillMobj(mobj, NULL, NULL, 0); return false; @@ -13530,7 +13530,7 @@ mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = P_AproxDistance(dest->x - x, dest->y - y); + dist = FixedHypot(dest->x - x, dest->y - y); dist = dist / speed; if (dist < 1) @@ -13592,7 +13592,7 @@ mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = P_AproxDistance(source->momx*800, source->momy*800); + dist = FixedHypot(source->momx*800, source->momy*800); dist = dist / speed; if (dist < 1) @@ -13657,7 +13657,7 @@ mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za, th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = P_AproxDistance(xa - x, ya - y); + dist = FixedHypot(xa - x, ya - y); dist = dist / speed; if (dist < 1) @@ -13737,9 +13737,9 @@ mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type) th->momy = FixedMul(speed, FINESINE(an)); if (type == MT_TURRETLASER || type == MT_ENERGYBALL) // More accurate! - dist = P_AproxDistance(dest->x+(dest->momx*gsf) - source->x, dest->y+(dest->momy*gsf) - source->y); + dist = FixedHypot(dest->x+(dest->momx*gsf) - source->x, dest->y+(dest->momy*gsf) - source->y); else - dist = P_AproxDistance(dest->x - source->x, dest->y - source->y); + dist = FixedHypot(dest->x - source->x, dest->y - source->y); dist = dist / speed; diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 874edbd50..95734ff86 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1636,7 +1636,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) distx = target->x - pox; disty = target->y - poy; distz = target->z - poz; - dist = P_AproxDistance(P_AproxDistance(distx, disty), distz); + dist = FixedHypot(FixedHypot(distx, disty), distz); if (dist < 1) dist = 1; diff --git a/src/p_setup.c b/src/p_setup.c index 41d8822e2..2ee588fbb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -232,7 +232,7 @@ mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo) if (!mo2) continue; - curdist = P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z); + curdist = FixedHypot(FixedHypot(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z); if (result && curdist > bestdist) continue; diff --git a/src/p_slopes.c b/src/p_slopes.c index aa46a8402..d77d0805f 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -885,7 +885,7 @@ void P_ButteredSlope(mobj_t *mo) } if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed - thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); + thrust = FixedMul(thrust, FRACUNIT+FixedHypot(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down // Let's get the gravity strength for the object... diff --git a/src/p_spec.c b/src/p_spec.c index 5b9e05c61..e696ad5d1 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1240,7 +1240,7 @@ static boolean PolyFlag(line_t *line) polyflagdata_t pfd; pfd.polyObjNum = Tag_FGet(&line->tags); - pfd.speed = P_AproxDistance(line->dx, line->dy) >> FRACBITS; + pfd.speed = FixedHypot(line->dx, line->dy) >> FRACBITS; pfd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y) >> ANGLETOFINESHIFT; pfd.momx = sides[line->sidenum[0]].textureoffset >> FRACBITS; @@ -1567,7 +1567,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller) { sector_t *ctlsector; - fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS; + fixed_t dist = FixedHypot(triggerline->dx, triggerline->dy)>>FRACBITS; size_t i, linecnt, sectori; INT16 specialtype = triggerline->special; @@ -2629,7 +2629,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) sectors[secnum].lightlevel = line->backsector->lightlevel; flick = P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); + FixedHypot(line->dx, line->dy)>>FRACBITS); // Make sure the starting light level is in range. if (reallightlevel < flick->minlight) @@ -2644,7 +2644,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Use front sector for min, target sector for max, // the same way linetype 61 does it. P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); + FixedHypot(line->dx, line->dy)>>FRACBITS); } } break; @@ -2663,7 +2663,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) sectors[secnum].lightlevel = line->backsector->lightlevel; glow = P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); + FixedHypot(line->dx, line->dy)>>FRACBITS); // Make sure the starting light level is in range. if (reallightlevel < glow->minlight) @@ -2678,7 +2678,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Use front sector for min, target sector for max, // the same way linetype 602 does it. P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); + FixedHypot(line->dx, line->dy)>>FRACBITS); } } break; @@ -2760,7 +2760,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) ((line->sidenum[1] != 0xFFFF && !(sides[line->sidenum[0]].rowoffset>>FRACBITS)) ? max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0) : max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0)) - : abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS, + : abs(FixedHypot(line->dx, line->dy))>>FRACBITS, (line->flags & ML_EFFECT4), (line->flags & ML_EFFECT5)); break; @@ -2795,7 +2795,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) else { P_SetTarget(&mo->player->awayviewmobj, altview); - mo->player->awayviewtics = P_AproxDistance(line->dx, line->dy)>>FRACBITS; + mo->player->awayviewtics = FixedHypot(line->dx, line->dy)>>FRACBITS; } @@ -2840,7 +2840,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 425: // Calls P_SetMobjState on calling mobj if (mo && !mo->player) - P_SetMobjState(mo, sides[line->sidenum[0]].toptexture); //P_AproxDistance(line->dx, line->dy)>>FRACBITS); + P_SetMobjState(mo, sides[line->sidenum[0]].toptexture); //FixedHypot(line->dx, line->dy)>>FRACBITS); break; case 426: // Moves the mobj to its sector's soundorg and on the floor, and stops it @@ -3026,7 +3026,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 438: // Set player scale if (mo) { - mo->destscale = FixedDiv(P_AproxDistance(line->dx, line->dy), 100<destscale = FixedDiv(FixedHypot(line->dx, line->dy), 100<destscale < FRACUNIT/100) mo->destscale = FRACUNIT/100; if (mo->player && bot) @@ -3144,7 +3144,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { quake.intensity = sides[line->sidenum[0]].textureoffset; quake.radius = sides[line->sidenum[0]].rowoffset; - quake.time = P_AproxDistance(line->dx, line->dy)>>FRACBITS; + quake.time = FixedHypot(line->dx, line->dy)>>FRACBITS; quake.epicenter = NULL; /// \todo @@ -3407,7 +3407,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 452: // Set FOF alpha { INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS); + (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(FixedHypot(line->dx, line->dy)>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible in @@ -4995,8 +4995,8 @@ DoneSection2: } else { - if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y), - player->mo->z-resultlow.z) < P_AproxDistance(P_AproxDistance(player->mo->x-resulthigh.x, + if (FixedHypot(FixedHypot(player->mo->x-resultlow.x, player->mo->y-resultlow.y), + player->mo->z-resultlow.z) < FixedHypot(FixedHypot(player->mo->x-resulthigh.x, player->mo->y-resulthigh.y), player->mo->z-resulthigh.z)) { // Line between Mid and Low is closer @@ -6314,7 +6314,7 @@ void P_SpawnSpecials(boolean fromnetsave) break; case 52: // Continuously Falling sector - EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, P_AproxDistance(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); + EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, FixedHypot(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); break; case 53: // New super cool and awesome moving floor and ceiling type @@ -6386,15 +6386,15 @@ void P_SpawnSpecials(boolean fromnetsave) case 66: // Displace floor by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_floor, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_floor, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 67: // Displace ceiling by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_ceiling, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_ceiling, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 68: // Displace both floor AND ceiling by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_both, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_both, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 100: // FOF (solid, opaque, shadows) @@ -6588,18 +6588,18 @@ void P_SpawnSpecials(boolean fromnetsave) case 150: // Air bobbing platform case 151: // Adjustable air bobbing platform { - fixed_t dist = (lines[i].special == 150) ? 16*FRACUNIT : P_AproxDistance(lines[i].dx, lines[i].dy); + fixed_t dist = (lines[i].special == 150) ? 16*FRACUNIT : FixedHypot(lines[i].dx, lines[i].dy); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); P_AddAirbob(lines[i].frontsector, tag, dist, false, !!(lines[i].flags & ML_NOCLIMB), false); break; } case 152: // Adjustable air bobbing platform in reverse P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), true, !!(lines[i].flags & ML_NOCLIMB), false); + P_AddAirbob(lines[i].frontsector, tag, FixedHypot(lines[i].dx, lines[i].dy), true, !!(lines[i].flags & ML_NOCLIMB), false); break; case 153: // Dynamic Sinking Platform P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), false, !!(lines[i].flags & ML_NOCLIMB), true); + P_AddAirbob(lines[i].frontsector, tag, FixedHypot(lines[i].dx, lines[i].dy), false, !!(lines[i].flags & ML_NOCLIMB), true); break; case 160: // Float/bob platform @@ -6678,7 +6678,7 @@ void P_SpawnSpecials(boolean fromnetsave) case 194: // Rising Platform 'Platform' - You can jump up through it case 195: // Rising Platform Translucent "platform" { - fixed_t speed = FixedDiv(P_AproxDistance(lines[i].dx, lines[i].dy), 4*FRACUNIT); + fixed_t speed = FixedDiv(FixedHypot(lines[i].dx, lines[i].dy), 4*FRACUNIT); fixed_t ceilingtop = P_FindHighestCeilingSurrounding(lines[i].frontsector); fixed_t ceilingbottom = P_FindLowestCeilingSurrounding(lines[i].frontsector); @@ -7003,14 +7003,14 @@ void P_SpawnSpecials(boolean fromnetsave) sec = sides[*lines[i].sidenum].sector - sectors; TAG_ITER_SECTORS(0, tag, s) P_SpawnAdjustableGlowingLight(§ors[sec], §ors[s], - P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); + FixedHypot(lines[i].dx, lines[i].dy)>>FRACBITS); break; case 603: // Adjustable flickering light sec = sides[*lines[i].sidenum].sector - sectors; TAG_ITER_SECTORS(0, tag, s) P_SpawnAdjustableFireFlicker(§ors[sec], §ors[s], - P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); + FixedHypot(lines[i].dx, lines[i].dy)>>FRACBITS); break; case 604: // Adjustable Blinking Light (unsynchronized) @@ -8416,9 +8416,9 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t * // "The right triangle of the square of the length of the hypotenuse is equal to the sum of the squares of the lengths of the other two sides." // "Bah! Stupid brains! Don't you know anything besides the Pythagorean Theorem?" - Earthworm Jim if (type == p_downcurrent || type == p_upcurrent || type == p_upwind || type == p_downwind) - p->magnitude = P_AproxDistance(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR); + p->magnitude = FixedHypot(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR); else - p->magnitude = P_AproxDistance(p->x_mag,p->y_mag); + p->magnitude = FixedHypot(p->x_mag,p->y_mag); if (source) // point source exist? { // where force goes to zero @@ -8469,14 +8469,14 @@ static inline boolean PIT_PushThing(mobj_t *thing) // don't fade wrt Z if health & 2 (mapthing has multi flag) if (tmpusher->source->health & 2) - dist = P_AproxDistance(thing->x - sx,thing->y - sy); + dist = FixedHypot(thing->x - sx,thing->y - sy); else { // Make sure the Z is in range if (thing->z < sz - tmpusher->radius || thing->z > sz + tmpusher->radius) return false; - dist = P_AproxDistance(P_AproxDistance(thing->x - sx, thing->y - sy), + dist = FixedHypot(FixedHypot(thing->x - sx, thing->y - sy), thing->z - sz); } @@ -8811,7 +8811,7 @@ void T_Pusher(pusher_t *p) // Tumbleweeds bounce a bit... if (thing->type == MT_LITTLETUMBLEWEED || thing->type == MT_BIGTUMBLEWEED) - thing->momz += P_AproxDistance(xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)) >> 2; + thing->momz += FixedHypot(xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)) >> 2; } if (moved) diff --git a/src/p_user.c b/src/p_user.c index 2dcc21009..84fc3e521 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1018,7 +1018,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // to recover if ((inflictor->flags2 & MF2_SCATTER) && source) { - fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); + fixed_t dist = FixedHypot(FixedHypot(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; @@ -2701,7 +2701,7 @@ static void P_CheckBustableBlocks(player_t *player) // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); + P_LinedefExecute((INT16)(FixedHypot(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); goto bustupdone; } @@ -2764,7 +2764,7 @@ static void P_CheckBouncySectors(player_t *player) if (player->mo->z + player->mo->height < bottomheight) continue; - bouncestrength = P_AproxDistance(rover->master->dx, rover->master->dy)/100; + bouncestrength = FixedHypot(rover->master->dx, rover->master->dy)/100; if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL) && oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)) @@ -4981,7 +4981,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) if (!((mo2->flags & MF_SHOOTABLE && mo2->flags & MF_ENEMY) || mo2->type == MT_EGGGUARD || mo2->player)) continue; - dist = P_AproxDistance(P_AproxDistance(player->mo->x-mo2->x, player->mo->y-mo2->y), player->mo->z-mo2->z); + dist = FixedHypot(FixedHypot(player->mo->x-mo2->x, player->mo->y-mo2->y), player->mo->z-mo2->z); if (range < dist) continue; @@ -6464,12 +6464,12 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad //CONS_Debug(DBG_NIGHTS, "T1 is at %d, %d\n", transfer1->x>>FRACBITS, transfer1->y>>FRACBITS); //CONS_Debug(DBG_NIGHTS, "T2 is at %d, %d\n", transfer2->x>>FRACBITS, transfer2->y>>FRACBITS); - //CONS_Debug(DBG_NIGHTS, "Distance from T1: %d\n", P_AproxDistance(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS); - //CONS_Debug(DBG_NIGHTS, "Distance from T2: %d\n", P_AproxDistance(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS); + //CONS_Debug(DBG_NIGHTS, "Distance from T1: %d\n", FixedHypot(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS); + //CONS_Debug(DBG_NIGHTS, "Distance from T2: %d\n", FixedHypot(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS); // Transfer1 is closer to the player than transfer2 - if (P_AproxDistance(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS - < P_AproxDistance(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS) + if (FixedHypot(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS + < FixedHypot(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS) { //CONS_Debug(DBG_NIGHTS, " must be < 0 to transfer\n"); @@ -7709,7 +7709,7 @@ void P_BlackOw(player_t *player) S_StartSound (player->mo, sfx_bkpoof); // Sound the BANG! for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && P_AproxDistance(player->mo->x - players[i].mo->x, + if (playeringame[i] && FixedHypot(player->mo->x - players[i].mo->x, player->mo->y - players[i].mo->y) < 1536*FRACUNIT) P_FlashPal(&players[i], PAL_NUKE, 10); @@ -7883,7 +7883,7 @@ static void P_SkidStuff(player_t *player) P_SpawnSkidDust(player, 0, false); } } - else if (P_AproxDistance(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame + else if (FixedHypot(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame && (player->mo->momx != pmx || player->mo->momy != pmy) // and you are moving differently this frame && P_GetPlayerControlDirection(player) == 2) // and your controls are pointing in the opposite direction to your movement { // check for skidding @@ -8514,7 +8514,7 @@ void P_MovePlayer(player_t *player) P_ResetScore(player); // Show the "THOK!" graphic when spinning quickly across the ground. (even applies to non-spinners, in the case of zoom tubes) - if (player->pflags & PF_SPINNING && P_AproxDistance(player->speed, player->mo->momz) > FixedMul(15<mo->scale) && !(player->pflags & PF_JUMPED)) + if (player->pflags & PF_SPINNING && FixedHypot(player->speed, player->mo->momz) > FixedMul(15<mo->scale) && !(player->pflags & PF_JUMPED)) { P_SpawnSpinMobj(player, player->spinitem); G_GhostAddSpin(); @@ -8735,7 +8735,7 @@ static void P_DoZoomTube(player_t *player) speed = abs(player->speed); // change slope - dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); + dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); if (dist < 1) dist = 1; @@ -8776,7 +8776,7 @@ static void P_DoZoomTube(player_t *player) // calculate MOMX/MOMY/MOMZ for next waypoint // change slope - dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); + dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); if (dist < 1) dist = 1; @@ -8829,7 +8829,7 @@ static void P_DoRopeHang(player_t *player) sequence = player->mo->tracer->threshold; // change slope - dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); + dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); if (dist < 1) dist = 1; @@ -8892,7 +8892,7 @@ static void P_DoRopeHang(player_t *player) // calculate MOMX/MOMY/MOMZ for next waypoint // change slope - dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); + dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); if (dist < 1) dist = 1; @@ -8993,7 +8993,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) if (abs(inflictor->x - mo->x) > radius || abs(inflictor->y - mo->y) > radius || abs(inflictor->z - mo->z) > radius) continue; // Workaround for possible integer overflow in the below -Red - if (P_AproxDistance(P_AproxDistance(inflictor->x - mo->x, inflictor->y - mo->y), inflictor->z - mo->z) > radius) + if (FixedHypot(FixedHypot(inflictor->x - mo->x, inflictor->y - mo->y), inflictor->z - mo->z) > radius) continue; if (mo->type == MT_MINUS && !(mo->flags & (MF_SPECIAL|MF_SHOOTABLE))) @@ -9129,12 +9129,12 @@ mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, { fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2); - dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y); + dist = FixedHypot(player->mo->x-mo->x, player->mo->y-mo->y); if (abs(zdist) > dist) continue; // Don't home outside of desired angle! - dist = P_AproxDistance(dist, zdist); + dist = FixedHypot(dist, zdist); if (dist > maxdist) continue; // out of range } @@ -9226,7 +9226,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) { fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2); - dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y); + dist = FixedHypot(player->mo->x-mo->x, player->mo->y-mo->y); if (bullet) { if ((R_PointToAngle2(0, 0, dist, zdist) + span) > span*2) @@ -9243,7 +9243,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) continue; } - dist = P_AproxDistance(dist, zdist); + dist = FixedHypot(dist, zdist); if (dist > maxdist) continue; // out of range } @@ -9303,7 +9303,7 @@ boolean P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target // change slope zdist = ((P_MobjFlip(source) == -1) ? (enemy->z + enemy->height) - (source->z + source->height) : (enemy->z - source->z)); - dist = P_AproxDistance(P_AproxDistance(enemy->x - source->x, enemy->y - source->y), zdist); + dist = FixedHypot(FixedHypot(enemy->x - source->x, enemy->y - source->y), zdist); if (dist < 1) dist = 1; @@ -10352,7 +10352,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // follow the player /*if (player->playerstate != PST_DEAD && (camspeed) != 0) { - if (P_AproxDistance(mo->x - thiscam->x, mo->y - thiscam->y) > (checkdist + P_AproxDistance(mo->momx, mo->momy)) * 4 + if (FixedHypot(mo->x - thiscam->x, mo->y - thiscam->y) > (checkdist + FixedHypot(mo->momx, mo->momy)) * 4 || abs(mo->z - thiscam->z) > checkdist * 3) { if (!resetcalled) @@ -10417,7 +10417,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } /* check z distance too for orbital camera */ - if (P_AproxDistance(P_AproxDistance(vx - mo->x, vy - mo->y), + if (FixedHypot(FixedHypot(vx - mo->x, vy - mo->y), vz - ( mo->z + mo->height / 2 )) < FixedMul(48*FRACUNIT, mo->scale)) mo->flags2 |= MF2_SHADOW; else @@ -10902,7 +10902,7 @@ static void P_ParabolicMove(mobj_t *mo, fixed_t x, fixed_t y, fixed_t z, fixed_t fixed_t dx = x - mo->x; fixed_t dy = y - mo->y; fixed_t dz = z - mo->z; - fixed_t dh = P_AproxDistance(dx, dy); + fixed_t dh = FixedHypot(dx, dy); fixed_t c = FixedDiv(dx, dh); fixed_t s = FixedDiv(dy, dh); fixed_t fixConst = FixedDiv(speed, g); @@ -11774,7 +11774,7 @@ void P_PlayerThink(player_t *player) if (mo2->flags2 & MF2_NIGHTSPULL) continue; - if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) + if (FixedHypot(FixedHypot(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) continue; // Yay! The thing's in reach! Pull it in! @@ -12010,7 +12010,7 @@ void P_PlayerThink(player_t *player) if (!currentlyonground) acceleration /= 2; // fake skidding! see P_SkidStuff for reference on conditionals - else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && P_AproxDistance(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed, player->mo->scale)) // modified from player->runspeed/2 'cuz the skid was just TOO frequent ngl + else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && FixedHypot(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed, player->mo->scale)) // modified from player->runspeed/2 'cuz the skid was just TOO frequent ngl { if (player->mo->state-states != S_PLAY_SKID) P_SetPlayerMobjState(player->mo, S_PLAY_SKID); @@ -12595,7 +12595,7 @@ void P_PlayerAfterThink(player_t *player) P_SetPlayerAngle(player, player->mo->angle); } - if (P_AproxDistance(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) + if (FixedHypot(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) player->powers[pw_carry] = CR_NONE; if (player->powers[pw_carry] != CR_NONE) @@ -12784,7 +12784,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = ptera->momy; player->mo->momz = ptera->momz; - if (P_AproxDistance(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) + if (FixedHypot(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) goto dropoff; ptera->watertop >>= 1; diff --git a/src/r_things.c b/src/r_things.c index 083373927..4e296bb1a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2991,7 +2991,7 @@ boolean R_ThingVisibleWithinDist (mobj_t *thing, if (! R_ThingVisible(thing)) return false; - approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); + approx_dist = FixedHypot(viewx-thing->x, viewy-thing->y); if (thing->sprite == SPR_HOOP) { @@ -3016,7 +3016,7 @@ boolean R_PrecipThingVisible (precipmobj_t *precipthing, if (( precipthing->precipflags & PCF_INVISIBLE )) return false; - approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); + approx_dist = FixedHypot(viewx-precipthing->x, viewy-precipthing->y); return ( approx_dist <= limit_dist ); } diff --git a/src/s_sound.c b/src/s_sound.c index 392a5b453..0085dc342 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -943,8 +943,8 @@ void S_UpdateSounds(void) const mobj_t *soundmobj = c->origin; fixed_t dist1, dist2; - dist1 = P_AproxDistance(listener.x-soundmobj->x, listener.y-soundmobj->y); - dist2 = P_AproxDistance(listener2.x-soundmobj->x, listener2.y-soundmobj->y); + dist1 = FixedHypot(listener.x-soundmobj->x, listener.y-soundmobj->y); + dist2 = FixedHypot(listener2.x-soundmobj->x, listener2.y-soundmobj->y); if (dist1 <= dist2) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 649644620..15d1af396 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2458,7 +2458,7 @@ num: static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offset) { INT32 interval, i; - UINT32 dist = ((UINT32)P_AproxDistance(P_AproxDistance(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS; + UINT32 dist = ((UINT32)FixedHypot(FixedHypot(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS; if (dist < 128) { From 83e80eef9ba1e60a71970807962ed49c9669eceb Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 12 Dec 2020 18:54:47 -0500 Subject: [PATCH 010/160] Add deprecation warning when using the level header parameter --- src/deh_soc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/deh_soc.c b/src/deh_soc.c index 2cd872378..2075d6484 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1574,6 +1574,8 @@ void readlevelheader(MYFILE *f, INT32 num) sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num)); } } + else if (fastcmp(word, "MUSICSLOT")) + deh_warning("Level header %d: MusicSlot parameter is deprecated and will be removed.\nUse \"Music\" instead.", num); else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICPOS")) From 6160a2d0fe6a09990a0fca6b0c9e5c4f75191e0e Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Mon, 14 Dec 2020 02:07:12 -0300 Subject: [PATCH 011/160] Fix a misuse of levelflat_t.picture in OpenGL (Kitchen Sink SRB2 port) --- src/hardware/hw_cache.c | 31 +++++++++++++++++++------------ src/hardware/hw_draw.c | 2 +- src/hardware/hw_glob.h | 2 +- src/p_setup.h | 1 + 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index b4fa7ec6c..6048affe0 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -850,7 +850,7 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum) } // Download a Doom 'flat' to the hardware cache and make it ready for use -void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum) +void HWR_GetRawFlat(lumpnum_t flatlumpnum) { GLMipmap_t *grmip; patch_t *patch; @@ -879,7 +879,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) return; if (levelflat->type == LEVELFLAT_FLAT) - HWR_LiterallyGetFlat(levelflat->u.flat.lumpnum); + HWR_GetRawFlat(levelflat->u.flat.lumpnum); else if (levelflat->type == LEVELFLAT_TEXTURE) { GLMapTexture_t *grtex; @@ -918,15 +918,17 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) #ifndef NO_PNG_LUMPS else if (levelflat->type == LEVELFLAT_PNG) { - INT32 pngwidth = 0, pngheight = 0; GLMipmap_t *mipmap = levelflat->mipmap; - UINT8 *flat; - size_t size; // Cache the picture. - if (!levelflat->picture) + if (!levelflat->mippic) { - levelflat->picture = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0); + INT32 pngwidth = 0, pngheight = 0; + void *pic = Picture_PNGConvert(W_CacheLumpNum(levelflat->u.flat.lumpnum, PU_CACHE), PICFMT_FLAT, &pngwidth, &pngheight, NULL, NULL, W_LumpLength(levelflat->u.flat.lumpnum), NULL, 0); + + Z_ChangeTag(pic, PU_LEVEL); + Z_SetUser(pic, &levelflat->mippic); + levelflat->width = (UINT16)pngwidth; levelflat->height = (UINT16)pngheight; } @@ -934,7 +936,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) // Make the mipmap. if (mipmap == NULL) { - mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_LEVEL, NULL); + mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_STATIC, NULL); mipmap->format = GL_TEXFMT_P_8; mipmap->flags = TF_WRAPXY|TF_CHROMAKEYED; levelflat->mipmap = mipmap; @@ -942,17 +944,22 @@ void HWR_GetLevelFlat(levelflat_t *levelflat) if (!mipmap->data && !mipmap->downloaded) { + UINT8 *flat; + size_t size; + + if (levelflat->mippic == NULL) + I_Error("HWR_GetLevelFlat: levelflat->mippic == NULL"); + mipmap->width = levelflat->width; mipmap->height = levelflat->height; + size = (mipmap->width * mipmap->height); flat = Z_Malloc(size, PU_LEVEL, &mipmap->data); - if (levelflat->picture == NULL) - I_Error("HWR_GetLevelFlat: levelflat->picture == NULL"); - M_Memcpy(flat, levelflat->picture, size); + M_Memcpy(flat, levelflat->mippic, size); } // Tell the hardware driver to bind the current texture to the flat's mipmap - HWD.pfnSetTexture(mipmap); + HWR_SetCurrentTexture(mipmap); } #endif else // set no texture diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index c5d362520..8c92c6709 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -639,7 +639,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum v[0].t = v[1].t = (float)((y & flatflag)/dflatsize); v[2].t = v[3].t = (float)(v[0].t + h/dflatsize); - HWR_LiterallyGetFlat(flatlumpnum); + HWR_GetRawFlat(flatlumpnum); //Hurdler: Boris, the same comment as above... but maybe for pics // it not a problem since they don't have any transparent pixel diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 87405d3d4..2aba62248 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -118,7 +118,7 @@ patch_t *HWR_GetPic(lumpnum_t lumpnum); GLMapTexture_t *HWR_GetTexture(INT32 tex); void HWR_GetLevelFlat(levelflat_t *levelflat); -void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum); +void HWR_GetRawFlat(lumpnum_t flatlumpnum); void HWR_FreeTexture(patch_t *patch); void HWR_FreeTextureData(patch_t *patch); diff --git a/src/p_setup.h b/src/p_setup.h index 34de9c93d..5d13ae7d4 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -80,6 +80,7 @@ typedef struct UINT8 *picture; #ifdef HWRENDER void *mipmap; + void *mippic; #endif } levelflat_t; From 4717261459efb5861943cb46a65b0038b5b9eb3c Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sat, 19 Dec 2020 17:32:45 -0300 Subject: [PATCH 012/160] Optimize Picture_GetPatchPixel --- src/r_picformats.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/r_picformats.c b/src/r_picformats.c index f87362c76..eeebb94fd 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -540,9 +540,7 @@ void *Picture_GetPatchPixel( { fixed_t ofs; column_t *column; - UINT8 *s8 = NULL; - UINT16 *s16 = NULL; - UINT32 *s32 = NULL; + INT32 inbpp = Picture_FormatBPP(informat); softwarepatch_t *doompatch = (softwarepatch_t *)patch; boolean isdoompatch = Picture_IsDoomPatchFormat(informat); INT16 width; @@ -566,30 +564,36 @@ void *Picture_GetPatchPixel( while (column->topdelta != 0xff) { + UINT8 *s8 = NULL; + UINT16 *s16 = NULL; + UINT32 *s32 = NULL; + topdelta = column->topdelta; if (topdelta <= prevdelta) topdelta += prevdelta; prevdelta = topdelta; - s8 = (UINT8 *)(column) + 3; - if (Picture_FormatBPP(informat) == PICDEPTH_32BPP) - s32 = (UINT32 *)s8; - else if (Picture_FormatBPP(informat) == PICDEPTH_16BPP) - s16 = (UINT16 *)s8; - for (ofs = 0; ofs < column->length; ofs++) + + ofs = (y - topdelta); + + if (y >= topdelta && ofs < column->length) { - if ((topdelta + ofs) == y) + s8 = (UINT8 *)(column) + 3; + switch (inbpp) { - if (Picture_FormatBPP(informat) == PICDEPTH_32BPP) + case PICDEPTH_32BPP: + s32 = (UINT32 *)s8; return &s32[ofs]; - else if (Picture_FormatBPP(informat) == PICDEPTH_16BPP) + case PICDEPTH_16BPP: + s16 = (UINT16 *)s8; return &s16[ofs]; - else // PICDEPTH_8BPP + default: // PICDEPTH_8BPP return &s8[ofs]; } } - if (Picture_FormatBPP(informat) == PICDEPTH_32BPP) + + if (inbpp == PICDEPTH_32BPP) column = (column_t *)((UINT32 *)column + column->length); - else if (Picture_FormatBPP(informat) == PICDEPTH_16BPP) + else if (inbpp == PICDEPTH_16BPP) column = (column_t *)((UINT16 *)column + column->length); else column = (column_t *)((UINT8 *)column + column->length); From 1254f691ee6d7262865c71d7c554c6300ffc7849 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sat, 19 Dec 2020 17:40:18 -0300 Subject: [PATCH 013/160] Fix unused variable warning when USE_APNG is not defined --- src/m_misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/m_misc.c b/src/m_misc.c index ad2d133ab..17a398b83 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -165,7 +165,9 @@ consvar_t cv_zlib_window_bitsa = CVAR_INIT ("apng_window_size", "32k", CV_SAVE, consvar_t cv_apng_delay = CVAR_INIT ("apng_speed", "1x", CV_SAVE, apng_delay_t, NULL); consvar_t cv_apng_downscale = CVAR_INIT ("apng_downscale", "On", CV_SAVE, CV_OnOff, NULL); +#ifdef USE_APNG static boolean apng_downscale = false; // So nobody can do something dumb like changing cvars mid output +#endif boolean takescreenshot = false; // Take a screenshot this tic From f9e5681a6b29cc87e220cd7c224f605cd2e843a6 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 19 Dec 2020 20:33:29 -0600 Subject: [PATCH 014/160] Actually check for a player smh --- src/p_enemy.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 203e04af1..1cc1686b1 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7521,7 +7521,7 @@ void A_Boss2PogoTarget(mobj_t *actor) } // Target hit, retreat! - if (actor->target->player->powers[pw_flashing] > TICRATE || actor->flags2 & MF2_FRET) + if ((actor->target->player && actor->target->player->powers[pw_flashing] > TICRATE) || actor->flags2 & MF2_FRET) { UINT8 prandom = P_RandomByte(); actor->z++; // unstick from the floor @@ -7532,7 +7532,7 @@ void A_Boss2PogoTarget(mobj_t *actor) // Try to land on top of the player. else if (P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(512*FRACUNIT, actor->scale)) { - fixed_t airtime, gravityadd, zoffs; + fixed_t airtime, gravityadd, zoffs, height; // check gravity in the sector (for later math) P_CheckGravity(actor, true); @@ -7554,7 +7554,13 @@ void A_Boss2PogoTarget(mobj_t *actor) // Remember, kids! // Reduced down Calculus lets you avoid bad 'logic math' loops! //airtime = FixedDiv(-actor->momz<<1, gravityadd)<<1; // going from 0 to 0 is much simpler - zoffs = (P_GetPlayerHeight(actor->target->player)>>1) + (actor->target->floorz - actor->floorz); // offset by the difference in floor height plus half the player height, + + if (actor->target->player) + height = P_GetPlayerHeight(actor->target->player) >> 1; + else + height = actor->target->height >> 1; + + zoffs = height + (actor->target->floorz - actor->floorz); // offset by the difference in floor height plus half the player height, airtime = FixedDiv((-actor->momz - FixedSqrt(FixedMul(actor->momz,actor->momz)+zoffs)), gravityadd)<<1; // to try and land on their head rather than on their feet actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); From 60564197afa4629a5f71bba673381e52874320e3 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 19 Dec 2020 21:12:09 -0600 Subject: [PATCH 015/160] Have A_DetonChase check for a player too --- src/p_enemy.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 1cc1686b1..898dcd3cc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5920,13 +5920,18 @@ void A_DetonChase(mobj_t *actor) if (actor->reactiontime == -42) { - fixed_t xyspeed; + fixed_t xyspeed, speed; + + if (actor->target->player) + speed = actor->target->player->normalspeed; + else + speed = actor->target->info->speed; actor->reactiontime = -42; exact = actor->movedir>>ANGLETOFINESHIFT; - xyspeed = FixedMul(FixedMul(actor->tracer->player->normalspeed,3*FRACUNIT/4), FINECOSINE(exact)); - actor->momz = FixedMul(FixedMul(actor->tracer->player->normalspeed,3*FRACUNIT/4), FINESINE(exact)); + xyspeed = FixedMul(FixedMul(speed,3*FRACUNIT/4), FINECOSINE(exact)); + actor->momz = FixedMul(FixedMul(speed,3*FRACUNIT/4), FINESINE(exact)); exact = actor->angle>>ANGLETOFINESHIFT; actor->momx = FixedMul(xyspeed, FINECOSINE(exact)); From 08146c9cad42f8a30a6b54386194ed22825d024a Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 19 Dec 2020 21:30:13 -0600 Subject: [PATCH 016/160] Have A_ThrownRing check for a player too --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 898dcd3cc..3e7f52a3f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4912,7 +4912,7 @@ void A_ThrownRing(mobj_t *actor) } if (actor->tracer && (actor->tracer->health) - && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC))// Already found someone to follow. + && (actor->tracer->player && actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC))// Already found someone to follow. { const INT32 temp = actor->threshold; actor->threshold = 32000; From 6c330bbf16a6dba4919d538d418b6b60f94b8244 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Mon, 21 Dec 2020 00:03:20 +0200 Subject: [PATCH 017/160] Fix video mode 0 not getting centered --- src/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index 9d36eee39..744523dab 100644 --- a/src/screen.c +++ b/src/screen.c @@ -217,7 +217,7 @@ void SCR_SetMode(void) // Set the video mode in the video interface. if (setmodeneeded) - VID_SetMode(--setmodeneeded); + VID_SetMode(setmodeneeded - 1); V_SetPalette(0); From 147c38c5ce489e2760f922ec98214005cfa9f99b Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Mon, 21 Dec 2020 02:03:44 -0600 Subject: [PATCH 018/160] Make sliding against objects actually work --- src/p_map.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index b934e3255..a1cad524e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2257,6 +2257,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { if (!P_BlockThingsIterator(bx, by, PIT_CheckThing)) blockval = false; + else + tmhitthing = tmfloorthing; if (P_MobjWasRemoved(tmthing)) return false; } From 0d1973075deafd5272f0cb9801f273d16e1736d9 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 24 Dec 2020 03:22:08 -0600 Subject: [PATCH 019/160] Nice UDB config there, SRB2. --- extras/conf/udb/Includes/SRB222_things.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index 0ea452155..113c1a4c2 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -1247,6 +1247,7 @@ patterns sprite = "SPHRA0"; width = 96; height = 192; + } 609 { title = "Circle of Rings and Spheres (Big)"; From 50d46e1fa634abd6672ca6a8bf43daaec528fa80 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 27 Dec 2020 00:21:09 -0600 Subject: [PATCH 020/160] Set the target of a spawned ghost to where it came from. --- src/p_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index a70dceb8b..8361004d6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2016,6 +2016,8 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) { mobj_t *ghost = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_GHOST); + P_SetTarget(&ghost->target, mobj); + P_SetScale(ghost, mobj->scale); ghost->destscale = mobj->scale; From c19539248aa02b64a4cb1c8ecebfde1d4c648eed Mon Sep 17 00:00:00 2001 From: katsy Date: Thu, 31 Dec 2020 04:38:26 -0600 Subject: [PATCH 021/160] add sprung flag to steam --- src/p_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_map.c b/src/p_map.c index b934e3255..7ca6d653a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -511,6 +511,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) if (spring->state != &states[S_STEAM1]) // Only when it bursts break; + object->eflags |= MFE_SPRUNG; object->momz = flipval*FixedMul(speed, FixedSqrt(FixedMul(spring->scale, object->scale))); // scale the speed with both objects' scales, just like with springs! if (p) From 1752f6efc1ce24508e65ef89d63a4432a8d9a47e Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Mon, 4 Jan 2021 18:10:41 -0300 Subject: [PATCH 022/160] Allow water running in reverse gravity --- src/p_mobj.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 58124fb9b..5cde1639c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3188,13 +3188,16 @@ boolean P_SceneryZMovement(mobj_t *mo) // boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) { - fixed_t topheight = P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y); + boolean flip = player->mo->eflags & MFE_VERTICALFLIP; + fixed_t surfaceheight = flip ? P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y) : P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y); + fixed_t playerbottom = flip ? (player->mo->z + player->mo->height) : player->mo->z; + boolean doifit = flip ? (surfaceheight - player->mo->floorz >= player->mo->height) : (player->mo->ceilingz - surfaceheight >= player->mo->height); if (!player->powers[pw_carry] && !player->homing - && ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && player->mo->ceilingz-topheight >= player->mo->height) + && ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && doifit) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && !(player->pflags & PF_SLIDING) - && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) + && abs(playerbottom - surfaceheight) < FixedMul(30*FRACUNIT, player->mo->scale)) return true; return false; From c8627464c9ace0d5939edf76a610dff458f3a95c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 6 Jan 2021 19:40:30 -0500 Subject: [PATCH 023/160] Check if GME_VERSION is defined. I made the assumption it would always be defined, which won't always be the case. --- src/sdl/mixer_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 5cae48077..412a21ea0 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1298,7 +1298,7 @@ boolean I_PlaySong(boolean looping) if (gme) { gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; -#if GME_VERSION >= 0x000603 +#if defined (GME_VERSION) && GME_VERSION >= 0x000603 if (looping) gme_set_autoload_playback_limit(gme, 0); #endif From 679bf5f999b8574a36a99b62b99824bb1239a635 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Fri, 8 Jan 2021 16:25:10 +0100 Subject: [PATCH 024/160] Fix CA_BOUNCE when flipped Fix P_DoAbilityBounce() always using "max", instead of "min" while upside-down and "max" while not --- src/p_user.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index a70dceb8b..5352a969c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4880,22 +4880,28 @@ void P_DoBubbleBounce(player_t *player) // void P_DoAbilityBounce(player_t *player, boolean changemomz) { - fixed_t prevmomz; if (player->mo->state-states == S_PLAY_BOUNCE_LANDING) return; + if (changemomz) { - fixed_t minmomz; - prevmomz = player->mo->momz; + fixed_t prevmomz = player->mo->momz, minmomz; + if (P_MobjFlip(player->mo)*prevmomz < 0) prevmomz = 0; else if (player->mo->eflags & MFE_UNDERWATER) prevmomz /= 2; + P_DoJump(player, false); player->pflags &= ~(PF_STARTJUMP|PF_JUMPED); minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2); - player->mo->momz = max(minmomz, (minmomz + prevmomz)/2); + + if (player->mo->eflags & MFE_VERTICALFLIP) // Use "min" or "max" depending on if the player is flipped + player->mo->momz = min(minmomz, (minmomz + prevmomz)/2); + else + player->mo->momz = max(minmomz, (minmomz + prevmomz)/2); } + S_StartSound(player->mo, sfx_boingf); P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE_LANDING); player->pflags |= PF_BOUNCING|PF_THOKKED; From 59bc197f3252bdfff838614bba7cd771d4f7440c Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 10 Jan 2021 10:01:31 -0600 Subject: [PATCH 025/160] Fix a divby0 when you have SF_MULTIABILITY, CA_DOUBLEJUMP, and actionspd -FRACUNIT. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index a70dceb8b..a9e1fe9a2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4499,7 +4499,7 @@ void P_DoJump(player_t *player, boolean soundandstate) if (twodlevel || (player->mo->flags2 & MF2_TWOD)) factor += player->jumpfactor / 10; - if (player->charflags & SF_MULTIABILITY && player->charability == CA_DOUBLEJUMP) + if (player->charflags & SF_MULTIABILITY && player->charability == CA_DOUBLEJUMP && (player->actionspd >> FRACBITS) != -1) factor -= max(0, player->secondjump * player->jumpfactor / ((player->actionspd >> FRACBITS) + 1)); // Reduce the jump height each time //if (maptol & TOL_NIGHTS) From d252f074b7cd28bea837552b8ff01314141058d0 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sun, 10 Jan 2021 21:33:54 +0200 Subject: [PATCH 026/160] Render midtextures on two-sided lines with a z-buffer offset This will fix z-fighting issues when they overlap with FOFs. --- src/hardware/hw_main.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a7e37d231..ca4d3e258 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -831,7 +831,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2) // // HWR_SplitWall // -static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor) +static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) { /* SoM: split up and light walls according to the lightlist. This may also include leaving out parts @@ -969,11 +969,11 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[1].y = endbot; if (cutflag & FF_FOG) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); else - HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); + HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); top = bot; endtop = endbot; @@ -998,11 +998,11 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, wallVerts[1].y = endbot; if (cutflag & FF_FOG) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture|polyflags, true, lightnum, colormap); else if (cutflag & FF_TRANSLUCENT) - HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Translucent|polyflags, false, lightnum, colormap); else - HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap); + HWR_ProjectWall(wallVerts, Surf, PF_Masked|polyflags, lightnum, colormap); } // HWR_DrawSkyWall @@ -1183,7 +1183,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, gl_toptexture, &Surf, FF_CUTLEVEL, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_toptexture, &Surf, FF_CUTLEVEL, NULL, 0); else if (grTex->mipmap.flags & TF_TRANSPARENT) HWR_AddTransparentWall(wallVerts, &Surf, gl_toptexture, PF_Environment, false, lightnum, colormap); else @@ -1249,7 +1249,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, gl_bottomtexture, &Surf, FF_CUTLEVEL, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_bottomtexture, &Surf, FF_CUTLEVEL, NULL, 0); else if (grTex->mipmap.flags & TF_TRANSPARENT) HWR_AddTransparentWall(wallVerts, &Surf, gl_bottomtexture, PF_Environment, false, lightnum, colormap); else @@ -1465,13 +1465,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, &Surf); } + // Render midtextures on two-sided lines with a z-buffer offset. + // This will cause the midtexture appear on top, if a FOF overlaps with it. + blendmode |= PF_Decal; + if (gl_frontsector->numlights) { if (!(blendmode & PF_Masked)) - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_TRANSLUCENT, NULL, PF_Decal); else { - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, PF_Decal); } } else if (!(blendmode & PF_Masked)) @@ -1554,7 +1558,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // I don't think that solid walls can use translucent linedef types... if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL); + HWR_SplitWall(gl_frontsector, wallVerts, gl_midtexture, &Surf, FF_CUTLEVEL, NULL, 0); else { if (grTex->mipmap.flags & TF_TRANSPARENT) @@ -1717,7 +1721,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover); + HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->flags, rover, 0); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1732,7 +1736,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } if (gl_frontsector->numlights) - HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover); + HWR_SplitWall(gl_frontsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); else { if (blendmode != PF_Masked) @@ -1829,7 +1833,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover); + HWR_SplitWall(gl_backsector, wallVerts, 0, &Surf, rover->flags, rover, 0); else HWR_AddTransparentWall(wallVerts, &Surf, 0, blendmode, true, lightnum, colormap); } @@ -1844,7 +1848,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } if (gl_backsector->numlights) - HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover); + HWR_SplitWall(gl_backsector, wallVerts, texnum, &Surf, rover->flags, rover, 0); else { if (blendmode != PF_Masked) From fbcc0c25b3198453d0f96bebdbd5e71724780b5c Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 10 Jan 2021 23:17:40 -0300 Subject: [PATCH 027/160] Add Logan to the art credits --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index b23ab4f7a..bd5f16f43 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1149,6 +1149,7 @@ static const char *credits[] = { "Daniel \"Inazuma\" Trinh", "\"VelocitOni\"", "Jarrett \"JEV3\" Voight", + "Logan \"Hyperchaotix\" McCloud", "", "\1Music and Sound", "\1Production", From 90b0242802151bced2c3355757e6670b60066e01 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Mon, 11 Jan 2021 21:49:31 -0300 Subject: [PATCH 028/160] Put his name at the right order --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index bd5f16f43..2232b669f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1138,6 +1138,7 @@ static const char *credits[] = { "Iestyn \"Monster Iestyn\" Jealous", "William \"GuyWithThePie\" Kloppenberg", "Alice \"Alacroix\" de Lemos", + "Logan \"Hyperchaotix\" McCloud", "Alexander \"DrTapeworm\" Moench-Ford", "Andrew \"Senku Niola\" Moran", "\"MotorRoach\"", @@ -1149,7 +1150,6 @@ static const char *credits[] = { "Daniel \"Inazuma\" Trinh", "\"VelocitOni\"", "Jarrett \"JEV3\" Voight", - "Logan \"Hyperchaotix\" McCloud", "", "\1Music and Sound", "\1Production", From f3ad648874a910cbd7d7dc508ed4b74de29b5373 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 6 Dec 2020 17:46:35 -0300 Subject: [PATCH 029/160] Revert "Move a few mobj spawn defaults to its own function" This reverts commit 6f9c48a30560b0f2d89f7202371dfc164015b9ba. # Conflicts: # src/p_mobj.c --- src/p_local.h | 1 - src/p_mobj.c | 87 ++++++++++++++++++++++----------------------------- src/p_saveg.c | 40 +++++++++++++++++++++-- 3 files changed, 75 insertions(+), 53 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 9359290fa..8caab0d27 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -279,7 +279,6 @@ mobjtype_t P_GetMobjtype(UINT16 mthingtype); void P_RespawnSpecials(void); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); -void P_SetMobjSpawnDefaults(mobj_t *mobj); void P_RecalcPrecipInSector(sector_t *sector); void P_PrecipitationEffects(void); diff --git a/src/p_mobj.c b/src/p_mobj.c index 58124fb9b..4945eed48 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10440,7 +10440,44 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->x = x; mobj->y = y; - P_SetMobjSpawnDefaults(mobj); + mobj->radius = info->radius; + mobj->height = info->height; + mobj->flags = info->flags; + + mobj->health = (info->spawnhealth ? info->spawnhealth : 1); + + mobj->reactiontime = info->reactiontime; + + mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer + + // do not set the state with P_SetMobjState, + // because action routines can not be called yet + st = &states[info->spawnstate]; + + mobj->state = st; + mobj->tics = st->tics; + mobj->sprite = st->sprite; + mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. + P_SetupStateAnimation(mobj, st); + + mobj->friction = ORIG_FRICTION; + + mobj->movefactor = FRACUNIT; + + // All mobjs are created at 100% scale. + mobj->scale = FRACUNIT; + mobj->destscale = mobj->scale; + mobj->scalespeed = FRACUNIT/12; + + // TODO: Make this a special map header + if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN)) + mobj->destscale = FRACUNIT/2; + + // Sprite rendering + mobj->blendmode = AST_TRANSLUCENT; + mobj->spritexscale = mobj->spriteyscale = mobj->scale; + mobj->spritexoffset = mobj->spriteyoffset = 0; + mobj->floorspriteslope = NULL; // set subsector and/or block links P_SetThingPosition(mobj); @@ -10747,8 +10784,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->frame &= ~FF_FRAMEMASK; } - st = &states[info->spawnstate]; - // Call action functions when the state is set if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC)) { @@ -10779,52 +10814,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) return mobj; } -void P_SetMobjSpawnDefaults(mobj_t *mobj) -{ - const mobjinfo_t *info = mobj->info; - state_t *st = &states[info->spawnstate]; - - mobj->radius = info->radius; - mobj->height = info->height; - mobj->flags = info->flags; - - mobj->health = (info->spawnhealth ? info->spawnhealth : 1); - - mobj->reactiontime = info->reactiontime; - - mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer - - // do not set the state with P_SetMobjState, - // because action routines can not be called yet - mobj->state = st; - mobj->tics = st->tics; - mobj->sprite = st->sprite; - mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. - P_SetupStateAnimation(mobj, st); - - mobj->friction = ORIG_FRICTION; - - mobj->movefactor = FRACUNIT; - - // All mobjs are created at 100% scale. - mobj->scale = FRACUNIT; - mobj->destscale = mobj->scale; - mobj->scalespeed = FRACUNIT/12; - - // TODO: Make this a special map header - if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN)) - mobj->destscale = FRACUNIT/2; - - // Make sure scale matches destscale immediately when spawned - P_SetScale(mobj, mobj->destscale); - - // Sprite rendering - mobj->blendmode = AST_TRANSLUCENT; - mobj->spritexscale = mobj->spriteyscale = FRACUNIT; - mobj->spritexoffset = mobj->spriteyoffset = 0; - mobj->floorspriteslope = NULL; -} - static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { state_t *st; diff --git a/src/p_saveg.c b/src/p_saveg.c index c1364e08f..03229e740 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2692,10 +2692,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) } mobj->type = i; } - mobj->info = &mobjinfo[mobj->type]; - P_SetMobjSpawnDefaults(mobj); - if (diff & MD_POS) { mobj->x = READFIXED(save_p); @@ -2721,21 +2718,35 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) if (diff & MD_RADIUS) mobj->radius = READFIXED(save_p); + else + mobj->radius = mobj->info->radius; if (diff & MD_HEIGHT) mobj->height = READFIXED(save_p); + else + mobj->height = mobj->info->height; if (diff & MD_FLAGS) mobj->flags = READUINT32(save_p); + else + mobj->flags = mobj->info->flags; if (diff & MD_FLAGS2) mobj->flags2 = READUINT32(save_p); if (diff & MD_HEALTH) mobj->health = READINT32(save_p); + else + mobj->health = mobj->info->spawnhealth; if (diff & MD_RTIME) mobj->reactiontime = READINT32(save_p); + else + mobj->reactiontime = mobj->info->reactiontime; if (diff & MD_STATE) mobj->state = &states[READUINT16(save_p)]; + else + mobj->state = &states[mobj->info->spawnstate]; if (diff & MD_TICS) mobj->tics = READINT32(save_p); + else + mobj->tics = mobj->state->tics; if (diff & MD_SPRITE) { mobj->sprite = READUINT16(save_p); if (mobj->sprite == SPR_PLAY) @@ -2751,6 +2762,11 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->frame = READUINT32(save_p); mobj->anim_duration = READUINT16(save_p); } + else + { + mobj->frame = mobj->state->frame; + mobj->anim_duration = (UINT16)mobj->state->var2; + } if (diff & MD_EFLAGS) mobj->eflags = READUINT16(save_p); if (diff & MD_PLAYER) @@ -2767,14 +2783,20 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->threshold = READINT32(save_p); if (diff & MD_LASTLOOK) mobj->lastlook = READINT32(save_p); + else + mobj->lastlook = -1; if (diff & MD_TARGET) mobj->target = (mobj_t *)(size_t)READUINT32(save_p); if (diff & MD_TRACER) mobj->tracer = (mobj_t *)(size_t)READUINT32(save_p); if (diff & MD_FRICTION) mobj->friction = READFIXED(save_p); + else + mobj->friction = ORIG_FRICTION; if (diff & MD_MOVEFACTOR) mobj->movefactor = READFIXED(save_p); + else + mobj->movefactor = FRACUNIT; if (diff & MD_FUSE) mobj->fuse = READINT32(save_p); if (diff & MD_WATERTOP) @@ -2783,10 +2805,16 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->waterbottom = READFIXED(save_p); if (diff & MD_SCALE) mobj->scale = READFIXED(save_p); + else + mobj->scale = FRACUNIT; if (diff & MD_DSCALE) mobj->destscale = READFIXED(save_p); + else + mobj->destscale = mobj->scale; if (diff2 & MD2_SCALESPEED) mobj->scalespeed = READFIXED(save_p); + else + mobj->scalespeed = FRACUNIT/12; if (diff2 & MD2_CUSVAL) mobj->cusval = READINT32(save_p); if (diff2 & MD2_CVMEM) @@ -2817,10 +2845,16 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->renderflags = READUINT32(save_p); if (diff2 & MD2_BLENDMODE) mobj->blendmode = READINT32(save_p); + else + mobj->blendmode = AST_TRANSLUCENT; if (diff2 & MD2_SPRITEXSCALE) mobj->spritexscale = READFIXED(save_p); + else + mobj->spritexscale = FRACUNIT; if (diff2 & MD2_SPRITEYSCALE) mobj->spriteyscale = READFIXED(save_p); + else + mobj->spriteyscale = FRACUNIT; if (diff2 & MD2_SPRITEXOFFSET) mobj->spritexoffset = READFIXED(save_p); if (diff2 & MD2_SPRITEYOFFSET) From 5501d495c72d0cb8f2d82d4424e64d67a6a6a8ea Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 27 Jan 2021 17:48:57 -0300 Subject: [PATCH 030/160] OpenGL backend: Manage uploaded GPU textures with an internal list Indirectly fixes the game doing whatever after freeing a patch. This commit implements a FTextureInfo struct type, instead of it being a typedef to the GLMipmap_s struct type. --- src/f_finale.c | 44 ++++++++--------- src/hardware/hw_cache.c | 1 - src/hardware/hw_data.h | 19 ++++---- src/hardware/hw_defs.h | 11 ++++- src/hardware/hw_drv.h | 8 ++- src/hardware/r_opengl/r_opengl.c | 84 ++++++++++++++++++++++---------- src/sdl/hwsym_sdl.c | 1 - src/sdl/i_video.c | 1 - src/w_wad.c | 18 +------ src/win32/win_dll.c | 2 - src/z_zone.h | 3 +- 11 files changed, 106 insertions(+), 86 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 2232b669f..fdcfad279 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2546,28 +2546,28 @@ static void F_UnloadAlacroixGraphics(SINT8 oldttscale) oldttscale--; // zero-based index for (i = 0; i < TTMAX_ALACROIX; i++) { - if(ttembl[oldttscale][i]) { Z_Free(ttembl[oldttscale][i]); ttembl[oldttscale][i] = 0; } - if(ttribb[oldttscale][i]) { Z_Free(ttribb[oldttscale][i]); ttribb[oldttscale][i] = 0; } - if(ttsont[oldttscale][i]) { Z_Free(ttsont[oldttscale][i]); ttsont[oldttscale][i] = 0; } - if(ttrobo[oldttscale][i]) { Z_Free(ttrobo[oldttscale][i]); ttrobo[oldttscale][i] = 0; } - if(tttwot[oldttscale][i]) { Z_Free(tttwot[oldttscale][i]); tttwot[oldttscale][i] = 0; } - if(ttrbtx[oldttscale][i]) { Z_Free(ttrbtx[oldttscale][i]); ttrbtx[oldttscale][i] = 0; } - if(ttsoib[oldttscale][i]) { Z_Free(ttsoib[oldttscale][i]); ttsoib[oldttscale][i] = 0; } - if(ttsoif[oldttscale][i]) { Z_Free(ttsoif[oldttscale][i]); ttsoif[oldttscale][i] = 0; } - if(ttsoba[oldttscale][i]) { Z_Free(ttsoba[oldttscale][i]); ttsoba[oldttscale][i] = 0; } - if(ttsobk[oldttscale][i]) { Z_Free(ttsobk[oldttscale][i]); ttsobk[oldttscale][i] = 0; } - if(ttsodh[oldttscale][i]) { Z_Free(ttsodh[oldttscale][i]); ttsodh[oldttscale][i] = 0; } - if(tttaib[oldttscale][i]) { Z_Free(tttaib[oldttscale][i]); tttaib[oldttscale][i] = 0; } - if(tttaif[oldttscale][i]) { Z_Free(tttaif[oldttscale][i]); tttaif[oldttscale][i] = 0; } - if(tttaba[oldttscale][i]) { Z_Free(tttaba[oldttscale][i]); tttaba[oldttscale][i] = 0; } - if(tttabk[oldttscale][i]) { Z_Free(tttabk[oldttscale][i]); tttabk[oldttscale][i] = 0; } - if(tttabt[oldttscale][i]) { Z_Free(tttabt[oldttscale][i]); tttabt[oldttscale][i] = 0; } - if(tttaft[oldttscale][i]) { Z_Free(tttaft[oldttscale][i]); tttaft[oldttscale][i] = 0; } - if(ttknib[oldttscale][i]) { Z_Free(ttknib[oldttscale][i]); ttknib[oldttscale][i] = 0; } - if(ttknif[oldttscale][i]) { Z_Free(ttknif[oldttscale][i]); ttknif[oldttscale][i] = 0; } - if(ttknba[oldttscale][i]) { Z_Free(ttknba[oldttscale][i]); ttknba[oldttscale][i] = 0; } - if(ttknbk[oldttscale][i]) { Z_Free(ttknbk[oldttscale][i]); ttknbk[oldttscale][i] = 0; } - if(ttkndh[oldttscale][i]) { Z_Free(ttkndh[oldttscale][i]); ttkndh[oldttscale][i] = 0; } + if(ttembl[oldttscale][i]) { Patch_Free(ttembl[oldttscale][i]); ttembl[oldttscale][i] = 0; } + if(ttribb[oldttscale][i]) { Patch_Free(ttribb[oldttscale][i]); ttribb[oldttscale][i] = 0; } + if(ttsont[oldttscale][i]) { Patch_Free(ttsont[oldttscale][i]); ttsont[oldttscale][i] = 0; } + if(ttrobo[oldttscale][i]) { Patch_Free(ttrobo[oldttscale][i]); ttrobo[oldttscale][i] = 0; } + if(tttwot[oldttscale][i]) { Patch_Free(tttwot[oldttscale][i]); tttwot[oldttscale][i] = 0; } + if(ttrbtx[oldttscale][i]) { Patch_Free(ttrbtx[oldttscale][i]); ttrbtx[oldttscale][i] = 0; } + if(ttsoib[oldttscale][i]) { Patch_Free(ttsoib[oldttscale][i]); ttsoib[oldttscale][i] = 0; } + if(ttsoif[oldttscale][i]) { Patch_Free(ttsoif[oldttscale][i]); ttsoif[oldttscale][i] = 0; } + if(ttsoba[oldttscale][i]) { Patch_Free(ttsoba[oldttscale][i]); ttsoba[oldttscale][i] = 0; } + if(ttsobk[oldttscale][i]) { Patch_Free(ttsobk[oldttscale][i]); ttsobk[oldttscale][i] = 0; } + if(ttsodh[oldttscale][i]) { Patch_Free(ttsodh[oldttscale][i]); ttsodh[oldttscale][i] = 0; } + if(tttaib[oldttscale][i]) { Patch_Free(tttaib[oldttscale][i]); tttaib[oldttscale][i] = 0; } + if(tttaif[oldttscale][i]) { Patch_Free(tttaif[oldttscale][i]); tttaif[oldttscale][i] = 0; } + if(tttaba[oldttscale][i]) { Patch_Free(tttaba[oldttscale][i]); tttaba[oldttscale][i] = 0; } + if(tttabk[oldttscale][i]) { Patch_Free(tttabk[oldttscale][i]); tttabk[oldttscale][i] = 0; } + if(tttabt[oldttscale][i]) { Patch_Free(tttabt[oldttscale][i]); tttabt[oldttscale][i] = 0; } + if(tttaft[oldttscale][i]) { Patch_Free(tttaft[oldttscale][i]); tttaft[oldttscale][i] = 0; } + if(ttknib[oldttscale][i]) { Patch_Free(ttknib[oldttscale][i]); ttknib[oldttscale][i] = 0; } + if(ttknif[oldttscale][i]) { Patch_Free(ttknif[oldttscale][i]); ttknif[oldttscale][i] = 0; } + if(ttknba[oldttscale][i]) { Patch_Free(ttknba[oldttscale][i]); ttknba[oldttscale][i] = 0; } + if(ttknbk[oldttscale][i]) { Patch_Free(ttknbk[oldttscale][i]); ttknbk[oldttscale][i] = 0; } + if(ttkndh[oldttscale][i]) { Patch_Free(ttkndh[oldttscale][i]); ttkndh[oldttscale][i] = 0; } } ttloaded[oldttscale] = false; } diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 37e9f690f..83a4e2e03 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -1091,7 +1091,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch) return; Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED); - Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED); } static const INT32 picmode2GR[] = diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 11e41b18a..ce6527666 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -48,18 +48,19 @@ struct GLColormap_s typedef struct GLColormap_s GLColormap_t; -// data holds the address of the graphics data cached in heap memory -// NULL if the texture is not in Doom heap cache. +// Texture information (misleadingly named "mipmap" all over the code.) +// The *data pointer holds the address of the graphics data cached in heap memory. +// NULL if the texture is not in SRB2's heap cache. struct GLMipmap_s { - // for TexDownloadMipMap + // for UpdateTexture GLTextureFormat_t format; void *data; UINT32 flags; UINT16 height; UINT16 width; - UINT32 downloaded; // The GPU has this texture. + UINT32 downloaded; // The GPU has this texture. struct GLMipmap_s *nextcolormap; struct GLColormap_s *colormap; @@ -70,22 +71,22 @@ typedef struct GLMipmap_s GLMipmap_t; // -// Doom texture info, as cached for hardware rendering +// Level textures, as cached for hardware rendering. // struct GLMapTexture_s { GLMipmap_t mipmap; - float scaleX; //used for scaling textures on walls + float scaleX; // Used for scaling textures on walls float scaleY; }; typedef struct GLMapTexture_s GLMapTexture_t; -// a cached patch as converted to hardware format +// Patch information for the hardware renderer. struct GLPatch_s { - float max_s,max_t; - GLMipmap_t *mipmap; + GLMipmap_t *mipmap; // Texture data. Allocated whenever the patch is. + float max_s, max_t; }; typedef struct GLPatch_s GLPatch_t; diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index a782762a3..bd6afc74f 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -255,7 +255,16 @@ enum ETextureFlags TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0 }; -typedef struct GLMipmap_s FTextureInfo; +struct FTextureInfo +{ + UINT32 width, height; + UINT32 downloaded; + UINT32 format; + + struct GLMipmap_s *texture; + struct FTextureInfo *prev, *next; +}; +typedef struct FTextureInfo FTextureInfo; // jimita 14032019 struct FLightInfo diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 5a2e0e44e..da4ee8614 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -40,13 +40,12 @@ EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutV EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky); EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags); EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor); -EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo); -EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *TexInfo); -EXPORT void HWRAPI(DeleteTexture) (FTextureInfo *TexInfo); +EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo); +EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo); +EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo); EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data); EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip); EXPORT void HWRAPI(ClearMipMapCache) (void); -EXPORT void HWRAPI(ClearCacheList) (void); //Hurdler: added for backward compatibility EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value); @@ -101,7 +100,6 @@ struct hwdriver_s ReadRect pfnReadRect; GClipRect pfnGClipRect; ClearMipMapCache pfnClearMipMapCache; - ClearCacheList pfnClearCacheList; SetSpecialState pfnSetSpecialState;//Hurdler: added for backward compatibility DrawModel pfnDrawModel; CreateModelVBOs pfnCreateModelVBOs; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 8cd948eea..2568a7d08 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -58,8 +58,9 @@ static GLuint tex_downloaded = 0; static GLfloat fov = 90.0f; static FBITFIELD CurrentPolyFlags; -static FTextureInfo *gl_cachetail = NULL; -static FTextureInfo *gl_cachehead = NULL; +// Linked list of all textures. +static FTextureInfo *TexCacheTail = NULL; +static FTextureInfo *TexCacheHead = NULL; RGBA_t myPaletteData[256]; GLint screen_width = 0; // used by Draw2DLine() @@ -1287,10 +1288,30 @@ void SetStates(void) // -----------------+ // DeleteTexture : Deletes a texture from the GPU and frees its data // -----------------+ -EXPORT void HWRAPI(DeleteTexture) (FTextureInfo *pTexInfo) +EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) { - if (pTexInfo->downloaded) + FTextureInfo *head = TexCacheHead; + + if (!pTexInfo) + return; + else if (pTexInfo->downloaded) pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); + + while (head) + { + if (head->downloaded == pTexInfo->downloaded) + { + if (head->next) + head->next->prev = head->prev; + if (head->prev) + head->prev->next = head->next; + free(head); + break; + } + + head = head->next; + } + pTexInfo->downloaded = 0; } @@ -1303,26 +1324,29 @@ void Flush(void) { //GL_DBG_Printf ("HWR_Flush()\n"); - while (gl_cachehead) + while (TexCacheHead) { - DeleteTexture(gl_cachehead); - gl_cachehead = gl_cachehead->nextmipmap; + FTextureInfo *pTexInfo = TexCacheHead; + GLMipmap_t *texture = pTexInfo->texture; + + if (pTexInfo->downloaded) + { + pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); + pTexInfo->downloaded = 0; + } + + if (texture) + texture->downloaded = 0; + + TexCacheHead = pTexInfo->next; + free(pTexInfo); } - ClearCacheList(); //Hurdler: well, gl_cachehead is already NULL + TexCacheTail = TexCacheHead = NULL; //Hurdler: well, TexCacheHead is already NULL tex_downloaded = 0; } -// -----------------+ -// ClearCacheList : Clears the texture cache tail and head -// -----------------+ -EXPORT void HWRAPI(ClearCacheList) (void) -{ - gl_cachetail = gl_cachehead = NULL; -} - - // -----------------+ // isExtAvailable : Look if an OpenGL extension is available // Returns : true if extension available @@ -1718,7 +1742,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags) // -----------------+ // UpdateTexture : Updates the texture data. // -----------------+ -EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo) +EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) { // Download a mipmap boolean updatemipmap = true; @@ -1920,7 +1944,7 @@ EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *pTexInfo) // -----------------+ // SetTexture : The mipmap becomes the current texture source // -----------------+ -EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) +EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo) { if (!pTexInfo) { @@ -1937,17 +1961,25 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo) } else { + FTextureInfo *newTex = calloc(1, sizeof (*newTex)); + UpdateTexture(pTexInfo); - pTexInfo->nextmipmap = NULL; + + newTex->texture = pTexInfo; + newTex->downloaded = (UINT32)pTexInfo->downloaded; + newTex->width = (UINT32)pTexInfo->width; + newTex->height = (UINT32)pTexInfo->height; + newTex->format = (UINT32)pTexInfo->format; // insertion at the tail - if (gl_cachetail) + if (TexCacheTail) { - gl_cachetail->nextmipmap = pTexInfo; - gl_cachetail = pTexInfo; + newTex->prev = TexCacheTail; + TexCacheTail->next = newTex; + TexCacheTail = newTex; } else // initialization of the linked list - gl_cachetail = gl_cachehead = pTexInfo; + TexCacheTail = TexCacheHead = newTex; } } @@ -3011,7 +3043,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) EXPORT INT32 HWRAPI(GetTextureUsed) (void) { - FTextureInfo *tmp = gl_cachehead; + FTextureInfo *tmp = TexCacheHead; INT32 res = 0; while (tmp) @@ -3028,7 +3060,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void) // Add it up! res += tmp->height*tmp->width*bpp; - tmp = tmp->nextmipmap; + tmp = tmp->next; } return res; diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 398508662..96e3d7d69 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -90,7 +90,6 @@ void *hwSym(const char *funcName,void *handle) GETFUNC(ReadRect); GETFUNC(GClipRect); GETFUNC(ClearMipMapCache); - GETFUNC(ClearCacheList); GETFUNC(SetSpecialState); GETFUNC(GetTextureUsed); GETFUNC(DrawModel); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 5ebff8700..0ed10463f 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1862,7 +1862,6 @@ void VID_StartupOpenGL(void) HWD.pfnReadRect = hwSym("ReadRect",NULL); HWD.pfnGClipRect = hwSym("GClipRect",NULL); HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL); - HWD.pfnClearCacheList = hwSym("ClearCacheList",NULL); HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL); HWD.pfnSetPalette = hwSym("SetPalette",NULL); HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL); diff --git a/src/w_wad.c b/src/w_wad.c index 6566800c0..2cbcdecb5 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1682,26 +1682,12 @@ void *W_CacheSoftwarePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag) // read the lump in full W_ReadLumpHeaderPwad(wad, lump, lumpdata, 0, 0); + ptr = lumpdata; #ifndef NO_PNG_LUMPS - // lump is a png so convert it if (Picture_IsLumpPNG((UINT8 *)lumpdata, len)) - { - size_t newlen; - void *converted = Picture_PNGConvert((UINT8 *)lumpdata, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, len, &newlen, 0); - ptr = Z_Malloc(newlen, PU_STATIC, NULL); - M_Memcpy(ptr, converted, newlen); - Z_Free(converted); - len = newlen; - } - else // just copy it into the patch cache + ptr = Picture_PNGConvert((UINT8 *)lumpdata, PICFMT_DOOMPATCH, NULL, NULL, NULL, NULL, len, &len, 0); #endif - { - ptr = Z_Malloc(len, PU_STATIC, NULL); - M_Memcpy(ptr, lumpdata, len); - } - - Z_Free(lumpdata); dest = Z_Calloc(sizeof(patch_t), tag, &lumpcache[lump]); Patch_Create(ptr, len, dest); diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c index d942d8cd4..4743cec34 100644 --- a/src/win32/win_dll.c +++ b/src/win32/win_dll.c @@ -111,7 +111,6 @@ static loadfunc_t hwdFuncTable[] = { {"ReadRect@24", &hwdriver.pfnReadRect}, {"GClipRect@20", &hwdriver.pfnGClipRect}, {"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache}, - {"ClearCacheList@0", &hwdriver.pfnClearCacheList}, {"SetSpecialState@8", &hwdriver.pfnSetSpecialState}, {"DrawModel@16", &hwdriver.pfnDrawModel}, {"SetTransform@4", &hwdriver.pfnSetTransform}, @@ -145,7 +144,6 @@ static loadfunc_t hwdFuncTable[] = { {"ReadRect", &hwdriver.pfnReadRect}, {"GClipRect", &hwdriver.pfnGClipRect}, {"ClearMipMapCache", &hwdriver.pfnClearMipMapCache}, - {"ClearCacheList", &hwdriver.pfnClearCacheList}, {"SetSpecialState", &hwdriver.pfnSetSpecialState}, {"DrawModel", &hwdriver.pfnDrawModel}, {"SetTransform", &hwdriver.pfnSetTransform}, diff --git a/src/z_zone.h b/src/z_zone.h index e80a45e7f..7b58be8f3 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -68,8 +68,7 @@ enum PU_HWRCACHE_UNLOCKED = 102, // 'unlocked' PU_HWRCACHE memory: // 'second-level' cache for graphics // stored in hardware format and downloaded as needed - PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRPATCHINFO memory - PU_HWRMODELTEXTURE_UNLOCKED = 104, // 'unlocked' PU_HWRMODELTEXTURE memory + PU_HWRMODELTEXTURE_UNLOCKED = 103, // 'unlocked' PU_HWRMODELTEXTURE memory }; // From d4044a4f82bd9862a848a1e3f49a62f35f8f8b71 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 27 Jan 2021 18:54:33 -0300 Subject: [PATCH 031/160] Add PF_ColorMapped Not all surfaces have tint and fade colors. Checking for a specific surface flag, that tells the backend those colors are present, avoids uninitialized reads. --- src/hardware/hw_defs.h | 10 +-- src/hardware/hw_drv.h | 1 - src/hardware/hw_main.c | 129 ++++++++++++++++++++++--------- src/hardware/r_opengl/r_opengl.c | 42 +++++----- 4 files changed, 119 insertions(+), 63 deletions(-) diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index a782762a3..eb4ddf572 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -230,14 +230,15 @@ enum EPolyFlags PF_NoDepthTest = 0x00000200, // Disables the depth test mode PF_Invisible = 0x00000400, // Disables write to color buffer PF_Decal = 0x00000800, // Enables polygon offset - PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB) + PF_Modulated = 0x00001000, // Modulation (multiply output with constant RGBA) // When set, pass the color constant into the FSurfaceInfo -> PolyColor PF_NoTexture = 0x00002000, // Disables texturing PF_Corona = 0x00004000, // Tells the renderer we are drawing a corona - PF_Ripple = 0x00008000, // Water effect shader + PF_ColorMapped = 0x00008000, // Surface has "tint" and "fade" colors, which are sent as uniforms to a shader. PF_RemoveYWrap = 0x00010000, // Forces clamp texture on Y PF_ForceWrapX = 0x00020000, // Forces repeat texture on X - PF_ForceWrapY = 0x00040000 // Forces repeat texture on Y + PF_ForceWrapY = 0x00040000, // Forces repeat texture on Y + PF_Ripple = 0x00100000 // Water ripple effect. The current backend doesn't use it for anything. }; @@ -257,7 +258,6 @@ enum ETextureFlags typedef struct GLMipmap_s FTextureInfo; -// jimita 14032019 struct FLightInfo { FUINT light_level; @@ -273,7 +273,7 @@ struct FSurfaceInfo RGBA_t PolyColor; RGBA_t TintColor; RGBA_t FadeColor; - FLightInfo LightInfo; // jimita 14032019 + FLightInfo LightInfo; }; typedef struct FSurfaceInfo FSurfaceInfo; diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 5a2e0e44e..03e664e42 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -69,7 +69,6 @@ EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height); #define SCREENVERTS 10 EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]); -// jimita EXPORT boolean HWRAPI(CompileShaders) (void); EXPORT void HWRAPI(CleanShaders) (void); EXPORT void HWRAPI(SetShader) (int type); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a7e37d231..ab5fa0229 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -173,6 +173,11 @@ boolean gl_shadersavailable = true; // Lighting // ========================================================================== +static boolean HWR_UseShader(void) +{ + return (cv_glshaders.value && gl_shadersavailable); +} + void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap) { RGBA_t poly_color, tint_color, fade_color; @@ -182,7 +187,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col fade_color.rgba = (colormap != NULL) ? (UINT32)colormap->fadergba : GL_DEFAULTFOG; // Crappy backup coloring if you can't do shaders - if (!cv_glshaders.value || !gl_shadersavailable) + if (!HWR_UseShader()) { // be careful, this may get negative for high lightlevel values. float tint_alpha, fade_alpha; @@ -371,7 +376,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; - int shader; + INT32 shader = SHADER_DEFAULT; // no convex poly were generated for this subsector if (!xsub->planepoly) @@ -568,12 +573,17 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool else PolyFlags |= PF_Masked|PF_Modulated; - if (PolyFlags & PF_Fog) - shader = SHADER_FOG; // fog shader - else if (PolyFlags & PF_Ripple) - shader = SHADER_WATER; // water shader - else - shader = SHADER_FLOOR; // floor shader + if (HWR_UseShader()) + { + if (PolyFlags & PF_Fog) + shader = SHADER_FOG; + else if (PolyFlags & PF_Ripple) + shader = SHADER_WATER; + else + shader = SHADER_FLOOR; + + PolyFlags |= PF_ColorMapped; + } HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, PolyFlags, shader, false); @@ -785,8 +795,17 @@ static void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, I // static void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap) { + INT32 shader = SHADER_DEFAULT; + HWR_Lighting(pSurf, lightlevel, wallcolormap); - HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, SHADER_WALL, false); // wall shader + + if (HWR_UseShader()) + { + shader = SHADER_WALL; + blendmode |= PF_ColorMapped; + } + + HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude, shader, false); } // ========================================================================== @@ -2659,30 +2678,30 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, FBITFIELD blendmode, UINT8 lightlevel, levelflat_t *levelflat, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap) { - float height; //constant y for all points on the convex flat polygon - FOutVector *v3d; - INT32 i; - float flatxref,flatyref; + FSurfaceInfo Surf; + FOutVector *v3d; + INT32 shader = SHADER_DEFAULT; + + size_t nrPlaneVerts = polysector->numVertices; + INT32 i; + + float height = FIXED_TO_FLOAT(fixedheight); // constant y for all points on the convex flat polygon + float flatxref, flatyref; float fflatwidth = 64.0f, fflatheight = 64.0f; INT32 flatflag = 63; + boolean texflat = false; + float scrollx = 0.0f, scrolly = 0.0f; angle_t angle = 0; - FSurfaceInfo Surf; fixed_t tempxs, tempyt; - size_t nrPlaneVerts; static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; - nrPlaneVerts = polysector->numVertices; - - height = FIXED_TO_FLOAT(fixedheight); - - if (nrPlaneVerts < 3) //not even a triangle ? + if (nrPlaneVerts < 3) // Not even a triangle? return; - - if (nrPlaneVerts > (size_t)UINT16_MAX) // FIXME: exceeds plVerts size + else if (nrPlaneVerts > (size_t)UINT16_MAX) // FIXME: exceeds plVerts size { CONS_Debug(DBG_RENDER, "polygon size of %s exceeds max value of %d vertices\n", sizeu1(nrPlaneVerts), UINT16_MAX); return; @@ -2834,7 +2853,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, v3d->z = FIXED_TO_FLOAT(polysector->vertices[i]->y); } - HWR_Lighting(&Surf, lightlevel, planecolormap); if (blendmode & PF_Translucent) @@ -2845,7 +2863,13 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, else blendmode |= PF_Masked|PF_Modulated; - HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, SHADER_FLOOR, false); // floor shader + if (HWR_UseShader()) + { + shader = SHADER_FLOOR; + blendmode |= PF_ColorMapped; + } + + HWR_ProcessPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode, shader, false); } static void HWR_AddPolyObjectPlanes(void) @@ -3566,6 +3590,8 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) FSurfaceInfo sSurf; float fscale; float fx; float fy; float offset; extracolormap_t *colormap = NULL; + FBITFIELD blendmode = PF_Translucent|PF_Modulated; + INT32 shader = SHADER_DEFAULT; UINT8 i; SINT8 flip = P_MobjFlip(thing); @@ -3658,7 +3684,13 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) HWR_Lighting(&sSurf, 0, colormap); sSurf.PolyColor.s.alpha = alpha; - HWR_ProcessPolygon(&sSurf, shadowVerts, 4, PF_Translucent|PF_Modulated, SHADER_SPRITE, false); // sprite shader + if (HWR_UseShader()) + { + shader = SHADER_SPRITE; + blendmode |= PF_ColorMapped; + } + + HWR_ProcessPolygon(&sSurf, shadowVerts, 4, blendmode, shader, false); } // This is expecting a pointer to an array containing 4 wallVerts for a sprite @@ -3706,6 +3738,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) boolean lightset = true; FBITFIELD blend = 0; FBITFIELD occlusion; + INT32 shader = SHADER_DEFAULT; boolean use_linkdraw_hack = false; boolean splat = R_ThingIsFloorSprite(spr->mobj); UINT8 alpha; @@ -3832,6 +3865,12 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) if (!occlusion) use_linkdraw_hack = true; } + if (HWR_UseShader()) + { + shader = SHADER_SPRITE; + blend |= PF_ColorMapped; + } + alpha = Surf.PolyColor.s.alpha; // Start with the lightlevel and colormap from the top of the sprite @@ -3940,7 +3979,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) Surf.PolyColor.s.alpha = alpha; - HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, SHADER_SPRITE, false); // sprite shader + HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, shader, false); if (use_linkdraw_hack) HWR_LinkDrawHackAdd(wallVerts, spr); @@ -3969,7 +4008,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) Surf.PolyColor.s.alpha = alpha; - HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, SHADER_SPRITE, false); // sprite shader + HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, shader, false); if (use_linkdraw_hack) HWR_LinkDrawHackAdd(wallVerts, spr); @@ -4219,6 +4258,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) } { + INT32 shader = SHADER_DEFAULT; FBITFIELD blend = 0; FBITFIELD occlusion; boolean use_linkdraw_hack = false; @@ -4271,7 +4311,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) if (!occlusion) use_linkdraw_hack = true; } - HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, SHADER_SPRITE, false); // sprite shader + if (HWR_UseShader()) + { + shader = SHADER_SPRITE; + blend |= PF_ColorMapped; + } + + HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, shader, false); if (use_linkdraw_hack) HWR_LinkDrawHackAdd(wallVerts, spr); @@ -4282,6 +4328,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) // Sprite drawer for precipitation static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) { + INT32 shader = SHADER_DEFAULT; FBITFIELD blend = 0; FOutVector wallVerts[4]; patch_t *gpatch; // sprite patch converted to hardware @@ -4372,7 +4419,13 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) blend = HWR_GetBlendModeFlag(spr->mobj->blendmode)|PF_Occlude; } - HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, SHADER_SPRITE, false); // sprite shader + if (HWR_UseShader()) + { + shader = SHADER_SPRITE; + blend |= PF_ColorMapped; + } + + HWR_ProcessPolygon(&Surf, wallVerts, 4, blend|PF_Modulated, shader, false); } #endif @@ -6454,24 +6507,29 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, FBITFIELD blendmode = blend; UINT8 alpha = pSurf->PolyColor.s.alpha; // retain the alpha - int shader; + INT32 shader = SHADER_DEFAULT; // Lighting is done here instead so that fog isn't drawn incorrectly on transparent walls after sorting HWR_Lighting(pSurf, lightlevel, wallcolormap); pSurf->PolyColor.s.alpha = alpha; // put the alpha back after lighting - shader = SHADER_WALL; // wall shader - if (blend & PF_Environment) blendmode |= PF_Occlude; // PF_Occlude must be used for solid objects - if (fogwall) + if (HWR_UseShader()) { - blendmode |= PF_Fog; - shader = SHADER_FOG; // fog shader + if (fogwall) + shader = SHADER_FOG; + else + shader = SHADER_WALL; + + blendmode |= PF_ColorMapped; } + if (fogwall) + blendmode |= PF_Fog; + blendmode |= PF_Modulated; // No PF_Occlude means overlapping (incorrect) transparency HWR_ProcessPolygon(pSurf, wallVerts, 4, blendmode, shader, false); } @@ -6647,7 +6705,6 @@ void HWR_DrawScreenFinalTexture(int width, int height) HWD.pfnDrawScreenFinalTexture(width, height); } -// jimita 18032019 static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum) { UINT16 i; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 8cd948eea..56e7efc4e 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -909,7 +909,6 @@ void SetupGLFunc4(void) pgluBuild2DMipmaps = GetGLFunc("gluBuild2DMipmaps"); } -// jimita EXPORT boolean HWRAPI(CompileShaders) (void) { #ifdef GL_SHADERS @@ -2144,32 +2143,34 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD SetBlend(PolyFlags); //TODO: inline (#pragma..) - // PolyColor if (pSurf) { - // If Modulated, mix the surface colour to the texture + // If modulated, mix the surface colour to the texture if (CurrentPolyFlags & PF_Modulated) - { - // Poly color - poly.red = byte2float[pSurf->PolyColor.s.red]; - poly.green = byte2float[pSurf->PolyColor.s.green]; - poly.blue = byte2float[pSurf->PolyColor.s.blue]; - poly.alpha = byte2float[pSurf->PolyColor.s.alpha]; - pglColor4ubv((GLubyte*)&pSurf->PolyColor.s); + + // If the surface is either modulated or colormapped, or both + if (CurrentPolyFlags & (PF_Modulated | PF_ColorMapped)) + { + poly.red = byte2float[pSurf->PolyColor.s.red]; + poly.green = byte2float[pSurf->PolyColor.s.green]; + poly.blue = byte2float[pSurf->PolyColor.s.blue]; + poly.alpha = byte2float[pSurf->PolyColor.s.alpha]; } - // Tint color - tint.red = byte2float[pSurf->TintColor.s.red]; - tint.green = byte2float[pSurf->TintColor.s.green]; - tint.blue = byte2float[pSurf->TintColor.s.blue]; - tint.alpha = byte2float[pSurf->TintColor.s.alpha]; + // Only if the surface is colormapped + if (CurrentPolyFlags & PF_ColorMapped) + { + tint.red = byte2float[pSurf->TintColor.s.red]; + tint.green = byte2float[pSurf->TintColor.s.green]; + tint.blue = byte2float[pSurf->TintColor.s.blue]; + tint.alpha = byte2float[pSurf->TintColor.s.alpha]; - // Fade color - fade.red = byte2float[pSurf->FadeColor.s.red]; - fade.green = byte2float[pSurf->FadeColor.s.green]; - fade.blue = byte2float[pSurf->FadeColor.s.blue]; - fade.alpha = byte2float[pSurf->FadeColor.s.alpha]; + fade.red = byte2float[pSurf->FadeColor.s.red]; + fade.green = byte2float[pSurf->FadeColor.s.green]; + fade.blue = byte2float[pSurf->FadeColor.s.blue]; + fade.alpha = byte2float[pSurf->FadeColor.s.alpha]; + } } // this test is added for new coronas' code (without depth buffer) @@ -2983,7 +2984,6 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglMatrixMode(GL_PROJECTION); pglLoadIdentity(); - // jimita 14042019 // Simulate Software's y-shearing // https://zdoom.org/wiki/Y-shearing if (shearing) From 4891611ab73a7ec60119bfee84d5a164b3127611 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 27 Jan 2021 19:23:04 -0300 Subject: [PATCH 032/160] tRNS chunk fix Fixes a faulty check not properly detecting the presence of a tRNS chunk. --- src/r_picformats.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_picformats.c b/src/r_picformats.c index f87362c76..ac9747426 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -979,8 +979,8 @@ static png_bytep *PNG_Read( for (i = 0; i < 256; i++) { - UINT32 rgb = R_PutRgbaRGBA(pal->red, pal->green, pal->blue, 0xFF); - if (rgb != pMasterPalette[i].rgba) + byteColor_t *curpal = &(pMasterPalette[i].s); + if (pal->red != curpal->red || pal->green != curpal->green || pal->blue != curpal->blue) { usepal = false; break; @@ -996,12 +996,12 @@ static png_bytep *PNG_Read( { png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values); - if (trans && trans_num == 256) + if (trans && trans_num > 0) { INT32 i; for (i = 0; i < trans_num; i++) { - // libpng will transform this image into RGB even if + // libpng will transform this image into RGBA even if // the transparent index does not exist in the image, // and there is no way around that. if (trans[i] < 0xFF) From 8318935811aab1bfbf28cc072f302000417e6680 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 27 Jan 2021 21:23:20 -0300 Subject: [PATCH 033/160] Remove GLMipmap_t.nextmipmap --- src/hardware/hw_data.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index ce6527666..7e56a14d0 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -64,8 +64,6 @@ struct GLMipmap_s struct GLMipmap_s *nextcolormap; struct GLColormap_s *colormap; - - struct GLMipmap_s *nextmipmap; // Linked list of all textures }; typedef struct GLMipmap_s GLMipmap_t; From 3dff1eb1b71af5c483238d63fcf5c6a5adcbecb8 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 11 Feb 2021 00:10:15 +0100 Subject: [PATCH 034/160] Fix consoleplayer returning the server player during joining phase --- src/lua_script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_script.c b/src/lua_script.c index bc88928f3..7fd5a98e6 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -333,7 +333,7 @@ int LUA_PushGlobals(lua_State *L, const char *word) return 1; // local player variables, by popular request } else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1) - if (consoleplayer < 0 || !playeringame[consoleplayer]) + if (!addedtogame || consoleplayer < 0 || !playeringame[consoleplayer]) return 0; LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER); return 1; From dfc1767794c140fc086bcac77c261fcdf39e2270 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 11 Feb 2021 00:24:42 +0100 Subject: [PATCH 035/160] Only call PlayerCmd hooks if added to game --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 6b7356c52..10bec888f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1678,7 +1678,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) // At this point, cmd doesn't contain the final angle yet, // So we need to temporarily transform it so Lua scripters // don't need to handle it differently than in other hooks. - if (gamestate == GS_LEVEL) + if (addedtogame && gamestate == GS_LEVEL) { INT16 extra = ticcmd_oldangleturn[forplayer] - player->oldrelangleturn; INT16 origangle = cmd->angleturn; From 09d911a5b607d889ecd7a6ae182f372badb296b7 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sat, 13 Feb 2021 17:45:20 +0100 Subject: [PATCH 036/160] Revert "Replace all instances of P_AproxDistance with FixedHypot" This reverts commit 75633bde5039106c5f916ca2b4d1bde11d274be9. --- src/b_bot.c | 10 +-- src/g_game.c | 2 +- src/p_ceilng.c | 4 +- src/p_enemy.c | 172 ++++++++++++++++++++++++------------------------ src/p_floor.c | 10 +-- src/p_inter.c | 20 +++--- src/p_map.c | 10 +-- src/p_maputl.h | 1 + src/p_mobj.c | 78 +++++++++++----------- src/p_polyobj.c | 2 +- src/p_setup.c | 2 +- src/p_slopes.c | 2 +- src/p_spec.c | 58 ++++++++-------- src/p_user.c | 56 ++++++++-------- src/r_things.c | 4 +- src/s_sound.c | 4 +- src/st_stuff.c | 2 +- 17 files changed, 219 insertions(+), 218 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index abe69caeb..d3635f32c 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -54,11 +54,11 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) boolean _2d = (tails->flags2 & MF2_TWOD) || twodlevel; fixed_t scale = tails->scale; - fixed_t dist = FixedHypot(sonic->x - tails->x, sonic->y - tails->y); + fixed_t dist = P_AproxDistance(sonic->x - tails->x, sonic->y - tails->y); fixed_t zdist = flip * (sonic->z - tails->z); angle_t ang = sonic->angle; - fixed_t pmom = FixedHypot(sonic->momx, sonic->momy); - fixed_t bmom = FixedHypot(tails->momx, tails->momy); + fixed_t pmom = P_AproxDistance(sonic->momx, sonic->momy); + fixed_t bmom = P_AproxDistance(tails->momx, tails->momy); fixed_t followmax = 128 * 8 * scale; // Max follow distance before AI begins to enter "panic" state fixed_t followthres = 92 * scale; // Distance that AI will try to reach fixed_t followmin = 32 * scale; @@ -81,7 +81,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd) if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) { boolean isrelevant = (sonic->player->powers[pw_carry] == CR_MACESPIN || sonic->player->powers[pw_carry] == CR_GENERIC); - dist = FixedHypot(tails->x-sonic->x, tails->y-sonic->y); + dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y); if (sonic->player->cmd.buttons & BT_JUMP && (sonic->player->pflags & PF_JUMPED) && isrelevant) cmd->buttons |= BT_JUMP; if (isrelevant) @@ -496,7 +496,7 @@ boolean B_CheckRespawn(player_t *player) } // If you can't see Sonic, I guess we should? - if (!P_CheckSight(sonic, tails) && FixedHypot(FixedHypot(tails->x-sonic->x, tails->y-sonic->y), tails->z-sonic->z) > FixedMul(1024*FRACUNIT, tails->scale)) + if (!P_CheckSight(sonic, tails) && P_AproxDistance(P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y), tails->z-sonic->z) > FixedMul(1024*FRACUNIT, tails->scale)) return true; return false; } diff --git a/src/g_game.c b/src/g_game.c index 10bec888f..2b304b4fd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1423,7 +1423,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) newtarget = P_SpawnMobj(ticcmd_ztargetfocus[forplayer]->x, ticcmd_ztargetfocus[forplayer]->y, ticcmd_ztargetfocus[forplayer]->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]); - if (FixedHypot( + if (P_AproxDistance( player->mo->x - ticcmd_ztargetfocus[forplayer]->x, player->mo->y - ticcmd_ztargetfocus[forplayer]->y ) > 50*player->mo->scale) diff --git a/src/p_ceilng.c b/src/p_ceilng.c index 2168d1d78..f12499d5c 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -468,7 +468,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) // Linedef executor excellence case moveCeilingByFrontSector: - ceiling->speed = FixedHypot(line->dx, line->dy); + ceiling->speed = P_AproxDistance(line->dx, line->dy); ceiling->speed = FixedDiv(ceiling->speed,8*FRACUNIT); if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up { @@ -547,7 +547,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) */ case bounceCeiling: - ceiling->speed = FixedHypot(line->dx, line->dy); // same speed as elevateContinuous + ceiling->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous ceiling->speed = FixedDiv(ceiling->speed,4*FRACUNIT); ceiling->origspeed = ceiling->speed; if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up diff --git a/src/p_enemy.c b/src/p_enemy.c index 0e20aac10..3e7f52a3f 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -334,7 +334,7 @@ boolean P_CheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); + dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); if (dist >= FixedMul(MELEERANGE - 20*FRACUNIT, actor->scale) + pl->radius) return false; @@ -360,7 +360,7 @@ boolean P_JetbCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); + dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); if (dist >= (actor->radius + pl->radius)*2) return false; @@ -389,7 +389,7 @@ boolean P_FaceStabCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); + dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); if (dist >= (actor->radius + pl->radius)*4) return false; @@ -413,7 +413,7 @@ boolean P_SkimCheckMeleeRange(mobj_t *actor) return false; pl = actor->target; - dist = FixedHypot(pl->x-actor->x, pl->y-actor->y); + dist = P_AproxDistance(pl->x-actor->x, pl->y-actor->y); if (dist >= FixedMul(MELEERANGE - 20*FRACUNIT, actor->scale) + pl->radius) return false; @@ -449,7 +449,7 @@ boolean P_CheckMissileRange(mobj_t *actor) return false; // OPTIMIZE: get this from a global checksight - dist = FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale); + dist = P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) - FixedMul(64*FRACUNIT, actor->scale); if (!actor->info->meleestate) dist -= FixedMul(128*FRACUNIT, actor->scale); // no melee attack, so fire more @@ -750,7 +750,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed continue; // Ignore uncontrolled bodies if (dist > 0 - && FixedHypot(FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) + && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) continue; // Too far away if (!allaround) @@ -758,7 +758,7 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed an = R_PointToAngle2(actor->x, actor->y, player->mo->x, player->mo->y) - actor->angle; if (an > ANGLE_90 && an < ANGLE_270) { - dist = FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y); + dist = P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y); // if real close, react anyway if (dist > FixedMul(MELEERANGE, actor->scale)) continue; // behind back @@ -821,7 +821,7 @@ static boolean P_LookForShield(mobj_t *actor) continue; if ((player->powers[pw_shield] & SH_PROTECTELECTRIC) - && (FixedHypot(FixedHypot(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) + && (P_AproxDistance(P_AproxDistance(actor->x-player->mo->x, actor->y-player->mo->y), actor->z-player->mo->z) < FixedMul(RING_DIST, player->mo->scale))) { P_SetTarget(&actor->tracer, player->mo); @@ -1548,8 +1548,8 @@ void A_PointyThink(mobj_t *actor) } else { - if (FixedHypot(players[i].mo->x - actor->x, players[i].mo->y - actor->y) < - FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y)) + if (P_AproxDistance(players[i].mo->x - actor->x, players[i].mo->y - actor->y) < + P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y)) player = &players[i]; } } @@ -1561,7 +1561,7 @@ void A_PointyThink(mobj_t *actor) P_SetTarget(&actor->target, player->mo); A_FaceTarget(actor); - if (FixedHypot(player->mo->x - actor->x, player->mo->y - actor->y) < FixedHypot(player->mo->x + player->mo->momx - actor->x, player->mo->y + player->mo->momy - actor->y)) + if (P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y) < P_AproxDistance(player->mo->x + player->mo->momx - actor->x, player->mo->y + player->mo->momy - actor->y)) sign = -1; // Player is moving away else sign = 1; // Player is moving closer @@ -1638,7 +1638,7 @@ static void P_ParabolicMove(mobj_t *actor, fixed_t x, fixed_t y, fixed_t z, fixe y -= actor->y; z -= actor->z; - dh = FixedHypot(x, y); + dh = P_AproxDistance(x, y); actor->momx = FixedMul(FixedDiv(x, dh), speed); actor->momy = FixedMul(FixedDiv(y, dh), speed); @@ -1706,7 +1706,7 @@ void A_HoodThink(mobj_t *actor) } dx = (actor->target->x - actor->x), dy = (actor->target->y - actor->y), dz = (actor->target->z - actor->z); - dm = FixedHypot(dx, dy); + dm = P_AproxDistance(dx, dy); // Target dangerously close to robohood, retreat then. if ((dm < 256<target || !crab->info->missilestate || (statenum_t)(crab->state-states) == crab->info->missilestate) return; - if (((ang + ANG1) < ANG2) || FixedHypot(crab->x - crab->target->x, crab->y - crab->target->y) < 333*crab->scale) + if (((ang + ANG1) < ANG2) || P_AproxDistance(crab->x - crab->target->x, crab->y - crab->target->y) < 333*crab->scale) P_SetMobjState(crab, crab->info->missilestate); } @@ -2703,7 +2703,7 @@ void A_LobShot(mobj_t *actor) shot->angle = an = actor->angle; an >>= ANGLETOFINESHIFT; - dist = FixedHypot(actor->target->x - shot->x, actor->target->y - shot->y); + dist = P_AproxDistance(actor->target->x - shot->x, actor->target->y - shot->y); horizontal = dist / airtime; vertical = FixedMul((gravity*airtime)/2, shot->scale); @@ -2721,7 +2721,7 @@ void A_LobShot(mobj_t *actor) diff = actor->z - actor->target->z; { - launchhyp = FixedHypot(horizontal, vertical); + launchhyp = P_AproxDistance(horizontal, vertical); orig = FixedMul(FixedDiv(vertical, horizontal), diff); @@ -3325,7 +3325,7 @@ void A_SkullAttack(mobj_t *actor) S_StartSound(actor, actor->info->activesound); A_FaceTarget(actor); - dist = FixedHypot(dest->x - actor->x, dest->y - actor->y); + dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y); if (locvar1 == 1) actor->angle += ANGLE_180; @@ -3443,7 +3443,7 @@ void A_BossZoom(mobj_t *actor) an = actor->angle >> ANGLETOFINESHIFT; actor->momx = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINECOSINE(an)); actor->momy = FixedMul(FixedMul(actor->info->speed*5*FRACUNIT, actor->scale), FINESINE(an)); - dist = FixedHypot(dest->x - actor->x, dest->y - actor->y); + dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y); dist = dist / FixedMul(actor->info->speed*5*FRACUNIT, actor->scale); if (dist < 1) @@ -3599,7 +3599,7 @@ void A_1upThinker(mobj_t *actor) if ((netgame || multiplayer) && players[i].playerstate != PST_LIVE) continue; - temp = FixedHypot(players[i].mo->x-actor->x, players[i].mo->y-actor->y); + temp = P_AproxDistance(players[i].mo->x-actor->x, players[i].mo->y-actor->y); if (temp < dist) { @@ -4144,8 +4144,8 @@ bossjustdie: // If this one's further then the last one, don't go for it. if (mo->target && - FixedHypot(FixedHypot(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > - FixedHypot(FixedHypot(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) + P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > + P_AproxDistance(P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) continue; // Otherwise... Do! @@ -4536,7 +4536,7 @@ void A_BubbleSpawn(mobj_t *actor) // Don't spawn bubbles unless a player is relatively close by (var1). for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x - players[i].mo->x, actor->y - players[i].mo->y) < (locvar1<x-target->x, actor->y-target->y)>>FRACBITS; + dist = P_AproxDistance(actor->x-target->x, actor->y-target->y)>>FRACBITS; if (dist > FixedMul((locvar2 & 65535), actor->scale)) return; @@ -4800,7 +4800,7 @@ void A_FishJump(mobj_t *actor) // Don't spawn trail unless a player is nearby. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) + && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) break; // Stop looking. if (i < MAXPLAYERS) { @@ -4905,7 +4905,7 @@ void A_ThrownRing(mobj_t *actor) // magnetic player. If he gets too far away, make // sure to stop the attraction! if ((!actor->tracer->health) || (actor->tracer->player && (actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC) - && FixedHypot(FixedHypot(actor->tracer->x-actor->x, + && P_AproxDistance(P_AproxDistance(actor->tracer->x-actor->x, actor->tracer->y-actor->y), actor->tracer->z-actor->z) > FixedMul(RING_DIST/4, actor->tracer->scale))) { P_SetTarget(&actor->tracer, NULL); @@ -4964,7 +4964,7 @@ void A_ThrownRing(mobj_t *actor) continue; } - dist = FixedHypot(FixedHypot(player->mo->x-actor->x, + dist = P_AproxDistance(P_AproxDistance(player->mo->x-actor->x, player->mo->y-actor->y), player->mo->z-actor->z); // check distance @@ -5345,7 +5345,7 @@ void A_JetChase(mobj_t *actor) return; // got a new target // If the player is over 3072 fracunits away, then look for another player - if (FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), + if (P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z) > FixedMul(3072*FRACUNIT, actor->scale) && P_LookForPlayers(actor, true, false, FixedMul(3072*FRACUNIT, actor->scale))) { return; // got a new target @@ -5460,7 +5460,7 @@ void A_JetgShoot(mobj_t *actor) if (actor->reactiontime) return; - dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); + dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); if (dist > FixedMul(actor->info->painchance*FRACUNIT, actor->scale)) return; @@ -5497,7 +5497,7 @@ void A_ShootBullet(mobj_t *actor) if (!actor->target) return; - dist = FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); + dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); if (dist > FixedMul(actor->info->painchance*FRACUNIT, actor->scale)) return; @@ -5522,7 +5522,7 @@ static boolean PIT_MinusCarry(mobj_t *thing) if (!(thing->flags & (MF_PUSHABLE|MF_ENEMY))) return true; - if (FixedHypot(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) + if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) return true; if (abs(thing->z - minus->z) > minus->height) @@ -5566,7 +5566,7 @@ void A_MinusDigging(mobj_t *actor) P_TryMove(par, x, y, false); // If close enough, prepare to attack - if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2) + if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2) { P_SetMobjState(actor, actor->info->meleestate); P_TryMove(actor, actor->target->x, actor->target->y, false); @@ -5858,7 +5858,7 @@ void A_DetonChase(mobj_t *actor) } }*/ // movedir is up/down angle: how much it has to go up as it goes over to the player - xydist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + xydist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); exact = R_PointToAngle2(0, 0, xydist, actor->tracer->z - actor->z); actor->movedir = exact; /*if (exact != actor->movedir) @@ -5880,7 +5880,7 @@ void A_DetonChase(mobj_t *actor) // check for melee attack if (actor->tracer) { - if (FixedHypot(actor->tracer->x-actor->x, actor->tracer->y-actor->y) < actor->radius+actor->tracer->radius) + if (P_AproxDistance(actor->tracer->x-actor->x, actor->tracer->y-actor->y) < actor->radius+actor->tracer->radius) { if (!((actor->tracer->z > actor->z + actor->height) || (actor->z > actor->tracer->z + actor->tracer->height))) { @@ -5891,7 +5891,7 @@ void A_DetonChase(mobj_t *actor) } // chase towards player - if ((dist = FixedHypot(xydist, actor->tracer->z-actor->z)) + if ((dist = P_AproxDistance(xydist, actor->tracer->z-actor->z)) > FixedMul((actor->info->painchance << FRACBITS), actor->scale)) { P_SetTarget(&actor->tracer, NULL); // Too far away @@ -5938,7 +5938,7 @@ void A_DetonChase(mobj_t *actor) actor->momy = FixedMul(xyspeed, FINESINE(exact)); // Variable re-use - xyspeed = (FixedHypot(actor->tracer->x - actor->x, FixedHypot(actor->tracer->y - actor->y, actor->tracer->z - actor->z))>>(FRACBITS+6)); + xyspeed = (P_AproxDistance(actor->tracer->x - actor->x, P_AproxDistance(actor->tracer->y - actor->y, actor->tracer->z - actor->z))>>(FRACBITS+6)); if (xyspeed < 1) xyspeed = 1; @@ -6086,7 +6086,7 @@ void A_UnidusBall(mobj_t *actor) if (actor->movecount) { - if (FixedHypot(actor->momx, actor->momy) < FixedMul(actor->info->damage/2, actor->scale)) + if (P_AproxDistance(actor->momx, actor->momy) < FixedMul(actor->info->damage/2, actor->scale)) P_ExplodeMissile(actor); return; } @@ -6118,7 +6118,7 @@ void A_UnidusBall(mobj_t *actor) if (locvar1 == 1 && canthrow) { - if (FixedHypot(actor->target->target->x - actor->target->x, actor->target->target->y - actor->target->y) > FixedMul(MISSILERANGE>>1, actor->scale) + if (P_AproxDistance(actor->target->target->x - actor->target->x, actor->target->target->y - actor->target->y) > FixedMul(MISSILERANGE>>1, actor->scale) || !P_CheckSight(actor, actor->target->target)) return; @@ -6193,7 +6193,7 @@ void A_RockSpawn(mobj_t *actor) return; } - dist = FixedHypot(line->dx, line->dy)/16; + dist = P_AproxDistance(line->dx, line->dy)/16; if (dist < 1) dist = 1; @@ -6359,7 +6359,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) return; } - dist = FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y); + dist = P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y); if (actor->target->player && (!hovermode || actor->reactiontime <= 2*TICRATE)) { @@ -6396,7 +6396,7 @@ void A_CrawlaCommanderThink(mobj_t *actor) { fixed_t mom; P_Thrust(actor, actor->angle, 2*actor->scale); - mom = FixedHypot(actor->momx, actor->momy); + mom = P_AproxDistance(actor->momx, actor->momy); if (mom > 20*actor->scale) { mom += 20*actor->scale; @@ -6484,7 +6484,7 @@ void A_RingExplode(mobj_t *actor) if (mo2 == actor) // Don't explode yourself! Endless loop! continue; - if (FixedHypot(FixedHypot(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > FixedMul(actor->info->painchance, actor->scale)) + if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > FixedMul(actor->info->painchance, actor->scale)) continue; if (mo2->flags & MF_SHOOTABLE) @@ -7083,7 +7083,7 @@ nomissile: } // chase towards player - if (FixedHypot(actor->target->x-actor->x, actor->target->y-actor->y) > actor->radius+actor->target->radius) + if (P_AproxDistance(actor->target->x-actor->x, actor->target->y-actor->y) > actor->radius+actor->target->radius) { if (--actor->movecount < 0 || !P_Move(actor, actor->info->speed)) P_NewChaseDir(actor); @@ -7322,7 +7322,7 @@ void A_Boss7Chase(mobj_t *actor) // Self-adjust if stuck on the edge if (actor->tracer) { - if (FixedHypot(actor->x - actor->tracer->x, actor->y - actor->tracer->y) > 128*FRACUNIT - actor->radius) + if (P_AproxDistance(actor->x - actor->tracer->x, actor->y - actor->tracer->y) > 128*FRACUNIT - actor->radius) P_InstaThrust(actor, R_PointToAngle2(actor->x, actor->y, actor->tracer->x, actor->tracer->y), FRACUNIT); } @@ -7358,7 +7358,7 @@ void A_Boss7Chase(mobj_t *actor) if (players[i].mo->health <= 0) continue; - if (FixedHypot(players[i].mo->x - actor->x, players[i].mo->y - actor->y) > actor->radius) + if (P_AproxDistance(players[i].mo->x - actor->x, players[i].mo->y - actor->y) > actor->radius) continue; if (players[i].mo->z > actor->z + actor->height - 2*FRACUNIT @@ -7481,7 +7481,7 @@ void A_Boss2PogoSFX(mobj_t *actor) } // Boing! - if (FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(256*FRACUNIT, actor->scale)) + if (P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(256*FRACUNIT, actor->scale)) { actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); P_InstaThrust(actor, actor->angle, FixedMul(actor->info->speed, actor->scale)); @@ -7514,7 +7514,7 @@ void A_Boss2PogoTarget(mobj_t *actor) return; if (!actor->target || !(actor->target->flags & MF_SHOOTABLE) || (actor->target->player && actor->target->player->powers[pw_flashing]) - || FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) >= FixedMul(512*FRACUNIT, actor->scale)) + || P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) >= FixedMul(512*FRACUNIT, actor->scale)) { // look for a new target if (P_LookForPlayers(actor, true, false, 512*FRACUNIT)) @@ -7535,7 +7535,7 @@ void A_Boss2PogoTarget(mobj_t *actor) P_InstaThrust(actor, actor->angle+ANGLE_180, FixedMul(FixedMul(actor->info->speed,(locvar2)), actor->scale)); // Move at wandering speed } // Try to land on top of the player. - else if (FixedHypot(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(512*FRACUNIT, actor->scale)) + else if (P_AproxDistance(actor->x-actor->target->x, actor->y-actor->target->y) < FixedMul(512*FRACUNIT, actor->scale)) { fixed_t airtime, gravityadd, zoffs, height; @@ -7569,7 +7569,7 @@ void A_Boss2PogoTarget(mobj_t *actor) airtime = FixedDiv((-actor->momz - FixedSqrt(FixedMul(actor->momz,actor->momz)+zoffs)), gravityadd)<<1; // to try and land on their head rather than on their feet actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y); - P_InstaThrust(actor, actor->angle, FixedDiv(FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y), airtime)); + P_InstaThrust(actor, actor->angle, FixedDiv(P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y), airtime)); } // Wander semi-randomly towards the player to get closer. else @@ -7640,7 +7640,7 @@ void A_TurretFire(mobj_t *actor) while (P_SupermanLook4Players(actor) && count < MAXPLAYERS) { - if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < dist) + if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < dist) { actor->flags2 |= MF2_FIRING; actor->extravalue1 = locvar1; @@ -7678,7 +7678,7 @@ void A_SuperTurretFire(mobj_t *actor) while (P_SupermanLook4Players(actor) && count < MAXPLAYERS) { - if (FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) < dist) + if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < dist) { actor->flags2 |= MF2_FIRING; actor->flags2 |= MF2_SUPERFIRE; @@ -7799,7 +7799,7 @@ void A_BuzzFly(mobj_t *actor) } // If the player is over 3072 fracunits away, then look for another player - if (FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), + if (P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z) > FixedMul(3072*FRACUNIT, actor->scale)) { if (multiplayer || netgame) @@ -7818,7 +7818,7 @@ void A_BuzzFly(mobj_t *actor) else realspeed = FixedMul(actor->info->speed, actor->scale); - dist = FixedHypot(FixedHypot(actor->target->x - actor->x, + dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z - actor->z); if (dist < 1) @@ -8176,7 +8176,7 @@ void A_Boss3Path(mobj_t *actor) if (actor->target->x == actor->x && actor->target->y == actor->y) { - dist = FixedHypot(FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z + actor->movefactor - actor->z); + dist = P_AproxDistance(P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y), actor->target->z + actor->movefactor - actor->z); if (dist < 1) dist = 1; @@ -9586,7 +9586,7 @@ void A_SetObjectTypeState(mobj_t *actor) if (mo2->type == (mobjtype_t)loc2lw) { - dist = FixedHypot(mo2->x - actor->x, mo2->y - actor->y); + dist = P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y); if (mo2->health > 0) { @@ -10092,9 +10092,9 @@ void A_CheckRange(mobj_t *actor) return; if (!(locvar1 >> 16)) //target - dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); + dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); else //tracer - dist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + dist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); if (dist <= FixedMul((locvar1 & 65535)*FRACUNIT, actor->scale)) P_SetMobjState(actor, locvar2); @@ -10156,16 +10156,16 @@ void A_CheckTrueRange(mobj_t *actor) if (!(locvar1 >> 16)) // target { height = actor->target->z - actor->z; - dist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); + dist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); } else // tracer { height = actor->tracer->z - actor->z; - dist = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + dist = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); } - l = FixedHypot(dist, height); + l = P_AproxDistance(dist, height); if (l <= FixedMul((locvar1 & 65535)*FRACUNIT, actor->scale)) P_SetMobjState(actor, locvar2); @@ -10210,7 +10210,7 @@ void A_CheckThingCount(mobj_t *actor) if (mo2->type == (mobjtype_t)loc1up) { - dist = FixedHypot(mo2->x - actor->x, mo2->y - actor->y); + dist = P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y); if (loc2up == 0) count++; @@ -10819,7 +10819,7 @@ void A_HomingChase(mobj_t *actor) actor->angle = R_PointToAngle2(actor->x, actor->y, dest->x, dest->y); - dist = FixedHypot(FixedHypot(dest->x - actor->x, dest->y - actor->y), dest->z - actor->z); + dist = P_AproxDistance(P_AproxDistance(dest->x - actor->x, dest->y - actor->y), dest->z - actor->z); if (dist < 1) dist = 1; @@ -11405,14 +11405,14 @@ void A_BrakLobShot(mobj_t *actor) g = gravity; // Look up distance between actor and its target - x = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); + x = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); if (!aimDirect) { // Distance should actually be a third of the way over x = FixedDiv(x, 3<x + P_ReturnThrustX(actor, actor->angle, x); newTargetY = actor->y + P_ReturnThrustY(actor, actor->angle, x); - x = FixedHypot(newTargetX - actor->x, newTargetY - actor->y); + x = P_AproxDistance(newTargetX - actor->x, newTargetY - actor->y); // Look up height difference between actor and the ground 1/3 of the way to its target y = P_FloorzAtPos(newTargetX, newTargetY, actor->target->z, actor->target->height) - (actor->z + FixedMul(locvar2*FRACUNIT, actor->scale)); } @@ -11764,7 +11764,7 @@ void A_FlickyCenter(mobj_t *actor) P_LookForPlayers(actor, true, false, actor->extravalue1); - if (actor->target && FixedHypot(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1) + if (actor->target && P_AproxDistance(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1) { actor->extravalue2 = 1; P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); @@ -11820,7 +11820,7 @@ void A_FlickyAim(mobj_t *actor) if ((actor->momx == actor->momy && actor->momy == 0) || (actor->target && P_IsFlickyCenter(actor->target->type) && actor->target->extravalue1 && (actor->target->flags & MF_SLIDEME) - && FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) >= actor->target->extravalue1)) + && P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) >= actor->target->extravalue1)) flickyhitwall = true; P_InternalFlickyBubble(actor); @@ -11842,12 +11842,12 @@ void A_FlickyAim(mobj_t *actor) actor->movedir *= -1; posvar = ((R_PointToAngle2(actor->target->x, actor->target->y, actor->x, actor->y) + actor->movedir*locvar1) >> ANGLETOFINESHIFT) & FINEMASK; - chasevar = FixedSqrt(max(FRACUNIT, FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y) - locvar2)) + locvar2; + chasevar = FixedSqrt(max(FRACUNIT, P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y) - locvar2)) + locvar2; chasex = actor->target->x + FixedMul(FINECOSINE(posvar), chasevar); chasey = actor->target->y + FixedMul(FINESINE(posvar), chasevar); - if (FixedHypot(chasex - actor->x, chasey - actor->y)) + if (P_AproxDistance(chasex - actor->x, chasey - actor->y)) actor->angle = R_PointToAngle2(actor->x, actor->y, chasex, chasey); } else if (flickyhitwall) @@ -11889,7 +11889,7 @@ void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fi targetdist = 16*FRACUNIT; //Default! if (actor->target && abs(chasez - actor->z) > targetdist) - targetdist = FixedHypot(actor->target->x - actor->x, actor->target->y - actor->y); + targetdist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); if (actor->target && P_IsFlickyCenter(actor->target->type) @@ -11967,7 +11967,7 @@ void A_FlickyCoast(mobj_t *actor) actor->momy = (11*actor->momy)/12; actor->momz = (11*actor->momz)/12; - if (FixedHypot(FixedHypot(actor->momx, actor->momy), actor->momz) < locvar1) + if (P_AproxDistance(P_AproxDistance(actor->momx, actor->momy), actor->momz) < locvar1) P_SetMobjState(actor, locvar2); return; @@ -12231,7 +12231,7 @@ void A_Boss5Jump(mobj_t *actor) g = gravity; // Look up distance between actor and its tracer - x = FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y); + x = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); // Look up height difference between actor and its tracer y = actor->tracer->z - actor->z; @@ -12352,7 +12352,7 @@ void A_MineExplode(mobj_t *actor) actor->z+P_RandomRange(((actor->eflags & MFE_UNDERWATER) ? -dist : 0), dist)*FRACUNIT, type); fixed_t dx = b->x - actor->x, dy = b->y - actor->y, dz = b->z - actor->z; - fixed_t dm = FixedHypot(dz, FixedHypot(dy, dx)); + fixed_t dm = P_AproxDistance(dz, P_AproxDistance(dy, dx)); b->momx = FixedDiv(dx, dm)*3; b->momy = FixedDiv(dy, dm)*3; b->momz = FixedDiv(dz, dm)*3; @@ -12384,7 +12384,7 @@ void A_MineRange(mobj_t *actor) if (!actor->target) return; - dm = FixedHypot(actor->z - actor->target->z, FixedHypot(actor->y - actor->target->y, actor->x - actor->target->x)); + dm = P_AproxDistance(actor->z - actor->target->z, P_AproxDistance(actor->y - actor->target->y, actor->x - actor->target->x)); if ((dm>>FRACBITS) < locvar1) P_SetMobjState(actor, actor->info->meleestate); } @@ -12510,7 +12510,7 @@ void A_MultiShotDist(mobj_t *actor) // Don't spawn dust unless a player is relatively close by (var1). for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (1600<x - players[i].mo->x, actor->y - players[i].mo->y) < (1600<tracer && - FixedHypot(FixedHypot(actor->x - mo2->x, actor->y - mo2->y), actor->z - mo2->z) > - FixedHypot(FixedHypot(actor->x - actor->tracer->x, actor->y - actor->tracer->y), actor->z - actor->tracer->z)) + P_AproxDistance(P_AproxDistance(actor->x - mo2->x, actor->y - mo2->y), actor->z - mo2->z) > + P_AproxDistance(P_AproxDistance(actor->x - actor->tracer->x, actor->y - actor->tracer->y), actor->z - actor->tracer->z)) continue; // Otherwise... Do! @@ -13058,7 +13058,7 @@ void A_Boss5CheckOnGround(mobj_t *actor) P_SetMobjState(actor, locvar1); } - if (actor->tracer && FixedHypot(actor->tracer->x - actor->x, actor->tracer->y - actor->y) < 2*actor->radius) + if (actor->tracer && P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y) < 2*actor->radius) { actor->momx = (4*actor->momx)/5; actor->momy = (4*actor->momy)/5; @@ -13518,7 +13518,7 @@ static boolean PIT_TNTExplode(mobj_t *nearby) dx = nearby->x - barrel->x; dy = nearby->y - barrel->y; dz = nearby->z - barrel->z + (nearby->height - barrel->height/2)/2; - dm = FixedHypot(FixedHypot(dx, dy), dz); + dm = P_AproxDistance(P_AproxDistance(dx, dy), dz); if (dm >= exploderadius || !P_CheckSight(barrel, nearby)) // out of range or not visible return true; @@ -13921,7 +13921,7 @@ void A_SnapperThinker(mobj_t *actor) // Look for nearby, valid players to chase angrily at. if ((actor->target || P_LookForPlayers(actor, true, false, 1024*FRACUNIT)) - && FixedHypot(actor->target->x - xs, actor->target->y - ys) < 2048*FRACUNIT + && P_AproxDistance(actor->target->x - xs, actor->target->y - ys) < 2048*FRACUNIT && abs(actor->target->z - actor->z) < 80*FRACUNIT && P_CheckSight(actor, actor->target)) { @@ -13936,7 +13936,7 @@ void A_SnapperThinker(mobj_t *actor) y1 = ys; } - dist = FixedHypot(x1 - x0, y1 - y0); + dist = P_AproxDistance(x1 - x0, y1 - y0); // The snapper either chases what it considers to be a nearby player, or instead decides to go back to its spawnpoint. if (chasing || dist > 32*FRACUNIT) @@ -14121,7 +14121,7 @@ void A_LavafallRocks(mobj_t *actor) // Don't spawn rocks unless a player is relatively close by. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed >> 1)) + && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed >> 1)) break; // Stop looking. if (i < MAXPLAYERS) @@ -14155,7 +14155,7 @@ void A_LavafallLava(mobj_t *actor) // Don't spawn lava unless a player is nearby. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) + && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (actor->info->speed)) break; // Stop looking. if (i >= MAXPLAYERS) @@ -14285,7 +14285,7 @@ void A_RolloutSpawn(mobj_t *actor) if (!(actor->target) || P_MobjWasRemoved(actor->target) - || FixedHypot(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) + || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; @@ -14313,7 +14313,7 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; // number of frames the mobj cycles through fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); // used to calculate when to change frame - fixed_t speed = FixedHypot(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); + fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); if (LUA_CallAction(A_ROLLOUTROCK, actor)) @@ -14355,7 +14355,7 @@ void A_RolloutRock(mobj_t *actor) actor->momy = FixedMul(actor->momy, locvar1); } - speed = FixedHypot(actor->momx, actor->momy); // recalculate speed for visual rolling + speed = P_AproxDistance(actor->momx, actor->momy); // recalculate speed for visual rolling if (speed < actor->scale >> 1) // stop moving if speed is insignificant { @@ -14477,7 +14477,7 @@ void A_DragonSegment(mobj_t *actor) return; } - dist = FixedHypot(FixedHypot(actor->x - target->x, actor->y - target->y), actor->z - target->z); + dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z); radius = actor->radius + target->radius; hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y); zangle = R_PointToAngle2(0, target->z, dist, actor->z); diff --git a/src/p_floor.c b/src/p_floor.c index de8f5d4e8..7c26065b5 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1164,7 +1164,7 @@ void T_ThwompSector(thwomp_t *thwomp) if (players[i].mo->z > thwomp->sector->ceilingheight) continue; - if (FixedHypot(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96*FRACUNIT) + if (P_AproxDistance(thwompx - players[i].mo->x, thwompy - players[i].mo->y) > 96*FRACUNIT) continue; thwomp->direction = -1; @@ -1892,7 +1892,7 @@ void EV_DoFloor(line_t *line, floor_e floortype) // Linedef executor command, linetype 106. // Line length = speed, front sector floor = destination height. case moveFloorByFrontSector: - dofloor->speed = FixedHypot(line->dx, line->dy); + dofloor->speed = P_AproxDistance(line->dx, line->dy); dofloor->speed = FixedDiv(dofloor->speed,8*FRACUNIT); dofloor->floordestheight = line->frontsector->floorheight; @@ -1958,7 +1958,7 @@ void EV_DoFloor(line_t *line, floor_e floortype) // Linetypes 2/3. // Move floor up and down indefinitely like the old elevators. case bounceFloor: - dofloor->speed = FixedHypot(line->dx, line->dy); // same speed as elevateContinuous + dofloor->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous dofloor->speed = FixedDiv(dofloor->speed,4*FRACUNIT); dofloor->origspeed = dofloor->speed; // it gets slowed down at the top and bottom dofloor->floordestheight = line->frontsector->floorheight; @@ -2104,7 +2104,7 @@ void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) case elevateContinuous: if (customspeed) { - elevator->origspeed = FixedHypot(line->dx, line->dy); + elevator->origspeed = P_AproxDistance(line->dx, line->dy); elevator->origspeed = FixedDiv(elevator->origspeed,4*FRACUNIT); elevator->speed = elevator->origspeed; } @@ -2266,7 +2266,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) if (flags & ML_EFFECT1) { - P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(FixedHypot(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor)); + P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(P_AproxDistance(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor)); P_SetObjectMomZ(spawned, FixedDiv((c - bottomz), heightfactor), false); } diff --git a/src/p_inter.c b/src/p_inter.c index be4133af5..e9a16a3dd 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1002,7 +1002,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) x = (x/count)<x - x, special->y - y), special->z - z); + gatherradius = P_AproxDistance(P_AproxDistance(special->x - x, special->y - y), special->z - z); P_RemoveMobj(special); if (player->powers[pw_nights_superloop]) @@ -1028,7 +1028,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) mo2 = (mobj_t *)th; - if (FixedHypot(FixedHypot(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius) + if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius) continue; if (mo2->flags & MF_SHOOTABLE) @@ -1450,8 +1450,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) fixed_t touchx, touchy, touchspeed; angle_t angle; - if (FixedHypot(toucher->x-special->x, toucher->y-special->y) > - FixedHypot((toucher->x-toucher->momx)-special->x, (toucher->y-toucher->momy)-special->y)) + if (P_AproxDistance(toucher->x-special->x, toucher->y-special->y) > + P_AproxDistance((toucher->x-toucher->momx)-special->x, (toucher->y-toucher->momy)-special->y)) { touchx = toucher->x + toucher->momx; touchy = toucher->y + toucher->momy; @@ -1463,7 +1463,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } angle = R_PointToAngle2(special->x, special->y, touchx, touchy); - touchspeed = FixedHypot(toucher->momx, toucher->momy); + touchspeed = P_AproxDistance(toucher->momx, toucher->momy); toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed); @@ -1509,7 +1509,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_EGGSHIELD: { angle_t angle = R_PointToAngle2(special->x, special->y, toucher->x, toucher->y) - special->angle; - fixed_t touchspeed = FixedHypot(toucher->momx, toucher->momy); + fixed_t touchspeed = P_AproxDistance(toucher->momx, toucher->momy); if (touchspeed < special->scale) touchspeed = special->scale; @@ -1590,7 +1590,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { special->momx = toucher->momx; special->momy = toucher->momy; - special->momz = FixedHypot(toucher->momx, toucher->momy)/4; + special->momz = P_AproxDistance(toucher->momx, toucher->momy)/4; if (toucher->momz > 0) special->momz += toucher->momz/8; @@ -1762,7 +1762,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = toucher->tracer->momx/2; toucher->momy = toucher->tracer->momy/2; - toucher->momz = toucher->tracer->momz + FixedHypot(toucher->tracer->momx, toucher->tracer->momy)/2; + toucher->momz = toucher->tracer->momz + P_AproxDistance(toucher->tracer->momx, toucher->tracer->momy)/2; P_ResetPlayer(player); player->pflags &= ~PF_APPLYAUTOBRAKE; P_SetPlayerMobjState(toucher, S_PLAY_FALL); @@ -2666,7 +2666,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget case MT_BUGGLE: if (inflictor && inflictor->player // did a player kill you? Spawn relative to the player so they're bound to get it - && FixedHypot(inflictor->x - target->x, inflictor->y - target->y) <= inflictor->radius + target->radius + FixedMul(8*FRACUNIT, inflictor->scale) // close enough? + && P_AproxDistance(inflictor->x - target->x, inflictor->y - target->y) <= inflictor->radius + target->radius + FixedMul(8*FRACUNIT, inflictor->scale) // close enough? && inflictor->z <= target->z + target->height + FixedMul(8*FRACUNIT, inflictor->scale) && inflictor->z + inflictor->height >= target->z - FixedMul(8*FRACUNIT, inflictor->scale)) mo = P_SpawnMobj(inflictor->x + inflictor->momx, inflictor->y + inflictor->momy, inflictor->z + (inflictor->height / 2) + inflictor->momz, MT_EXTRALARGEBUBBLE); @@ -3305,7 +3305,7 @@ static void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, I // to recover if (inflictor->flags2 & MF2_SCATTER && source) { - fixed_t dist = FixedHypot(FixedHypot(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); + fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; diff --git a/src/p_map.c b/src/p_map.c index b4fa2e9e0..a1cad524e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -776,7 +776,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SOLID) S_StartSound(tmthing, thing->info->deathsound); for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext) - if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || FixedHypot(FixedHypot(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) + if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) P_KillMobj(iter, tmthing, tmthing, 0); } else @@ -815,7 +815,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->flags & MF_SOLID) S_StartSound(tmthing, thing->info->deathsound); for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext) - if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || FixedHypot(FixedHypot(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) + if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) P_KillMobj(iter, tmthing, tmthing, 0); return true; } @@ -3063,7 +3063,7 @@ static void P_HitCameraSlideLine(line_t *ld, camera_t *thiscam) lineangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT; - movelen = FixedHypot(tmxmove, tmymove); + movelen = P_AproxDistance(tmxmove, tmymove); newlen = FixedMul(movelen, FINECOSINE(deltaangle)); tmxmove = FixedMul(newlen, FINECOSINE(lineangle)); @@ -3149,7 +3149,7 @@ static void P_HitBounceLine(line_t *ld) lineangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT; - movelen = FixedHypot(tmxmove, tmymove); + movelen = P_AproxDistance(tmxmove, tmymove); tmxmove = FixedMul(movelen, FINECOSINE(deltaangle)); tmymove = FixedMul(movelen, FINESINE(deltaangle)); @@ -4076,7 +4076,7 @@ static boolean PIT_RadiusAttack(mobj_t *thing) dy = abs(thing->y - bombspot->y); dz = abs(thing->z + (thing->height>>1) - bombspot->z); - dist = FixedHypot(FixedHypot(dx, dy), dz); + dist = P_AproxDistance(P_AproxDistance(dx, dy), dz); dist -= thing->radius; if (dist < 0) diff --git a/src/p_maputl.h b/src/p_maputl.h index 9bc00fa17..df90ab4b4 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,6 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); +#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); diff --git a/src/p_mobj.c b/src/p_mobj.c index 69eecd26d..49db6daee 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1736,7 +1736,7 @@ static void P_PushableCheckBustables(mobj_t *mo) // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(FixedHypot(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector); + P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector); goto bustupdone; } @@ -2512,7 +2512,7 @@ boolean P_ZMovement(mobj_t *mo) // float down towards target if too close if (!(mo->flags2 & MF2_SKULLFLY) && !(mo->flags2 & MF2_INFLOAT)) { - dist = FixedHypot(mo->x - mo->target->x, mo->y - mo->target->y); + dist = P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y); delta = (mo->target->z + (mo->height>>1)) - mo->z; @@ -3665,11 +3665,11 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled P_ResetCamera(player, thiscam); else { - fixed_t camspeed = FixedHypot(thiscam->momx, thiscam->momy); + fixed_t camspeed = P_AproxDistance(thiscam->momx, thiscam->momy); P_SlideCameraMove(thiscam); - if (!resetcalled && FixedHypot(thiscam->momx, thiscam->momy) == camspeed) + if (!resetcalled && P_AproxDistance(thiscam->momx, thiscam->momy) == camspeed) { P_ResetCamera(player, thiscam); resetcalled = true; @@ -4152,7 +4152,7 @@ boolean P_BossTargetPlayer(mobj_t *actor, boolean closest) if (closest) { - dist = FixedHypot(actor->x - player->mo->x, actor->y - player->mo->y); + dist = P_AproxDistance(actor->x - player->mo->x, actor->y - player->mo->y); if (!lastdist || dist < lastdist) { lastdist = dist+1; @@ -4521,7 +4521,7 @@ static void P_Boss3Thinker(mobj_t *mobj) if (mobj->tracer->x == mobj->x && mobj->tracer->y == mobj->y) { // apply ambush for old routing, otherwise whack a mole only - dist = FixedHypot(FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z + mobj->movefactor - mobj->z); + dist = P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z + mobj->movefactor - mobj->z); if (dist < 1) dist = 1; @@ -5045,7 +5045,7 @@ static void P_Boss5Thinker(mobj_t *mobj) } if (mobj->state == &states[mobj->info->xdeathstate]) mobj->momz -= (2*FRACUNIT)/3; - else if (mobj->tracer && FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y) < 2*mobj->radius) + else if (mobj->tracer && P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y) < 2*mobj->radius) mobj->flags &= ~MF_NOCLIP; } else @@ -5171,7 +5171,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (players[i].mo->health <= 0) continue; - if (FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > (mobj->radius + players[i].mo->radius)) + if (P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > (mobj->radius + players[i].mo->radius)) continue; if (players[i].mo->z > mobj->z + mobj->height - FRACUNIT @@ -5275,7 +5275,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (mobj->health <= mobj->info->damage && !(mo2->spawnpoint->options & 7)) continue; // don't jump to center - dist = FixedHypot(players[i].mo->x - mo2->x, players[i].mo->y - mo2->y); + dist = P_AproxDistance(players[i].mo->x - mo2->x, players[i].mo->y - mo2->y); if (!(closestNum == -1 || dist < closestdist)) continue; @@ -5348,7 +5348,7 @@ static void P_Boss7Thinker(mobj_t *mobj) an = mobj->angle; an >>= ANGLETOFINESHIFT; - dist = FixedHypot(hitspot->x - mobj->x, hitspot->y - mobj->y); + dist = P_AproxDistance(hitspot->x - mobj->x, hitspot->y - mobj->y); horizontal = dist / airtime; vertical = (gravity*airtime)/2; @@ -5399,7 +5399,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (players[i].mo->health <= 0) continue; - if (FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > mobj->radius*4) + if (P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > mobj->radius*4) continue; if (players[i].mo->z > mobj->z + 128*FRACUNIT) @@ -5653,14 +5653,14 @@ static void P_Boss9Thinker(mobj_t *mobj) // Spawn energy particles for (spawner = mobj->hnext; spawner; spawner = spawner->hnext) { - dist = FixedHypot(spawner->x - mobj->x, spawner->y - mobj->y); + dist = P_AproxDistance(spawner->x - mobj->x, spawner->y - mobj->y); if (P_RandomRange(1,(dist>>FRACBITS)/16) == 1) break; } if (spawner && dist) { mobj_t *missile = P_SpawnMissile(spawner, mobj, MT_MSGATHER); - missile->fuse = (dist/FixedHypot(missile->momx, missile->momy)); + missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy)); if (missile->fuse > mobj->fuse) P_RemoveMobj(missile); @@ -6092,7 +6092,7 @@ nodanger: mobj->flags2 |= MF2_INVERTAIMABLE; // Move normally: Approach the player using normal thrust and simulated friction. - dist = FixedHypot(mobj->x-mobj->target->x, mobj->y-mobj->target->y); + dist = P_AproxDistance(mobj->x-mobj->target->x, mobj->y-mobj->target->y); P_Thrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), -3*FRACUNIT/8); if (dist < 64*FRACUNIT && !(mobj->target->player && mobj->target->player->homing)) P_Thrust(mobj, mobj->angle, -4*FRACUNIT); @@ -6100,7 +6100,7 @@ nodanger: P_Thrust(mobj, mobj->angle, FRACUNIT); else P_Thrust(mobj, mobj->angle + ANGLE_90, FINECOSINE((((angle_t)(leveltime*ANG1))>>ANGLETOFINESHIFT) & FINEMASK)>>1); - mobj->momz += FixedHypot(mobj->momx, mobj->momy)/12; // Move up higher the faster you're going. + mobj->momz += P_AproxDistance(mobj->momx, mobj->momy)/12; // Move up higher the faster you're going. } } } @@ -6306,7 +6306,7 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb mobj->angle = R_PointToAngle2(mobj->x, mobj->y, x, y); // change slope - dist = FixedHypot(FixedHypot(x - mobj->x, y - mobj->y), z - mobj->z); + dist = P_AproxDistance(P_AproxDistance(x - mobj->x, y - mobj->y), z - mobj->z); if (dist < 1) dist = 1; @@ -6380,7 +6380,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y fixed_t tx = dest->x; fixed_t ty = dest->y; fixed_t tz = dest->z + (dest->height/2); // Aim for center - fixed_t xydist = FixedHypot(tx - source->x, ty - source->y); + fixed_t xydist = P_AproxDistance(tx - source->x, ty - source->y); if (!dest || dest->health <= 0 || !dest->player || !source->tracer) return; @@ -6389,7 +6389,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y source->angle = R_PointToAngle2(source->x, source->y, tx, ty); // change slope - dist = FixedHypot(xydist, tz - source->z); + dist = P_AproxDistance(xydist, tz - source->z); if (dist < 1) dist = 1; @@ -6415,9 +6415,9 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y else { if (nightsgrab) - speedmul = FixedHypot(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); + speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); else - speedmul = FixedHypot(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); + speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); source->momx = FixedMul(FixedDiv(tx - source->x, dist), speedmul); source->momy = FixedMul(FixedDiv(ty - source->y, dist), speedmul); @@ -6425,7 +6425,7 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y } // Instead of just unsetting NOCLIP like an idiot, let's check the distance to our target. - ndist = FixedHypot(FixedHypot(tx - (source->x+source->momx), + ndist = P_AproxDistance(P_AproxDistance(tx - (source->x+source->momx), ty - (source->y+source->momy)), tz - (source->z+source->momz)); @@ -7076,7 +7076,7 @@ static void P_MaceSceneryThink(mobj_t *mobj) // The below is selected based on CEZ2's first room. I promise you it is a coincidence that it looks like the weed number. for (i = 0; i < MAXPLAYERS; ++i) if (playeringame[i] && players[i].mo - && FixedHypot(FixedHypot(mobj->x - players[i].mo->x, mobj->y - players[i].mo->y), mobj->z - players[i].mo->z) < (4200 << FRACBITS)) + && P_AproxDistance(P_AproxDistance(mobj->x - players[i].mo->x, mobj->y - players[i].mo->y), mobj->z - players[i].mo->z) < (4200 << FRACBITS)) break; // Stop looking. if (i == MAXPLAYERS) { @@ -8052,7 +8052,7 @@ static boolean P_MobjBossThink(mobj_t *mobj) { if (mobj->target) { - mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, FixedHypot(mobj->x - mobj->target->x, mobj->y - mobj->target->y)), mobj->scale << 1); + mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, P_AproxDistance(mobj->x - mobj->target->x, mobj->y - mobj->target->y)), mobj->scale << 1); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); } else @@ -8296,7 +8296,7 @@ static void P_ArrowThink(mobj_t *mobj) 0------dist(momx,momy) */ - fixed_t dist = FixedHypot(mobj->momx, mobj->momy); + fixed_t dist = P_AproxDistance(mobj->momx, mobj->momy); angle_t angle = R_PointToAngle2(0, 0, dist, mobj->momz); if (angle > ANG20 && angle <= ANGLE_180) @@ -8578,7 +8578,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) continue; if (players[i].mo->z + players[i].mo->height < mobj->z - 8*mobj->scale) continue; - compdist = FixedHypot( + compdist = P_AproxDistance( players[i].mo->x + players[i].mo->momx - basex, players[i].mo->y + players[i].mo->momy - basey); if (compdist >= dist) @@ -8593,7 +8593,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) mobj->frame = 3 + ((leveltime & 2) >> 1); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - if (FixedHypot( + if (P_AproxDistance( mobj->x - basex, mobj->y - basey) < mobj->scale) @@ -8624,7 +8624,7 @@ static boolean P_EggRobo1Think(mobj_t *mobj) if (!didmove) { - if (FixedHypot(mobj->x - basex, mobj->y - basey) < mobj->scale) + if (P_AproxDistance(mobj->x - basex, mobj->y - basey) < mobj->scale) P_TeleportMove(mobj, basex, basey, mobj->z); else P_TeleportMove(mobj, @@ -9014,7 +9014,7 @@ static void P_PyreFlyThink(mobj_t *mobj) { //Aim for player z position. If too close to floor/ceiling, aim just above/below them. fixed_t destz = min(max(mobj->target->z, mobj->target->floorz + 70*FRACUNIT), mobj->target->ceilingz - 80*FRACUNIT - mobj->height); - fixed_t dist = FixedHypot(hdist, destz - mobj->z); + fixed_t dist = P_AproxDistance(hdist, destz - mobj->z); P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT); mobj->momz = FixedMul(FixedDiv(destz - mobj->z, dist), 2*FRACUNIT); } @@ -9116,7 +9116,7 @@ static void P_PterabyteThink(mobj_t *mobj) var1 = 2*mobj->info->speed; var2 = 1; A_HomingChase(mobj); - if (FixedHypot(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) + if (P_AproxDistance(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) { mobj->extravalue1 -= 2; mobj->momx = mobj->momy = mobj->momz = 0; @@ -9141,7 +9141,7 @@ static void P_DragonbomberThink(mobj_t *mobj) { mobj_t *mine = P_SpawnMobjFromMobj(segment, 0, 0, 0, segment->info->painchance); mine->angle = segment->angle; - P_InstaThrust(mine, mobj->angle, FixedHypot(mobj->momx, mobj->momy) >> 1); + P_InstaThrust(mine, mobj->angle, P_AproxDistance(mobj->momx, mobj->momy) >> 1); P_SetObjectMomZ(mine, -2*FRACUNIT, true); S_StartSound(mine, mine->info->seesound); P_SetMobjState(segment, segment->info->raisestate); @@ -9151,7 +9151,7 @@ static void P_DragonbomberThink(mobj_t *mobj) } if (mobj->target) // Are we chasing a player? { - fixed_t dist = FixedHypot(mobj->x - mobj->target->x, mobj->y - mobj->target->y); + fixed_t dist = P_AproxDistance(mobj->x - mobj->target->x, mobj->y - mobj->target->y); if (dist > 2000*mobj->scale) // Not anymore! P_SetTarget(&mobj->target, NULL); else @@ -9259,7 +9259,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->eflags |= MFE_UNDERWATER; //P_MobjCheckWater(mobj); // solely for MFE_UNDERWATER for A_FlickySpawn { if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0 - && FixedHypot(FixedHypot(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16) + && P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16) { var1 = mobj->info->speed; var2 = 1; @@ -9394,7 +9394,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (playeringame[i] && players[i].mo && players[i].mare == mobj->threshold && players[i].spheres > 0) { - fixed_t dist = FixedHypot(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); + fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); if (dist < shortest) { P_SetTarget(&mobj->target, players[i].mo); @@ -9425,7 +9425,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_KoopaThinker(mobj); break; case MT_FIREBALL: - if (FixedHypot(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them + if (P_AproxDistance(mobj->momx, mobj->momy) <= 16*FRACUNIT) // Once fireballs lose enough speed, kill them { P_KillMobj(mobj, NULL, NULL, 0); return false; @@ -13530,7 +13530,7 @@ mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = FixedHypot(dest->x - x, dest->y - y); + dist = P_AproxDistance(dest->x - x, dest->y - y); dist = dist / speed; if (dist < 1) @@ -13592,7 +13592,7 @@ mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = FixedHypot(source->momx*800, source->momy*800); + dist = P_AproxDistance(source->momx*800, source->momy*800); dist = dist / speed; if (dist < 1) @@ -13657,7 +13657,7 @@ mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za, th->momx = FixedMul(speed, FINECOSINE(an)); th->momy = FixedMul(speed, FINESINE(an)); - dist = FixedHypot(xa - x, ya - y); + dist = P_AproxDistance(xa - x, ya - y); dist = dist / speed; if (dist < 1) @@ -13737,9 +13737,9 @@ mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type) th->momy = FixedMul(speed, FINESINE(an)); if (type == MT_TURRETLASER || type == MT_ENERGYBALL) // More accurate! - dist = FixedHypot(dest->x+(dest->momx*gsf) - source->x, dest->y+(dest->momy*gsf) - source->y); + dist = P_AproxDistance(dest->x+(dest->momx*gsf) - source->x, dest->y+(dest->momy*gsf) - source->y); else - dist = FixedHypot(dest->x - source->x, dest->y - source->y); + dist = P_AproxDistance(dest->x - source->x, dest->y - source->y); dist = dist / speed; diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 95734ff86..874edbd50 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1636,7 +1636,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th) distx = target->x - pox; disty = target->y - poy; distz = target->z - poz; - dist = FixedHypot(FixedHypot(distx, disty), distz); + dist = P_AproxDistance(P_AproxDistance(distx, disty), distz); if (dist < 1) dist = 1; diff --git a/src/p_setup.c b/src/p_setup.c index 2c0b84ba6..66243fb0e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -232,7 +232,7 @@ mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo) if (!mo2) continue; - curdist = FixedHypot(FixedHypot(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z); + curdist = P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z); if (result && curdist > bestdist) continue; diff --git a/src/p_slopes.c b/src/p_slopes.c index d77d0805f..aa46a8402 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -885,7 +885,7 @@ void P_ButteredSlope(mobj_t *mo) } if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed - thrust = FixedMul(thrust, FRACUNIT+FixedHypot(mo->momx, mo->momy)/16); + thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down // Let's get the gravity strength for the object... diff --git a/src/p_spec.c b/src/p_spec.c index eb14f8dd6..226e58d15 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1240,7 +1240,7 @@ static boolean PolyFlag(line_t *line) polyflagdata_t pfd; pfd.polyObjNum = Tag_FGet(&line->tags); - pfd.speed = FixedHypot(line->dx, line->dy) >> FRACBITS; + pfd.speed = P_AproxDistance(line->dx, line->dy) >> FRACBITS; pfd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y) >> ANGLETOFINESHIFT; pfd.momx = sides[line->sidenum[0]].textureoffset >> FRACBITS; @@ -1567,7 +1567,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller) { sector_t *ctlsector; - fixed_t dist = FixedHypot(triggerline->dx, triggerline->dy)>>FRACBITS; + fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS; size_t i, linecnt, sectori; INT16 specialtype = triggerline->special; @@ -2629,7 +2629,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) sectors[secnum].lightlevel = line->backsector->lightlevel; flick = P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - FixedHypot(line->dx, line->dy)>>FRACBITS); + P_AproxDistance(line->dx, line->dy)>>FRACBITS); // Make sure the starting light level is in range. if (reallightlevel < flick->minlight) @@ -2644,7 +2644,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Use front sector for min, target sector for max, // the same way linetype 61 does it. P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - FixedHypot(line->dx, line->dy)>>FRACBITS); + P_AproxDistance(line->dx, line->dy)>>FRACBITS); } } break; @@ -2663,7 +2663,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) sectors[secnum].lightlevel = line->backsector->lightlevel; glow = P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - FixedHypot(line->dx, line->dy)>>FRACBITS); + P_AproxDistance(line->dx, line->dy)>>FRACBITS); // Make sure the starting light level is in range. if (reallightlevel < glow->minlight) @@ -2678,7 +2678,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Use front sector for min, target sector for max, // the same way linetype 602 does it. P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - FixedHypot(line->dx, line->dy)>>FRACBITS); + P_AproxDistance(line->dx, line->dy)>>FRACBITS); } } break; @@ -2760,7 +2760,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) ((line->sidenum[1] != 0xFFFF && !(sides[line->sidenum[0]].rowoffset>>FRACBITS)) ? max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0) : max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0)) - : abs(FixedHypot(line->dx, line->dy))>>FRACBITS, + : abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS, (line->flags & ML_EFFECT4), (line->flags & ML_EFFECT5)); break; @@ -2795,7 +2795,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) else { P_SetTarget(&mo->player->awayviewmobj, altview); - mo->player->awayviewtics = FixedHypot(line->dx, line->dy)>>FRACBITS; + mo->player->awayviewtics = P_AproxDistance(line->dx, line->dy)>>FRACBITS; } @@ -2840,7 +2840,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 425: // Calls P_SetMobjState on calling mobj if (mo && !mo->player) - P_SetMobjState(mo, sides[line->sidenum[0]].toptexture); //FixedHypot(line->dx, line->dy)>>FRACBITS); + P_SetMobjState(mo, sides[line->sidenum[0]].toptexture); //P_AproxDistance(line->dx, line->dy)>>FRACBITS); break; case 426: // Moves the mobj to its sector's soundorg and on the floor, and stops it @@ -3026,7 +3026,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 438: // Set player scale if (mo) { - mo->destscale = FixedDiv(FixedHypot(line->dx, line->dy), 100<destscale = FixedDiv(P_AproxDistance(line->dx, line->dy), 100<destscale < FRACUNIT/100) mo->destscale = FRACUNIT/100; if (mo->player && bot) @@ -3144,7 +3144,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { quake.intensity = sides[line->sidenum[0]].textureoffset; quake.radius = sides[line->sidenum[0]].rowoffset; - quake.time = FixedHypot(line->dx, line->dy)>>FRACBITS; + quake.time = P_AproxDistance(line->dx, line->dy)>>FRACBITS; quake.epicenter = NULL; /// \todo @@ -3407,7 +3407,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 452: // Set FOF alpha { INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(FixedHypot(line->dx, line->dy)>>FRACBITS); + (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible in @@ -4997,8 +4997,8 @@ DoneSection2: } else { - if (FixedHypot(FixedHypot(player->mo->x-resultlow.x, player->mo->y-resultlow.y), - player->mo->z-resultlow.z) < FixedHypot(FixedHypot(player->mo->x-resulthigh.x, + if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y), + player->mo->z-resultlow.z) < P_AproxDistance(P_AproxDistance(player->mo->x-resulthigh.x, player->mo->y-resulthigh.y), player->mo->z-resulthigh.z)) { // Line between Mid and Low is closer @@ -6316,7 +6316,7 @@ void P_SpawnSpecials(boolean fromnetsave) break; case 52: // Continuously Falling sector - EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, FixedHypot(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); + EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, P_AproxDistance(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); break; case 53: // New super cool and awesome moving floor and ceiling type @@ -6388,15 +6388,15 @@ void P_SpawnSpecials(boolean fromnetsave) case 66: // Displace floor by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_floor, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_floor, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 67: // Displace ceiling by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_ceiling, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_ceiling, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 68: // Displace both floor AND ceiling by front sector TAG_ITER_SECTORS(0, tag, s) - P_AddPlaneDisplaceThinker(pd_both, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + P_AddPlaneDisplaceThinker(pd_both, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); break; case 100: // FOF (solid, opaque, shadows) @@ -6590,18 +6590,18 @@ void P_SpawnSpecials(boolean fromnetsave) case 150: // Air bobbing platform case 151: // Adjustable air bobbing platform { - fixed_t dist = (lines[i].special == 150) ? 16*FRACUNIT : FixedHypot(lines[i].dx, lines[i].dy); + fixed_t dist = (lines[i].special == 150) ? 16*FRACUNIT : P_AproxDistance(lines[i].dx, lines[i].dy); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); P_AddAirbob(lines[i].frontsector, tag, dist, false, !!(lines[i].flags & ML_NOCLIMB), false); break; } case 152: // Adjustable air bobbing platform in reverse P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, FixedHypot(lines[i].dx, lines[i].dy), true, !!(lines[i].flags & ML_NOCLIMB), false); + P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), true, !!(lines[i].flags & ML_NOCLIMB), false); break; case 153: // Dynamic Sinking Platform P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, FixedHypot(lines[i].dx, lines[i].dy), false, !!(lines[i].flags & ML_NOCLIMB), true); + P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), false, !!(lines[i].flags & ML_NOCLIMB), true); break; case 160: // Float/bob platform @@ -6680,7 +6680,7 @@ void P_SpawnSpecials(boolean fromnetsave) case 194: // Rising Platform 'Platform' - You can jump up through it case 195: // Rising Platform Translucent "platform" { - fixed_t speed = FixedDiv(FixedHypot(lines[i].dx, lines[i].dy), 4*FRACUNIT); + fixed_t speed = FixedDiv(P_AproxDistance(lines[i].dx, lines[i].dy), 4*FRACUNIT); fixed_t ceilingtop = P_FindHighestCeilingSurrounding(lines[i].frontsector); fixed_t ceilingbottom = P_FindLowestCeilingSurrounding(lines[i].frontsector); @@ -7005,14 +7005,14 @@ void P_SpawnSpecials(boolean fromnetsave) sec = sides[*lines[i].sidenum].sector - sectors; TAG_ITER_SECTORS(0, tag, s) P_SpawnAdjustableGlowingLight(§ors[sec], §ors[s], - FixedHypot(lines[i].dx, lines[i].dy)>>FRACBITS); + P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); break; case 603: // Adjustable flickering light sec = sides[*lines[i].sidenum].sector - sectors; TAG_ITER_SECTORS(0, tag, s) P_SpawnAdjustableFireFlicker(§ors[sec], §ors[s], - FixedHypot(lines[i].dx, lines[i].dy)>>FRACBITS); + P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); break; case 604: // Adjustable Blinking Light (unsynchronized) @@ -8418,9 +8418,9 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t * // "The right triangle of the square of the length of the hypotenuse is equal to the sum of the squares of the lengths of the other two sides." // "Bah! Stupid brains! Don't you know anything besides the Pythagorean Theorem?" - Earthworm Jim if (type == p_downcurrent || type == p_upcurrent || type == p_upwind || type == p_downwind) - p->magnitude = FixedHypot(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR); + p->magnitude = P_AproxDistance(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR); else - p->magnitude = FixedHypot(p->x_mag,p->y_mag); + p->magnitude = P_AproxDistance(p->x_mag,p->y_mag); if (source) // point source exist? { // where force goes to zero @@ -8471,14 +8471,14 @@ static inline boolean PIT_PushThing(mobj_t *thing) // don't fade wrt Z if health & 2 (mapthing has multi flag) if (tmpusher->source->health & 2) - dist = FixedHypot(thing->x - sx,thing->y - sy); + dist = P_AproxDistance(thing->x - sx,thing->y - sy); else { // Make sure the Z is in range if (thing->z < sz - tmpusher->radius || thing->z > sz + tmpusher->radius) return false; - dist = FixedHypot(FixedHypot(thing->x - sx, thing->y - sy), + dist = P_AproxDistance(P_AproxDistance(thing->x - sx, thing->y - sy), thing->z - sz); } @@ -8813,7 +8813,7 @@ void T_Pusher(pusher_t *p) // Tumbleweeds bounce a bit... if (thing->type == MT_LITTLETUMBLEWEED || thing->type == MT_BIGTUMBLEWEED) - thing->momz += FixedHypot(xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)) >> 2; + thing->momz += P_AproxDistance(xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)) >> 2; } if (moved) diff --git a/src/p_user.c b/src/p_user.c index dbf13cefc..a9e1fe9a2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1018,7 +1018,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) // to recover if ((inflictor->flags2 & MF2_SCATTER) && source) { - fixed_t dist = FixedHypot(FixedHypot(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); + fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; @@ -2701,7 +2701,7 @@ static void P_CheckBustableBlocks(player_t *player) // Run a linedef executor?? if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(FixedHypot(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); + P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); goto bustupdone; } @@ -2764,7 +2764,7 @@ static void P_CheckBouncySectors(player_t *player) if (player->mo->z + player->mo->height < bottomheight) continue; - bouncestrength = FixedHypot(rover->master->dx, rover->master->dy)/100; + bouncestrength = P_AproxDistance(rover->master->dx, rover->master->dy)/100; if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL) && oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)) @@ -4981,7 +4981,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) if (!((mo2->flags & MF_SHOOTABLE && mo2->flags & MF_ENEMY) || mo2->type == MT_EGGGUARD || mo2->player)) continue; - dist = FixedHypot(FixedHypot(player->mo->x-mo2->x, player->mo->y-mo2->y), player->mo->z-mo2->z); + dist = P_AproxDistance(P_AproxDistance(player->mo->x-mo2->x, player->mo->y-mo2->y), player->mo->z-mo2->z); if (range < dist) continue; @@ -6464,12 +6464,12 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad //CONS_Debug(DBG_NIGHTS, "T1 is at %d, %d\n", transfer1->x>>FRACBITS, transfer1->y>>FRACBITS); //CONS_Debug(DBG_NIGHTS, "T2 is at %d, %d\n", transfer2->x>>FRACBITS, transfer2->y>>FRACBITS); - //CONS_Debug(DBG_NIGHTS, "Distance from T1: %d\n", FixedHypot(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS); - //CONS_Debug(DBG_NIGHTS, "Distance from T2: %d\n", FixedHypot(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS); + //CONS_Debug(DBG_NIGHTS, "Distance from T1: %d\n", P_AproxDistance(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS); + //CONS_Debug(DBG_NIGHTS, "Distance from T2: %d\n", P_AproxDistance(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS); // Transfer1 is closer to the player than transfer2 - if (FixedHypot(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS - < FixedHypot(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS) + if (P_AproxDistance(transfer1->x - player->mo->x, transfer1->y - player->mo->y)>>FRACBITS + < P_AproxDistance(transfer2->x - player->mo->x, transfer2->y - player->mo->y)>>FRACBITS) { //CONS_Debug(DBG_NIGHTS, " must be < 0 to transfer\n"); @@ -7709,7 +7709,7 @@ void P_BlackOw(player_t *player) S_StartSound (player->mo, sfx_bkpoof); // Sound the BANG! for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && FixedHypot(player->mo->x - players[i].mo->x, + if (playeringame[i] && P_AproxDistance(player->mo->x - players[i].mo->x, player->mo->y - players[i].mo->y) < 1536*FRACUNIT) P_FlashPal(&players[i], PAL_NUKE, 10); @@ -7893,7 +7893,7 @@ static void P_SkidStuff(player_t *player) P_SpawnSkidDust(player, 0, false); } } - else if (FixedHypot(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame + else if (P_AproxDistance(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame && (player->mo->momx != pmx || player->mo->momy != pmy) // and you are moving differently this frame && P_GetPlayerControlDirection(player) == 2) // and your controls are pointing in the opposite direction to your movement { // check for skidding @@ -8524,7 +8524,7 @@ void P_MovePlayer(player_t *player) P_ResetScore(player); // Show the "THOK!" graphic when spinning quickly across the ground. (even applies to non-spinners, in the case of zoom tubes) - if (player->pflags & PF_SPINNING && FixedHypot(player->speed, player->mo->momz) > FixedMul(15<mo->scale) && !(player->pflags & PF_JUMPED)) + if (player->pflags & PF_SPINNING && P_AproxDistance(player->speed, player->mo->momz) > FixedMul(15<mo->scale) && !(player->pflags & PF_JUMPED)) { P_SpawnSpinMobj(player, player->spinitem); G_GhostAddSpin(); @@ -8745,7 +8745,7 @@ static void P_DoZoomTube(player_t *player) speed = abs(player->speed); // change slope - dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); + dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); if (dist < 1) dist = 1; @@ -8786,7 +8786,7 @@ static void P_DoZoomTube(player_t *player) // calculate MOMX/MOMY/MOMZ for next waypoint // change slope - dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); + dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - player->mo->z); if (dist < 1) dist = 1; @@ -8839,7 +8839,7 @@ static void P_DoRopeHang(player_t *player) sequence = player->mo->tracer->threshold; // change slope - dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); + dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); if (dist < 1) dist = 1; @@ -8902,7 +8902,7 @@ static void P_DoRopeHang(player_t *player) // calculate MOMX/MOMY/MOMZ for next waypoint // change slope - dist = FixedHypot(FixedHypot(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); + dist = P_AproxDistance(P_AproxDistance(player->mo->tracer->x - player->mo->x, player->mo->tracer->y - player->mo->y), player->mo->tracer->z - playerz); if (dist < 1) dist = 1; @@ -9003,7 +9003,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) if (abs(inflictor->x - mo->x) > radius || abs(inflictor->y - mo->y) > radius || abs(inflictor->z - mo->z) > radius) continue; // Workaround for possible integer overflow in the below -Red - if (FixedHypot(FixedHypot(inflictor->x - mo->x, inflictor->y - mo->y), inflictor->z - mo->z) > radius) + if (P_AproxDistance(P_AproxDistance(inflictor->x - mo->x, inflictor->y - mo->y), inflictor->z - mo->z) > radius) continue; if (mo->type == MT_MINUS && !(mo->flags & (MF_SPECIAL|MF_SHOOTABLE))) @@ -9139,12 +9139,12 @@ mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, { fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2); - dist = FixedHypot(player->mo->x-mo->x, player->mo->y-mo->y); + dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y); if (abs(zdist) > dist) continue; // Don't home outside of desired angle! - dist = FixedHypot(dist, zdist); + dist = P_AproxDistance(dist, zdist); if (dist > maxdist) continue; // out of range } @@ -9236,7 +9236,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) { fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2); - dist = FixedHypot(player->mo->x-mo->x, player->mo->y-mo->y); + dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y); if (bullet) { if ((R_PointToAngle2(0, 0, dist, zdist) + span) > span*2) @@ -9253,7 +9253,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) continue; } - dist = FixedHypot(dist, zdist); + dist = P_AproxDistance(dist, zdist); if (dist > maxdist) continue; // out of range } @@ -9313,7 +9313,7 @@ boolean P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target // change slope zdist = ((P_MobjFlip(source) == -1) ? (enemy->z + enemy->height) - (source->z + source->height) : (enemy->z - source->z)); - dist = FixedHypot(FixedHypot(enemy->x - source->x, enemy->y - source->y), zdist); + dist = P_AproxDistance(P_AproxDistance(enemy->x - source->x, enemy->y - source->y), zdist); if (dist < 1) dist = 1; @@ -10362,7 +10362,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // follow the player /*if (player->playerstate != PST_DEAD && (camspeed) != 0) { - if (FixedHypot(mo->x - thiscam->x, mo->y - thiscam->y) > (checkdist + FixedHypot(mo->momx, mo->momy)) * 4 + if (P_AproxDistance(mo->x - thiscam->x, mo->y - thiscam->y) > (checkdist + P_AproxDistance(mo->momx, mo->momy)) * 4 || abs(mo->z - thiscam->z) > checkdist * 3) { if (!resetcalled) @@ -10427,7 +10427,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } /* check z distance too for orbital camera */ - if (FixedHypot(FixedHypot(vx - mo->x, vy - mo->y), + if (P_AproxDistance(P_AproxDistance(vx - mo->x, vy - mo->y), vz - ( mo->z + mo->height / 2 )) < FixedMul(48*FRACUNIT, mo->scale)) mo->flags2 |= MF2_SHADOW; else @@ -10912,7 +10912,7 @@ static void P_ParabolicMove(mobj_t *mo, fixed_t x, fixed_t y, fixed_t z, fixed_t fixed_t dx = x - mo->x; fixed_t dy = y - mo->y; fixed_t dz = z - mo->z; - fixed_t dh = FixedHypot(dx, dy); + fixed_t dh = P_AproxDistance(dx, dy); fixed_t c = FixedDiv(dx, dh); fixed_t s = FixedDiv(dy, dh); fixed_t fixConst = FixedDiv(speed, g); @@ -11784,7 +11784,7 @@ void P_PlayerThink(player_t *player) if (mo2->flags2 & MF2_NIGHTSPULL) continue; - if (FixedHypot(FixedHypot(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) + if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) continue; // Yay! The thing's in reach! Pull it in! @@ -12020,7 +12020,7 @@ void P_PlayerThink(player_t *player) if (!currentlyonground) acceleration /= 2; // fake skidding! see P_SkidStuff for reference on conditionals - else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && FixedHypot(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed, player->mo->scale)) // modified from player->runspeed/2 'cuz the skid was just TOO frequent ngl + else if (!player->skidtime && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID) && P_AproxDistance(player->mo->momx, player->mo->momy) >= FixedMul(player->runspeed, player->mo->scale)) // modified from player->runspeed/2 'cuz the skid was just TOO frequent ngl { if (player->mo->state-states != S_PLAY_SKID) P_SetPlayerMobjState(player->mo, S_PLAY_SKID); @@ -12605,7 +12605,7 @@ void P_PlayerAfterThink(player_t *player) P_SetPlayerAngle(player, player->mo->angle); } - if (FixedHypot(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) + if (P_AproxDistance(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) player->powers[pw_carry] = CR_NONE; if (player->powers[pw_carry] != CR_NONE) @@ -12794,7 +12794,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = ptera->momy; player->mo->momz = ptera->momz; - if (FixedHypot(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) + if (P_AproxDistance(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) goto dropoff; ptera->watertop >>= 1; diff --git a/src/r_things.c b/src/r_things.c index 66c292b07..30bf15f85 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3019,7 +3019,7 @@ boolean R_ThingVisibleWithinDist (mobj_t *thing, if (! R_ThingVisible(thing)) return false; - approx_dist = FixedHypot(viewx-thing->x, viewy-thing->y); + approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); if (thing->sprite == SPR_HOOP) { @@ -3044,7 +3044,7 @@ boolean R_PrecipThingVisible (precipmobj_t *precipthing, if (( precipthing->precipflags & PCF_INVISIBLE )) return false; - approx_dist = FixedHypot(viewx-precipthing->x, viewy-precipthing->y); + approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); return ( approx_dist <= limit_dist ); } diff --git a/src/s_sound.c b/src/s_sound.c index 0085dc342..392a5b453 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -943,8 +943,8 @@ void S_UpdateSounds(void) const mobj_t *soundmobj = c->origin; fixed_t dist1, dist2; - dist1 = FixedHypot(listener.x-soundmobj->x, listener.y-soundmobj->y); - dist2 = FixedHypot(listener2.x-soundmobj->x, listener2.y-soundmobj->y); + dist1 = P_AproxDistance(listener.x-soundmobj->x, listener.y-soundmobj->y); + dist2 = P_AproxDistance(listener2.x-soundmobj->x, listener2.y-soundmobj->y); if (dist1 <= dist2) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 15d1af396..649644620 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2458,7 +2458,7 @@ num: static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offset) { INT32 interval, i; - UINT32 dist = ((UINT32)FixedHypot(FixedHypot(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS; + UINT32 dist = ((UINT32)P_AproxDistance(P_AproxDistance(stplyr->mo->x - hunt->x, stplyr->mo->y - hunt->y), stplyr->mo->z - hunt->z))>>FRACBITS; if (dist < 128) { From d2d1f83b62de98a9f08f5197e9bed84306f12741 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sat, 13 Feb 2021 17:45:54 +0100 Subject: [PATCH 037/160] Revert "Use R_PointToDist2 instead" This reverts commit e19196a86e5347edf7f25b335214cede978b91b8. --- src/m_fixed.c | 40 ++++++++++++---------------------------- src/r_main.c | 24 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/m_fixed.c b/src/m_fixed.c index 09d6936f2..eb10fd5f8 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -18,10 +18,8 @@ #define HAVE_SQRTF #endif #endif - #include "doomdef.h" #include "m_fixed.h" -#include "tables.h" // ANGLETOFINESHIFT #ifdef __USE_C_FIXEDMUL__ @@ -107,34 +105,20 @@ fixed_t FixedSqrt(fixed_t x) fixed_t FixedHypot(fixed_t x, fixed_t y) { - // Moved the code from R_PointToDist2 to here, - // since R_PointToDist2 did the same thing, - // except less prone to overflowing. - - angle_t angle; - fixed_t dist; - - x = abs(x); - y = abs(y); - - if (y > x) + fixed_t ax, yx, yx2, yx1; + if (abs(y) > abs(x)) // |y|>|x| { - fixed_t temp; - - temp = x; - x = y; - y = temp; + ax = abs(y); // |y| => ax + yx = FixedDiv(x, y); // (x/y) } - - if (!y) - return x; - - angle = (tantoangle[FixedDiv(y, x)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; - - // use as cosine - dist = FixedDiv(x, FINESINE(angle)); - - return dist; + else // |x|>|y| + { + ax = abs(x); // |x| => ax + yx = FixedDiv(y, x); // (x/y) + } + yx2 = FixedMul(yx, yx); // (x/y)^2 + yx1 = FixedSqrt(1 * FRACUNIT + yx2); // (1 + (x/y)^2)^1/2 + return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) } vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) diff --git a/src/r_main.c b/src/r_main.c index f6c05e312..f82fb589e 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -357,7 +357,29 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1) { - return FixedHypot(px1 - px2, py1 - py2); + angle_t angle; + fixed_t dx, dy, dist; + + dx = abs(px1 - px2); + dy = abs(py1 - py2); + + if (dy > dx) + { + fixed_t temp; + + temp = dx; + dx = dy; + dy = temp; + } + if (!dy) + return dx; + + angle = (tantoangle[FixedDiv(dy, dx)>>DBITS] + ANGLE_90) >> ANGLETOFINESHIFT; + + // use as cosine + dist = FixedDiv(dx, FINESINE(angle)); + + return dist; } // Little extra utility. Works in the same way as R_PointToAngle2 From a58df577fe9579bc879de895aea0ef310d8750e1 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sat, 13 Feb 2021 17:46:29 +0100 Subject: [PATCH 038/160] Revert "Use FixedHypot over P_AproxDistance" This reverts commit c5474436af67408342e8dce0ec996d62c9a4c21c. --- src/lua_baselib.c | 3 +-- src/p_maputl.c | 13 +++++++++++++ src/p_maputl.h | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 609d9c8b8..c5f847be6 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -432,8 +432,7 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); - lua_pushfixed(L, FixedHypot(dx, dy)); + lua_pushfixed(L, P_AproxDistance(dx, dy)); return 1; } diff --git a/src/p_maputl.c b/src/p_maputl.c index 83905a418..90718a41c 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -24,6 +24,19 @@ #include "p_slopes.h" #include "z_zone.h" +// +// P_AproxDistance +// Gives an estimation of distance (not exact) +// +fixed_t P_AproxDistance(fixed_t dx, fixed_t dy) +{ + dx = abs(dx); + dy = abs(dy); + if (dx < dy) + return dx + dy - (dx>>1); + return dx + dy - (dy>>1); +} + // // P_ClosestPointOnLine // Finds the closest point on a given line to the supplied point diff --git a/src/p_maputl.h b/src/p_maputl.h index df90ab4b4..08b606833 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -41,7 +41,7 @@ typedef boolean (*traverser_t)(intercept_t *in); boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, INT32 pflags, traverser_t ptrav); -#define P_AproxDistance(dx, dy) FixedHypot(dx, dy) +FUNCMATH fixed_t P_AproxDistance(fixed_t dx, fixed_t dy); void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result); void P_ClosestPointOnLine3D(const vector3_t *p, const vector3_t *line, vector3_t *result); INT32 P_PointOnLineSide(fixed_t x, fixed_t y, line_t *line); From 758de501da8c458cc3b8f06a376db1b3cb818316 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sat, 13 Feb 2021 18:04:12 +0100 Subject: [PATCH 039/160] Use R_PointToDist2 for the Lua versions of P_AproxDistance and FixedHypot --- src/lua_baselib.c | 2 +- src/lua_mathlib.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c5f847be6..916fa9254 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -432,7 +432,7 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - lua_pushfixed(L, P_AproxDistance(dx, dy)); + lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); return 1; } diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 10ba42ee0..b6046ab53 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -15,6 +15,7 @@ #include "tables.h" #include "p_local.h" #include "doomstat.h" // for ALL7EMERALDS +#include "r_main.h" // for R_PointToDist2 #include "lua_script.h" #include "lua_libs.h" @@ -129,7 +130,7 @@ static int lib_fixedsqrt(lua_State *L) static int lib_fixedhypot(lua_State *L) { - lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); + lua_pushfixed(L, R_PointToDist2(0, 0, luaL_checkfixed(L, 1), luaL_checkfixed(L, 2))); return 1; } From 70850b083632d9b590cdaaf102be7ecf081be1ca Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sat, 13 Feb 2021 18:04:27 +0100 Subject: [PATCH 040/160] Deprecate P_AproxDistance for Lua scripts --- src/lua_baselib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 916fa9254..6e0116d12 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -432,6 +432,7 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE + LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); return 1; } From 4430835a71430c73b5ca3f014babd6ff1778abd1 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Sun, 14 Feb 2021 20:49:03 -0600 Subject: [PATCH 041/160] This might be dumb, but whatever --- src/lua_baselib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 6e0116d12..916fa9254 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -432,7 +432,6 @@ static int lib_pAproxDistance(lua_State *L) fixed_t dx = luaL_checkfixed(L, 1); fixed_t dy = luaL_checkfixed(L, 2); //HUDSAFE - LUA_Deprecated(L, "P_AproxDistance", "FixedHypot"); lua_pushfixed(L, R_PointToDist2(0, 0, dx, dy)); return 1; } From b369243bebf5db2d2f1cc270d2716e8a73750073 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 15 Feb 2021 13:37:25 +0100 Subject: [PATCH 042/160] Use standard Lua naming scheme for polyobject list --- src/lua_polyobjlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_polyobjlib.c b/src/lua_polyobjlib.c index 365d97056..2a5bcfbf1 100644 --- a/src/lua_polyobjlib.c +++ b/src/lua_polyobjlib.c @@ -417,7 +417,7 @@ static int lib_getPolyObject(lua_State *L) { i = luaL_checkinteger(L, 2); if (i < 0 || i >= numPolyObjects) - return luaL_error(L, "PolyObjects[] index %d out of range (0 - %d)", i, numPolyObjects-1); + return luaL_error(L, "polyobjects[] index %d out of range (0 - %d)", i, numPolyObjects-1); LUA_PushUserdata(L, &PolyObjects[i], META_POLYOBJ); return 1; } @@ -481,6 +481,6 @@ int LUA_PolyObjLib(lua_State *L) lua_pushcfunction(L, lib_numPolyObjects); lua_setfield(L, -2, "__len"); lua_setmetatable(L, -2); - lua_setglobal(L, "PolyObjects"); + lua_setglobal(L, "polyobjects"); return 0; } From 0b012d5db0bd5f3d6b904bbed4f585fde61ce582 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 15 Feb 2021 16:21:26 +0100 Subject: [PATCH 043/160] Make the names of disconnected players flicker in tab HUD --- src/hu_stuff.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 0b24d0690..1e69e6d51 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2307,10 +2307,11 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I // V_DrawSmallString(x+ 246, y+4, V_YELLOWMAP, "SERVER"); } - V_DrawString(x + 20, y, - ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? V_60TRANS : 0) - | V_ALLOWLOWERCASE, tab[i].name); + if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) + V_DrawString(x + 20, y, + ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) + | (greycheck ? V_60TRANS : 0) + | V_ALLOWLOWERCASE, tab[i].name); // Draw emeralds if (players[tab[i].num].powers[pw_invulnerability] && (players[tab[i].num].powers[pw_invulnerability] == players[tab[i].num].powers[pw_sneakers]) && ((leveltime/7) & 1)) @@ -2458,10 +2459,11 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) supercheck = supercheckdef; strlcpy(name, tab[i].name, 8); - V_DrawString(x + 10, y, - ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? 0 : V_TRANSLUCENT) - | V_ALLOWLOWERCASE, name); + if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) + V_DrawString(x + 10, y, + ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) + | (greycheck ? 0 : V_TRANSLUCENT) + | V_ALLOWLOWERCASE, name); if (gametyperules & GTR_TEAMFLAGS) { @@ -2586,10 +2588,11 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) supercheck = supercheckdef; strlcpy(name, tab[i].name, 7); - V_DrawString(x + 20, y, - ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? V_TRANSLUCENT : 0) - | V_ALLOWLOWERCASE, name); + if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) + V_DrawString(x + 20, y, + ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) + | (greycheck ? V_TRANSLUCENT : 0) + | V_ALLOWLOWERCASE, name); if (gametyperules & GTR_TEAMFLAGS) { @@ -2660,10 +2663,11 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline //else // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER"); - V_DrawString(x + 20, y, - ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? V_TRANSLUCENT : 0) - | V_ALLOWLOWERCASE, name); + if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) + V_DrawString(x + 20, y, + ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) + | (greycheck ? V_TRANSLUCENT : 0) + | V_ALLOWLOWERCASE, name); if (G_GametypeUsesLives() && !(G_GametypeUsesCoopLives() && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives)); @@ -2769,10 +2773,11 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor // V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST"); } - V_DrawString(x + 10, y, - ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) - | (greycheck ? 0 : V_TRANSLUCENT) - | V_ALLOWLOWERCASE, name); + if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) + V_DrawString(x + 10, y, + ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) + | (greycheck ? 0 : V_TRANSLUCENT) + | V_ALLOWLOWERCASE, name); if (G_GametypeUsesLives()) //show lives V_DrawRightAlignedThinString(x-1, y, V_ALLOWLOWERCASE, va("%d", players[tab[i].num].lives)); From aa33d90215c058e0f19621661d4ae10391b583eb Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 15 Feb 2021 16:23:57 +0100 Subject: [PATCH 044/160] Add rejointimeout to the server options --- src/m_menu.c | 69 ++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 05c819c37..516bd34c1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1612,53 +1612,54 @@ static menuitem_t OP_ServerOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Max Players", &cv_maxplayers, 21}, {IT_STRING | IT_CVAR, NULL, "Allow Add-on Downloading", &cv_downloading, 26}, {IT_STRING | IT_CVAR, NULL, "Allow players to join", &cv_allownewplayer, 31}, + {IT_STRING | IT_CVAR, NULL, "Minutes for reconnecting", &cv_rejointimeout, 36}, #endif - {IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 36}, - {IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 41}, + {IT_STRING | IT_CVAR, NULL, "Map progression", &cv_advancemap, 41}, + {IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 46}, - {IT_HEADER, NULL, "Characters", NULL, 50}, - {IT_STRING | IT_CVAR, NULL, "Force a character", &cv_forceskin, 56}, - {IT_STRING | IT_CVAR, NULL, "Restrict character changes", &cv_restrictskinchange, 61}, + {IT_HEADER, NULL, "Characters", NULL, 55}, + {IT_STRING | IT_CVAR, NULL, "Force a character", &cv_forceskin, 61}, + {IT_STRING | IT_CVAR, NULL, "Restrict character changes", &cv_restrictskinchange, 66}, - {IT_HEADER, NULL, "Items", NULL, 70}, - {IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 76}, - {IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 81}, + {IT_HEADER, NULL, "Items", NULL, 75}, + {IT_STRING | IT_CVAR, NULL, "Item respawn delay", &cv_itemrespawntime, 81}, + {IT_STRING | IT_SUBMENU, NULL, "Mystery Item Monitor Toggles...", &OP_MonitorToggleDef, 86}, - {IT_HEADER, NULL, "Cooperative", NULL, 90}, - {IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 96}, - {IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 101}, - {IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 106}, - {IT_STRING | IT_CVAR, NULL, "Post-goal free roaming", &cv_exitmove, 111}, + {IT_HEADER, NULL, "Cooperative", NULL, 95}, + {IT_STRING | IT_CVAR, NULL, "Players required for exit", &cv_playersforexit, 101}, + {IT_STRING | IT_CVAR, NULL, "Starposts", &cv_coopstarposts, 106}, + {IT_STRING | IT_CVAR, NULL, "Life sharing", &cv_cooplives, 111}, + {IT_STRING | IT_CVAR, NULL, "Post-goal free roaming", &cv_exitmove, 116}, - {IT_HEADER, NULL, "Race, Competition", NULL, 120}, - {IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 126}, - {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 131}, + {IT_HEADER, NULL, "Race, Competition", NULL, 125}, + {IT_STRING | IT_CVAR, NULL, "Level completion countdown", &cv_countdowntime, 131}, + {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_competitionboxes, 136}, - {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 140}, - {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 146}, - {IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 151}, - {IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 156}, - {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 161}, + {IT_HEADER, NULL, "Ringslinger (Match, CTF, Tag, H&S)", NULL, 145}, + {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 151}, + {IT_STRING | IT_CVAR, NULL, "Score Limit", &cv_pointlimit, 156}, + {IT_STRING | IT_CVAR, NULL, "Overtime on Tie", &cv_overtime, 161}, + {IT_STRING | IT_CVAR, NULL, "Player respawn delay", &cv_respawntime, 166}, - {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 171}, - {IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 176}, - {IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 181}, + {IT_STRING | IT_CVAR, NULL, "Item Monitors", &cv_matchboxes, 176}, + {IT_STRING | IT_CVAR, NULL, "Weapon Rings", &cv_specialrings, 181}, + {IT_STRING | IT_CVAR, NULL, "Power Stones", &cv_powerstones, 186}, - {IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 191}, - {IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 196}, + {IT_STRING | IT_CVAR, NULL, "Flag respawn delay", &cv_flagtime, 196}, + {IT_STRING | IT_CVAR, NULL, "Hiding time", &cv_hidetime, 201}, - {IT_HEADER, NULL, "Teams", NULL, 205}, - {IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 211}, - {IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 216}, + {IT_HEADER, NULL, "Teams", NULL, 210}, + {IT_STRING | IT_CVAR, NULL, "Autobalance sizes", &cv_autobalance, 216}, + {IT_STRING | IT_CVAR, NULL, "Scramble on Map Change", &cv_scrambleonchange, 221}, #ifndef NONET - {IT_HEADER, NULL, "Advanced", NULL, 225}, - {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 231}, + {IT_HEADER, NULL, "Advanced", NULL, 230}, + {IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 236}, - {IT_STRING | IT_CVAR, NULL, "Join delay", &cv_joindelay, 246}, - {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 251}, + {IT_STRING | IT_CVAR, NULL, "Join delay", &cv_joindelay, 251}, + {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 256}, - {IT_STRING | IT_CVAR, NULL, "Show IP Address of Joiners", &cv_showjoinaddress, 256}, + {IT_STRING | IT_CVAR, NULL, "Show IP Address of Joiners", &cv_showjoinaddress, 261}, #endif }; From 97daba68d0beb57622f996c6086d15355175ae22 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 15 Feb 2021 16:24:30 +0100 Subject: [PATCH 045/160] Enable rejointimeout by default --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4fdc7e7ee..02577b508 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3112,7 +3112,7 @@ consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_NETVAR, maxpl static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}}; consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL); static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}}; -consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "Off", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL); +consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "2", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL); static CV_PossibleValue_t resynchattempts_cons_t[] = {{1, "MIN"}, {20, "MAX"}, {0, "No"}, {0, NULL}}; consvar_t cv_resynchattempts = CVAR_INIT ("resynchattempts", "10", CV_SAVE|CV_NETVAR, resynchattempts_cons_t, NULL); From 7133c703b4c6a6cada6ee47f8c8fad9ee768f099 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 15 Feb 2021 22:19:48 +0100 Subject: [PATCH 046/160] Show an alternate ping icon when the player is disconnected --- src/hu_stuff.c | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 1e69e6d51..7c4f1acf1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -98,6 +98,7 @@ patch_t *emeraldpics[3][8]; // 0 = normal, 1 = tiny, 2 = coinbox static patch_t *emblemicon; patch_t *tokenicon; static patch_t *exiticon; +static patch_t *nopingicon; //------------------------------------------- // misc vars @@ -286,6 +287,7 @@ void HU_LoadGraphics(void) emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX); tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX); exiticon = W_CachePatchName("EXITICON", PU_HUDGFX); + nopingicon = W_CachePatchName("NOPINGICON", PU_HUDGFX); emeraldpics[0][0] = W_CachePatchName("CHAOS1", PU_HUDGFX); emeraldpics[0][1] = W_CachePatchName("CHAOS2", PU_HUDGFX); @@ -2246,8 +2248,8 @@ void HU_Erase(void) // void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags) { - UINT8 numbars = 1; // how many ping bars do we draw? - UINT8 barcolor = 35; // color we use for the bars (green, yellow or red) + UINT8 numbars = 0; // how many ping bars do we draw? + UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black) SINT8 i = 0; SINT8 yoffset = 6; INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), @@ -2260,11 +2262,16 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags) } else if (ping < 256) { - numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it. + numbars = 2; barcolor = 73; } + else if (ping < UINT32_MAX) + { + numbars = 1; + barcolor = 35; + } - if (!notext || vid.width >= 640) // how sad, we're using a shit resolution. + if (ping < UINT32_MAX && (!notext || vid.width >= 640)) // how sad, we're using a shit resolution. V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", ping)); for (i=0; (i<3); i++) // Draw the ping bar @@ -2275,6 +2282,9 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags) yoffset -= 2; } + + if (ping == UINT32_MAX) + V_DrawSmallScaledPatch(x + 4 - nopingicon->width/2, y + 9 - nopingicon->height/2, 0, nopingicon); } // @@ -2301,8 +2311,8 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I if (!splitscreen) // don't draw it on splitscreen, { - if (!(tab[i].num == serverplayer || players[tab[i].num].quittime)) - HU_drawPing(x+ 253, y, playerpingtable[tab[i].num], false, 0); + if (tab[i].num != serverplayer) + HU_drawPing(x + 253, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0); //else // V_DrawSmallString(x+ 246, y+4, V_YELLOWMAP, "SERVER"); } @@ -2502,10 +2512,10 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) V_DrawRightAlignedThinString(x+128, y, ((players[tab[i].num].spectator || players[tab[i].num].playerstate == PST_DEAD) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); if (!splitscreen) { - if (!(tab[i].num == serverplayer || players[tab[i].num].quittime)) - HU_drawPing(x+ 135, y+1, playerpingtable[tab[i].num], true, 0); - //else - //V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST"); + if (tab[i].num != serverplayer) + HU_drawPing(x + 135, y+1, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], true, 0); + //else + //V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST"); } } } @@ -2627,10 +2637,10 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) V_DrawRightAlignedThinString(x+100, y, (greycheck ? V_TRANSLUCENT : 0), va("%u", tab[i].count)); if (!splitscreen) { - if (!(tab[i].num == serverplayer || players[tab[i].num].quittime)) - HU_drawPing(x+ 113, y, playerpingtable[tab[i].num], false, 0); - //else - // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER"); + if (tab[i].num != serverplayer) + HU_drawPing(x+ 113, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0); + //else + // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER"); } } } @@ -2658,8 +2668,8 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline supercheck = supercheckdef; strlcpy(name, tab[i].name, 7); - if (!(tab[i].num == serverplayer || players[tab[i].num].quittime)) - HU_drawPing(x+ 113, y, playerpingtable[tab[i].num], false, 0); + if (tab[i].num != serverplayer) + HU_drawPing(x+ 113, y, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], false, 0); //else // V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER"); @@ -2767,10 +2777,10 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor strlcpy(name, tab[i].name, 7); if (!splitscreen) // don't draw it on splitscreen, { - if (!(tab[i].num == serverplayer || players[tab[i].num].quittime)) - HU_drawPing(x+ 135, y+1, playerpingtable[tab[i].num], true, 0); - //else - // V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST"); + if (tab[i].num != serverplayer) + HU_drawPing(x+ 135, y+1, players[tab[i].num].quittime ? UINT32_MAX : playerpingtable[tab[i].num], true, 0); + //else + // V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST"); } if (!players[tab[i].num].quittime || (leveltime / (TICRATE/2) & 1)) From 205ccc2727a2c755d9e44dcd662cd8d4d1b6db68 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 16 Feb 2021 19:46:31 +0100 Subject: [PATCH 047/160] Move Dehacked table sanity check to deh_tables.c --- src/d_main.c | 2 +- src/deh_tables.c | 24 ++++++++++++++++++++++++ src/deh_tables.h | 3 +++ src/dehacked.c | 22 ---------------------- src/dehacked.h | 2 -- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index a89f4ed2d..409a66bec 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1072,7 +1072,7 @@ void D_SRB2Main(void) G_LoadGameSettings(); // Test Dehacked lists - DEH_Check(); + DEH_TableCheck(); // Netgame URL special case: change working dir to EXE folder. ChangeDirForUrlHandler(); diff --git a/src/deh_tables.c b/src/deh_tables.c index 3039bf7de..dd6d7d69f 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5457,3 +5457,27 @@ struct int_const_s const INT_CONST[] = { {NULL,0} }; + +// For this to work compile-time without being in this file, +// this function would need to check sizes at runtime, without sizeof +void DEH_TableCheck(void) +{ +#if defined(_DEBUG) || defined(PARANOIA) + const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*); + const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*); + const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*); + const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*); + + if (dehstates != S_FIRSTFREESLOT) + I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates)); + + if (dehmobjs != MT_FIRSTFREESLOT) + I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs)); + + if (dehpowers != NUMPOWERS) + I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers)); + + if (dehcolors != SKINCOLOR_FIRSTFREESLOT) + I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors)); +#endif +} diff --git a/src/deh_tables.h b/src/deh_tables.h index 2c6b3e204..d094bcbad 100644 --- a/src/deh_tables.h +++ b/src/deh_tables.h @@ -72,4 +72,7 @@ extern const char *const MENUTYPES_LIST[]; extern struct int_const_s const INT_CONST[]; +// Moved to this file because it can't work compile-time otherwise +void DEH_TableCheck(void); + #endif diff --git a/src/dehacked.c b/src/dehacked.c index b42663267..c2ea28d27 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -645,25 +645,3 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum) { DEH_LoadDehackedLumpPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum), false); } - -void DEH_Check(void) -{ -#if defined(_DEBUG) || defined(PARANOIA) - const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*); - const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*); - const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*); - const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*); - - if (dehstates != S_FIRSTFREESLOT) - I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates)); - - if (dehmobjs != MT_FIRSTFREESLOT) - I_Error("You forgot to update the Dehacked mobjtype list, you dolt!\n(%d mobj types defined, versus %s in the Dehacked list)\n", MT_FIRSTFREESLOT, sizeu1(dehmobjs)); - - if (dehpowers != NUMPOWERS) - I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers)); - - if (dehcolors != SKINCOLOR_FIRSTFREESLOT) - I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors)); -#endif -} diff --git a/src/dehacked.h b/src/dehacked.h index d5256be23..1620314ca 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -30,8 +30,6 @@ typedef enum void DEH_LoadDehackedLump(lumpnum_t lumpnum); void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump, boolean mainfile); -void DEH_Check(void); - fixed_t get_number(const char *word); FUNCPRINTF void deh_warning(const char *first, ...); void deh_strlcpy(char *dst, const char *src, size_t size, const char *warntext); From 90611ed547044d6902ad61008a8eca2be393074e Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 16 Feb 2021 21:36:28 +0100 Subject: [PATCH 048/160] Fix MOBJCONSISTANCY and make it optional in DEBUGMODE MOBJCONSISTANCY checks confined to gamestate GS_LEVEL. DEBUGMODE no longer implicitly enables them, making it netgame-compatible. --- src/Makefile | 2 +- src/d_clisrv.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 1314161bd..67560caf6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -415,7 +415,7 @@ ifdef GCC48 else CFLAGS+=-O0 endif - CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP -DMOBJCONSISTANCY + CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP else diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 02577b508..1b6b4cd1f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4480,6 +4480,7 @@ static INT16 Consistancy(void) ret += P_GetRandSeed(); #ifdef MOBJCONSISTANCY +if (gamestate == GS_LEVEL) { for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) @@ -4546,6 +4547,7 @@ static INT16 Consistancy(void) ret += mo->frame; } } +} #endif DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF))); From 0cbf9a791b883e7a819aceaa4a0a7e330dccdb15 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 16 Feb 2021 23:27:44 +0100 Subject: [PATCH 049/160] Fix indentation in MOBJCONSISTANCY conditional --- src/d_clisrv.c | 125 +++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1b6b4cd1f..7c2dec6a1 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4480,74 +4480,75 @@ static INT16 Consistancy(void) ret += P_GetRandSeed(); #ifdef MOBJCONSISTANCY -if (gamestate == GS_LEVEL) { - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + if (gamestate == GS_LEVEL) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo = (mobj_t *)th; - - if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY)) + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - ret -= mo->type; - ret += mo->x; - ret -= mo->y; - ret += mo->z; - ret -= mo->momx; - ret += mo->momy; - ret -= mo->momz; - ret += mo->angle; - ret -= mo->flags; - ret += mo->flags2; - ret -= mo->eflags; - if (mo->target) + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + + mo = (mobj_t *)th; + + if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY)) { - ret += mo->target->type; - ret -= mo->target->x; - ret += mo->target->y; - ret -= mo->target->z; - ret += mo->target->momx; - ret -= mo->target->momy; - ret += mo->target->momz; - ret -= mo->target->angle; - ret += mo->target->flags; - ret -= mo->target->flags2; - ret += mo->target->eflags; - ret -= mo->target->state - states; - ret += mo->target->tics; - ret -= mo->target->sprite; - ret += mo->target->frame; + ret -= mo->type; + ret += mo->x; + ret -= mo->y; + ret += mo->z; + ret -= mo->momx; + ret += mo->momy; + ret -= mo->momz; + ret += mo->angle; + ret -= mo->flags; + ret += mo->flags2; + ret -= mo->eflags; + if (mo->target) + { + ret += mo->target->type; + ret -= mo->target->x; + ret += mo->target->y; + ret -= mo->target->z; + ret += mo->target->momx; + ret -= mo->target->momy; + ret += mo->target->momz; + ret -= mo->target->angle; + ret += mo->target->flags; + ret -= mo->target->flags2; + ret += mo->target->eflags; + ret -= mo->target->state - states; + ret += mo->target->tics; + ret -= mo->target->sprite; + ret += mo->target->frame; + } + else + ret ^= 0x3333; + if (mo->tracer && mo->tracer->type != MT_OVERLAY) + { + ret += mo->tracer->type; + ret -= mo->tracer->x; + ret += mo->tracer->y; + ret -= mo->tracer->z; + ret += mo->tracer->momx; + ret -= mo->tracer->momy; + ret += mo->tracer->momz; + ret -= mo->tracer->angle; + ret += mo->tracer->flags; + ret -= mo->tracer->flags2; + ret += mo->tracer->eflags; + ret -= mo->tracer->state - states; + ret += mo->tracer->tics; + ret -= mo->tracer->sprite; + ret += mo->tracer->frame; + } + else + ret ^= 0xAAAA; + ret -= mo->state - states; + ret += mo->tics; + ret -= mo->sprite; + ret += mo->frame; } - else - ret ^= 0x3333; - if (mo->tracer && mo->tracer->type != MT_OVERLAY) - { - ret += mo->tracer->type; - ret -= mo->tracer->x; - ret += mo->tracer->y; - ret -= mo->tracer->z; - ret += mo->tracer->momx; - ret -= mo->tracer->momy; - ret += mo->tracer->momz; - ret -= mo->tracer->angle; - ret += mo->tracer->flags; - ret -= mo->tracer->flags2; - ret += mo->tracer->eflags; - ret -= mo->tracer->state - states; - ret += mo->tracer->tics; - ret -= mo->tracer->sprite; - ret += mo->tracer->frame; - } - else - ret ^= 0xAAAA; - ret -= mo->state - states; - ret += mo->tics; - ret -= mo->sprite; - ret += mo->frame; } } -} #endif DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF))); From 998d06569880aa79e310484d7baa7fdd638d9083 Mon Sep 17 00:00:00 2001 From: sphere Date: Wed, 17 Feb 2021 16:06:02 +0100 Subject: [PATCH 050/160] Add more actions for slope copying & update the ZB config. --- extras/conf/SRB2-22.cfg | 78 +++++++++++++++++++++++++++++++++++++++++ src/p_setup.c | 28 +++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index a0d40cdf0..b7ba56ba7 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -3059,6 +3059,84 @@ linedeftypes slopeargs = 3; } + 723 + { + title = "Copy Backside Floor Slope from Line Tag"; + prefix = "(720)"; + slope = "copy"; + slopeargs = 4; + } + + 724 + { + title = "Copy Backside Ceiling Slope from Line Tag"; + prefix = "(721)"; + slope = "copy"; + slopeargs = 8; + } + + 725 + { + title = "Copy Backside Floor and Ceiling Slope from Line Tag"; + prefix = "(722)"; + slope = "copy"; + slopeargs = 12; + } + + 730 + { + title = "Copy Frontside Floor Slope to Backside"; + prefix = "(730)"; + slope = "copy"; + slopeargs = 1; + //copyslopeargs = 1; uncomment when ZB updates + } + + 731 + { + title = "Copy Frontside Ceiling Slope to Backside"; + prefix = "(731)"; + slope = "copy"; + slopeargs = 2; + //copyslopeargs = 4; uncomment when ZB updates + } + + 732 + { + title = "Copy Frontside Floor and Ceiling Slope to Backside"; + prefix = "(732)"; + slope = "copy"; + slopeargs = 3; + //copyslopeargs = 5; uncomment when ZB updates + } + + 733 + { + title = "Copy Backside Floor Slope to Frontside"; + prefix = "(730)"; + slope = "copy"; + slopeargs = 1; + //copyslopeargs = 2; uncomment when ZB updates + } + + 734 + { + title = "Copy Backside Ceiling Slope to Frontside"; + prefix = "(731)"; + slope = "copy"; + slopeargs = 2; + //copyslopeargs = 8; uncomment when ZB updates + } + + 735 + { + title = "Copy Backside Floor and Ceiling Slope to Frontside"; + prefix = "(732)"; + slope = "copy"; + slopeargs = 3; + //copyslopeargs = 10; uncomment when ZB updates + } + 799 { title = "Set Tagged Dynamic Slope Vertex to Front Sector Height"; diff --git a/src/p_setup.c b/src/p_setup.c index 66243fb0e..1c70c01e6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3141,6 +3141,34 @@ static void P_ConvertBinaryMap(void) lines[i].args[1] = tag; lines[i].special = 720; break; + case 723: //Copy back side floor slope + case 724: //Copy back side ceiling slope + case 725: //Copy back side floor and ceiling slope + if (lines[i].special != 724) + lines[i].args[2] = tag; + if (lines[i].special != 723) + lines[i].args[3] = tag; + lines[i].special = 720; + break; + case 730: //Copy front side floor slope to back side + case 731: //Copy front side ceiling slope to back side + case 732: //Copy front side floor and ceiling slope to back side + if (lines[i].special != 731) + lines[i].args[4] |= TMSC_FRONTTOBACKFLOOR; + if (lines[i].special != 730) + lines[i].args[4] |= TMSC_FRONTTOBACKCEILING; + lines[i].special = 720; + break; + case 733: //Copy back side floor slope to front side + case 734: //Copy back side ceiling slope to front side + case 735: //Copy back side floor and ceiling slope to front side + if (lines[i].special != 734) + lines[i].args[4] |= TMSC_BACKTOFRONTFLOOR; + if (lines[i].special != 733) + lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; + lines[i].special = 720; + break; + case 900: //Translucent wall (10%) case 901: //Translucent wall (20%) case 902: //Translucent wall (30%) From 3003c252d12651111498e47eb9d372c0e8794a75 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 18 Feb 2021 05:16:15 -0800 Subject: [PATCH 051/160] Makfile: don't print some messages twice --- src/Makefile | 10 +++++++--- src/Makefile.cfg | 10 ++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Makefile b/src/Makefile index 42b757940..1186fe915 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ # GNU Make makefile for SRB2 ############################################################################# # Copyright (C) 1998-2000 by DooM Legacy Team. -# Copyright (C) 2003-2020 by Sonic Team Junior. +# Copyright (C) 2003-2021 by Sonic Team Junior. # # This program is free software distributed under the # terms of the GNU General Public License, version 2. @@ -79,6 +79,10 @@ # ############################################################################# +ifndef MAKE_RESTARTS +print=$(info $(1)) +endif + ALL_SYSTEMS=\ PANDORA\ LINUX64\ @@ -98,7 +102,7 @@ ALL_SYSTEMS=\ ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES))) ifeq ($(OS),Windows_NT) # all windows are Windows_NT... - $(info Detected a Windows system, compiling for 32-bit MinGW SDL2...) + $(call print,Detected a Windows system, compiling for 32-bit MinGW SDL2...) # go for a 32-bit sdl mingw exe by default MINGW=1 @@ -123,7 +127,7 @@ else # if you on the *nix new_system:=$(new_system)64 endif - $(info Detected $(system) ($(new_system))...) + $(call print,Detected $(system) ($(new_system))...) $(new_system)=1 endif diff --git a/src/Makefile.cfg b/src/Makefile.cfg index f081eacdf..c323f4ffd 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -60,12 +60,14 @@ ifeq (,$(filter GCC%,$(.VARIABLES))) # If this version is not in the list, default to the latest supported ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS))) - $(info\ - Your compiler version, GCC $(version), is not supported by the Makefile.\ - The Makefile will assume GCC $(LATEST_GCC_VERSION).) + define line = + Your compiler version, GCC $(version), is not supported by the Makefile. + The Makefile will assume GCC $(LATEST_GCC_VERSION).)) + endef + $(call print,$(line)) GCC$(subst .,,$(LATEST_GCC_VERSION))=1 else - $(info Detected GCC $(version) (GCC$(v))) + $(call print,Detected GCC $(version) (GCC$(v))) GCC$(v)=1 endif endif From 3d32f3145cf1bec85f77c33908a8bfc6772bd779 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 18 Feb 2021 06:15:11 -0800 Subject: [PATCH 052/160] Generate individual dependency files This removes Makefile.depends. Instead, '.d' files are included from the 'dep' directory. This speeds up building because dependencies for every file don't need to be regenerated if only one changes. As a bonus, dependencies also won't be generated if only clean type targets are going to be run. Also added a 'distclean' target, which cleans both objects and dependency files. --- src/Makefile | 57 ++++++++++++++++++++++++------------------------ src/Makefile.cfg | 13 +++++++++++ 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/Makefile b/src/Makefile index 1186fe915..3e8c33624 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,7 +24,9 @@ # clean # Remove all object files # cleandep -# Remove depend.dep +# Remove dependency files +# distclean +# Remove autogenerated files # dll # compile primary HW render DLL/SO # all_dll @@ -459,7 +461,6 @@ DBGNAME?=$(EXENAME).debug # not too sophisticated dependency OBJS:=$(i_main_o) \ - $(OBJDIR)/comptime.o \ $(OBJDIR)/string.o \ $(OBJDIR)/d_main.o \ $(OBJDIR)/d_clisrv.o \ @@ -539,6 +540,8 @@ OBJS:=$(i_main_o) \ $(i_sound_o) \ $(OBJS) +DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(OBJS)) +OBJS+=$(OBJDIR)/comptime.o ifndef ECHO ifndef NOECHOFILENAMES @@ -559,12 +562,12 @@ OPTS+=-DGETTEXT endif ifdef PANDORA -all: pre-build $(BIN)/$(PNDNAME) +all: $(BIN)/$(PNDNAME) endif ifdef SDL -all: pre-build $(BIN)/$(EXENAME) +all: $(BIN)/$(EXENAME) endif ifdef DUMMY @@ -572,20 +575,15 @@ all: $(BIN)/$(EXENAME) endif cleandep: - $(REMOVE) $(OBJDIR)/depend.dep + $(REMOVE) $(DEPS) $(REMOVE) comptime.h -pre-build: -ifdef WINDOWSHELL - -..\comptime.bat . -else - -@../comptime.sh . -endif - clean: $(REMOVE) *~ *.flc $(REMOVE) $(OBJDIR)/*.o +distclean: clean cleandep + ifdef MINGW $(REMOVE) $(OBJDIR)/*.res endif @@ -667,24 +665,21 @@ endif endif #dependecy made by gcc itself ! -$(OBJS): ifndef DUMMY --include $(OBJDIR)/depend.dep +ifneq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all))) +$(call print,Checking dependency files...) +-include $(DEPS) +endif endif -$(OBJDIR)/depend.dep: - @echo "Creating dependency file, depend.dep" - @echo > comptime.h - -$(MKDIR) $(OBJDIR) - $(CC) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped - $(CC) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped -ifndef NOHW - $(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped +$(DEPDIR)/%.d: %.c +# windows makes it too hard ! +ifndef WINDOWSHELL +ifndef ECHO + @printf "%-20.20s\r" $< endif - $(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped - @sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep - $(REMOVE) $(OBJDIR)/depend.ped - @echo "Created dependency file, depend.dep" +endif + $(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$< $< ifdef VALGRIND $(OBJDIR)/z_zone.o: z_zone.c @@ -692,9 +687,13 @@ $(OBJDIR)/z_zone.o: z_zone.c $(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@ endif -$(OBJDIR)/comptime.o: comptime.c pre-build - $(echoName) - $(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@ +$(OBJDIR)/comptime.o:: +ifdef WINDOWSHELL + -..\comptime.bat . +else + -../comptime.sh . +endif + $(CC) $(CFLAGS) $(WFLAGS) -c comptime.c -o $@ $(BIN)/%.mo: locale/%.po -$(MKDIR) $(BIN) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index c323f4ffd..ec19e9f85 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -363,6 +363,7 @@ i_main_o=$(OBJDIR)/i_main.o #set OBJDIR and BIN's starting place OBJDIR=../objs BIN=../bin +DEPDIR=../dep #Nasm ASM and rm ifdef YASM NASM?=yasm @@ -385,6 +386,7 @@ ifdef DUMMY INTERFACE=dummy OBJDIR:=$(OBJDIR)/dummy BIN:=$(BIN)/dummy + DEPDIR:=$(DEPDIR)/dummy else ifdef LINUX NASMFORMAT=elf -DLINUX @@ -392,9 +394,11 @@ ifdef LINUX ifdef LINUX64 OBJDIR:=$(OBJDIR)/Linux64 BIN:=$(BIN)/Linux64 + DEPDIR:=$(DEPDIR)/Linux64 else OBJDIR:=$(OBJDIR)/Linux BIN:=$(BIN)/Linux + DEPDIR:=$(DEPDIR)/Linux endif else ifdef FREEBSD @@ -404,6 +408,7 @@ ifdef FREEBSD OBJDIR:=$(OBJDIR)/FreeBSD BIN:=$(BIN)/FreeBSD + DEPDIR:=$(DEPDIR)/Linux else ifdef SOLARIS INTERFACE=sdl @@ -412,6 +417,7 @@ ifdef SOLARIS OBJDIR:=$(OBJDIR)/Solaris BIN:=$(BIN)/Solaris + DEPDIR:=$(DEPDIR)/Solaris else ifdef CYGWIN32 INTERFACE=sdl @@ -420,18 +426,21 @@ ifdef CYGWIN32 OBJDIR:=$(OBJDIR)/cygwin BIN:=$(BIN)/Cygwin + DEPDIR:=$(DEPDIR)/Cygwin else ifdef MINGW64 #NASMFORMAT=win64 SDL=1 OBJDIR:=$(OBJDIR)/Mingw64 BIN:=$(BIN)/Mingw64 + DEPDIR:=$(DEPDIR)/Mingw64 else ifdef MINGW NASMFORMAT=win32 SDL=1 OBJDIR:=$(OBJDIR)/Mingw BIN:=$(BIN)/Mingw + DEPDIR:=$(DEPDIR)/Mingw endif endif endif @@ -443,6 +452,7 @@ endif ifdef ARCHNAME OBJDIR:=$(OBJDIR)/$(ARCHNAME) BIN:=$(BIN)/$(ARCHNAME) + DEPDIR:=$(DEPDIR)/$(ARCHNAME) endif OBJDUMP_OPTS?=--wide --source --line-numbers @@ -451,14 +461,17 @@ LD=$(CC) ifdef SDL INTERFACE=sdl OBJDIR:=$(OBJDIR)/SDL + DEPDIR:=$(DEPDIR)/SDL endif ifndef DUMMY ifdef DEBUGMODE OBJDIR:=$(OBJDIR)/Debug BIN:=$(BIN)/Debug + DEPDIR:=$(DEPDIR)/Debug else OBJDIR:=$(OBJDIR)/Release BIN:=$(BIN)/Release + DEPDIR:=$(DEPDIR)/Release endif endif From 747c278bc2380d5f48c0c939de1ef3994d44b6c4 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 18 Feb 2021 07:03:25 -0800 Subject: [PATCH 053/160] Makefile: add a SILENT flag This makes it print nothing to stdout. Also fixed some irregularities. --- src/Makefile | 37 ++++++++++++++++++++++++++----------- src/Makefile.cfg | 3 ++- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3e8c33624..260175a69 100644 --- a/src/Makefile +++ b/src/Makefile @@ -81,9 +81,16 @@ # ############################################################################# +,=, + +ifeq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all))) +CLEANONLY=1 +else ifndef SILENT +echo=@echo "$(1)" ifndef MAKE_RESTARTS print=$(info $(1)) endif +endif ALL_SYSTEMS=\ PANDORA\ @@ -104,7 +111,7 @@ ALL_SYSTEMS=\ ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES))) ifeq ($(OS),Windows_NT) # all windows are Windows_NT... - $(call print,Detected a Windows system, compiling for 32-bit MinGW SDL2...) + $(call print,Detected a Windows system$(,) compiling for 32-bit MinGW SDL2...) # go for a 32-bit sdl mingw exe by default MINGW=1 @@ -243,6 +250,12 @@ endif MSGFMT?=msgfmt +ifdef WINDOWSHELL + COMPTIME=-..\comptime.bat +else + COMPTIME=-../comptime.sh +endif + ifndef ECHO NASM:=@$(NASM) REMOVE:=@$(REMOVE) @@ -257,6 +270,7 @@ ifndef ECHO MSGFMT:=@$(MSGFMT) UPX:=@$(UPX) UPX_OPTS+=-q + COMPTIME:=@$(COMPTIME) endif ifdef NONET @@ -543,6 +557,7 @@ OBJS:=$(i_main_o) \ DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(OBJS)) OBJS+=$(OBJDIR)/comptime.o +ifndef SILENT ifndef ECHO ifndef NOECHOFILENAMES define echoName = @@ -550,6 +565,7 @@ define echoName = endef endif endif +endif # List of languages to compile. # For reference, this is the command I use to build a srb2.pot file from the source code. @@ -603,11 +619,11 @@ asm: $(BIN)/$(EXENAME): $(POS) $(OBJS) -$(MKDIR) $(BIN) - @echo Linking $(EXENAME)... + $(call echo,Linking $(EXENAME)...) $(LD) $(LDFLAGS) $(OBJS) -o $(BIN)/$(EXENAME) $(LIBS) ifndef VALGRIND ifndef NOOBJDUMP - @echo Dumping debugging info + $(call echo,Dumping debugging info) $(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(EXENAME) > $(BIN)/$(DBGNAME).txt ifdef WINDOWSHELL -$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt @@ -626,10 +642,10 @@ ifndef NOUPX -$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME) endif endif - @echo Build is done, please look for $(EXENAME) in $(BIN), \(checking for post steps\) + $(call echo,Build is done$(,) please look for $(EXENAME) in $(BIN)$(,) (checking for post steps)) reobjdump: - @echo Redumping debugging info + $(call echo,Redumping debugging info) $(OBJDUMP) $(OBJDUMP_OPTS) $(BIN)/$(DBGNAME) > $(BIN)/$(DBGNAME).txt ifdef WINDOWSHELL -$(GZIP) $(GZIP_OPTS) $(BIN)/$(DBGNAME).txt @@ -666,7 +682,7 @@ endif #dependecy made by gcc itself ! ifndef DUMMY -ifneq (,$(filter-out cleandep clean distclean,$(or $(MAKECMDGOALS),all))) +ifndef CLEANONLY $(call print,Checking dependency files...) -include $(DEPS) endif @@ -675,7 +691,7 @@ endif $(DEPDIR)/%.d: %.c # windows makes it too hard ! ifndef WINDOWSHELL -ifndef ECHO +ifdef echoName @printf "%-20.20s\r" $< endif endif @@ -688,11 +704,10 @@ $(OBJDIR)/z_zone.o: z_zone.c endif $(OBJDIR)/comptime.o:: -ifdef WINDOWSHELL - -..\comptime.bat . -else - -../comptime.sh . +ifdef echoName + @echo -- comptime.c ... endif + $(COMPTIME) . $(CC) $(CFLAGS) $(WFLAGS) -c comptime.c -o $@ $(BIN)/%.mo: locale/%.po diff --git a/src/Makefile.cfg b/src/Makefile.cfg index ec19e9f85..075cd2d3a 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -47,7 +47,8 @@ ifdef MACOSX endif # Automatically set version flag, but not if one was manually set -ifeq (,$(filter GCC%,$(.VARIABLES))) +# And don't bother if this is a clean only run +ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES))) version:=$(shell $(CC) --version) # check if this is in fact GCC ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version)))) From 73758f50ff5586f537a2e414519bc4b8ae8103f4 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 19 Feb 2021 06:45:28 -0500 Subject: [PATCH 054/160] Fix dropshadows of papersprites drifting depending on angle relative to camera. Discovered in Kart internal for the paper item drops and ported back, hence the branch name. --- src/r_things.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 30bf15f85..bea40c810 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1423,7 +1423,7 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t sheartan = 0; fixed_t shadowscale = FRACUNIT; - fixed_t basetx; // drop shadows + fixed_t basetx, basetz; // drop shadows boolean shadowdraw, shadoweffects, shadowskew; boolean splat = R_ThingIsFloorSprite(thing); @@ -1453,7 +1453,7 @@ static void R_ProjectSprite(mobj_t *thing) tr_x = thing->x - viewx; tr_y = thing->y - viewy; - tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance + basetz = tz = FixedMul(tr_x, viewcos) + FixedMul(tr_y, viewsin); // near/far distance // thing is behind view plane? if (!papersprite && (tz < FixedMul(MINZ, this_scale))) // papersprite clipping is handled later @@ -2052,7 +2052,7 @@ static void R_ProjectSprite(mobj_t *thing) R_SplitSprite(vis); if (oldthing->shadowscale && cv_shadow.value) - R_ProjectDropShadow(oldthing, vis, oldthing->shadowscale, basetx, tz); + R_ProjectDropShadow(oldthing, vis, oldthing->shadowscale, basetx, basetz); // Debug ++objectsdrawn; From 308ab0e0791abe16fd1109c0c48e6a249592cfe9 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Sun, 21 Feb 2021 22:16:38 +0100 Subject: [PATCH 055/160] Fix OpenGL V_DrawCroppedPatch --- src/hardware/hw_draw.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 8c92c6709..ba4923d10 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -437,18 +437,9 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (!(option & V_SCALEPATCHMASK)) { - // if it's meant to cover the whole screen, black out the rest (ONLY IF TOP LEFT ISN'T TRANSPARENT) - // cx and cy are possibly *slightly* off from float maths - // This is done before here compared to software because we directly alter cx and cy to centre - if (cx >= -0.1f && cx <= 0.1f && gpatch->width == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && gpatch->height == BASEVIDHEIGHT) - { - const column_t *column = (const column_t *)((const UINT8 *)(gpatch->columns) + (gpatch->columnofs[0])); - if (!column->topdelta) - { - const UINT8 *source = (const UINT8 *)(column) + 3; - HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); - } - } + // if it's meant to cover the whole screen, black out the rest + // no the patch is cropped do not do this ever + // centre screen if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f) { @@ -470,11 +461,11 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fwidth = w; fheight = h; - if (fwidth > gpatch->width) - fwidth = gpatch->width; + if (sx + w > gpatch->width) + fwidth = gpatch->width - sx; - if (fheight > gpatch->height) - fheight = gpatch->height; + if (sy + h > gpatch->height) + fheight = gpatch->height - sy; if (pscale != FRACUNIT) { @@ -506,13 +497,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, v[0].s = v[3].s = ((sx)/(float)(gpatch->width))*hwrPatch->max_s; if (sx + w > gpatch->width) - v[2].s = v[1].s = hwrPatch->max_s - ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s; + v[2].s = v[1].s = hwrPatch->max_s; else v[2].s = v[1].s = ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s; v[0].t = v[1].t = ((sy)/(float)(gpatch->height))*hwrPatch->max_t; if (sy + h > gpatch->height) - v[2].t = v[3].t = hwrPatch->max_t - ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t; + v[2].t = v[3].t = hwrPatch->max_t; else v[2].t = v[3].t = ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t; From 12205314bcc8e973e22e1bbbfcccb8f34c304629 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 21 Feb 2021 19:32:00 -0600 Subject: [PATCH 056/160] Check against null tmpusher source before attempting to push a thing. --- src/p_spec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 226e58d15..9886495db 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -8458,6 +8458,9 @@ static inline boolean PIT_PushThing(mobj_t *thing) if (thing->player && thing->player->powers[pw_carry] == CR_ROPEHANG) return false; + if (!tmpusher->source) + return false; + // Allow this to affect pushable objects at some point? if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || thing->player->powers[pw_carry] == CR_NIGHTSMODE)) { From d305952119aff3f84eee15697c4e2af6b32a1140 Mon Sep 17 00:00:00 2001 From: sphere Date: Wed, 24 Feb 2021 10:30:48 +0100 Subject: [PATCH 057/160] Update ZB config: at this rate, ZB will update before this gets merged. --- extras/conf/SRB2-22.cfg | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index b7ba56ba7..246ef9b64 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -3088,8 +3088,7 @@ linedeftypes title = "Copy Frontside Floor Slope to Backside"; prefix = "(730)"; slope = "copy"; - slopeargs = 1; - //copyslopeargs = 1; uncomment when ZB updates + copyslopeargs = 1; } 731 @@ -3097,8 +3096,7 @@ linedeftypes title = "Copy Frontside Ceiling Slope to Backside"; prefix = "(731)"; slope = "copy"; - slopeargs = 2; - //copyslopeargs = 4; uncomment when ZB updates + copyslopeargs = 4; } 732 @@ -3106,8 +3104,7 @@ linedeftypes title = "Copy Frontside Floor and Ceiling Slope to Backside"; prefix = "(732)"; slope = "copy"; - slopeargs = 3; - //copyslopeargs = 5; uncomment when ZB updates + copyslopeargs = 5; } 733 @@ -3115,8 +3112,7 @@ linedeftypes title = "Copy Backside Floor Slope to Frontside"; prefix = "(730)"; slope = "copy"; - slopeargs = 1; - //copyslopeargs = 2; uncomment when ZB updates + copyslopeargs = 2; } 734 @@ -3124,8 +3120,7 @@ linedeftypes title = "Copy Backside Ceiling Slope to Frontside"; prefix = "(731)"; slope = "copy"; - slopeargs = 2; - //copyslopeargs = 8; uncomment when ZB updates + copyslopeargs = 8; } 735 @@ -3133,8 +3128,7 @@ linedeftypes title = "Copy Backside Floor and Ceiling Slope to Frontside"; prefix = "(732)"; slope = "copy"; - slopeargs = 3; - //copyslopeargs = 10; uncomment when ZB updates + copyslopeargs = 10; } 799 From 75d0e702369e80cc93191782bc8dfd4de45fde88 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 25 Feb 2021 23:41:43 +0100 Subject: [PATCH 058/160] Fix sector tags being signed in Lua --- src/lua_maplib.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 6a9091cc9..9598f7708 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -583,7 +583,18 @@ static int sector_get(lua_State *L) lua_pushinteger(L, sector->special); return 1; case sector_tag: - lua_pushinteger(L, Tag_FGet(§or->tags)); + // HELLO + // THIS IS LJ SONIC + // HOW IS YOUR DAY? + // BY THE WAY WHEN 2.3 OR 3.0 OR 4.0 OR SRB3 OR SRB4 OR WHATEVER IS OUT + // YOU SHOULD REMEMBER TO CHANGE THIS SO IT ALWAYS RETURNS A UNSIGNED VALUE + // HAVE A NICE DAY + // + // + // + // + // you are ugly + lua_pushinteger(L, (UINT16)Tag_FGet(§or->tags)); return 1; case sector_taglist: LUA_PushUserdata(L, §or->tags, META_SECTORTAGLIST); @@ -828,6 +839,17 @@ static int line_get(lua_State *L) lua_pushinteger(L, line->special); return 1; case line_tag: + // HELLO + // THIS IS LJ SONIC + // HOW IS YOUR DAY? + // BY THE WAY WHEN 2.3 OR 3.0 OR 4.0 OR SRB3 OR SRB4 OR WHATEVER IS OUT + // YOU SHOULD REMEMBER TO CHANGE THIS SO IT ALWAYS RETURNS A UNSIGNED VALUE + // HAVE A NICE DAY + // + // + // + // + // you are ugly lua_pushinteger(L, Tag_FGet(&line->tags)); return 1; case line_taglist: From 5b1dc6ba338ac1f1401d38ce1d82aeb082ad3dff Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 24 Feb 2021 23:45:39 -0300 Subject: [PATCH 059/160] [Meta] Change branding --- src/d_netcmd.c | 4 ++-- src/m_misc.c | 6 +++--- src/sdl/i_system.c | 8 ++++---- src/sdl/i_video.c | 2 +- src/win32/Makefile.cfg | 2 +- src/win32/Srb2win.rc | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4208e4c4f..8d42ca4c2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3477,9 +3477,9 @@ static void Command_ListWADS_f(void) static void Command_Version_f(void) { #ifdef DEVELOP - CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime); + CONS_Printf("Kitchen Sink Faucet %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime); #else - CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch); + CONS_Printf("Kitchen Sink Faucet %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch); #endif // Base library diff --git a/src/m_misc.c b/src/m_misc.c index 42890cb08..376e7512f 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -783,10 +783,10 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png char keytxt[SRB2PNGTXT][12] = { "Title", "Description", "Playername", "Mapnum", "Mapname", "Location", "Interface", "Render Mode", "Revision", "Build Date", "Build Time"}; - char titletxt[] = "Sonic Robo Blast 2 " VERSIONSTRING; + char titletxt[] = "Kitchen Sink Faucet " VERSIONSTRING; png_charp playertxt = cv_playername.zstring; - char desctxt[] = "SRB2 Screenshot"; - char Movietxt[] = "SRB2 Movie"; + char desctxt[] = "Kitchen Sink Faucet Screenshot"; + char Movietxt[] = "Kitchen Sink Faucet Movie"; size_t i; char interfacetxt[] = #ifdef HAVE_SDL diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 10c0747bf..1c47b89c9 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -629,7 +629,7 @@ static void I_StartupConsole(void) if (gotConsole) { - SetConsoleTitleA("SRB2 Console"); + SetConsoleTitleA("Kitchen Sink Faucet Console"); consolevent = SDL_TRUE; } @@ -1622,7 +1622,7 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) return; if(mumble->uiVersion != 2) { - wcsncpy(mumble->name, L"SRB2 "VERSIONSTRINGW, 256); + wcsncpy(mumble->name, L"Kitchen Sink Faucet "VERSIONSTRINGW, 256); wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048); mumble->uiVersion = 2; } @@ -2400,7 +2400,7 @@ void I_Error(const char *error, ...) // which should fail gracefully if it can't put a message box up // on the target system SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "SRB2 "VERSIONSTRING" Recursive Error", + "Kitchen Sink Faucet Recursive Error", buffer, NULL); W_Shutdown(); @@ -2444,7 +2444,7 @@ void I_Error(const char *error, ...) // which should fail gracefully if it can't put a message box up // on the target system SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "SRB2 "VERSIONSTRING" Error", + "Kitchen Sink Faucet Error", buffer, NULL); // Note that SDL_ShowSimpleMessageBox does *not* require SDL to be // initialized at the time, so calling it after SDL_Quit() is diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index c8f67da77..032521c0a 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1631,7 +1631,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif // Create a window - window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + window = SDL_CreateWindow("Kitchen Sink Faucet "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 702ae3765..0365f617d 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -68,7 +68,7 @@ endif endif # name of the exefile - EXENAME?=srb2win.exe + EXENAME?=kitchensinkfaucet.exe ifdef SDL i_system_o+=$(OBJDIR)/SRB2.res diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index 5ba366bda..98927e2a6 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -84,14 +84,14 @@ BEGIN BEGIN VALUE "Comments", "Visit our web site at www.srb2.org for news and updates!\0" VALUE "CompanyName", "Sonic Team Junior\0" - VALUE "FileDescription", "Sonic Robo Blast 2\0" + VALUE "FileDescription", "Kitchen Sink Faucet\0" VALUE "FileVersion", VERSIONSTRING_RC VALUE "InternalName", "srb2\0" VALUE "LegalCopyright", "Copyright 1998-2020 by Sonic Team Junior\0" VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0" - VALUE "OriginalFilename", "srb2win.exe\0" + VALUE "OriginalFilename", "kitchensinkfaucet.exe\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Sonic Robo Blast 2\0" + VALUE "ProductName", "Kitchen Sink Faucet\0" VALUE "ProductVersion", VERSIONSTRING_RC VALUE "SpecialBuild", "\0" END From 70ebca2bf602dd69beb1a4c00a9aafe96b8722e0 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Thu, 25 Feb 2021 00:25:09 -0300 Subject: [PATCH 060/160] Update README --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a5ca1a1f..98cff8fec 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ -# Sonic Robo Blast 2 +# Kitchen Sink Faucet SRB2 -[![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2) -[![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2) -[![CircleCI](https://circleci.com/gh/STJr/SRB2/tree/master.svg?style=svg)](https://circleci.com/gh/STJr/SRB2/tree/master) - -[Sonic Robo Blast 2](https://srb2.org/) is a 3D Sonic the Hedgehog fangame based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/). +[![Build status](https://ci.appveyor.com/api/projects/status/gv49pw5mra2sad1j?svg=true)](https://ci.appveyor.com/project/jimita/kitchensinkfaucetsrb2) +[![CircleCI](https://circleci.com/gh/Jimita/KitchenSinkFaucetSRB2/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/Jimita/KitchenSinkFaucetSRB2) ## Dependencies - NASM (x86 builds only) From 2ca8efd7eea4b3d531ac5fca4ef09a5da9f2efd1 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Thu, 25 Feb 2021 20:17:27 -0300 Subject: [PATCH 061/160] Revert accidental push --- README.md | 9 ++++++--- src/d_netcmd.c | 4 ++-- src/m_misc.c | 6 +++--- src/sdl/i_system.c | 8 ++++---- src/sdl/i_video.c | 2 +- src/win32/Makefile.cfg | 2 +- src/win32/Srb2win.rc | 6 +++--- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 98cff8fec..8a5ca1a1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -# Kitchen Sink Faucet SRB2 +# Sonic Robo Blast 2 -[![Build status](https://ci.appveyor.com/api/projects/status/gv49pw5mra2sad1j?svg=true)](https://ci.appveyor.com/project/jimita/kitchensinkfaucetsrb2) -[![CircleCI](https://circleci.com/gh/Jimita/KitchenSinkFaucetSRB2/tree/master.svg?style=svg)](https://app.circleci.com/pipelines/github/Jimita/KitchenSinkFaucetSRB2) +[![Build status](https://ci.appveyor.com/api/projects/status/399d4hcw9yy7hg2y?svg=true)](https://ci.appveyor.com/project/STJr/srb2) +[![Build status](https://travis-ci.org/STJr/SRB2.svg?branch=master)](https://travis-ci.org/STJr/SRB2) +[![CircleCI](https://circleci.com/gh/STJr/SRB2/tree/master.svg?style=svg)](https://circleci.com/gh/STJr/SRB2/tree/master) + +[Sonic Robo Blast 2](https://srb2.org/) is a 3D Sonic the Hedgehog fangame based on a modified version of [Doom Legacy](http://doomlegacy.sourceforge.net/). ## Dependencies - NASM (x86 builds only) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8d42ca4c2..4208e4c4f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3477,9 +3477,9 @@ static void Command_ListWADS_f(void) static void Command_Version_f(void) { #ifdef DEVELOP - CONS_Printf("Kitchen Sink Faucet %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime); + CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s) ", compbranch, comprevision, compdate, comptime); #else - CONS_Printf("Kitchen Sink Faucet %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch); + CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch); #endif // Base library diff --git a/src/m_misc.c b/src/m_misc.c index 376e7512f..42890cb08 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -783,10 +783,10 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png char keytxt[SRB2PNGTXT][12] = { "Title", "Description", "Playername", "Mapnum", "Mapname", "Location", "Interface", "Render Mode", "Revision", "Build Date", "Build Time"}; - char titletxt[] = "Kitchen Sink Faucet " VERSIONSTRING; + char titletxt[] = "Sonic Robo Blast 2 " VERSIONSTRING; png_charp playertxt = cv_playername.zstring; - char desctxt[] = "Kitchen Sink Faucet Screenshot"; - char Movietxt[] = "Kitchen Sink Faucet Movie"; + char desctxt[] = "SRB2 Screenshot"; + char Movietxt[] = "SRB2 Movie"; size_t i; char interfacetxt[] = #ifdef HAVE_SDL diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 1c47b89c9..10c0747bf 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -629,7 +629,7 @@ static void I_StartupConsole(void) if (gotConsole) { - SetConsoleTitleA("Kitchen Sink Faucet Console"); + SetConsoleTitleA("SRB2 Console"); consolevent = SDL_TRUE; } @@ -1622,7 +1622,7 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) return; if(mumble->uiVersion != 2) { - wcsncpy(mumble->name, L"Kitchen Sink Faucet "VERSIONSTRINGW, 256); + wcsncpy(mumble->name, L"SRB2 "VERSIONSTRINGW, 256); wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048); mumble->uiVersion = 2; } @@ -2400,7 +2400,7 @@ void I_Error(const char *error, ...) // which should fail gracefully if it can't put a message box up // on the target system SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "Kitchen Sink Faucet Recursive Error", + "SRB2 "VERSIONSTRING" Recursive Error", buffer, NULL); W_Shutdown(); @@ -2444,7 +2444,7 @@ void I_Error(const char *error, ...) // which should fail gracefully if it can't put a message box up // on the target system SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, - "Kitchen Sink Faucet Error", + "SRB2 "VERSIONSTRING" Error", buffer, NULL); // Note that SDL_ShowSimpleMessageBox does *not* require SDL to be // initialized at the time, so calling it after SDL_Quit() is diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 032521c0a..c8f67da77 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1631,7 +1631,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif // Create a window - window = SDL_CreateWindow("Kitchen Sink Faucet "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, realwidth, realheight, flags); diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 0365f617d..702ae3765 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -68,7 +68,7 @@ endif endif # name of the exefile - EXENAME?=kitchensinkfaucet.exe + EXENAME?=srb2win.exe ifdef SDL i_system_o+=$(OBJDIR)/SRB2.res diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index 98927e2a6..5ba366bda 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -84,14 +84,14 @@ BEGIN BEGIN VALUE "Comments", "Visit our web site at www.srb2.org for news and updates!\0" VALUE "CompanyName", "Sonic Team Junior\0" - VALUE "FileDescription", "Kitchen Sink Faucet\0" + VALUE "FileDescription", "Sonic Robo Blast 2\0" VALUE "FileVersion", VERSIONSTRING_RC VALUE "InternalName", "srb2\0" VALUE "LegalCopyright", "Copyright 1998-2020 by Sonic Team Junior\0" VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0" - VALUE "OriginalFilename", "kitchensinkfaucet.exe\0" + VALUE "OriginalFilename", "srb2win.exe\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Kitchen Sink Faucet\0" + VALUE "ProductName", "Sonic Robo Blast 2\0" VALUE "ProductVersion", VERSIONSTRING_RC VALUE "SpecialBuild", "\0" END From 8bcc71c6295cd65d3fbb72d9706ef072ff21d4ce Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Fri, 26 Feb 2021 15:43:53 +0200 Subject: [PATCH 062/160] Disable pausing during score screens in marathon mode --- src/d_netcmd.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 0acbec928..09f9d4651 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2130,7 +2130,7 @@ static void Command_Pause(void) if (cv_pause.value || server || (IsPlayerAdmin(consoleplayer))) { - if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION)) + if (modeattacking || !(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) || (marathonmode && gamestate == GS_INTERMISSION)) { CONS_Printf(M_GetText("You can't pause here.\n")); return; diff --git a/src/p_user.c b/src/p_user.c index a9e1fe9a2..d7ce33177 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -190,7 +190,7 @@ fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move) boolean P_AutoPause(void) { // Don't pause even on menu-up or focus-lost in netgames or record attack - if (netgame || modeattacking || gamestate == GS_TITLESCREEN) + if (netgame || modeattacking || gamestate == GS_TITLESCREEN || (marathonmode && gamestate == GS_INTERMISSION)) return false; return (menuactive || ( window_notinfocus && cv_pauseifunfocused.value )); From 77feee73c36085180db713871098f1917fdf1f3d Mon Sep 17 00:00:00 2001 From: Lachlan Wright Date: Sat, 27 Feb 2021 03:38:13 +0000 Subject: [PATCH 063/160] Revert "Merge branch 'player-speed' into 'next'" This reverts merge request !1309 --- src/p_enemy.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 3e7f52a3f..12bba0b4d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -1834,7 +1834,7 @@ void A_SnailerThink(mobj_t *actor) fixed_t dist; fixed_t dx, dy; - dist = R_PointToDist2(0, 0, actor->x - actor->target->x, actor->y - actor->target->y); + dist = P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y); if (an > ANGLE_45 && an <= ANGLE_90) // fire at 45 degrees to the left { diff --git a/src/p_user.c b/src/p_user.c index a9e1fe9a2..b3b337572 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5924,7 +5924,7 @@ static void P_3dMovement(player_t *player) player->rmomy = player->mo->momy - player->cmomy; // Calculates player's speed based on distance-of-a-line formula - player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); + player->speed = P_AproxDistance(player->rmomx, player->rmomy); // Monster Iestyn - 04-11-13 // Quadrants are stupid, excessive and broken, let's do this a much simpler way! From a1e0aa18120ad75d25b5aad4373c24e47f9dbb47 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sat, 27 Feb 2021 12:04:48 -0300 Subject: [PATCH 064/160] Fix "implicit declaration of function 'DEH_TableCheck'" warning --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 409a66bec..23a2c0133 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -61,7 +61,7 @@ #include "p_local.h" // chasecam #include "mserv.h" // ms_RoomId #include "m_misc.h" // screenshot functionality -#include "dehacked.h" // Dehacked list test +#include "deh_tables.h" // Dehacked list test #include "m_cond.h" // condition initialization #include "fastcmp.h" #include "keys.h" From 4016a2e0622826f35948da1d357be83946450fcc Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 3 Dec 2020 17:29:39 -0600 Subject: [PATCH 065/160] Crash backtrace logging for NEWSIGNALHANDLER. --- src/doomdef.h | 1 + src/sdl/i_main.c | 4 ++ src/sdl/i_system.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/src/doomdef.h b/src/doomdef.h index 52abc9597..e1cda6f42 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -118,6 +118,7 @@ #ifdef LOGMESSAGES extern FILE *logstream; +extern FILE *crashstream; extern char logfilename[1024]; #endif diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 1dee379c0..03783d1ef 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -52,6 +52,7 @@ extern int SDL_main(int argc, char *argv[]); #ifdef LOGMESSAGES FILE *logstream = NULL; +FILE *crashstream = NULL; char logfilename[1024]; #endif @@ -249,6 +250,9 @@ int main(int argc, char **argv) // startup SRB2 CONS_Printf("Setting up SRB2...\n"); D_SRB2Main(); + + crashstream = fopen(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), "at"); + #ifdef LOGMESSAGES if (!M_CheckParm("-nolog")) CONS_Printf("Logfile: %s\n", logfilename); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index d2c819c37..528d495c7 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -137,6 +137,11 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#include +#include +#endif + // Locations for searching the srb2.pk3 #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" @@ -238,6 +243,75 @@ SDL_bool framebuffer = SDL_FALSE; UINT8 keyboard_started = false; +#define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string) +#define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string)) +#define CRASHLOG_STDERR_WRITE(string) \ + if (fd != -1)\ + write(fd, string, strlen(string));\ + I_OutputMsg("%s", string) + +static void write_backtrace(INT32 signal) +{ +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) + int fd = -1; + size_t size; + time_t rawtime; + struct tm * timeinfo; + + enum { MAX_SIZE = 1024 }; + void *array[MAX_SIZE]; + + const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n"; + const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr. + + if (!crashstream) + crashstream = fopen(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), "at"); + + if (!crashstream) + I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); + else + { + fd = fileno(crashstream); + + if (fd == -1) + fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND); + } + + time(&rawtime); + timeinfo = localtime(&rawtime); + + CRASHLOG_WRITE("------------------------\n"); // Nice looking seperator + + CRASHLOG_STDERR_WRITE("\n"); // Newline to look nice for both outputs. + CRASHLOG_STDERR_WRITE(error); // "Oops, SRB2 crashed" message + STDERR_WRITE(error2); // Tell the user where the crash log is. + + // Tell the log when we crashed. + CRASHLOG_WRITE("Time of crash: "); + CRASHLOG_WRITE(asctime(timeinfo)); + + // Give the crash log the cause and a nice 'Backtrace:' thing + // The signal is given to the user when the parent process sees we crashed. + CRASHLOG_WRITE("Cause: "); + CRASHLOG_WRITE(strsignal(signal)); + CRASHLOG_WRITE("\n"); // Newline for the signal name + + CRASHLOG_STDERR_WRITE("\nBacktrace:\n"); + + // Flood the output and log with the backtrace + size = backtrace(array, MAX_SIZE); + backtrace_symbols_fd(array, size, fd); + backtrace_symbols_fd(array, size, STDERR_FILENO); + + CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :) + + close(fd); +#endif +} +#undef STDERR_WRITE +#undef CRASHLOG_WRITE +#undef CRASHLOG_STDERR_WRITE + static void I_ReportSignal(int num, int coredumped) { //static char msg[] = "oh no! back to reality!\r\n"; @@ -298,6 +372,9 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) D_QuitNetGame(); // Fix server freezes CL_AbortDownloadResume(); I_ReportSignal(num, 0); + + write_backtrace(num); + I_ShutdownSystem(); signal(num, SIG_DFL); //default signal action raise(num); @@ -687,6 +764,26 @@ static void I_RegisterSignals (void) #endif } +#ifdef NEWSIGNALHANDLER +static void signal_handler_child(INT32 num) +{ + write_backtrace(num); + + signal(num, SIG_DFL); //default signal action + raise(num); +} + +static void I_RegisterChildSignals(void) +{ + // If these defines don't exist, + // then compilation would have failed above us... + signal(SIGILL , signal_handler_child); + signal(SIGSEGV , signal_handler_child); + signal(SIGABRT , signal_handler_child); + signal(SIGFPE , signal_handler_child); +} +#endif + // //I_OutputMsg // @@ -2123,6 +2220,7 @@ static void I_Fork(void) newsignalhandler_Warn("fork()"); break; case 0: + I_RegisterChildSignals(); break; default: if (logstream) From 5108f1f57b805f7517e703f8c4b973d8489c3aa7 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 3 Dec 2020 17:08:40 -0600 Subject: [PATCH 066/160] Use file descriptors and ditch file streams, for now. --- src/doomdef.h | 1 - src/sdl/i_main.c | 4 ---- src/sdl/i_system.c | 12 ++---------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index e1cda6f42..52abc9597 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -118,7 +118,6 @@ #ifdef LOGMESSAGES extern FILE *logstream; -extern FILE *crashstream; extern char logfilename[1024]; #endif diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 03783d1ef..1dee379c0 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -52,7 +52,6 @@ extern int SDL_main(int argc, char *argv[]); #ifdef LOGMESSAGES FILE *logstream = NULL; -FILE *crashstream = NULL; char logfilename[1024]; #endif @@ -250,9 +249,6 @@ int main(int argc, char **argv) // startup SRB2 CONS_Printf("Setting up SRB2...\n"); D_SRB2Main(); - - crashstream = fopen(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), "at"); - #ifdef LOGMESSAGES if (!M_CheckParm("-nolog")) CONS_Printf("Logfile: %s\n", logfilename); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 528d495c7..7c870c0c7 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -264,18 +264,10 @@ static void write_backtrace(INT32 signal) const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n"; const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr. - if (!crashstream) - crashstream = fopen(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), "at"); + fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR); - if (!crashstream) + if (fd == -1) I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); - else - { - fd = fileno(crashstream); - - if (fd == -1) - fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND); - } time(&rawtime); timeinfo = localtime(&rawtime); From bdb28a06f4ace02a71375a462696329786dee7e9 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 3 Dec 2020 18:23:33 -0600 Subject: [PATCH 067/160] Print the backtrace before showing the signal handler popup. --- src/sdl/i_system.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7c870c0c7..1d1fc2af2 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -363,10 +363,8 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) { D_QuitNetGame(); // Fix server freezes CL_AbortDownloadResume(); - I_ReportSignal(num, 0); - write_backtrace(num); - + I_ReportSignal(num, 0); I_ShutdownSystem(); signal(num, SIG_DFL); //default signal action raise(num); From a0396d5e437929e525805414cc83d207d7db1331 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Fri, 4 Dec 2020 12:08:50 -0600 Subject: [PATCH 068/160] Make it more async-signal-safe --- src/sdl/i_system.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 1d1fc2af2..e8c5d59fb 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -256,10 +256,11 @@ static void write_backtrace(INT32 signal) int fd = -1; size_t size; time_t rawtime; - struct tm * timeinfo; + struct tm timeinfo; - enum { MAX_SIZE = 1024 }; - void *array[MAX_SIZE]; + enum { BT_SIZE = 1024, STR_SIZE = 32 }; + void *array[BT_SIZE]; + char timestr[STR_SIZE]; const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n"; const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr. @@ -269,8 +270,10 @@ static void write_backtrace(INT32 signal) if (fd == -1) I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); + // Get the current time as a string. time(&rawtime); - timeinfo = localtime(&rawtime); + localtime_r(&rawtime, &timeinfo); + strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo); CRASHLOG_WRITE("------------------------\n"); // Nice looking seperator @@ -280,7 +283,8 @@ static void write_backtrace(INT32 signal) // Tell the log when we crashed. CRASHLOG_WRITE("Time of crash: "); - CRASHLOG_WRITE(asctime(timeinfo)); + CRASHLOG_WRITE(timestr); + CRASHLOG_WRITE("\n"); // Give the crash log the cause and a nice 'Backtrace:' thing // The signal is given to the user when the parent process sees we crashed. @@ -290,8 +294,8 @@ static void write_backtrace(INT32 signal) CRASHLOG_STDERR_WRITE("\nBacktrace:\n"); - // Flood the output and log with the backtrace - size = backtrace(array, MAX_SIZE); + // Flood the output and log with the backtrace + size = backtrace(array, BT_SIZE); backtrace_symbols_fd(array, size, fd); backtrace_symbols_fd(array, size, STDERR_FILENO); From 07ffe2599cc25d5fb46f55f9f78f4e6b0dece019 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 28 Feb 2021 16:23:40 -0300 Subject: [PATCH 069/160] Fix thing scale mismatch in R_DrawVisSprite --- src/r_things.c | 4 +++- src/r_things.h | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 30bf15f85..92340cab3 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -796,7 +796,7 @@ static void R_DrawVisSprite(vissprite_t *vis) INT32 pwidth; fixed_t frac; patch_t *patch = vis->patch; - fixed_t this_scale = vis->mobj->scale; + fixed_t this_scale = vis->thingscale; INT32 x1, x2; INT64 overflow_test; @@ -1332,6 +1332,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, shadow->xscale = FixedMul(xscale, shadowxscale); //SoM: 4/17/2000 shadow->scale = FixedMul(yscale, shadowyscale); + shadow->thingscale = thing->scale; shadow->sector = vis->sector; shadow->szt = (INT16)((centeryfrac - FixedMul(shadow->gzt - viewz, yscale))>>FRACBITS); shadow->sz = (INT16)((centeryfrac - FixedMul(shadow->gz - viewz, yscale))>>FRACBITS); @@ -1975,6 +1976,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->xscale = FixedMul(spritexscale, xscale); //SoM: 4/17/2000 vis->scale = FixedMul(spriteyscale, yscale); //<thingscale = oldthing->scale; vis->spritexscale = spritexscale; vis->spriteyscale = spriteyscale; diff --git a/src/r_things.h b/src/r_things.h index f960089a1..708b6c24c 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -155,7 +155,8 @@ typedef struct vissprite_s fixed_t pz, pzt; // physical bottom/top for sorting with 3D floors fixed_t startfrac; // horizontal position of x1 - fixed_t scale; + fixed_t xscale, scale; // projected horizontal and vertical scales + fixed_t thingscale; // the object's scale fixed_t sortscale; // sortscale only differs from scale for paper sprites, floor sprites, and MF2_LINKDRAW fixed_t sortsplat; // the sortscale from behind the floor sprite fixed_t scalestep; // only for paper sprites, 0 otherwise @@ -183,8 +184,6 @@ typedef struct vissprite_s extracolormap_t *extra_colormap; // global colormaps - fixed_t xscale; - // Precalculated top and bottom screen coords for the sprite. fixed_t thingheight; // The actual height of the thing (for 3D floors) sector_t *sector; // The sector containing the thing. From 401271feb7d44bc47b7a4b29aa4de31dbf34b989 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 28 Feb 2021 17:05:25 -0300 Subject: [PATCH 070/160] Fix translation colormap cache rebuilding using the old translation enumerations This was causing a buffer underwrite too. Lovely. --- src/r_draw.c | 60 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index d9ea942a2..96554fad3 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -134,9 +134,43 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask; #define DEFAULT_STARTTRANSCOLOR 96 #define NUM_PALETTE_ENTRIES 256 -static UINT8** translationtablecache[MAXSKINS + 7] = {NULL}; +static UINT8 **translationtablecache[MAXSKINS + 7] = {NULL}; UINT8 skincolor_modified[MAXSKINCOLORS]; +static INT32 SkinToCacheIndex(INT32 skinnum) +{ + switch (skinnum) + { + case TC_DEFAULT: return DEFAULT_TT_CACHE_INDEX; + case TC_BOSS: return BOSS_TT_CACHE_INDEX; + case TC_METALSONIC: return METALSONIC_TT_CACHE_INDEX; + case TC_ALLWHITE: return ALLWHITE_TT_CACHE_INDEX; + case TC_RAINBOW: return RAINBOW_TT_CACHE_INDEX; + case TC_BLINK: return BLINK_TT_CACHE_INDEX; + case TC_DASHMODE: return DASHMODE_TT_CACHE_INDEX; + default: break; + } + + return skinnum; +} + +static INT32 CacheIndexToSkin(INT32 ttc) +{ + switch (ttc) + { + case DEFAULT_TT_CACHE_INDEX: return TC_DEFAULT; + case BOSS_TT_CACHE_INDEX: return TC_BOSS; + case METALSONIC_TT_CACHE_INDEX: return TC_METALSONIC; + case ALLWHITE_TT_CACHE_INDEX: return TC_ALLWHITE; + case RAINBOW_TT_CACHE_INDEX: return TC_RAINBOW; + case BLINK_TT_CACHE_INDEX: return TC_BLINK; + case DASHMODE_TT_CACHE_INDEX: return TC_DASHMODE; + default: break; + } + + return ttc; +} + CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; #define TRANSTAB_AMTMUL10 (256.0f / 10.0f) @@ -308,7 +342,7 @@ static void R_RainbowColormap(UINT8 *dest_colormap, UINT16 skincolor) /** \brief Generates a translation colormap. \param dest_colormap colormap to populate - \param skinnum number of skin, TC_DEFAULT or TC_BOSS + \param skinnum skin number, or a translation mode \param color translation color \return void @@ -412,6 +446,9 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U if (color >= numskincolors) I_Error("Invalid skin color #%hu.", (UINT16)color); + if (skinnum < 0 && skinnum > TC_DEFAULT) + I_Error("Invalid non-translation skin number %d.", skinnum); + starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR; if (starttranscolor >= NUM_PALETTE_ENTRIES) @@ -448,25 +485,11 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags) { UINT8* ret; - INT32 skintableindex; + INT32 skintableindex = SkinToCacheIndex(skinnum); // Adjust if we want the default colormap INT32 i; - // Adjust if we want the default colormap - switch (skinnum) - { - case TC_DEFAULT: skintableindex = DEFAULT_TT_CACHE_INDEX; break; - case TC_BOSS: skintableindex = BOSS_TT_CACHE_INDEX; break; - case TC_METALSONIC: skintableindex = METALSONIC_TT_CACHE_INDEX; break; - case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break; - case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break; - case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break; - case TC_DASHMODE: skintableindex = DASHMODE_TT_CACHE_INDEX; break; - default: skintableindex = skinnum; break; - } - if (flags & GTC_CACHE) { - // Allocate table for skin if necessary if (!translationtablecache[skintableindex]) translationtablecache[skintableindex] = Z_Calloc(MAXSKINCOLORS * sizeof(UINT8**), PU_STATIC, NULL); @@ -479,7 +502,8 @@ UINT8* R_GetTranslationColormap(INT32 skinnum, skincolornum_t color, UINT8 flags { for (i = 0; i < (INT32)(sizeof(translationtablecache) / sizeof(translationtablecache[0])); i++) if (translationtablecache[i] && translationtablecache[i][color]) - R_GenerateTranslationColormap(translationtablecache[i][color], i>=MAXSKINS ? MAXSKINS-i-1 : i, color); + R_GenerateTranslationColormap(translationtablecache[i][color], CacheIndexToSkin(i), color); + skincolor_modified[color] = false; } } From 94fe7a3d8c66d1417dfd0b07d8d5d59962fa8e3b Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 28 Feb 2021 17:47:12 -0300 Subject: [PATCH 071/160] Change I_Error message --- src/r_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_draw.c b/src/r_draw.c index 96554fad3..c3d4efae3 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -447,7 +447,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U I_Error("Invalid skin color #%hu.", (UINT16)color); if (skinnum < 0 && skinnum > TC_DEFAULT) - I_Error("Invalid non-translation skin number %d.", skinnum); + I_Error("Invalid translation colormap index %d.", skinnum); starttranscolor = (skinnum != TC_DEFAULT) ? skins[skinnum].starttranscolor : DEFAULT_STARTTRANSCOLOR; From 6d539626c4f6cd2ba7434571daae3878788a50ac Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 28 Feb 2021 16:12:38 -0800 Subject: [PATCH 072/160] I forgot to add the dep directory --- dep/.gitignore | 2 ++ dep/FreeBSD/SDL/Debug/.gitignore | 2 ++ dep/FreeBSD/SDL/Release/.gitignore | 2 ++ dep/Linux/SDL/Debug/.gitignore | 2 ++ dep/Linux/SDL/Release/.gitignore | 2 ++ dep/Linux64/SDL/Debug/.gitignore | 2 ++ dep/Linux64/SDL/Release/.gitignore | 2 ++ dep/MasterClient/.gitignore | 2 ++ dep/MasterServer/.gitignore | 2 ++ dep/Mingw/Debug/.gitignore | 2 ++ dep/Mingw/Release/.gitignore | 2 ++ dep/Mingw/SDL/Debug/.gitignore | 2 ++ dep/Mingw/SDL/Release/.gitignore | 2 ++ dep/Mingw64/Debug/.gitignore | 2 ++ dep/Mingw64/Release/.gitignore | 2 ++ dep/Mingw64/SDL/Debug/.gitignore | 2 ++ dep/Mingw64/SDL/Release/.gitignore | 2 ++ dep/SDL/Release/.gitignore | 2 ++ dep/VC/.gitignore | 2 ++ dep/VC9/.gitignore | 2 ++ dep/cygwin/Debug/.gitignore | 2 ++ dep/cygwin/Release/.gitignore | 2 ++ dep/dummy/.gitignore | 2 ++ 23 files changed, 46 insertions(+) create mode 100644 dep/.gitignore create mode 100644 dep/FreeBSD/SDL/Debug/.gitignore create mode 100644 dep/FreeBSD/SDL/Release/.gitignore create mode 100644 dep/Linux/SDL/Debug/.gitignore create mode 100644 dep/Linux/SDL/Release/.gitignore create mode 100644 dep/Linux64/SDL/Debug/.gitignore create mode 100644 dep/Linux64/SDL/Release/.gitignore create mode 100644 dep/MasterClient/.gitignore create mode 100644 dep/MasterServer/.gitignore create mode 100644 dep/Mingw/Debug/.gitignore create mode 100644 dep/Mingw/Release/.gitignore create mode 100644 dep/Mingw/SDL/Debug/.gitignore create mode 100644 dep/Mingw/SDL/Release/.gitignore create mode 100644 dep/Mingw64/Debug/.gitignore create mode 100644 dep/Mingw64/Release/.gitignore create mode 100644 dep/Mingw64/SDL/Debug/.gitignore create mode 100644 dep/Mingw64/SDL/Release/.gitignore create mode 100644 dep/SDL/Release/.gitignore create mode 100644 dep/VC/.gitignore create mode 100644 dep/VC9/.gitignore create mode 100644 dep/cygwin/Debug/.gitignore create mode 100644 dep/cygwin/Release/.gitignore create mode 100644 dep/dummy/.gitignore diff --git a/dep/.gitignore b/dep/.gitignore new file mode 100644 index 000000000..fb941664f --- /dev/null +++ b/dep/.gitignore @@ -0,0 +1,2 @@ +#All folders +*.d diff --git a/dep/FreeBSD/SDL/Debug/.gitignore b/dep/FreeBSD/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/FreeBSD/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/FreeBSD/SDL/Release/.gitignore b/dep/FreeBSD/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/FreeBSD/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Linux/SDL/Debug/.gitignore b/dep/Linux/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Linux/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Linux/SDL/Release/.gitignore b/dep/Linux/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Linux/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Linux64/SDL/Debug/.gitignore b/dep/Linux64/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Linux64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Linux64/SDL/Release/.gitignore b/dep/Linux64/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Linux64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/MasterClient/.gitignore b/dep/MasterClient/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/MasterClient/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/MasterServer/.gitignore b/dep/MasterServer/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/MasterServer/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw/Debug/.gitignore b/dep/Mingw/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw/Release/.gitignore b/dep/Mingw/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw/SDL/Debug/.gitignore b/dep/Mingw/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw/SDL/Release/.gitignore b/dep/Mingw/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw64/Debug/.gitignore b/dep/Mingw64/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw64/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw64/Release/.gitignore b/dep/Mingw64/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw64/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw64/SDL/Debug/.gitignore b/dep/Mingw64/SDL/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw64/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/Mingw64/SDL/Release/.gitignore b/dep/Mingw64/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/Mingw64/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/SDL/Release/.gitignore b/dep/SDL/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/VC/.gitignore b/dep/VC/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/VC/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/VC9/.gitignore b/dep/VC9/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/VC9/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/cygwin/Debug/.gitignore b/dep/cygwin/Debug/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/cygwin/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/cygwin/Release/.gitignore b/dep/cygwin/Release/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/cygwin/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/dep/dummy/.gitignore b/dep/dummy/.gitignore new file mode 100644 index 000000000..42c6dc2c6 --- /dev/null +++ b/dep/dummy/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing From 5f4e21ed3a97063c917d7f9ff406548b7e873ddd Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 28 Feb 2021 17:02:08 -0800 Subject: [PATCH 073/160] Fix dependency file trying to be made for SRB2.res and not for interface/blua/hardware files --- src/Makefile | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 260175a69..471c55ed3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -554,7 +554,7 @@ OBJS:=$(i_main_o) \ $(i_sound_o) \ $(OBJS) -DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(OBJS)) +DEPS:=$(patsubst $(OBJDIR)/%.o,$(DEPDIR)/%.d,$(filter %.o,$(OBJS))) OBJS+=$(OBJDIR)/comptime.o ifndef SILENT @@ -688,14 +688,33 @@ $(call print,Checking dependency files...) endif endif -$(DEPDIR)/%.d: %.c +undefine deps_rule + # windows makes it too hard ! ifndef WINDOWSHELL ifdef echoName +define deps_rule = @printf "%-20.20s\r" $< + +endef endif endif + +define deps_rule += $(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$< $< +endef + +$(DEPDIR)/%.d: %.c + $(deps_rule) + +$(DEPDIR)/%.d: $(INTERFACE)/%.c + $(deps_rule) + +$(DEPDIR)/%.d: hardware/%.c + $(deps_rule) + +$(DEPDIR)/%.d: blua/%.c + $(deps_rule) ifdef VALGRIND $(OBJDIR)/z_zone.o: z_zone.c From f6cb1798ccfc161264c3039bd294c0e061f650a7 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Tue, 2 Mar 2021 02:27:14 -0300 Subject: [PATCH 074/160] Fix a few renderflags oversights in OpenGL --- src/hardware/hw_main.c | 40 ++++++++++++++++++---------------------- src/hardware/hw_md2.c | 11 +++++------ 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a7e37d231..c2d617eaf 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3665,7 +3665,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) static void HWR_RotateSpritePolyToAim(gl_vissprite_t *spr, FOutVector *wallVerts, const boolean precip) { if (cv_glspritebillboarding.value - && spr && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE) + && spr && spr->mobj && !R_ThingIsPaperSprite(spr->mobj) && wallVerts) { float basey = FIXED_TO_FLOAT(spr->mobj->z); @@ -3707,7 +3707,6 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) FBITFIELD blend = 0; FBITFIELD occlusion; boolean use_linkdraw_hack = false; - boolean splat = R_ThingIsFloorSprite(spr->mobj); UINT8 alpha; INT32 i; @@ -3766,22 +3765,19 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) baseWallVerts[0].t = baseWallVerts[1].t = ((GLPatch_t *)gpatch->hardware)->max_t; } - if (!splat) - { - // if it has a dispoffset, push it a little towards the camera - if (spr->dispoffset) { - float co = -gl_viewcos*(0.05f*spr->dispoffset); - float si = -gl_viewsin*(0.05f*spr->dispoffset); - baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si; - baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si; - baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co; - baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co; - } - - // Let dispoffset work first since this adjust each vertex - HWR_RotateSpritePolyToAim(spr, baseWallVerts, false); + // if it has a dispoffset, push it a little towards the camera + if (spr->dispoffset) { + float co = -gl_viewcos*(0.05f*spr->dispoffset); + float si = -gl_viewsin*(0.05f*spr->dispoffset); + baseWallVerts[0].z = baseWallVerts[3].z = baseWallVerts[0].z+si; + baseWallVerts[1].z = baseWallVerts[2].z = baseWallVerts[1].z+si; + baseWallVerts[0].x = baseWallVerts[3].x = baseWallVerts[0].x+co; + baseWallVerts[1].x = baseWallVerts[2].x = baseWallVerts[1].x+co; } + // Let dispoffset work first since this adjust each vertex + HWR_RotateSpritePolyToAim(spr, baseWallVerts, false); + realtop = top = baseWallVerts[3].y; realbot = bot = baseWallVerts[0].y; ttop = baseWallVerts[3].t; @@ -3914,7 +3910,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // The x and y only need to be adjusted in the case that it's not a papersprite if (cv_glspritebillboarding.value - && spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE)) + && spr->mobj && !R_ThingIsPaperSprite(spr->mobj)) { // Get the x and z of the vertices so billboarding draws correctly realheight = realbot - realtop; @@ -3983,7 +3979,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) static void HWR_DrawSprite(gl_vissprite_t *spr) { FOutVector wallVerts[4]; - patch_t *gpatch; // sprite patch converted to hardware + patch_t *gpatch; FSurfaceInfo Surf; const boolean splat = R_ThingIsFloorSprite(spr->mobj); @@ -4284,7 +4280,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) { FBITFIELD blend = 0; FOutVector wallVerts[4]; - patch_t *gpatch; // sprite patch converted to hardware + patch_t *gpatch; FSurfaceInfo Surf; if (!spr->mobj) @@ -4337,7 +4333,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) // Always use the light at the top instead of whatever I was doing before INT32 light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); - if (!(spr->mobj->frame & FF_FULLBRIGHT)) + if (!R_ThingIsFullBright(spr->mobj)) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; if (*sector->lightlist[light].extra_colormap) @@ -4345,7 +4341,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) } else { - if (!(spr->mobj->frame & FF_FULLBRIGHT)) + if (!R_ThingIsFullBright(spr->mobj)) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) @@ -4921,8 +4917,8 @@ static void HWR_ProjectSprite(mobj_t *thing) angle_t ang; INT32 heightsec, phs; - const boolean papersprite = R_ThingIsPaperSprite(thing); const boolean splat = R_ThingIsFloorSprite(thing); + const boolean papersprite = (R_ThingIsPaperSprite(thing) && !splat); angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle); float z1, z2; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 2e944d3e6..3ef746b9f 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1314,7 +1314,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before - if (!(spr->mobj->frame & FF_FULLBRIGHT)) + if (!R_ThingIsFullBright(spr->mobj)) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; if (*sector->lightlist[light].extra_colormap) @@ -1322,7 +1322,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } else { - if (!(spr->mobj->frame & FF_FULLBRIGHT)) + if (!R_ThingIsFullBright(spr->mobj)) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) @@ -1340,10 +1340,9 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL; INT32 durs = spr->mobj->state->tics; INT32 tics = spr->mobj->tics; - //mdlframe_t *next = NULL; - const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE); - const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP)); - const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP)); + const boolean papersprite = (R_ThingIsPaperSprite(spr->mobj) && !R_ThingIsFloorSprite(spr->mobj)); + const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); + const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); spritedef_t *sprdef; spriteframe_t *sprframe; spriteinfo_t *sprinfo; From caab4e96cd5b59b603b77b672ea1edaa1052a095 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 6 Mar 2021 19:38:17 +0200 Subject: [PATCH 075/160] Remove misplaced SetShader call in CompileShaders --- src/hardware/r_opengl/r_opengl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 2568a7d08..6967bab74 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -962,8 +962,6 @@ EXPORT boolean HWRAPI(CompileShaders) (void) } } - SetShader(SHADER_DEFAULT); - return true; #else return false; From 8cc49a0f2e3a658495094c3972f6c69376bd6a26 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 6 Mar 2021 19:56:25 +0200 Subject: [PATCH 076/160] Use double precision in R_StoreWallRange sloped seg culling calculations Fixes culling issues in CEZ2 skybox --- src/r_segs.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index c79071e9b..a6772f964 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1649,23 +1649,26 @@ void R_StoreWallRange(INT32 start, INT32 stop) // left temp = xtoviewangle[start]+viewangle; +#define FIXED_TO_DOUBLE(x) (((double)(x)) / ((double)FRACUNIT)) +#define DOUBLE_TO_FIXED(x) (fixed_t)((x) * ((double)FRACUNIT)) + { // Both lines can be written in slope-intercept form, so figure out line intersection - float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... - ///TODO: convert to FPU + double a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to fixed point - a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); - b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); - c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y); + a1 = FIXED_TO_DOUBLE(curline->v2->y-curline->v1->y); + b1 = FIXED_TO_DOUBLE(curline->v1->x-curline->v2->x); + c1 = a1*FIXED_TO_DOUBLE(curline->v1->x) + b1*FIXED_TO_DOUBLE(curline->v1->y); - a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT)); - b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT)); - c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy); + a2 = -FIXED_TO_DOUBLE(FINESINE(temp>>ANGLETOFINESHIFT)); + b2 = FIXED_TO_DOUBLE(FINECOSINE(temp>>ANGLETOFINESHIFT)); + c2 = a2*FIXED_TO_DOUBLE(viewx) + b2*FIXED_TO_DOUBLE(viewy); det = a1*b2 - a2*b1; - ds_p->leftpos.x = segleft.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); - ds_p->leftpos.y = segleft.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + ds_p->leftpos.x = segleft.x = DOUBLE_TO_FIXED((b2*c1 - b1*c2)/det); + ds_p->leftpos.y = segleft.y = DOUBLE_TO_FIXED((a1*c2 - a2*c1)/det); } // right @@ -1673,22 +1676,26 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // Both lines can be written in slope-intercept form, so figure out line intersection - float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... - ///TODO: convert to FPU + double a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to fixed point - a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); - b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); - c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y); + a1 = FIXED_TO_DOUBLE(curline->v2->y-curline->v1->y); + b1 = FIXED_TO_DOUBLE(curline->v1->x-curline->v2->x); + c1 = a1*FIXED_TO_DOUBLE(curline->v1->x) + b1*FIXED_TO_DOUBLE(curline->v1->y); - a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT)); - b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT)); - c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy); + a2 = -FIXED_TO_DOUBLE(FINESINE(temp>>ANGLETOFINESHIFT)); + b2 = FIXED_TO_DOUBLE(FINECOSINE(temp>>ANGLETOFINESHIFT)); + c2 = a2*FIXED_TO_DOUBLE(viewx) + b2*FIXED_TO_DOUBLE(viewy); det = a1*b2 - a2*b1; - ds_p->rightpos.x = segright.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); - ds_p->rightpos.y = segright.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + ds_p->rightpos.x = segright.x = DOUBLE_TO_FIXED((b2*c1 - b1*c2)/det); + ds_p->rightpos.y = segright.y = DOUBLE_TO_FIXED((a1*c2 - a2*c1)/det); } + +#undef FIXED_TO_DOUBLE +#undef DOUBLE_TO_FIXED + } From efdfa55328c68a53c9d821537a2c60f6a68f4f08 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 12 Mar 2021 19:54:01 +0100 Subject: [PATCH 077/160] Remove misleading comment --- src/lua_maplib.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 9598f7708..016141796 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -583,17 +583,6 @@ static int sector_get(lua_State *L) lua_pushinteger(L, sector->special); return 1; case sector_tag: - // HELLO - // THIS IS LJ SONIC - // HOW IS YOUR DAY? - // BY THE WAY WHEN 2.3 OR 3.0 OR 4.0 OR SRB3 OR SRB4 OR WHATEVER IS OUT - // YOU SHOULD REMEMBER TO CHANGE THIS SO IT ALWAYS RETURNS A UNSIGNED VALUE - // HAVE A NICE DAY - // - // - // - // - // you are ugly lua_pushinteger(L, (UINT16)Tag_FGet(§or->tags)); return 1; case sector_taglist: From 746c84e0b5431c55841d91ac2cbfbd1ef78b0ebf Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 13 Mar 2021 23:07:51 +0200 Subject: [PATCH 078/160] Fix wrong color on player models' first frame by updating variable after loading blend texture --- src/hardware/hw_md2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 2e944d3e6..aa005c2fd 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1405,6 +1405,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) || ((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile))) md2_loadBlendTexture(md2); + // Load it again, because it isn't being loaded into blendgpatch after md2_loadblendtexture... + blendgpatch = md2->blendgrpatch; + if (blendgpatch) + hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware); + if (md2->error) return false; // we already failed loading this before :( if (!md2->model) From 36c2be283caad32c51093872f73aa5db6dcb9b4c Mon Sep 17 00:00:00 2001 From: lachablock Date: Mon, 15 Mar 2021 15:17:55 +1100 Subject: [PATCH 079/160] Disallow write_backtrace on Windows entirely --- src/sdl/i_system.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e8c5d59fb..a0dd6e1da 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -140,6 +140,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #include #include +#define UNIXBACKTRACE #endif // Locations for searching the srb2.pk3 @@ -243,6 +244,7 @@ SDL_bool framebuffer = SDL_FALSE; UINT8 keyboard_started = false; +#ifdef UNIXBACKTRACE #define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string) #define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string)) #define CRASHLOG_STDERR_WRITE(string) \ @@ -252,7 +254,6 @@ UINT8 keyboard_started = false; static void write_backtrace(INT32 signal) { -#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) int fd = -1; size_t size; time_t rawtime; @@ -302,11 +303,11 @@ static void write_backtrace(INT32 signal) CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :) close(fd); -#endif } #undef STDERR_WRITE #undef CRASHLOG_WRITE #undef CRASHLOG_STDERR_WRITE +#endif // UNIXBACKTRACE static void I_ReportSignal(int num, int coredumped) { @@ -367,7 +368,9 @@ FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) { D_QuitNetGame(); // Fix server freezes CL_AbortDownloadResume(); +#ifdef UNIXBACKTRACE write_backtrace(num); +#endif I_ReportSignal(num, 0); I_ShutdownSystem(); signal(num, SIG_DFL); //default signal action @@ -761,7 +764,9 @@ static void I_RegisterSignals (void) #ifdef NEWSIGNALHANDLER static void signal_handler_child(INT32 num) { +#ifdef UNIXBACKTRACE write_backtrace(num); +#endif signal(num, SIG_DFL); //default signal action raise(num); From 95eff8cbc5f4b0be2ae09a83b8fc04e654a81579 Mon Sep 17 00:00:00 2001 From: sphere Date: Mon, 15 Mar 2021 18:11:02 +0100 Subject: [PATCH 080/160] Avoid savemoddata being set in W_InitFile to fix addons with gamedata. --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 2cbcdecb5..91c8331f7 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -821,7 +821,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) } if (important && !mainfile) - G_SetGameModified(true); + //G_SetGameModified(true); + modifiedgame = true; // avoid savemoddata being set to false // // link wad file to search files From b882aea2e4286ccdc3f82bf5cc0bdbc51bd4e8fd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 21 Mar 2021 19:49:32 +0000 Subject: [PATCH 081/160] Fix clobbering error in hw_md2.c by adding "volatile" to png_FILE. (Apparently Kart made this exact fix 2 years ago and it was never backported?) --- src/hardware/hw_md2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index ac637dfb7..5caf344f7 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -158,7 +158,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_ jmp_buf jmpbuf; #endif #endif - png_FILE_p png_FILE; + volatile png_FILE_p png_FILE; //Filename checking fixed ~Monster Iestyn and Golden char *pngfilename = va("%s"PATHSEP"models"PATHSEP"%s", srb2home, filename); From 42cfcbf7be35372fb10363858488b6f68e74fa22 Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 21 Mar 2021 16:09:11 -0500 Subject: [PATCH 082/160] fix sigsegv in A_Custom3DRotate --- src/p_enemy.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 203e04af1..ceacc1962 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -9868,22 +9868,23 @@ void A_Custom3DRotate(mobj_t *actor) if (LUA_CallAction(A_CUSTOM3DROTATE, actor)) return; + if (!actor->target) // Ensure we actually have a target first. + { + CONS_Printf("Error: A_Custom3DRotate: Object has no target.\n"); + P_RemoveMobj(actor); + return; + } + if (actor->target->health == 0) { P_RemoveMobj(actor); return; } - if (!actor->target) // This should NEVER happen. - { - if (cv_debug) - CONS_Printf("Error: Object has no target\n"); - P_RemoveMobj(actor); - return; - } if (hspeed==0 && vspeed==0) { - CONS_Printf("Error: A_Custom3DRotate: Object has no speed.\n"); + if (cv_debug) + CONS_Printf("Error: A_Custom3DRotate: Object has no speed.\n"); return; } From 2aaaddae7c46e8f3ec108841bc1903cd54fd450a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 Mar 2021 14:17:22 +0000 Subject: [PATCH 083/160] Fix mistake I made with my previous commit for r_skins.c --- src/r_skins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_skins.c b/src/r_skins.c index 228ec46d0..c56f55e01 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -303,7 +303,7 @@ void SetPlayerSkin(INT32 playernum, const char *skinname) if ((i != -1) && R_SkinUsable(playernum, i)) { - SetSkin(playernum, i); + SetSkin(player, i); return; } From ee8acccd3cd54b87d2f9effa3f49aa8a8cbd969f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 Mar 2021 14:43:26 +0000 Subject: [PATCH 084/160] RETURN OF THE PORTS CHOPPING BLOCK: Destroy DOS! Remove all remaining traces of the following macros for the obsolete DOS port, which were missed previously: * `DJGPP` * `__DJGPP__` * `DJGPPDOS` * `PC_DOS` * `WATTCP` May get rid of `MSDOS` later once I get word on whether I should kill it or not --- src/Makefile | 3 -- src/d_main.h | 4 -- src/d_netfil.c | 6 +-- src/doomdef.h | 2 +- src/doomtype.h | 13 +----- src/i_addrinfo.c | 2 +- src/i_tcp.c | 106 ++--------------------------------------------- src/m_fixed.h | 2 +- src/m_misc.c | 2 - src/s_sound.c | 2 - 10 files changed, 8 insertions(+), 134 deletions(-) diff --git a/src/Makefile b/src/Makefile index 9518942b2..929612271 100644 --- a/src/Makefile +++ b/src/Makefile @@ -98,7 +98,6 @@ ALL_SYSTEMS=\ MINGW64\ HAIKU\ DUMMY\ - DJGPPDOS\ MINGW\ UNIX\ LINUX\ @@ -622,8 +621,6 @@ asm: $(REMOVE) $(OBJDIR)/tmp.exe # executable -# NOTE: DJGPP's objcopy do not have --add-gnu-debuglink - $(BIN)/$(EXENAME): $(POS) $(OBJS) -$(MKDIR) $(BIN) $(call echo,Linking $(EXENAME)...) diff --git a/src/d_main.h b/src/d_main.h index 81de0634d..4e5df87e3 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -40,10 +40,6 @@ void D_SRB2Main(void); // Called by IO functions when input is detected. void D_PostEvent(const event_t *ev); -#if defined (PC_DOS) && !defined (DOXYGEN) -void D_PostEvent_end(void); // delimiter for locking memory -#endif - void D_ProcessEvents(void); const char *D_Home(void); diff --git a/src/d_netfil.c b/src/d_netfil.c index 8f661bb5f..4729eb09d 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -15,7 +15,7 @@ #include -#if defined (_WIN32) || defined (__DJGPP__) +#ifdef _WIN32 #include #include #else @@ -30,10 +30,6 @@ #elif defined (_WIN32) #include #endif -#ifdef __DJGPP__ -#include -#include -#endif #include "doomdef.h" #include "doomstat.h" diff --git a/src/doomdef.h b/src/doomdef.h index 52abc9597..5f36f2d69 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -100,7 +100,7 @@ #include #include -#if defined (_WIN32) || defined (__DJGPP__) +#ifdef _WIN32 #include #endif diff --git a/src/doomtype.h b/src/doomtype.h index 950f50856..ffaa540b1 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -54,17 +54,6 @@ typedef long ssize_t; #define PDWORD_PTR PDWORD #endif #endif -#elif defined (__DJGPP__) -#define UINT8 unsigned char -#define SINT8 signed char - -#define UINT16 unsigned short int -#define INT16 signed short int - -#define INT32 signed long -#define UINT32 unsigned long -#define INT64 signed long long -#define UINT64 unsigned long long #else #define __STDC_LIMIT_MACROS #include @@ -136,7 +125,7 @@ char *strcasestr(const char *in, const char *what); #endif #endif //macintosh -#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__) +#if defined (_WIN32) || defined (__HAIKU__) #define HAVE_DOSSTR_FUNCS #endif diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index e77774549..ff0dfbd32 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -20,7 +20,7 @@ #else #include #endif -#elif !defined (__DJGPP__) +#else #include #include #include diff --git a/src/i_tcp.c b/src/i_tcp.c index ab8a69a9f..a9f617dc9 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -107,15 +107,6 @@ #endif #endif // USE_WINSOCK - #ifdef __DJGPP__ - #ifdef WATTCP // Alam_GBC: Wattcp may need this - #include - #define strerror strerror_s - #else // wattcp - #include - #endif // libsocket - #endif // djgpp - typedef union { struct sockaddr any; @@ -149,25 +140,15 @@ #include "doomstat.h" -// win32 or djgpp -#if defined (USE_WINSOCK) || defined (__DJGPP__) +// win32 +#ifdef USE_WINSOCK // winsock stuff (in winsock a socket is not a file) #define ioctl ioctlsocket #define close closesocket #endif #include "i_addrinfo.h" - -#ifdef __DJGPP__ - -#ifdef WATTCP #define SELECTTEST -#endif - -#else -#define SELECTTEST -#endif - #define DEFAULTPORT "5029" #if defined (USE_WINSOCK) && !defined (NONET) @@ -184,7 +165,7 @@ #ifndef NONET // define socklen_t in DOS/Windows if it is not already defined - #if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) + #ifdef USE_WINSOCK1 typedef int socklen_t; #endif static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET}; @@ -207,19 +188,6 @@ static const char *serverport_name = DEFAULTPORT; static const char *clientport_name;/* any port */ #ifndef NONET - -#ifdef WATTCP -static void wattcp_outch(char s) -{ - static char old = '\0'; - char pr[2] = {s,0}; - if (s == old && old == ' ') return; - else old = s; - if (s == '\r') CONS_Printf("\n"); - else if (s != '\n') CONS_Printf(pr); -} -#endif - #ifdef USE_WINSOCK // stupid microsoft makes things complicated static char *get_WSAErrorStr(int e) @@ -764,11 +732,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen int opt; socklen_t opts; #ifdef FIONBIO -#ifdef WATTCP - char trueval = true; -#else unsigned long trueval = true; -#endif #endif mysockaddr_t straddr; struct sockaddr_in sin; @@ -1138,61 +1102,7 @@ boolean I_InitTcpDriver(void) CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription); CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus); #endif -#ifdef __DJGPP__ -#ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load - survive_eth = 1; // would be needed to not exit if pkt_eth_init() fails - survive_bootp = 1; // ditto for BOOTP - survive_dhcp = 1; // ditto for DHCP/RARP - survive_rarp = 1; - //_watt_do_exit = false; - //_watt_handle_cbreak = false; - //_watt_no_config = true; - _outch = wattcp_outch; - init_misc(); -//#ifdef DEBUGFILE - dbug_init(); -//#endif - switch (sock_init()) - { - case 0: - init_tcp_driver = true; - break; - case 3: - CONS_Debug(DBG_NETPLAY, "No packet driver detected\n"); - break; - case 4: - CONS_Debug(DBG_NETPLAY, "Error while talking to packet driver\n"); - break; - case 5: - CONS_Debug(DBG_NETPLAY, "BOOTP failed\n"); - break; - case 6: - CONS_Debug(DBG_NETPLAY, "DHCP failed\n"); - break; - case 7: - CONS_Debug(DBG_NETPLAY, "RARP failed\n"); - break; - case 8: - CONS_Debug(DBG_NETPLAY, "TCP/IP failed\n"); - break; - case 9: - CONS_Debug(DBG_NETPLAY, "PPPoE login/discovery failed\n"); - break; - default: - CONS_Debug(DBG_NETPLAY, "Unknown error with TCP/IP stack\n"); - break; - } - hires_timer(0); -#else // wattcp - if (__lsck_init()) - init_tcp_driver = true; - else - CONS_Debug(DBG_NETPLAY, "No TCP/IP driver detected\n"); -#endif // libsocket -#endif // __DJGPP__ -#ifndef __DJGPP__ init_tcp_driver = true; -#endif } #endif if (!tcp_was_up && init_tcp_driver) @@ -1217,10 +1127,8 @@ static void SOCK_CloseSocket(void) if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET && FD_ISSET(mysockets[i], &masterset)) { -#if !defined (__DJGPP__) || defined (WATTCP) FD_CLR(mysockets[i], &masterset); close(mysockets[i]); -#endif } mysockets[i] = ERRSOCKET; } @@ -1237,14 +1145,6 @@ void I_ShutdownTcpDriver(void) WS_addrinfocleanup(); WSACleanup(); #endif -#ifdef __DJGPP__ -#ifdef WATTCP // wattcp - //_outch = NULL; - sock_exit(); -#else - __lsck_uninit(); -#endif // libsocket -#endif // __DJGPP__ CONS_Printf("shut down\n"); init_tcp_driver = false; #endif diff --git a/src/m_fixed.h b/src/m_fixed.h index 289ca442a..f634028c7 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -71,7 +71,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f) value [eax] \ modify exact [eax edx] #elif defined (__GNUC__) && defined (__i386__) && !defined (NOASM) - // DJGPP, i386 linux, cygwin or mingw + // i386 linux, cygwin or mingw FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm { fixed_t ret; diff --git a/src/m_misc.c b/src/m_misc.c index ad2d133ab..a9defab3c 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -64,8 +64,6 @@ typedef off_t off64_t; #define PRIdS "u" #elif defined (_WIN32) #define PRIdS "Iu" -#elif defined (DJGPP) -#define PRIdS "u" #else #define PRIdS "zu" #endif diff --git a/src/s_sound.c b/src/s_sound.c index 392a5b453..7f644b12c 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1033,11 +1033,9 @@ void S_SetSfxVolume(INT32 volume) void S_ClearSfx(void) { -#ifndef DJGPPDOS size_t i; for (i = 1; i < NUMSFX; i++) I_FreeSfx(S_sfx + i); -#endif } static void S_StopChannel(INT32 cnum) From 0405b3922c6104a4e1c1eee899e8ebb07209260a Mon Sep 17 00:00:00 2001 From: lachablock Date: Tue, 23 Mar 2021 14:49:22 +1100 Subject: [PATCH 085/160] Do not let nonspin characters enter sectors they could not enter if standing at full height --- src/lua_baselib.c | 22 ++++++++++++++++++++++ src/p_local.h | 2 ++ src/p_map.c | 11 +++++++++++ src/p_user.c | 24 ++++++++++++++++++------ 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 916fa9254..a59ba546e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1671,6 +1671,26 @@ static int lib_pSwitchShield(lua_State *L) return 0; } +static int lib_pPlayerCanEnterSpinGaps(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + lua_pushboolean(L, P_PlayerCanEnterSpinGaps(player)); + return 1; +} + +static int lib_pPlayerShouldUseSpinHeight(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + lua_pushboolean(L, P_PlayerShouldUseSpinHeight(player)); + return 1; +} + // P_MAP /////////// @@ -3872,6 +3892,8 @@ static luaL_Reg lib[] = { {"P_SpawnSpinMobj",lib_pSpawnSpinMobj}, {"P_Telekinesis",lib_pTelekinesis}, {"P_SwitchShield",lib_pSwitchShield}, + {"P_PlayerCanEnterSpinGaps",lib_pPlayerCanEnterSpinGaps}, + {"P_PlayerShouldUseSpinHeight",lib_pPlayerShouldUseSpinHeight}, // p_map {"P_CheckPosition",lib_pCheckPosition}, diff --git a/src/p_local.h b/src/p_local.h index 8caab0d27..8568dd4f8 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -143,6 +143,8 @@ angle_t P_GetLocalAngle(player_t *player); void P_SetLocalAngle(player_t *player, angle_t angle); void P_ForceLocalAngle(player_t *player, angle_t angle); boolean P_PlayerFullbright(player_t *player); +boolean P_PlayerCanEnterSpinGaps(player_t *player); +boolean P_PlayerShouldUseSpinHeight(player_t *player); boolean P_IsObjectInGoop(mobj_t *mo); boolean P_IsObjectOnGround(mobj_t *mo); diff --git a/src/p_map.c b/src/p_map.c index a1cad524e..7eec0937c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1955,6 +1955,12 @@ static boolean PIT_CheckLine(line_t *ld) // set openrange, opentop, openbottom P_LineOpening(ld, tmthing); + // players should not always cross into sectors that they could not at full height + if (tmthing->player + && openrange < P_GetPlayerHeight(tmthing->player) + && !P_PlayerCanEnterSpinGaps(tmthing->player)) + return false; + // adjust floor / ceiling heights if (opentop < tmceilingz) { @@ -3331,6 +3337,11 @@ static boolean PTR_LineIsBlocking(line_t *li) if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale)) return true; // too big a step up + if (slidemo->player + && openrange < P_GetPlayerHeight(slidemo->player) + && !P_PlayerCanEnterSpinGaps(slidemo->player)) + return true; // nonspin character should not take this path + return false; } diff --git a/src/p_user.c b/src/p_user.c index 02592053d..38f13f8fd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8653,12 +8653,7 @@ void P_MovePlayer(player_t *player) fixed_t oldheight = player->mo->height; // Less height while spinning. Good for spinning under things...? - if ((player->mo->state == &states[player->mo->info->painstate]) - || ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE)) - || (player->pflags & PF_SPINNING) - || player->powers[pw_tailsfly] || player->pflags & PF_GLIDING - || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) - || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)) + if (P_PlayerShouldUseSpinHeight(player)) { player->mo->height = P_GetPlayerSpinHeight(player); atspinheight = true; @@ -12953,3 +12948,20 @@ boolean P_PlayerFullbright(player_t *player) || !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1] && player->mo->state < &states[S_PLAY_NIGHTS_TRANS6])))); // Note the < instead of <= } + +// returns true if the player can enter a sector that they could not if standing at their skin's full height +boolean P_PlayerCanEnterSpinGaps(player_t *player) +{ + return ((player->pflags & (PF_SPINNING|PF_GLIDING)) + || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)); +} + +// returns true if the player should use their skin's spinheight instead of their skin's height +boolean P_PlayerShouldUseSpinHeight(player_t *player) +{ + return (P_PlayerCanEnterSpinGaps(player) + || (player->mo->state == &states[player->mo->info->painstate]) + || ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE)) + || player->powers[pw_tailsfly] + || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)); +} From f99d89742a7c0347bb7e2092fa1ede7a02766abc Mon Sep 17 00:00:00 2001 From: lachablock Date: Thu, 25 Mar 2021 15:09:04 +1100 Subject: [PATCH 086/160] Revise conditions under which players use spinheight and enter gaps: - players with SF_NOJUMPDAMAGE but *not* SF_NOJUMPSPIN now always use spinheight while jumping (i.e. even with PF_NOJUMPDAMAGE), as long as their panim is PA_JUMP or PA_ROLL - players with SF_NOJUMPSPIN no longer use spinheight while jumping (but,) - PA_ROLL is now an acceptable condition for using spinheight (but not for entering gaps, e.g. S3K shields will shrink the hitbox but not allow gap entry on their own) - flying players now only use spinheight if they do not have SF_NOJUMPSPIN (you're welcome, EggpackRE) - players with neither SF_NOJUMPSPIN nor SF_NOJUMPDAMAGE use the same conditions as in 2.2.9 prerelease, i.e. use spinheight and can enter gaps unless they have PF_NOJUMPDAMAGE --- src/p_user.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 38f13f8fd..63942e0be 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12949,11 +12949,18 @@ boolean P_PlayerFullbright(player_t *player) && player->mo->state < &states[S_PLAY_NIGHTS_TRANS6])))); // Note the < instead of <= } +#define JUMPCURLED(player) ((player->pflags & PF_JUMPED)\ + && (!(player->charflags & SF_NOJUMPSPIN))\ + && (!(player->pflags & PF_NOJUMPDAMAGE)\ + || ((player->charflags & SF_NOJUMPDAMAGE)\ + && (player->panim == PA_JUMP || player->panim == PA_ROLL))))\ + // returns true if the player can enter a sector that they could not if standing at their skin's full height boolean P_PlayerCanEnterSpinGaps(player_t *player) { - return ((player->pflags & (PF_SPINNING|PF_GLIDING)) - || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)); + return ((player->pflags & (PF_SPINNING|PF_GLIDING)) // players who are spinning or gliding + || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) // players who are landing from a glide + || JUMPCURLED(player)); // players who are jumpcurled, but only if they would normally jump that way } // returns true if the player should use their skin's spinheight instead of their skin's height @@ -12961,7 +12968,7 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player) { return (P_PlayerCanEnterSpinGaps(player) || (player->mo->state == &states[player->mo->info->painstate]) - || ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE)) - || player->powers[pw_tailsfly] - || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)); + || (player->panim == PA_ROLL) + || ((player->powers[pw_tailsfly] || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)) + && !(player->charflags & SF_NOJUMPSPIN))); } From b1a926288961fceda7cab4205fed66a706500726 Mon Sep 17 00:00:00 2001 From: lachablock Date: Thu, 25 Mar 2021 15:25:35 +1100 Subject: [PATCH 087/160] Fix P_PlayerCanEnterGaps issues with polyobject collision --- src/p_map.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7eec0937c..bf668ba3e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1955,12 +1955,6 @@ static boolean PIT_CheckLine(line_t *ld) // set openrange, opentop, openbottom P_LineOpening(ld, tmthing); - // players should not always cross into sectors that they could not at full height - if (tmthing->player - && openrange < P_GetPlayerHeight(tmthing->player) - && !P_PlayerCanEnterSpinGaps(tmthing->player)) - return false; - // adjust floor / ceiling heights if (opentop < tmceilingz) { @@ -2729,7 +2723,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->type == MT_SKIM) maxstep = 0; - if (tmceilingz - tmfloorz < thing->height) + if (tmceilingz - tmfloorz < thing->height + || (thing->player + && tmceilingz - tmfloorz < P_GetPlayerHeight(thing->player) + && !P_PlayerCanEnterSpinGaps(thing->player))) { if (tmfloorthing) tmhitthing = tmfloorthing; From 6ea96536810cc8ad95708436a4f5afd03be3154f Mon Sep 17 00:00:00 2001 From: lachablock Date: Thu, 25 Mar 2021 21:41:09 +1100 Subject: [PATCH 088/160] Add PlayerHeight and PlayerCanEnterSpinGaps Lua hooks --- src/lua_hook.h | 4 +++ src/lua_hooklib.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++ src/p_user.c | 21 +++++++++-- 3 files changed, 112 insertions(+), 3 deletions(-) diff --git a/src/lua_hook.h b/src/lua_hook.h index 5cfcb8360..0d631aa4e 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -61,6 +61,8 @@ enum hook { hook_GameQuit, hook_PlayerCmd, hook_MusicChange, + hook_PlayerHeight, + hook_PlayerCanEnterSpinGaps, hook_MAX // last hook }; @@ -118,3 +120,5 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hoo void LUAh_GameQuit(boolean quitting); // Hook for game quitting boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart) boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes +fixed_t LUAh_PlayerHeight(player_t *player); +UINT8 LUAh_PlayerCanEnterSpinGaps(player_t *player); diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 29c15a4de..6e9b9d65c 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -77,6 +77,8 @@ const char *const hookNames[hook_MAX+1] = { "GameQuit", "PlayerCmd", "MusicChange", + "PlayerHeight", + "PlayerCanEnterSpinGaps", NULL }; @@ -221,6 +223,8 @@ static int lib_addHook(lua_State *L) case hook_ShieldSpawn: case hook_ShieldSpecial: case hook_PlayerThink: + case hook_PlayerHeight: + case hook_PlayerCanEnterSpinGaps: lastp = &playerhooks; break; case hook_LinedefExecute: @@ -1971,3 +1975,89 @@ boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boo newname[6] = 0; return hooked; } + +// Hook for determining player height +fixed_t LUAh_PlayerHeight(player_t *player) +{ + hook_p hookp; + fixed_t newheight = -1; + if (!gL || !(hooksAvailable[hook_PlayerHeight/8] & (1<<(hook_PlayerHeight%8)))) + return 0; + + lua_settop(gL, 0); + lua_pushcfunction(gL, LUA_GetErrorMessage); + + for (hookp = playerhooks; hookp; hookp = hookp->next) + { + if (hookp->type != hook_PlayerHeight) + continue; + + ps_lua_mobjhooks++; + if (lua_gettop(gL) == 1) + LUA_PushUserdata(gL, player, META_PLAYER); + PushHook(gL, hookp); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 1)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { + fixed_t returnedheight = lua_tonumber(gL, -1); + // 0 height has... strange results, but it's not problematic like negative heights are. + // when an object's height is set to a negative number directly with lua, it's forced to 0 instead. + // here, I think it's better to ignore negatives so that they don't replace any results of previous hooks! + if (returnedheight >= 0) + newheight = returnedheight; + } + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return newheight; +} + +// Hook for determining whether players are allowed passage through spin gaps +UINT8 LUAh_PlayerCanEnterSpinGaps(player_t *player) +{ + hook_p hookp; + UINT8 canEnter = 0; // 0 = default, 1 = force yes, 2 = force no. + if (!gL || !(hooksAvailable[hook_PlayerCanEnterSpinGaps/8] & (1<<(hook_PlayerCanEnterSpinGaps%8)))) + return 0; + + lua_settop(gL, 0); + lua_pushcfunction(gL, LUA_GetErrorMessage); + + for (hookp = playerhooks; hookp; hookp = hookp->next) + { + if (hookp->type != hook_PlayerCanEnterSpinGaps) + continue; + + ps_lua_mobjhooks++; + if (lua_gettop(gL) == 1) + LUA_PushUserdata(gL, player, META_PLAYER); + PushHook(gL, hookp); + lua_pushvalue(gL, -2); + if (lua_pcall(gL, 1, 1, 1)) { + if (!hookp->error || cv_debug & DBG_LUA) + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); + lua_pop(gL, 1); + hookp->error = true; + continue; + } + if (!lua_isnil(gL, -1)) + { // if nil, leave canEnter = 0. + if (lua_toboolean(gL, -1)) + canEnter = 1; // Force yes + else + canEnter = 2; // Force no + } + lua_pop(gL, 1); + } + + lua_settop(gL, 0); + return canEnter; +} diff --git a/src/p_user.c b/src/p_user.c index 63942e0be..56767f433 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8651,9 +8651,16 @@ void P_MovePlayer(player_t *player) { boolean atspinheight = false; fixed_t oldheight = player->mo->height; + fixed_t luaheight = LUAh_PlayerHeight(player); + if (luaheight != -1) + { + player->mo->height = luaheight; + if (luaheight <= P_GetPlayerSpinHeight(player)) + atspinheight = true; // spinning will not save you from being crushed + } // Less height while spinning. Good for spinning under things...? - if (P_PlayerShouldUseSpinHeight(player)) + else if (P_PlayerShouldUseSpinHeight(player)) { player->mo->height = P_GetPlayerSpinHeight(player); atspinheight = true; @@ -12958,6 +12965,12 @@ boolean P_PlayerFullbright(player_t *player) // returns true if the player can enter a sector that they could not if standing at their skin's full height boolean P_PlayerCanEnterSpinGaps(player_t *player) { + UINT8 canEnter = LUAh_PlayerCanEnterSpinGaps(player); + if (canEnter == 1) + return true; + else if (canEnter == 2) + return false; + return ((player->pflags & (PF_SPINNING|PF_GLIDING)) // players who are spinning or gliding || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) // players who are landing from a glide || JUMPCURLED(player)); // players who are jumpcurled, but only if they would normally jump that way @@ -12966,9 +12979,11 @@ boolean P_PlayerCanEnterSpinGaps(player_t *player) // returns true if the player should use their skin's spinheight instead of their skin's height boolean P_PlayerShouldUseSpinHeight(player_t *player) { - return (P_PlayerCanEnterSpinGaps(player) + return ((player->pflags & (PF_SPINNING|PF_GLIDING)) || (player->mo->state == &states[player->mo->info->painstate]) || (player->panim == PA_ROLL) || ((player->powers[pw_tailsfly] || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)) - && !(player->charflags & SF_NOJUMPSPIN))); + && !(player->charflags & SF_NOJUMPSPIN)) + || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) + || JUMPCURLED(player)); } From 000e865f80f3e4f7e77184cc140eaf0dabb1c09b Mon Sep 17 00:00:00 2001 From: lachablock Date: Thu, 25 Mar 2021 21:42:25 +1100 Subject: [PATCH 089/160] Revise spinheight/gap entry conditions (again), let's keep things WAY simpler: - PF_NOJUMPDAMAGE no longer affects height at all (you're welcome katsy). - Characters with SF_NOJUMPSPIN will only use spinheight when panim is PA_ROLL. They cannot enter gaps when jumping with spinheight, unless also spinning or gliding. - All other characters use spinheight when panim is PA_JUMP or PA_ROLL. They can enter gaps when jumping with spinheight. --- src/p_user.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 56767f433..6c7cdb0d0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12958,9 +12958,7 @@ boolean P_PlayerFullbright(player_t *player) #define JUMPCURLED(player) ((player->pflags & PF_JUMPED)\ && (!(player->charflags & SF_NOJUMPSPIN))\ - && (!(player->pflags & PF_NOJUMPDAMAGE)\ - || ((player->charflags & SF_NOJUMPDAMAGE)\ - && (player->panim == PA_JUMP || player->panim == PA_ROLL))))\ + && (player->panim == PA_JUMP || player->panim == PA_ROLL))\ // returns true if the player can enter a sector that they could not if standing at their skin's full height boolean P_PlayerCanEnterSpinGaps(player_t *player) From b6e5837161e29191e9ce16f2f08e760b45030acb Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 25 Mar 2021 22:28:07 +0100 Subject: [PATCH 090/160] Use a separate transfer status for disconnected nodes --- src/d_netfil.c | 16 +++++++++------- src/d_netfil.h | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 8f661bb5f..e15c15bd5 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -562,7 +562,7 @@ static void SV_PrepareSendLuaFileToNextNode(void) // Find a client to send the file to for (i = 1; i < MAXNETNODES; i++) - if (nodeingame[i] && luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting + if (luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting { // Tell the client we're about to send them the file netbuffer->packettype = PT_SENDINGLUAFILE; @@ -588,7 +588,7 @@ void SV_PrepareSendLuaFile(void) // Set status to "waiting" for everyone for (i = 0; i < MAXNETNODES; i++) - luafiletransfers->nodestatus[i] = LFTNS_WAITING; + luafiletransfers->nodestatus[i] = (nodeingame[i] ? LFTNS_WAITING : LFTNS_NONE); if (FIL_ReadFileOK(luafiletransfers->realfilename)) { @@ -649,12 +649,14 @@ void RemoveAllLuaFileTransfers(void) void SV_AbortLuaFileTransfer(INT32 node) { - if (luafiletransfers - && (luafiletransfers->nodestatus[node] == LFTNS_ASKED - || luafiletransfers->nodestatus[node] == LFTNS_SENDING)) + if (luafiletransfers) { - luafiletransfers->nodestatus[node] = LFTNS_WAITING; - SV_PrepareSendLuaFileToNextNode(); + if (luafiletransfers->nodestatus[node] == LFTNS_ASKED + || luafiletransfers->nodestatus[node] == LFTNS_SENDING) + { + SV_PrepareSendLuaFileToNextNode(); + } + luafiletransfers->nodestatus[node] = LFTNS_NONE; } } diff --git a/src/d_netfil.h b/src/d_netfil.h index 1b399be75..2e656e0f6 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -85,10 +85,11 @@ boolean PT_RequestFile(INT32 node); typedef enum { + LFTNS_NONE, // This node is not connected LFTNS_WAITING, // This node is waiting for the server to send the file - LFTNS_ASKED, // The server has told the node they're ready to send the file + LFTNS_ASKED, // The server has told the node they're ready to send the file LFTNS_SENDING, // The server is sending the file to this node - LFTNS_SENT // The node already has the file + LFTNS_SENT // The node already has the file } luafiletransfernodestatus_t; typedef struct luafiletransfer_s From 854e43ea7c7cf3b3eb81e7388958f6546ce28ab6 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 25 Mar 2021 22:28:07 +0100 Subject: [PATCH 091/160] Kick clients if they take too long to download a Lua file --- src/d_netfil.c | 17 +++++++++++++++++ src/d_netfil.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/d_netfil.c b/src/d_netfil.c index e15c15bd5..50dc2ba60 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -570,6 +570,7 @@ static void SV_PrepareSendLuaFileToNextNode(void) I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol luafiletransfers->nodestatus[i] = LFTNS_ASKED; + luafiletransfers->nodetimeouts[i] = I_GetTime() + 30 * TICRATE; return; } @@ -930,6 +931,22 @@ void FileSendTicker(void) filetx_t *f; INT32 packetsent, ram, i, j; + // If someone is taking too long to download, kick them with a timeout + // to prevent blocking the rest of the server... + if (luafiletransfers) + { + for (i = 1; i < MAXNETNODES; i++) + { + luafiletransfernodestatus_t status = luafiletransfers->nodestatus[i]; + + if (status != LFTNS_NONE && status != LFTNS_WAITING && status != LFTNS_SENT + && I_GetTime() > luafiletransfers->nodetimeouts[i]) + { + Net_ConnectionTimeout(i); + } + } + } + if (!filestosend) // No file to send return; diff --git a/src/d_netfil.h b/src/d_netfil.h index 2e656e0f6..158149477 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -100,6 +100,7 @@ typedef struct luafiletransfer_s INT32 id; // Callback ID boolean ongoing; luafiletransfernodestatus_t nodestatus[MAXNETNODES]; + tic_t nodetimeouts[MAXNETNODES]; struct luafiletransfer_s *next; } luafiletransfer_t; From 8162d90c9427dea87223133048998d42afc7d032 Mon Sep 17 00:00:00 2001 From: lachablock Date: Fri, 26 Mar 2021 18:01:55 +1100 Subject: [PATCH 092/160] Fix LUAh_PlayerHeight returning wrong default value --- src/lua_hooklib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 6e9b9d65c..637809fd8 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1982,7 +1982,7 @@ fixed_t LUAh_PlayerHeight(player_t *player) hook_p hookp; fixed_t newheight = -1; if (!gL || !(hooksAvailable[hook_PlayerHeight/8] & (1<<(hook_PlayerHeight%8)))) - return 0; + return newheight; lua_settop(gL, 0); lua_pushcfunction(gL, LUA_GetErrorMessage); From 55d63000f4eb4de8cfcd533d6e1d3c46f0db5306 Mon Sep 17 00:00:00 2001 From: katsy Date: Sat, 27 Mar 2021 18:30:59 -0500 Subject: [PATCH 093/160] don't HWR_ClearAllTextures() in software --- src/p_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 41d8822e2..28ea613d5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4135,7 +4135,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) #ifdef HWRENDER // Free GPU textures before freeing patches. - if (vid.glstate == VID_GL_LIBRARY_LOADED) + if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED)) HWR_ClearAllTextures(); #endif @@ -4500,7 +4500,7 @@ boolean P_AddWadFile(const char *wadfilename) #ifdef HWRENDER // Free GPU textures before freeing patches. - if (vid.glstate == VID_GL_LIBRARY_LOADED) + if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED)) HWR_ClearAllTextures(); #endif From d6eaf7e0ff479a1c6ae907779c47877e3abc88e3 Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 28 Mar 2021 12:22:04 -0500 Subject: [PATCH 094/160] clear before switching, not after --- src/screen.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/screen.c b/src/screen.c index 9d36eee39..02de884bf 100644 --- a/src/screen.c +++ b/src/screen.c @@ -33,6 +33,11 @@ #include "s_sound.h" // ditto #include "g_game.h" // ditto #include "p_local.h" // P_AutoPause() +#ifdef HWRENDER +#include "hardware/hw_main.h" +#include "hardware/hw_light.h" +#include "hardware/hw_model.h" +#endif #if defined (USEASM) && !defined (NORUSEASM)//&& (!defined (_MSC_VER) || (_MSC_VER <= 1200)) @@ -423,6 +428,10 @@ void SCR_ChangeRenderer(void) CONS_Alert(CONS_ERROR, "OpenGL never loaded\n"); return; } + + if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED)) // Clear these out before switching to software + HWR_ClearAllTextures(); + #endif // Set the new render mode From 428ae3127e76753aa47c79b07867560bf9145c60 Mon Sep 17 00:00:00 2001 From: Mari0shi06 Date: Sun, 28 Mar 2021 17:12:58 -0400 Subject: [PATCH 095/160] Change Raspberry's chat colormap to V_ROSYMAP --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index ee836a372..19a477e5b 100644 --- a/src/info.c +++ b/src/info.c @@ -21761,7 +21761,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM - {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY + {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY // super From 424f67a74b5aff5083c174a81a21664a1a63e6dc Mon Sep 17 00:00:00 2001 From: Mari0shi06 Date: Sun, 28 Mar 2021 21:19:26 +0000 Subject: [PATCH 096/160] Revert "Change Raspberry's chat colormap to V_ROSYMAP" This reverts commit 428ae3127e76753aa47c79b07867560bf9145c60 --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 19a477e5b..ee836a372 100644 --- a/src/info.c +++ b/src/info.c @@ -21761,7 +21761,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM - {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY + {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY // super From 192fa5cb4b2d13ac6e1a026c3a190cece32201fc Mon Sep 17 00:00:00 2001 From: Mari0shi06 Date: Sun, 28 Mar 2021 17:26:41 -0400 Subject: [PATCH 097/160] Change Raspberry's chat color to V_ROSYMAP --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index ee836a372..2b577c07e 100644 --- a/src/info.c +++ b/src/info.c @@ -21761,7 +21761,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM - {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY + {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY // super From 715a3661b5e2cdc8ae3ef8dd5374427031d9da4b Mon Sep 17 00:00:00 2001 From: Mari0shi06 Date: Sun, 28 Mar 2021 21:27:46 +0000 Subject: [PATCH 098/160] Revert "Change Raspberry's chat color to V_ROSYMAP" This reverts commit 192fa5cb4b2d13ac6e1a026c3a190cece32201fc --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 2b577c07e..ee836a372 100644 --- a/src/info.c +++ b/src/info.c @@ -21761,7 +21761,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM - {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY + {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY // super From 29704e141b9bc2b265a58f41a2ff1c7a293b3ad7 Mon Sep 17 00:00:00 2001 From: Mari0shi06 Date: Sun, 28 Mar 2021 17:29:24 -0400 Subject: [PATCH 099/160] Change Raspberry's chat colormap to V_ROSYMAP --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index ee836a372..2b577c07e 100644 --- a/src/info.c +++ b/src/info.c @@ -21761,7 +21761,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM - {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_MAGENTAMAP, true}, // SKINCOLOR_RASPBERRY + {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY // super From 4025a1d5177b2b9b9d9c535a19d0b2c1324a35de Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Mon, 29 Mar 2021 23:04:13 -0300 Subject: [PATCH 100/160] [Software] A few floorsprite fixes This fixes the texture of the floorsprite sometimes facing the wrong way, since plane rendering can change the view angle. --- src/r_data.c | 6 +----- src/r_draw8.c | 12 +----------- src/r_plane.c | 13 +++---------- src/r_splats.c | 27 +++++++++++---------------- src/r_splats.h | 3 +-- src/r_textures.c | 9 ++------- src/r_things.c | 5 +++-- src/r_things.h | 1 + 8 files changed, 23 insertions(+), 53 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index af672f6dc..2cfe9cb7a 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -30,10 +30,6 @@ #include "byteptr.h" #include "dehacked.h" -#ifdef _WIN32 -#include // alloca(sizeof) -#endif - // // Graphics. // SRB2 graphics for walls and sprites diff --git a/src/r_draw8.c b/src/r_draw8.c index e78ba8a6c..1f451115e 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -1447,10 +1447,7 @@ void R_DrawFloorSprite_8 (void) // SoM: Why didn't I see this earlier? the spot variable is a waste now because we don't // have the uber complicated math to calculate it now, so that was a memory write we didn't // need! - // - // 4194303 = (2048x2048)-1 (2048x2048 is maximum flat size) val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[0] = colormap[translation[val & 0xFF]]; @@ -1458,7 +1455,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[1] = colormap[translation[val & 0xFF]]; @@ -1466,7 +1462,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[2] = colormap[translation[val & 0xFF]]; @@ -1474,7 +1469,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[3] = colormap[translation[val & 0xFF]]; @@ -1482,7 +1476,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[4] = colormap[translation[val & 0xFF]]; @@ -1490,7 +1483,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[5] = colormap[translation[val & 0xFF]]; @@ -1498,7 +1490,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[6] = colormap[translation[val & 0xFF]]; @@ -1506,7 +1497,6 @@ void R_DrawFloorSprite_8 (void) yposition += ystep; val = (((UINT32)yposition >> nflatyshift) & nflatmask) | ((UINT32)xposition >> nflatxshift); - val &= 4194303; val = source[val]; if (val & 0xFF00) dest[7] = colormap[translation[val & 0xFF]]; diff --git a/src/r_plane.c b/src/r_plane.c index 45d635213..ea4dfa4e8 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -154,14 +154,10 @@ static void R_UpdatePlaneRipple(void) // R_MapPlane // // Uses global vars: +// planeheight // basexscale // baseyscale // centerx -// viewx -// viewy -// viewsin -// viewcos -// viewheight void R_MapPlane(INT32 y, INT32 x1, INT32 x2) { @@ -580,7 +576,7 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop) // void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2) { - // Alam: from r_splats's R_RenderFloorSplat + // Alam: from r_splats's R_RasterizeFloorSplat if (t1 >= vid.height) t1 = vid.height-1; if (b1 >= vid.height) b1 = vid.height-1; if (t2 >= vid.height) t2 = vid.height-1; @@ -607,7 +603,6 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2) void R_DrawPlanes(void) { visplane_t *pl; - angle_t va = viewangle; INT32 i; R_UpdatePlaneRipple(); @@ -622,8 +617,6 @@ void R_DrawPlanes(void) R_DrawSinglePlane(pl); } } - - viewangle = va; } // R_DrawSkyPlane diff --git a/src/r_splats.c b/src/r_splats.c index a3fad82d8..72cac9fd9 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -28,11 +28,12 @@ static void prepare_rastertab(void); // FLOOR SPLATS // ========================================================================== +static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis); + #ifdef USEASM void ASMCALL rasterize_segment_tex_asm(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir); #endif -// Lactozilla static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 tv1, INT32 tv2, INT32 tc, INT32 dir) { #ifdef USEASM @@ -137,7 +138,7 @@ static void rasterize_segment_tex(INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT32 } } -void R_DrawFloorSprite(vissprite_t *spr) +void R_DrawFloorSplat(vissprite_t *spr) { floorsplat_t splat; mobj_t *mobj = spr->mobj; @@ -187,7 +188,7 @@ void R_DrawFloorSprite(vissprite_t *spr) if (spr->rotateflags & SRF_3D || renderflags & RF_NOSPLATBILLBOARD) splatangle = mobj->angle; else - splatangle = viewangle; + splatangle = spr->viewangle; if (!(spr->cut & SC_ISROTATED)) splatangle += mobj->rollangle; @@ -265,7 +266,6 @@ void R_DrawFloorSprite(vissprite_t *spr) if (splat.tilted) { - // Lactozilla: Just copy the entire slope LMFAOOOO pslope_t *s = &splat.slope; s->o.x = slope->o.x; @@ -330,7 +330,7 @@ void R_DrawFloorSprite(vissprite_t *spr) v2d[i].y = (centeryfrac + FixedMul(rot_z, yscale))>>FRACBITS; } - R_RenderFloorSplat(&splat, v2d, spr); + R_RasterizeFloorSplat(&splat, v2d, spr); } // -------------------------------------------------------------------------- @@ -338,7 +338,7 @@ void R_DrawFloorSprite(vissprite_t *spr) // fill the polygon with linear interpolation, call span drawer for each // scan line // -------------------------------------------------------------------------- -void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis) +static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis) { // rasterizing INT32 miny = viewheight + 1, maxy = 0; @@ -416,11 +416,10 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis if (R_CheckPowersOfTwo()) R_CheckFlatLength(ds_flatwidth * ds_flatheight); - // Lactozilla: I don't know what I'm doing if (pSplat->tilted) { R_SetTiltedSpan(0); - R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, viewangle, pSplat->angle, 1.0f); + R_CalculateSlopeVectors(&pSplat->slope, viewx, viewy, viewz, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewangle, pSplat->angle, 1.0f); spanfunctype = SPANDRAWFUNC_TILTEDSPRITE; } else @@ -533,7 +532,7 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis fixed_t xstep, ystep; fixed_t distance, span; - angle_t angle = (viewangle + pSplat->angle)>>ANGLETOFINESHIFT; + angle_t angle = (vis->viewangle + pSplat->angle)>>ANGLETOFINESHIFT; angle_t planecos = FINECOSINE(angle); angle_t planesin = FINESINE(angle); @@ -543,17 +542,13 @@ void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis distance = cacheddistance[y] = FixedMul(planeheight, yslope[y]); span = abs(centery - y); - if (span) // don't divide by zero + if (span) // Don't divide by zero { xstep = FixedMul(planesin, planeheight) / span; ystep = FixedMul(planecos, planeheight) / span; } else - { - // ah - xstep = FRACUNIT; - ystep = FRACUNIT; - } + xstep = ystep = FRACUNIT; cachedxstep[y] = xstep; cachedystep[y] = ystep; diff --git a/src/r_splats.h b/src/r_splats.h index e1f836f48..05d8b66b0 100644 --- a/src/r_splats.h +++ b/src/r_splats.h @@ -42,7 +42,6 @@ typedef struct floorsplat_s mobj_t *mobj; // Mobj it is tied to } floorsplat_t; -void R_DrawFloorSprite(vissprite_t *spr); -void R_RenderFloorSplat(floorsplat_t *pSplat, vector2_t *verts, vissprite_t *vis); +void R_DrawFloorSplat(vissprite_t *spr); #endif /*__R_SPLATS_H__*/ diff --git a/src/r_textures.c b/src/r_textures.c index a006d739f..d5da69018 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -28,11 +28,6 @@ #include "byteptr.h" #include "dehacked.h" -// I don't know what this is even for, but r_data.c had it. -#ifdef _WIN32 -#include // alloca(sizeof) -#endif - #ifdef HWRENDER #include "hardware/hw_glob.h" // HWR_LoadMapTextures #endif @@ -626,7 +621,7 @@ void *R_GetLevelFlat(levelflat_t *levelflat) // // R_CheckPowersOfTwo // -// Self-explanatory? +// Sets ds_powersoftwo true if the flat's dimensions are powers of two, and returns that. // boolean R_CheckPowersOfTwo(void) { diff --git a/src/r_things.c b/src/r_things.c index 14eed9cf2..98e7d00ca 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -1956,6 +1956,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->paperoffset = paperoffset; vis->paperdistance = paperdistance; vis->centerangle = centerangle; + vis->viewangle = viewangle; vis->shear.tan = sheartan; vis->shear.offset = 0; @@ -2783,7 +2784,7 @@ static void R_DrawSprite(vissprite_t *spr) mceilingclip = spr->cliptop; if (spr->cut & SC_SPLAT) - R_DrawFloorSprite(spr); + R_DrawFloorSplat(spr); else R_DrawVisSprite(spr); } diff --git a/src/r_things.h b/src/r_things.h index 708b6c24c..95b4215af 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -164,6 +164,7 @@ typedef struct vissprite_s fixed_t xiscale; // negative if flipped angle_t centerangle; // for paper sprites + angle_t viewangle; // for floor sprites, the viewpoint's current angle struct { fixed_t tan; // The amount to shear the sprite vertically per row From 0d5284c36c2485d370c7fda604ad458e85cf0ec4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 30 Mar 2021 19:27:10 +0100 Subject: [PATCH 101/160] Murder `MSDOS`, another of the remaining DOS port related macros I also put in a missing `defined (__APPLE__)` in d_netcmd.h related to cv_mouse2opt Also removed a redundant `!defined (__APPLE__)` in d_main.c --- src/d_main.c | 10 +++++----- src/d_netcmd.c | 6 +++--- src/d_netcmd.h | 2 +- src/doomdef.h | 4 ++-- src/doomtype.h | 2 +- src/i_tcp.c | 4 ++-- src/m_menu.c | 8 ++++---- src/sdl/i_system.c | 2 +- src/v_video.c | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 23a2c0133..cc02c5398 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -15,7 +15,7 @@ /// plus functions to parse command line parameters, configure game /// parameters, and call the startup functions. -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) #include #include #endif @@ -934,7 +934,7 @@ static void IdentifyVersion(void) char *srb2wad; const char *srb2waddir = NULL; -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) // change to the directory where 'srb2.pk3' is found srb2waddir = I_LocateWad(); #endif @@ -1107,7 +1107,7 @@ void D_SRB2Main(void) if (!userhome) { -#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) +#if (defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) I_Error("Please set $HOME to your home directory\n"); #else if (dedicated) @@ -1287,7 +1287,7 @@ void D_SRB2Main(void) G_LoadGameData(); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen #endif @@ -1553,7 +1553,7 @@ const char *D_Home(void) userhome = M_GetNextParm(); else { -#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) +#if !(defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)) if (FIL_FileOK(CONFIGFILENAME)) usehome = false; // Let's NOT use home else diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 09f9d4651..e2ccd0172 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -168,7 +168,7 @@ void SendWeaponPref(void); void SendWeaponPref2(void); static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}}; -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"}, {2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}}; #else @@ -255,7 +255,7 @@ consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_CALL, NULL, I_J consvar_t cv_joyscale = CVAR_INIT ("padscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save consvar_t cv_joyscale2 = CVAR_INIT ("padscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL); //Alam: Dummy for save #endif -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) consvar_t cv_mouse2port = CVAR_INIT ("mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL); consvar_t cv_mouse2opt = CVAR_INIT ("mouse2opt", "0", CV_SAVE, NULL, NULL); #else @@ -788,7 +788,7 @@ void D_RegisterClientCommands(void) // WARNING: the order is important when initialising mouse2 // we need the mouse2port CV_RegisterVar(&cv_mouse2port); -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) CV_RegisterVar(&cv_mouse2opt); #endif CV_RegisterVar(&cv_controlperkey); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index ac39626a4..59c231255 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -45,7 +45,7 @@ extern consvar_t cv_joyscale2; // splitscreen with second mouse extern consvar_t cv_mouse2port; extern consvar_t cv_usemouse2; -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) extern consvar_t cv_mouse2opt; #endif diff --git a/src/doomdef.h b/src/doomdef.h index 5f36f2d69..0c88d1add 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -112,7 +112,7 @@ //#define PARANOIA // do some tests that never fail but maybe // turn this on by make etc.. DEBUGMODE = 1 or use the Debug profile in the VC++ projects //#endif -#if defined (_WIN32) || (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (macintosh) +#if defined (_WIN32) || defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (macintosh) #define LOGMESSAGES // write message in log.txt #endif @@ -415,7 +415,7 @@ enum { }; // Name of local directory for config files and savegames -#if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__) +#if (defined (__unix__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (__APPLE__) #define DEFAULTDIR ".srb2" #else #define DEFAULTDIR "srb2" diff --git a/src/doomtype.h b/src/doomtype.h index ffaa540b1..f04314f54 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -97,7 +97,7 @@ typedef long ssize_t; #define strncasecmp strnicmp #define strcasecmp strcmpi #endif -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) #undef stricmp #define stricmp(x,y) strcasecmp(x,y) #undef strnicmp diff --git a/src/i_tcp.c b/src/i_tcp.c index a9f617dc9..f54dd6878 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -64,7 +64,7 @@ #include #include - #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) + #if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON) #include #endif // UNIXCOMMON #endif @@ -155,7 +155,7 @@ typedef SOCKET SOCKET_TYPE; #define ERRSOCKET (SOCKET_ERROR) #else - #if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) + #if defined (__unix__) || defined (__APPLE__) || defined (__HAIKU__) typedef int SOCKET_TYPE; #else typedef unsigned long SOCKET_TYPE; diff --git a/src/m_menu.c b/src/m_menu.c index 516bd34c1..a41c2db26 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1322,7 +1322,7 @@ static menuitem_t OP_Camera2ExtendedOptionsMenu[] = enum { op_video_resolution = 1, -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) op_video_fullscreen, #endif op_video_vsync, @@ -1334,7 +1334,7 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_HEADER, NULL, "Screen", NULL, 0}, {IT_STRING | IT_CALL, NULL, "Set Resolution...", M_VideoModeMenu, 6}, -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11}, #endif {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16}, @@ -1453,7 +1453,7 @@ static menuitem_t OP_OpenGLOptionsMenu[] = #ifdef ALAM_LIGHTING {IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 144}, #endif -#if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL))) +#if defined (_WINDOWS) && (!(defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL))) {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 154}, #endif }; @@ -12923,7 +12923,7 @@ static void M_VideoModeMenu(INT32 choice) memset(modedescs, 0, sizeof(modedescs)); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) VID_PrepareModeList(); // FIXME: hack #endif vidm_nummodes = 0; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index a0dd6e1da..e3a0c2563 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -102,7 +102,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if (defined (__unix__) && !defined (_MSDOS)) || (defined (UNIXCOMMON) && !defined(__APPLE__)) +#if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include #include #define NEWSIGNALHANDLER diff --git a/src/v_video.c b/src/v_video.c index 4713db0d8..1c383a2ac 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -418,7 +418,7 @@ void V_SetPalette(INT32 palettenum) #ifdef HWRENDER if (rendermode == render_opengl) HWR_SetPalette(&pLocalPalette[palettenum*256]); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else #endif #endif @@ -432,7 +432,7 @@ void V_SetPaletteLump(const char *pal) #ifdef HWRENDER if (rendermode == render_opengl) HWR_SetPalette(pLocalPalette); -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else #endif #endif From eece82c481dfa2cc7ab6a3fa1480f2976484b6f4 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Tue, 30 Mar 2021 17:03:05 -0300 Subject: [PATCH 102/160] Blend modes revision This changes how blend modes render, and includes fixes. --- src/hardware/hw_defs.h | 13 ++- src/hardware/hw_light.c | 8 +- src/hardware/hw_main.c | 32 ++++--- src/hardware/r_opengl/r_opengl.c | 8 +- src/r_draw.c | 148 ++++++++++++++++++++++++------- src/r_draw.h | 5 +- src/r_things.c | 6 +- 7 files changed, 156 insertions(+), 64 deletions(-) diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index bd6afc74f..4bff8fc6a 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -216,14 +216,13 @@ enum EPolyFlags PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pixels are discarded (holes in texture) PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency PF_Environment = 0x00000004, // Poly should be drawn environment mapped. (Hurdler: used for text drawing) - PF_Additive = 0x00000008, // Additive color blending - PF_AdditiveSource = 0x00000010, // Source blending factor is additive. This is the opposite of regular additive blending. - PF_Subtractive = 0x00000020, // Subtractive color blending - PF_ReverseSubtract = 0x00000040, // Reverse subtract, used in wall splats (decals) - PF_Multiplicative = 0x00000080, // Multiplicative color blending + PF_Additive = 0x00000008, // Source blending factor is additive. + PF_Subtractive = 0x00000010, // Subtractive color blending + PF_ReverseSubtract = 0x00000020, // Reverse subtract, used in wall splats (decals) + PF_Multiplicative = 0x00000040, // Multiplicative color blending PF_Fog = 0x20000000, // Fog blocks PF_NoAlphaTest = 0x40000000, // Disables alpha testing - PF_Blending = (PF_Masked|PF_Translucent|PF_Environment|PF_Additive|PF_AdditiveSource|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Fog) & ~PF_NoAlphaTest, + PF_Blending = (PF_Masked|PF_Translucent|PF_Environment|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Fog) & ~PF_NoAlphaTest, // other flag bits PF_Occlude = 0x00000100, // Updates the depth buffer diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 93c61f4e7..e83d9a6ec 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -35,7 +35,7 @@ #define DL_HIGH_QUALITY //#define STATICLIGHT //Hurdler: TODO! -#define LIGHTMAPFLAGS (PF_Modulated|PF_AdditiveSource) +#define LIGHTMAPFLAGS (PF_Modulated|PF_Additive) #ifdef ALAM_LIGHTING static dynlights_t view_dynlights[2]; // 2 players in splitscreen mode @@ -1056,7 +1056,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr) HWR_GetPic(coronalumpnum); /// \todo use different coronas - HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_AdditiveSource | PF_Corona | PF_NoDepthTest); + HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Corona | PF_NoDepthTest); } } #endif @@ -1144,7 +1144,7 @@ void HWR_DrawCoronas(void) light[3].y = cy+size*1.33f; light[3].s = 0.0f; light[3].t = 1.0f; - HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_AdditiveSource | PF_NoDepthTest | PF_Corona); + HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_NoDepthTest | PF_Corona); } } #endif diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c2d617eaf..0602c5c49 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -706,6 +706,8 @@ FBITFIELD HWR_GetBlendModeFlag(INT32 ast) { switch (ast) { + case AST_COPY: + return PF_Masked; case AST_ADD: return PF_Additive; case AST_SUBTRACT: @@ -744,7 +746,7 @@ UINT8 HWR_GetTranstableAlpha(INT32 transtablenum) FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf) { - if (!transtablenum) + if (!transtablenum || style == AST_COPY) { pSurf->PolyColor.s.alpha = 0xff; return PF_Masked; @@ -3813,8 +3815,6 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS) - return; blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); } else @@ -4240,8 +4240,6 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS) - return; blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); } else @@ -4354,9 +4352,7 @@ static inline void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) if (spr->mobj->frame & FF_TRANSMASK) { INT32 trans = (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT; - if (spr->mobj->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS) - return; - blend = HWR_SurfaceBlend(spr->mobj->blendmode, trans, &Surf); + blend = HWR_SurfaceBlend(AST_TRANSLUCENT, trans, &Surf); } else { @@ -4935,6 +4931,13 @@ static void HWR_ProjectSprite(mobj_t *thing) if (thing->spritexscale < 1 || thing->spriteyscale < 1) return; + // Visibility check by the blend mode. + if (thing->frame & FF_TRANSMASK) + { + if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) + return; + } + dispoffset = thing->info->dispoffset; this_scale = FIXED_TO_FLOAT(thing->scale); @@ -5321,6 +5324,13 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) unsigned rot = 0; UINT8 flip; + // Visibility check by the blend mode. + if (thing->frame & FF_TRANSMASK) + { + if (!R_BlendLevelVisible(thing->blendmode, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)) + return; + } + // transform the origin point tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx; tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy; @@ -5354,7 +5364,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) return; #endif - sprframe = &sprdef->spriteframes[ thing->frame & FF_FRAMEMASK]; + sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK]; // use single rotation for all views lumpoff = sprframe->lumpid[0]; @@ -6510,7 +6520,7 @@ void HWR_DoPostProcessor(player_t *player) Surf.PolyColor.s.alpha = 0xc0; // match software mode - HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_AdditiveSource|PF_NoTexture|PF_NoDepthTest); + HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Additive|PF_NoTexture|PF_NoDepthTest); } // Capture the screen for intermission and screen waving diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 6967bab74..3969f7f35 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1576,12 +1576,11 @@ static void SetBlendMode(FBITFIELD flags) case PF_Additive & PF_Blending: case PF_Subtractive & PF_Blending: case PF_ReverseSubtract & PF_Blending: + pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest + break; case PF_Environment & PF_Blending: pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); break; - case PF_AdditiveSource & PF_Blending: - pglBlendFunc(GL_SRC_ALPHA, GL_ONE); // src * alpha + dest - break; case PF_Multiplicative & PF_Blending: pglBlendFunc(GL_DST_COLOR, GL_ZERO); break; @@ -1620,7 +1619,6 @@ static void SetBlendMode(FBITFIELD flags) break; case PF_Translucent & PF_Blending: case PF_Additive & PF_Blending: - case PF_AdditiveSource & PF_Blending: case PF_Subtractive & PF_Blending: case PF_ReverseSubtract & PF_Blending: case PF_Environment & PF_Blending: @@ -2752,7 +2750,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32 fade.alpha = byte2float[Surface->FadeColor.s.alpha]; flags = (Surface->PolyFlags | PF_Modulated); - if (Surface->PolyFlags & (PF_Additive|PF_AdditiveSource|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative)) + if (Surface->PolyFlags & (PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative)) flags |= PF_Occlude; else if (Surface->PolyColor.s.alpha == 0xFF) flags |= (PF_Occlude | PF_Masked); diff --git a/src/r_draw.c b/src/r_draw.c index c3d4efae3..0ebdb4dd8 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -198,43 +198,15 @@ void R_InitTranslucencyTables(void) R_GenerateBlendTables(); } -void R_GenerateBlendTables(void) -{ - INT32 i; - - for (i = 0; i < NUMBLENDMAPS; i++) - { - if (i == blendtab_modulate) - continue; - blendtables[i] = Z_MallocAlign((NUMTRANSTABLES + 1) * 0x10000, PU_STATIC, NULL, 16); - } - - for (i = 0; i <= 9; i++) - { - const size_t offs = (0x10000 * i); - const UINT8 alpha = TRANSTAB_AMTMUL10 * i; - - R_GenerateTranslucencyTable(blendtables[blendtab_add] + offs, AST_ADD, alpha); - R_GenerateTranslucencyTable(blendtables[blendtab_subtract] + offs, AST_SUBTRACT, alpha); - R_GenerateTranslucencyTable(blendtables[blendtab_reversesubtract] + offs, AST_REVERSESUBTRACT, alpha); - } - - // Modulation blending only requires a single table - blendtables[blendtab_modulate] = Z_MallocAlign(0x10000, PU_STATIC, NULL, 16); - R_GenerateTranslucencyTable(blendtables[blendtab_modulate], AST_MODULATE, 0); -} - static colorlookup_t transtab_lut; -void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt) +static void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt) { INT16 bg, fg; if (table == NULL) I_Error("R_GenerateTranslucencyTable: input table was NULL!"); - InitColorLUT(&transtab_lut, pMasterPalette, false); - for (bg = 0; bg < 0xFF; bg++) { for (fg = 0; fg < 0xFF; fg++) @@ -243,12 +215,117 @@ void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt) RGBA_t frontrgba = V_GetMasterColor(fg); RGBA_t result; - result.rgba = ASTBlendPixel(backrgba, frontrgba, style, blendamt); + result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); + result.rgba = ASTBlendPixel(result, frontrgba, AST_TRANSLUCENT, blendamt); + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); } } } +static void R_GenerateSubtractiveTable(UINT8 *table, int style, UINT8 blendamt) +{ + INT16 bg, fg; + + if (table == NULL) + I_Error("R_GenerateSubtractiveTable: input table was NULL!"); + + blendamt = 0xFF - blendamt; + if (!blendamt) + { + memset(table, GetColorLUT(&transtab_lut, 0, 0, 0), 0x10000); + return; + } + + for (bg = 0; bg < 0xFF; bg++) + { + for (fg = 0; fg < 0xFF; fg++) + { + RGBA_t backrgba = V_GetMasterColor(bg); + RGBA_t frontrgba = V_GetMasterColor(fg); + RGBA_t result; + + result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); + result.s.red = (result.s.red * blendamt) / 0xFF; + result.s.green = (result.s.green * blendamt) / 0xFF; + result.s.blue = (result.s.blue * blendamt) / 0xFF; + + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); + } + } +} + +static void R_GenerateModulationTable(UINT8 *table) +{ + INT16 bg, fg; + + if (table == NULL) + I_Error("R_GenerateModulationTable: input table was NULL!"); + + for (bg = 0; bg < 0xFF; bg++) + { + for (fg = 0; fg < 0xFF; fg++) + { + RGBA_t backrgba = V_GetMasterColor(bg); + RGBA_t frontrgba = V_GetMasterColor(fg); + RGBA_t result; + result.rgba = ASTBlendPixel(backrgba, frontrgba, AST_MODULATE, 0); + table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); + } + } +} + +static INT32 R_GetBlendTableCount(INT32 style) +{ + INT32 count = NUMTRANSTABLES; + if (style == blendtab_subtract || style == blendtab_reversesubtract) + count++; + return count; +} + +static void R_GenerateBlendTableMaps(INT32 tab, INT32 style, void (*genfunc)(UINT8 *, int, UINT8)) +{ + INT32 i = 0; + for (; i <= R_GetBlendTableCount(tab); i++) + { + const size_t offs = (0x10000 * i); + const UINT16 alpha = min(TRANSTAB_AMTMUL10 * i, 0xFF); + genfunc(blendtables[tab] + offs, style, alpha); + } +} + +void R_GenerateBlendTables(void) +{ + INT32 i; + + for (i = 0; i < NUMBLENDMAPS; i++) + { + if (i == blendtab_modulate) + continue; + blendtables[i] = Z_MallocAlign((R_GetBlendTableCount(i) + 1) * 0x10000, PU_STATIC, NULL, 16); + } + + InitColorLUT(&transtab_lut, pMasterPalette, false); + + // Additive + R_GenerateBlendTableMaps(blendtab_add, AST_ADD, R_GenerateTranslucencyTable); + + // Subtractive +#if 1 + R_GenerateBlendTableMaps(blendtab_subtract, AST_SUBTRACT, R_GenerateSubtractiveTable); +#else + R_GenerateBlendTableMaps(blendtab_subtract, AST_SUBTRACT, R_GenerateTranslucencyTable); +#endif + + // Reverse subtractive + R_GenerateBlendTableMaps(blendtab_reversesubtract, AST_REVERSESUBTRACT, R_GenerateTranslucencyTable); + + // Modulation blending only requires a single table + blendtables[blendtab_modulate] = Z_MallocAlign(0x10000, PU_STATIC, NULL, 16); + R_GenerateModulationTable(blendtables[blendtab_modulate]); +} + +#define ClipBlendLevel(style, trans) max(min((trans), R_GetBlendTableCount(style)+1), 0) #define ClipTransLevel(trans) max(min((trans), NUMTRANSMAPS-2), 0) UINT8 *R_GetTranslucencyTable(INT32 alphalevel) @@ -258,7 +335,7 @@ UINT8 *R_GetTranslucencyTable(INT32 alphalevel) UINT8 *R_GetBlendTable(int style, INT32 alphalevel) { - size_t offs = (ClipTransLevel(alphalevel) << FF_TRANSSHIFT); + size_t offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT); // Lactozilla: Returns the equivalent to AST_TRANSLUCENT // if no alpha style matches any of the blend tables. @@ -283,6 +360,13 @@ UINT8 *R_GetBlendTable(int style, INT32 alphalevel) return NULL; } +boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel) +{ + if (blendmode == AST_COPY || blendmode == AST_SUBTRACT || blendmode == AST_MODULATE) + return true; + return (alphalevel < R_GetBlendTableCount(blendmode)); +} + // Define for getting accurate color brightness readings according to how the human eye sees them. // https://en.wikipedia.org/wiki/Relative_luminance // 0.2126 to red diff --git a/src/r_draw.h b/src/r_draw.h index d1eb83033..caf43fd89 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -140,11 +140,12 @@ extern UINT8 *blendtables[NUMBLENDMAPS]; void R_InitTranslucencyTables(void); void R_GenerateBlendTables(void); -void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt); UINT8 *R_GetTranslucencyTable(INT32 alphalevel); UINT8 *R_GetBlendTable(int style, INT32 alphalevel); +boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel); + // Color ramp modification should force a recache extern UINT8 skincolor_modified[]; diff --git a/src/r_things.c b/src/r_things.c index 14eed9cf2..aa28b7c2b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -1803,7 +1803,7 @@ static void R_ProjectSprite(mobj_t *thing) else if (oldthing->frame & FF_TRANSMASK) { trans = (oldthing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT; - if (oldthing->blendmode == AST_TRANSLUCENT && trans >= NUMTRANSMAPS) + if (!R_BlendLevelVisible(oldthing->blendmode, trans)) return; } else @@ -2199,7 +2199,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) // specific translucency if (thing->frame & FF_TRANSMASK) - vis->transmap = (thing->frame & FF_TRANSMASK) - 0x10000 + transtables; + vis->transmap = R_GetTranslucencyTable((thing->frame & FF_TRANSMASK) >> FF_TRANSSHIFT); else vis->transmap = NULL; From 59be35e533c420f392da56987f5414cb679e9c25 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Tue, 30 Mar 2021 22:12:31 -0300 Subject: [PATCH 103/160] Rename functions, make more efficient, fix subtractive in Software --- src/hardware/hw_main.c | 3 +- src/r_draw.c | 92 +++++++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0602c5c49..f2af1cc40 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -707,6 +707,7 @@ FBITFIELD HWR_GetBlendModeFlag(INT32 ast) switch (ast) { case AST_COPY: + case AST_OVERLAY: return PF_Masked; case AST_ADD: return PF_Additive; @@ -746,7 +747,7 @@ UINT8 HWR_GetTranstableAlpha(INT32 transtablenum) FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf) { - if (!transtablenum || style == AST_COPY) + if (!transtablenum || style == AST_COPY || style == AST_OVERLAY) { pSurf->PolyColor.s.alpha = 0xff; return PF_Masked; diff --git a/src/r_draw.c b/src/r_draw.c index 0ebdb4dd8..8625fbab2 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -173,14 +173,12 @@ static INT32 CacheIndexToSkin(INT32 ttc) CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; -#define TRANSTAB_AMTMUL10 (256.0f / 10.0f) - /** \brief Initializes the translucency tables used by the Software renderer. */ void R_InitTranslucencyTables(void) { - // Load here the transparency lookup tables 'TINTTAB' - // NOTE: the TINTTAB resource MUST BE aligned on 64k for the asm + // Load here the transparency lookup tables 'TRANSx0' + // NOTE: the TRANSx0 resources MUST BE aligned on 64k for the asm // optimised code (in other words, transtables pointer low word is 0) transtables = Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC, NULL, 16); @@ -200,12 +198,12 @@ void R_InitTranslucencyTables(void) static colorlookup_t transtab_lut; -static void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt) +static void BlendTab_Translucent(UINT8 *table, int style, UINT8 blendamt) { INT16 bg, fg; if (table == NULL) - I_Error("R_GenerateTranslucencyTable: input table was NULL!"); + I_Error("BlendTab_Translucent: input table was NULL!"); for (bg = 0; bg < 0xFF; bg++) { @@ -223,15 +221,14 @@ static void R_GenerateTranslucencyTable(UINT8 *table, int style, UINT8 blendamt) } } -static void R_GenerateSubtractiveTable(UINT8 *table, int style, UINT8 blendamt) +static void BlendTab_Subtractive(UINT8 *table, int style, UINT8 blendamt) { INT16 bg, fg; if (table == NULL) - I_Error("R_GenerateSubtractiveTable: input table was NULL!"); + I_Error("BlendTab_Subtractive: input table was NULL!"); - blendamt = 0xFF - blendamt; - if (!blendamt) + if (blendamt == 0xFF) { memset(table, GetColorLUT(&transtab_lut, 0, 0, 0), 0x10000); return; @@ -246,21 +243,21 @@ static void R_GenerateSubtractiveTable(UINT8 *table, int style, UINT8 blendamt) RGBA_t result; result.rgba = ASTBlendPixel(backrgba, frontrgba, style, 0xFF); - result.s.red = (result.s.red * blendamt) / 0xFF; - result.s.green = (result.s.green * blendamt) / 0xFF; - result.s.blue = (result.s.blue * blendamt) / 0xFF; + result.s.red = max(0, result.s.red - blendamt); + result.s.green = max(0, result.s.green - blendamt); + result.s.blue = max(0, result.s.blue - blendamt); table[((bg * 0x100) + fg)] = GetColorLUT(&transtab_lut, result.s.red, result.s.green, result.s.blue); } } } -static void R_GenerateModulationTable(UINT8 *table) +static void BlendTab_Modulative(UINT8 *table) { INT16 bg, fg; if (table == NULL) - I_Error("R_GenerateModulationTable: input table was NULL!"); + I_Error("BlendTab_Modulative: input table was NULL!"); for (bg = 0; bg < 0xFF; bg++) { @@ -275,21 +272,33 @@ static void R_GenerateModulationTable(UINT8 *table) } } -static INT32 R_GetBlendTableCount(INT32 style) +static INT32 BlendTab_Count[NUMBLENDMAPS] = { - INT32 count = NUMTRANSTABLES; - if (style == blendtab_subtract || style == blendtab_reversesubtract) - count++; - return count; -} + NUMTRANSTABLES, // blendtab_add + NUMTRANSTABLES+1, // blendtab_subtract + NUMTRANSTABLES+1, // blendtab_reversesubtract + 1 // blendtab_modulate +}; -static void R_GenerateBlendTableMaps(INT32 tab, INT32 style, void (*genfunc)(UINT8 *, int, UINT8)) +static INT32 BlendTab_FromStyle[] = { - INT32 i = 0; - for (; i <= R_GetBlendTableCount(tab); i++) + 0, // AST_COPY + 0, // AST_TRANSLUCENT + blendtab_add, // AST_ADD + blendtab_subtract, // AST_SUBTRACT + blendtab_reversesubtract, // AST_REVERSESUBTRACT + blendtab_modulate, // AST_MODULATE + 0 // AST_OVERLAY +}; + +static void BlendTab_GenerateMaps(INT32 tab, INT32 style, void (*genfunc)(UINT8 *, int, UINT8)) +{ + INT32 i = 0, num = BlendTab_Count[tab]; + const float amtmul = (256.0f / (float)(NUMTRANSTABLES)); + for (; i < num; i++) { const size_t offs = (0x10000 * i); - const UINT16 alpha = min(TRANSTAB_AMTMUL10 * i, 0xFF); + const UINT16 alpha = min(amtmul * i, 0xFF); genfunc(blendtables[tab] + offs, style, alpha); } } @@ -299,33 +308,28 @@ void R_GenerateBlendTables(void) INT32 i; for (i = 0; i < NUMBLENDMAPS; i++) - { - if (i == blendtab_modulate) - continue; - blendtables[i] = Z_MallocAlign((R_GetBlendTableCount(i) + 1) * 0x10000, PU_STATIC, NULL, 16); - } + blendtables[i] = Z_MallocAlign(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL, 16); InitColorLUT(&transtab_lut, pMasterPalette, false); // Additive - R_GenerateBlendTableMaps(blendtab_add, AST_ADD, R_GenerateTranslucencyTable); + BlendTab_GenerateMaps(blendtab_add, AST_ADD, BlendTab_Translucent); // Subtractive #if 1 - R_GenerateBlendTableMaps(blendtab_subtract, AST_SUBTRACT, R_GenerateSubtractiveTable); + BlendTab_GenerateMaps(blendtab_subtract, AST_SUBTRACT, BlendTab_Subtractive); #else - R_GenerateBlendTableMaps(blendtab_subtract, AST_SUBTRACT, R_GenerateTranslucencyTable); + BlendTab_GenerateMaps(blendtab_subtract, AST_SUBTRACT, BlendTab_Translucent); #endif // Reverse subtractive - R_GenerateBlendTableMaps(blendtab_reversesubtract, AST_REVERSESUBTRACT, R_GenerateTranslucencyTable); + BlendTab_GenerateMaps(blendtab_reversesubtract, AST_REVERSESUBTRACT, BlendTab_Translucent); - // Modulation blending only requires a single table - blendtables[blendtab_modulate] = Z_MallocAlign(0x10000, PU_STATIC, NULL, 16); - R_GenerateModulationTable(blendtables[blendtab_modulate]); + // Modulative blending only requires a single table + BlendTab_Modulative(blendtables[blendtab_modulate]); } -#define ClipBlendLevel(style, trans) max(min((trans), R_GetBlendTableCount(style)+1), 0) +#define ClipBlendLevel(style, trans) max(min((trans), BlendTab_Count[BlendTab_FromStyle[style]]-1), 0) #define ClipTransLevel(trans) max(min((trans), NUMTRANSMAPS-2), 0) UINT8 *R_GetTranslucencyTable(INT32 alphalevel) @@ -335,7 +339,12 @@ UINT8 *R_GetTranslucencyTable(INT32 alphalevel) UINT8 *R_GetBlendTable(int style, INT32 alphalevel) { - size_t offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT); + size_t offs; + + if (style == AST_COPY || style == AST_OVERLAY) + return NULL; + + offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT); // Lactozilla: Returns the equivalent to AST_TRANSLUCENT // if no alpha style matches any of the blend tables. @@ -362,9 +371,10 @@ UINT8 *R_GetBlendTable(int style, INT32 alphalevel) boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel) { - if (blendmode == AST_COPY || blendmode == AST_SUBTRACT || blendmode == AST_MODULATE) + if (blendmode == AST_COPY || blendmode == AST_SUBTRACT || blendmode == AST_MODULATE || blendmode == AST_OVERLAY) return true; - return (alphalevel < R_GetBlendTableCount(blendmode)); + + return (alphalevel < BlendTab_Count[BlendTab_FromStyle[blendmode]]); } // Define for getting accurate color brightness readings according to how the human eye sees them. From 7e6bc9724053dc3af859d0fc02893a8ec5eb6b91 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Tue, 30 Mar 2021 22:52:50 -0300 Subject: [PATCH 104/160] Smoother freelook in Software Mhm hmm... --- src/r_main.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index f82fb589e..04bdebc58 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1089,8 +1089,6 @@ subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y) // 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out) static void R_SetupFreelook(player_t *player, boolean skybox) { - INT32 dy = 0; - #ifndef HWRENDER (void)player; (void)skybox; @@ -1109,14 +1107,15 @@ static void R_SetupFreelook(player_t *player, boolean skybox) G_SoftwareClipAimingPitch((INT32 *)&aimingangle); } - if (rendermode == render_soft) - { - dy = (AIMINGTODY(aimingangle)>>FRACBITS) * viewwidth/BASEVIDWIDTH; - yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)]; - } + centeryfrac = (viewheight/2)< Date: Sat, 13 Feb 2021 20:33:41 +0100 Subject: [PATCH 105/160] Our menu system sucks. That's all I have to say. --- src/m_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 516bd34c1..0fca39801 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11419,9 +11419,9 @@ static void M_ServerOptions(INT32 choice) OP_ServerOptionsMenu[ 2].status = IT_GRAYEDOUT; // Max players OP_ServerOptionsMenu[ 3].status = IT_GRAYEDOUT; // Allow add-on downloading OP_ServerOptionsMenu[ 4].status = IT_GRAYEDOUT; // Allow players to join - OP_ServerOptionsMenu[35].status = IT_GRAYEDOUT; // Master server - OP_ServerOptionsMenu[36].status = IT_GRAYEDOUT; // Minimum delay between joins - OP_ServerOptionsMenu[37].status = IT_GRAYEDOUT; // Attempts to resynchronise + OP_ServerOptionsMenu[36].status = IT_GRAYEDOUT; // Master server + OP_ServerOptionsMenu[37].status = IT_GRAYEDOUT; // Minimum delay between joins + OP_ServerOptionsMenu[38].status = IT_GRAYEDOUT; // Attempts to resynchronise } else { @@ -11429,11 +11429,11 @@ static void M_ServerOptions(INT32 choice) OP_ServerOptionsMenu[ 2].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[ 3].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[ 4].status = IT_STRING | IT_CVAR; - OP_ServerOptionsMenu[35].status = (netgame + OP_ServerOptionsMenu[36].status = (netgame ? IT_GRAYEDOUT : (IT_STRING | IT_CVAR | IT_CV_STRING)); - OP_ServerOptionsMenu[36].status = IT_STRING | IT_CVAR; OP_ServerOptionsMenu[37].status = IT_STRING | IT_CVAR; + OP_ServerOptionsMenu[38].status = IT_STRING | IT_CVAR; } #endif From 57c7a18a20b3049a47bc4bf6a3cc8fc678085e6f Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 2 Apr 2021 20:50:56 -0400 Subject: [PATCH 106/160] don't say we launched if we didn't actually launch --- src/p_slopes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index e93b0f6c9..bd0f15d2e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -777,13 +777,13 @@ void P_SlopeLaunch(mobj_t *mo) mo->momx = slopemom.x; mo->momy = slopemom.y; mo->momz = slopemom.z/2; + + if (mo->player) + mo->player->powers[pw_justlaunched] = 1; } //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; - - if (mo->player) - mo->player->powers[pw_justlaunched] = 1; } // From e9213b2b41fd60b2331ccad987409786fd337499 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sun, 4 Apr 2021 21:29:15 +0300 Subject: [PATCH 107/160] Fix a OpenGL backend DeleteTexture crash --- src/hardware/r_opengl/r_opengl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 6967bab74..064457c03 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1301,8 +1301,12 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) { if (head->next) head->next->prev = head->prev; + else // no next -> tail is being deleted -> update TexCacheTail + TexCacheTail = head->prev; if (head->prev) head->prev->next = head->next; + else // no prev -> head is being deleted -> update TexCacheHead + TexCacheHead = head->next; free(head); break; } From 84191252d2c5116b19fc17066e9e313fefa47223 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 4 Apr 2021 17:01:54 -0700 Subject: [PATCH 108/160] Remove code that converts uppercase letters to lower, when coming from dedicated console --- src/console.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/console.c b/src/console.c index 121605b10..1560220f6 100644 --- a/src/console.c +++ b/src/console.c @@ -1303,10 +1303,6 @@ boolean CON_Responder(event_t *ev) if (key < 32 || key > 127) return true; - // add key to cmd line here - if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers - key = key + 'a' - 'A'; - if (input_sel != input_cur) CON_InputDelSelection(); CON_InputAddChar(key); From 3dd04b90c630574f41ae0f70f03104706ac051dd Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 5 Apr 2021 16:59:02 -0400 Subject: [PATCH 109/160] Fix jet fume crash when dashmode is above DASHMODE_MAX I would like to use higher dashmode values for extra leniency, the jet fume kicks and screams when this happens. --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index b8e7d1746..03682b938 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11310,7 +11310,7 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume) angle_t angle = player->drawangle; fixed_t dist; panim_t panim = player->panim; - tic_t dashmode = player->dashmode; + tic_t dashmode = min(player->dashmode, DASHMODE_MAX); boolean underwater = mo->eflags & MFE_UNDERWATER; statenum_t stat = fume->state-states; From a01a420aa06176fce2cc249eacbdfd64ed73d93c Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 5 Apr 2021 18:10:34 -0700 Subject: [PATCH 110/160] Brackets --- src/w_wad.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index 91c8331f7..6149aec6e 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -821,8 +821,10 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) } if (important && !mainfile) + { //G_SetGameModified(true); modifiedgame = true; // avoid savemoddata being set to false + } // // link wad file to search files From 397fdef034faf90bb89116e7028340f806c81488 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 5 Apr 2021 22:34:52 -0400 Subject: [PATCH 111/160] Load intermission patches in Y_LoadIntermisionData --- src/g_game.c | 1 + src/y_inter.c | 133 ++++++++++++++++++++++++++++++++------------------ src/y_inter.h | 1 + 3 files changed, 87 insertions(+), 48 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2b304b4fd..29ad4086e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3973,6 +3973,7 @@ static void G_DoCompleted(void) { G_SetGamestate(GS_INTERMISSION); Y_StartIntermission(); + Y_LoadIntermisionData(); G_UpdateVisited(); G_HandleSaveLevel(); } diff --git a/src/y_inter.c b/src/y_inter.c index bd3b557d7..629d07426 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -215,6 +215,86 @@ static void Y_IntermissionTokenDrawer(void) V_DrawCroppedPatch(32<width, calc); } + +// +// Y_LoadData +// +// Load patches for drawing the intermission, if acceptable +// +void Y_LoadIntermisionData(void) +{ + INT32 i; + + if (dedicated) + return; + + switch (intertype) + { + case int_coop: + { + for (i = 0; i < 4; ++i) + { + if (strlen(data.coop.bonuses[i].patch)) + data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); + } + data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH); + + // get background patches + bgpatch = W_CachePatchName("INTERSCR", PU_PATCH); + + // grab an interscreen if appropriate + if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') + interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); + break; + } + case int_spec: + { + for (i = 0; i < 2; ++i) + data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH); + + data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH); + data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH); + + // get background tile + bgtile = W_CachePatchName("SPECTILE", PU_PATCH); + + // grab an interscreen if appropriate + if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') + interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); + break; + } + case int_match: + case int_race: + case int_teammatch: + case int_ctf: + { + if (intertype == int_match || intertype == int_race) + { + // get RESULT header + data.match.result = W_CachePatchName("RESULT", PU_PATCH); + } + + if (intertype == int_ctf) + { + data.match.redflag = rflagico; + data.match.blueflag = bflagico; + } + else // team match + { + data.match.redflag = rmatcico; + data.match.blueflag = bmatcico; + } + + // get background tile + bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); + break; + } + case int_none: + default: + break; + } +} + // // Y_ConsiderScreenBuffer // @@ -1176,6 +1256,11 @@ void Y_DetermineIntermissionType(void) intertype = int_ctf; } +// +// Y_StartIntermission +// +// Called by G_DoCompleted. Sets up data for intermission drawer/ticker. +// // // Y_StartIntermission // @@ -1183,8 +1268,6 @@ void Y_DetermineIntermissionType(void) // void Y_StartIntermission(void) { - INT32 i; - intertic = -1; #ifdef PARANOIA @@ -1228,23 +1311,12 @@ void Y_StartIntermission(void) // setup time data data.coop.tics = players[consoleplayer].realtime; - for (i = 0; i < 4; ++i) - { - if (strlen(data.coop.bonuses[i].patch)) - data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); - } - data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH); - // get act number data.coop.actnum = mapheaderinfo[gamemap-1]->actnum; - // get background patches - bgpatch = W_CachePatchName("INTERSCR", PU_PATCH); - // grab an interscreen if appropriate if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') { - interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); useinterpic = true; usebuffer = false; } @@ -1301,21 +1373,9 @@ void Y_StartIntermission(void) // give out ring bonuses Y_AwardSpecialStageBonus(); - for (i = 0; i < 2; ++i) - data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH); - - data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH); - data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH); - - // get background tile - bgtile = W_CachePatchName("SPECTILE", PU_PATCH); - // grab an interscreen if appropriate if (mapheaderinfo[gamemap-1]->interscreen[0] != '#') - { - interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); useinterpic = true; - } else useinterpic = false; @@ -1408,11 +1468,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - // get RESULT header - data.match.result = - W_CachePatchName("RESULT", PU_PATCH); - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1437,10 +1492,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - // get RESULT header - data.match.result = W_CachePatchName("RESULT", PU_PATCH); - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1466,18 +1517,6 @@ void Y_StartIntermission(void) data.match.levelstring[sizeof data.match.levelstring - 1] = '\0'; - if (intertype == int_ctf) - { - data.match.redflag = rflagico; - data.match.blueflag = bflagico; - } - else // team match - { - data.match.redflag = rmatcico; - data.match.blueflag = bmatcico; - } - - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; @@ -1502,8 +1541,6 @@ void Y_StartIntermission(void) data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0'; - // get background tile - bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); usetile = true; useinterpic = false; break; diff --git a/src/y_inter.h b/src/y_inter.h index 859144b1d..08f7cf9bd 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -14,6 +14,7 @@ extern boolean usebuffer; void Y_IntermissionDrawer(void); void Y_Ticker(void); +void Y_LoadIntermisionData(void); void Y_StartIntermission(void); void Y_EndIntermission(void); From 35c0f8b5cc46ee8addc3cac102daebe7051aef8e Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 5 Apr 2021 22:44:16 -0400 Subject: [PATCH 112/160] Correct function name comment --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 629d07426..e1bbd16f6 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -217,7 +217,7 @@ static void Y_IntermissionTokenDrawer(void) // -// Y_LoadData +// Y_LoadIntermisionData // // Load patches for drawing the intermission, if acceptable // From 33b7075d4607a4d68a64d9c7d35f06e99fb22399 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 5 Apr 2021 22:50:22 -0400 Subject: [PATCH 113/160] bruh --- src/g_game.c | 2 +- src/y_inter.c | 4 ++-- src/y_inter.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 29ad4086e..13423ce77 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3973,7 +3973,7 @@ static void G_DoCompleted(void) { G_SetGamestate(GS_INTERMISSION); Y_StartIntermission(); - Y_LoadIntermisionData(); + Y_LoadIntermissionData(); G_UpdateVisited(); G_HandleSaveLevel(); } diff --git a/src/y_inter.c b/src/y_inter.c index e1bbd16f6..4e10e7398 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -217,11 +217,11 @@ static void Y_IntermissionTokenDrawer(void) // -// Y_LoadIntermisionData +// Y_LoadIntermissionData // // Load patches for drawing the intermission, if acceptable // -void Y_LoadIntermisionData(void) +void Y_LoadIntermissionData(void) { INT32 i; diff --git a/src/y_inter.h b/src/y_inter.h index 08f7cf9bd..7268b1a47 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -14,7 +14,7 @@ extern boolean usebuffer; void Y_IntermissionDrawer(void); void Y_Ticker(void); -void Y_LoadIntermisionData(void); +void Y_LoadIntermissionData(void); void Y_StartIntermission(void); void Y_EndIntermission(void); From 101b6e46d413821f74aa8f10d8e55a4d1959634f Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 5 Apr 2021 22:56:03 -0400 Subject: [PATCH 114/160] Even more bruhs --- src/y_inter.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 4e10e7398..32dfb52a7 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1262,10 +1262,6 @@ void Y_DetermineIntermissionType(void) // Called by G_DoCompleted. Sets up data for intermission drawer/ticker. // // -// Y_StartIntermission -// -// Called by G_DoCompleted. Sets up data for intermission drawer/ticker. -// void Y_StartIntermission(void) { intertic = -1; From e39bf7503fe37dfe412ef06b45ef9dba7095b9dc Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 6 Apr 2021 03:55:57 -0700 Subject: [PATCH 115/160] Makefile: fix object file not depending on headers BRUH MOMENT --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 471c55ed3..cf06ce904 100644 --- a/src/Makefile +++ b/src/Makefile @@ -701,7 +701,7 @@ endif endif define deps_rule += - $(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$< $< + $(CC) $(CFLAGS) -M -MF $@ -MT $(OBJDIR)/$(<:.c=.o) $< endef $(DEPDIR)/%.d: %.c From a501b7b00d74bcdce98e2ca0d6b69ddfb0c39ea9 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 7 Apr 2021 00:55:08 -0400 Subject: [PATCH 116/160] Reorganize the switch block, add missing int_comp case --- src/y_inter.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 32dfb52a7..5dd3e845d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -263,28 +263,23 @@ void Y_LoadIntermissionData(void) interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH); break; } + case int_ctf: + case int_teammatch: + { + data.match.redflag = (intertype == int_ctf) ? rflagico : rmatcico; + data.match.blueflag = (intertype == int_ctf) ? bflagico : bmatcico; + } + /* FALLTHRU */ case int_match: case int_race: - case int_teammatch: - case int_ctf: + case int_comp: { - if (intertype == int_match || intertype == int_race) + if (intertype == int_match || intertype == int_race || intertype == int_comp) { // get RESULT header data.match.result = W_CachePatchName("RESULT", PU_PATCH); } - if (intertype == int_ctf) - { - data.match.redflag = rflagico; - data.match.blueflag = bflagico; - } - else // team match - { - data.match.redflag = rmatcico; - data.match.blueflag = bmatcico; - } - // get background tile bgtile = W_CachePatchName("SRB2BACK", PU_PATCH); break; From 77f2b1f682b1b4112d7f3d74e1f937107479aaef Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 7 Apr 2021 01:11:39 -0400 Subject: [PATCH 117/160] Prevent redudant result patch caching on competition --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 5dd3e845d..6833ca2b5 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -274,7 +274,7 @@ void Y_LoadIntermissionData(void) case int_race: case int_comp: { - if (intertype == int_match || intertype == int_race || intertype == int_comp) + if (intertype == int_match || intertype == int_race) { // get RESULT header data.match.result = W_CachePatchName("RESULT", PU_PATCH); From 876daa7d6ef762312fd4ec990c30fc3b3c499c4d Mon Sep 17 00:00:00 2001 From: katsy Date: Wed, 7 Apr 2021 04:57:18 -0500 Subject: [PATCH 118/160] fix ctf flag garbage --- src/st_stuff.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 649644620..a1fbbec03 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -299,10 +299,6 @@ void ST_LoadGraphics(void) gravboots = W_CachePatchName("TVGVICON", PU_HUDGFX); tagico = W_CachePatchName("TAGICO", PU_HUDGFX); - rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); - bflagico = W_CachePatchName("BFLAGICO", PU_HUDGFX); - rmatcico = W_CachePatchName("RMATCICO", PU_HUDGFX); - bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); gotrflag = W_CachePatchName("GOTRFLAG", PU_HUDGFX); gotbflag = W_CachePatchName("GOTBFLAG", PU_HUDGFX); fnshico = W_CachePatchName("FNSHICO", PU_HUDGFX); @@ -2363,27 +2359,29 @@ static inline void ST_drawRaceHUD(void) static void ST_drawTeamHUD(void) { - patch_t *p; #define SEP 20 if (F_GetPromptHideHud(0)) // y base is 0 return; - if (gametyperules & GTR_TEAMFLAGS) - p = bflagico; - else - p = bmatcico; + rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); + bflagico = W_CachePatchName("BFLAGICO", PU_HUDGFX); + rmatcico = W_CachePatchName("RMATCICO", PU_HUDGFX); + bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); if (LUA_HudEnabled(hud_teamscores)) - V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - (p->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p); - - if (gametyperules & GTR_TEAMFLAGS) - p = rflagico; - else - p = rmatcico; - - if (LUA_HudEnabled(hud_teamscores)) - V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - (p->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p); + { + if (gametyperules & GTR_TEAMFLAGS) + { + V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - (bflagico->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, bflagico); + V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - (rflagico->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, rflagico); + } + else + { + V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - (bmatcico->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, bmatcico); + V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - (rmatcico->width / 4), 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, rmatcico); + } + } if (!(gametyperules & GTR_TEAMFLAGS)) goto num; From 0d628c351aa57d2dfa95c77fd86c49a3a1a7a3b0 Mon Sep 17 00:00:00 2001 From: sphere Date: Sat, 10 Apr 2021 17:44:42 +0200 Subject: [PATCH 119/160] Update Zone Builder configuration. --- extras/conf/SRB2-22.cfg | 146 ++++++++++++++++++++++++++++------------ 1 file changed, 104 insertions(+), 42 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index a0d40cdf0..3fd4b6ccd 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -746,13 +746,13 @@ linedeftypes 20 { - title = "First Line"; + title = "PolyObject First Line"; prefix = "(20)"; } 22 { - title = "Parameters"; + title = "PolyObject Parameters"; prefix = "(22)"; flags8text = "[3] Set translucency by X offset"; flags32text = "[5] Render outer sides only"; @@ -765,19 +765,19 @@ linedeftypes 30 { - title = "Waving Flag"; + title = "PolyObject Waving Flag"; prefix = "(30)"; } 31 { - title = "Displacement by Front Sector"; + title = "Move PolyObject by Front Sector Displacement"; prefix = "(31)"; } 32 { - title = "Angular Displacement by Front Sector"; + title = "Rotate PolyObject by Front Sector Displacement"; prefix = "(32)"; flags64text = "[6] Don't turn players"; flags512text = "[9] Turn all objects"; @@ -2498,35 +2498,35 @@ linedeftypes 480 { - title = "Door Slide"; + title = "PolyObject Door Slide"; prefix = "(480)"; flags8text = "[3] Set delay by backside sector"; } 481 { - title = "Door Swing"; + title = "PolyObject Door Swing"; prefix = "(481)"; flags8text = "[3] Set delay by backside sector"; } 482 { - title = "Move"; + title = "Move PolyObject"; prefix = "(482)"; flags8text = "[3] Set delay by backside sector"; } 483 { - title = "Move, Override"; + title = "Move PolyObject, Override"; prefix = "(483)"; flags8text = "[3] Set delay by backside sector"; } 484 { - title = "Rotate Right"; + title = "Rotate PolyObject Right"; prefix = "(484)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Don't turn players"; @@ -2535,7 +2535,7 @@ linedeftypes 485 { - title = "Rotate Right, Override"; + title = "Rotate PolyObject Right, Override"; prefix = "(485)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Don't turn players"; @@ -2544,7 +2544,7 @@ linedeftypes 486 { - title = "Rotate Left"; + title = "Rotate PolyObject Left"; prefix = "(486)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Don't turn players"; @@ -2553,7 +2553,7 @@ linedeftypes 487 { - title = "Rotate Left, Override"; + title = "Rotate PolyObject Left, Override"; prefix = "(487)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Don't turn players"; @@ -2562,7 +2562,7 @@ linedeftypes 488 { - title = "Move by Waypoints"; + title = "Move PolyObject by Waypoints"; prefix = "(488)"; flags8text = "[3] Set delay by backside sector"; flags32text = "[5] Reverse order"; @@ -2573,7 +2573,7 @@ linedeftypes 489 { - title = "Turn Invisible, Intangible"; + title = "Turn PolyObject Invisible, Intangible"; prefix = "(489)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Only invisible"; @@ -2581,7 +2581,7 @@ linedeftypes 490 { - title = "Turn Visible, Tangible"; + title = "Turn PolyObject Visible, Tangible"; prefix = "(490)"; flags8text = "[3] Set delay by backside sector"; flags64text = "[6] Only visible"; @@ -2589,7 +2589,7 @@ linedeftypes 491 { - title = "Set Translucency"; + title = "Set PolyObject Translucency"; prefix = "(491)"; flags8text = "[3] Set delay by backside sector"; flags16text = "[4] Set raw alpha by Front X"; @@ -2598,7 +2598,7 @@ linedeftypes 492 { - title = "Fade Translucency"; + title = "Fade PolyObject Translucency"; prefix = "(492)"; flags8text = "[3] Set delay by backside sector"; flags16text = "[4] Set raw alpha by Front X"; @@ -3393,6 +3393,7 @@ thingtypes width = 8; height = 28; angletext = "Jump strength"; + fixedrotation = 1; } 103 { @@ -3431,6 +3432,7 @@ thingtypes width = 12; height = 64; angletext = "Firing delay"; + fixedrotation = 1; } 122 { @@ -3547,9 +3549,10 @@ thingtypes { title = "Pterabyte Spawner"; sprite = "PTERA2A8"; - width = 16; - height = 16; - parametertext = "No. Pterabytes"; + width = 24; + height = 48; + parametertext = "Spawns +1"; + arrow = 0; } 136 { @@ -3771,6 +3774,7 @@ thingtypes height = 16; sprite = "internal:capsule"; angletext = "Tag"; + fixedrotation = 1; } 292 { @@ -3781,11 +3785,13 @@ thingtypes flags8text = "[8] Sea Egg shooting point"; sprite = "internal:eggmanway"; angletext = "No. (Sea Egg)"; + fixedrotation = 1; flagsvaluetext = "No. (Brak)"; parametertext = "Next"; } 293 { + arrow = 0; title = "Metal Sonic Gather Point"; sprite = "internal:metal"; width = 8; @@ -3793,6 +3799,7 @@ thingtypes } 294 { + arrow = 0; title = "Fang Waypoint"; flags8text = "[8] Center waypoint"; sprite = "internal:eggmanway"; @@ -3820,79 +3827,79 @@ thingtypes 301 { title = "Bounce Ring"; - sprite = "internal:RNGBA0"; + sprite = "RNGBA0"; } 302 { title = "Rail Ring"; - sprite = "internal:RNGRA0"; + sprite = "RNGRA0"; } 303 { title = "Infinity Ring"; - sprite = "internal:RNGIA0"; + sprite = "RNGIA0"; } 304 { title = "Automatic Ring"; - sprite = "internal:RNGAA0"; + sprite = "RNGAA0"; } 305 { title = "Explosion Ring"; - sprite = "internal:RNGEA0"; + sprite = "RNGEA0"; } 306 { title = "Scatter Ring"; - sprite = "internal:RNGSA0"; + sprite = "RNGSA0"; } 307 { title = "Grenade Ring"; - sprite = "internal:RNGGA0"; + sprite = "RNGGA0"; } 308 { title = "CTF Team Ring (Red)"; - sprite = "internal:RRNGA0"; + sprite = "internal:TRNGA0r"; width = 16; } 309 { title = "CTF Team Ring (Blue)"; - sprite = "internal:BRNGA0"; + sprite = "internal:TRNGA0b"; width = 16; } 330 { title = "Bounce Ring Panel"; - sprite = "internal:PIKBA0"; + sprite = "PIKBA0"; } 331 { title = "Rail Ring Panel"; - sprite = "internal:PIKRA0"; + sprite = "PIKRA0"; } 332 { title = "Automatic Ring Panel"; - sprite = "internal:PIKAA0"; + sprite = "PIKAA0"; } 333 { title = "Explosion Ring Panel"; - sprite = "internal:PIKEA0"; + sprite = "PIKEA0"; } 334 { title = "Scatter Ring Panel"; - sprite = "internal:PIKSA0"; + sprite = "PIKSA0"; } 335 { title = "Grenade Ring Panel"; - sprite = "internal:PIKGA0"; + sprite = "PIKGA0"; } } @@ -3986,6 +3993,7 @@ thingtypes flags8height = 24; flags8text = "[8] Float"; angletext = "Tag"; + fixedrotation = 1; } } @@ -4000,6 +4008,7 @@ thingtypes flags4text = "[4] Random (Strong)"; flags8text = "[8] Random (Weak)"; angletext = "Tag"; + fixedrotation = 1; 400 { @@ -4131,6 +4140,7 @@ thingtypes height = 44; flags1text = "[1] Run linedef executor on pop"; angletext = "Tag"; + fixedrotation = 1; 431 { @@ -4228,6 +4238,7 @@ thingtypes height = 128; flags4text = "[4] Respawn at center"; angletext = "Angle/Order"; + fixedrotation = 1; parametertext = "Order"; } 520 @@ -4259,7 +4270,7 @@ thingtypes flags1text = "[1] Start retracted"; flags4text = "[4] Retractable"; flags8text = "[8] Intangible"; - parametertext = "Initial delay"; + parametertext = "Start delay"; } 523 { @@ -4271,7 +4282,8 @@ thingtypes flags4text = "[4] Retractable"; flags8text = "[8] Intangible"; angletext = "Retraction interval"; - parametertext = "Initial delay"; + fixedrotation = 1; + parametertext = "Start delay"; } 1130 { @@ -4320,6 +4332,7 @@ thingtypes flags4text = "[4] Invisible"; flags8text = "[8] No distance check"; angletext = "Lift height"; + fixedrotation = 1; } 541 { @@ -4335,6 +4348,7 @@ thingtypes width = 32; height = 64; angletext = "Strength"; + fixedrotation = 1; } 543 { @@ -4344,6 +4358,7 @@ thingtypes height = 64; flags8text = "[8] Respawn"; angletext = "Color"; + fixedrotation = 1; } 550 { @@ -4617,6 +4632,9 @@ thingtypes title = "Slope Vertex"; sprite = "internal:vertexslope"; angletext = "Tag"; + fixedrotation = 1; + parametertext = "Absolute?"; + flagsvaluetext = "Absolute Z"; } 751 @@ -4638,6 +4656,7 @@ thingtypes title = "Zoom Tube Waypoint"; sprite = "internal:zoom"; angletext = "Order"; + fixedrotation = 1; } 754 @@ -4647,6 +4666,7 @@ thingtypes flags8text = "[8] Push using XYZ"; sprite = "GWLGA0"; angletext = "Radius"; + fixedrotation = 1; } 755 { @@ -4655,6 +4675,7 @@ thingtypes flags8text = "[8] Pull using XYZ"; sprite = "GWLRA0"; angletext = "Radius"; + fixedrotation = 1; } 756 { @@ -4663,6 +4684,7 @@ thingtypes width = 32; height = 16; angletext = "Tag"; + fixedrotation = 1; } 757 { @@ -4671,6 +4693,7 @@ thingtypes width = 8; height = 16; angletext = "Tag"; + fixedrotation = 1; } 758 { @@ -4681,21 +4704,24 @@ thingtypes { title = "PolyObject Anchor"; sprite = "internal:polyanchor"; - angletext = "ID"; + angletext = "Tag"; + fixedrotation = 1; } 761 { title = "PolyObject Spawn Point"; sprite = "internal:polycenter"; - angletext = "ID"; + angletext = "Tag"; + fixedrotation = 1; } 762 { title = "PolyObject Spawn Point (Crush)"; sprite = "internal:polycentercrush"; - angletext = "ID"; + angletext = "Tag"; + fixedrotation = 1; } 780 { @@ -4703,6 +4729,7 @@ thingtypes sprite = "internal:skyb"; flags4text = "[4] In-map centerpoint"; parametertext = "ID"; + fixedrotation = 1; } } @@ -4897,6 +4924,7 @@ thingtypes height = 16; hangs = 1; angletext = "Dripping interval"; + fixedrotation = 1; } 1003 { @@ -4953,7 +4981,7 @@ thingtypes 1011 { title = "Stalagmite (DSZ2)"; - sprite = "DSTGA0"; + sprite = "DSTGB0"; width = 8; height = 116; flags4text = "[4] Double size"; @@ -5038,6 +5066,8 @@ thingtypes flags4text = "[4] No sounds"; flags8text = "[8] Double size"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1105 { @@ -5048,6 +5078,8 @@ thingtypes flags4text = "[4] No sounds"; flags8text = "[8] Double size"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1106 { @@ -5058,6 +5090,8 @@ thingtypes flags4text = "[4] No sounds"; flags8text = "[8] Red spring"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1107 { @@ -5067,6 +5101,8 @@ thingtypes height = 34; flags8text = "[8] Double size"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1108 { @@ -5086,6 +5122,8 @@ thingtypes flags4text = "[4] No sounds"; flags8text = "[8] Double size"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1110 { @@ -5095,6 +5133,8 @@ thingtypes height = 34; flags4text = "[4] No sounds"; angletext = "Tag"; + parametertext = "Spokes"; + fixedrotation = 1; } 1111 { @@ -5224,6 +5264,7 @@ thingtypes sprite = "EGR1A1"; width = 20; height = 72; + arrow = 1; } 1128 { @@ -5272,6 +5313,7 @@ thingtypes width = 8; height = 16; angletext = "Tag"; + fixedrotation = 1; } 1203 { @@ -5342,6 +5384,7 @@ thingtypes sprite = "WWSGAR"; width = 22; height = 64; + arrow = 1; } 1213 { @@ -5349,6 +5392,7 @@ thingtypes sprite = "WWS2AR"; width = 22; height = 64; + arrow = 1; } 1214 { @@ -5356,6 +5400,7 @@ thingtypes sprite = "WWS3ALAR"; width = 16; height = 192; + arrow = 1; } 1215 { @@ -5371,6 +5416,7 @@ thingtypes sprite = "BARRA1"; width = 24; height = 63; + arrow = 1; } 1217 { @@ -5392,6 +5438,7 @@ thingtypes sprite = "MCRTCLFR"; width = 22; height = 32; + arrow = 1; } 1220 { @@ -5399,6 +5446,7 @@ thingtypes sprite = "MCRTIR"; width = 32; height = 32; + arrow = 1; } 1221 { @@ -5406,6 +5454,7 @@ thingtypes sprite = "SALDARAL"; width = 96; height = 160; + arrow = 1; flags8text = "[8] Allow non-minecart players"; } 1222 @@ -5467,6 +5516,7 @@ thingtypes height = 40; flags8text = "[8] Waves vertically"; angletext = "On/Off time"; + fixedrotation = 1; parametertext = "Strength"; } 1301 @@ -5477,6 +5527,7 @@ thingtypes height = 40; flags8text = "[8] Shoot downwards"; angletext = "On/Off time"; + fixedrotation = 1; parametertext = "Strength"; } 1302 @@ -5500,6 +5551,7 @@ thingtypes width = 30; height = 32; angletext = "Initial delay"; + fixedrotation = 1; flags8text = "[8] Double size"; } 1305 @@ -5537,6 +5589,7 @@ thingtypes sprite = "WVINALAR"; width = 1; height = 288; + arrow = 1; } 1310 { @@ -5544,6 +5597,7 @@ thingtypes sprite = "WVINBLBR"; width = 1; height = 288; + arrow = 1; } } @@ -5901,6 +5955,7 @@ thingtypes width = 8; height = 4096; sprite = "UNKNA0"; + fixedrotation = 1; 1700 { @@ -5959,6 +6014,7 @@ thingtypes flags4text = "[4] Align player to top"; flags8text = "[8] Die upon time up"; angletext = "Time limit"; + fixedrotation = 1; parametertext = "Height"; } 1704 @@ -5971,6 +6027,7 @@ thingtypes unflippable = true; flagsvaluetext = "Pitch"; angletext = "Yaw"; + fixedrotation = 1; } 1705 { @@ -5983,6 +6040,7 @@ thingtypes centerHitbox = true; flagsvaluetext = "Height"; angletext = "Pitch/Yaw"; + fixedrotation = 1; } 1706 { @@ -6104,6 +6162,7 @@ thingtypes width = 8; height = 16; angletext = "Jump strength"; + fixedrotation = 1; } 1806 { @@ -6336,6 +6395,7 @@ thingtypes width = 18; height = 28; angletext = "Initial delay"; + fixedrotation = 1; } 2001 { @@ -6459,6 +6519,7 @@ thingtypes sprite = "XMS6A0"; width = 52; height = 106; + hangs = 1; } } @@ -6472,6 +6533,7 @@ thingtypes flags4text = "[4] No movement"; flags8text = "[8] Hop"; angletext = "Radius"; + fixedrotation = 1; 2200 { From dbc7f93f15479d7d123b5507b5aaf94e7f952249 Mon Sep 17 00:00:00 2001 From: sphere Date: Sat, 10 Apr 2021 11:52:15 -0400 Subject: [PATCH 120/160] Fix incorrect prefixes in the config --- extras/conf/SRB2-22.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 246ef9b64..a8217754d 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -3110,7 +3110,7 @@ linedeftypes 733 { title = "Copy Backside Floor Slope to Frontside"; - prefix = "(730)"; + prefix = "(733)"; slope = "copy"; copyslopeargs = 2; } @@ -3118,7 +3118,7 @@ linedeftypes 734 { title = "Copy Backside Ceiling Slope to Frontside"; - prefix = "(731)"; + prefix = "(734)"; slope = "copy"; copyslopeargs = 8; } @@ -3126,7 +3126,7 @@ linedeftypes 735 { title = "Copy Backside Floor and Ceiling Slope to Frontside"; - prefix = "(732)"; + prefix = "(735)"; slope = "copy"; copyslopeargs = 10; } From 4f3802a2cc400a0c93818fce5ac40d60ea2f6424 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 11 Apr 2021 18:29:14 -0500 Subject: [PATCH 121/160] acos Lua exposure --- src/lua_mathlib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index b6046ab53..9a288e17b 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -87,6 +87,12 @@ static int lib_finetangent(lua_State *L) return 1; } +static int lib_finearccosine(lua_State *L) +{ + lua_pushangle(L, FixedAcos(luaL_checkfixed(L, 1))); + return 1; +} + // Fixed math //////////////// @@ -192,6 +198,7 @@ static luaL_Reg lib[] = { {"sin", lib_finesine}, {"cos", lib_finecosine}, {"tan", lib_finetangent}, + {"acos", lib_finearccosine}, {"FixedAngle", lib_fixedangle}, {"fixangle" , lib_fixedangle}, {"AngleFixed", lib_anglefixed}, From 8f322fd86fc8b2709c364ef4d2b1e4f363265f78 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 11 Apr 2021 18:33:11 -0500 Subject: [PATCH 122/160] name kinda sucked --- src/lua_mathlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 9a288e17b..45168ad79 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -87,7 +87,7 @@ static int lib_finetangent(lua_State *L) return 1; } -static int lib_finearccosine(lua_State *L) +static int lib_fixedacos(lua_State *L) { lua_pushangle(L, FixedAcos(luaL_checkfixed(L, 1))); return 1; @@ -198,7 +198,7 @@ static luaL_Reg lib[] = { {"sin", lib_finesine}, {"cos", lib_finecosine}, {"tan", lib_finetangent}, - {"acos", lib_finearccosine}, + {"acos", lib_fixedacos}, {"FixedAngle", lib_fixedangle}, {"fixangle" , lib_fixedangle}, {"AngleFixed", lib_anglefixed}, From 701c6c8968fea04dc13f02c3cc5e3e7841e48345 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 6 Apr 2021 01:01:33 +0200 Subject: [PATCH 123/160] Fix myhashfgets-related buffer overflows in deh_soc.c --- src/deh_soc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 5b12ea1b0..bc7533ee0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -229,7 +229,10 @@ void readPlayer(MYFILE *f, INT32 num) SLOTFOUND - for (i = 0; i < MAXLINELEN-3; i++) + // A friendly neighborhood alias for brevity's sake + const size_t note_size = sizeof(description[num].notes); + + for (i = 0; i < MAXLINELEN-note_size-3; i++) { if (s[i] == '=') { @@ -239,8 +242,9 @@ void readPlayer(MYFILE *f, INT32 num) } if (playertext) { - strcpy(description[num].notes, playertext); - strcat(description[num].notes, myhashfgets(playertext, sizeof (description[num].notes), f)); + strlcpy(description[num].notes, playertext, note_size); + strlcat(description[num].notes, + myhashfgets(playertext, note_size, f), note_size); } else strcpy(description[num].notes, ""); @@ -249,7 +253,7 @@ void readPlayer(MYFILE *f, INT32 num) // It works down here, though. { INT32 numline = 0; - for (i = 0; (size_t)i < sizeof(description[num].notes)-1; i++) + for (i = 0; (size_t)i < note_size-1; i++) { if (numline < 20 && description[num].notes[i] == '\n') numline++; @@ -1140,8 +1144,10 @@ void readgametype(MYFILE *f, char *gtname) } if (descr) { - strcpy(gtdescription, descr); - strcat(gtdescription, myhashfgets(descr, sizeof (gtdescription), f)); + strlcpy(gtdescription, descr, sizeof (gtdescription)); + strlcat(gtdescription, + myhashfgets(descr, sizeof (gtdescription), f), + sizeof (gtdescription)); } else strcpy(gtdescription, ""); From f0f3b33d71db97ccf4b747f8962022df3104a18c Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 6 Apr 2021 03:12:46 +0200 Subject: [PATCH 124/160] Edit note_size alias to get rid of warnings --- src/deh_soc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index bc7533ee0..72f785eff 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -230,9 +230,9 @@ void readPlayer(MYFILE *f, INT32 num) SLOTFOUND // A friendly neighborhood alias for brevity's sake - const size_t note_size = sizeof(description[num].notes); +#define NOTE_SIZE sizeof(description[num].notes) - for (i = 0; i < MAXLINELEN-note_size-3; i++) + for (i = 0; i < (INT32)(MAXLINELEN-NOTE_SIZE-3); i++) { if (s[i] == '=') { @@ -242,9 +242,9 @@ void readPlayer(MYFILE *f, INT32 num) } if (playertext) { - strlcpy(description[num].notes, playertext, note_size); + strlcpy(description[num].notes, playertext, NOTE_SIZE); strlcat(description[num].notes, - myhashfgets(playertext, note_size, f), note_size); + myhashfgets(playertext, NOTE_SIZE, f), NOTE_SIZE); } else strcpy(description[num].notes, ""); @@ -253,7 +253,7 @@ void readPlayer(MYFILE *f, INT32 num) // It works down here, though. { INT32 numline = 0; - for (i = 0; (size_t)i < note_size-1; i++) + for (i = 0; (size_t)i < NOTE_SIZE-1; i++) { if (numline < 20 && description[num].notes[i] == '\n') numline++; @@ -264,6 +264,7 @@ void readPlayer(MYFILE *f, INT32 num) } description[num].notes[strlen(description[num].notes)-1] = '\0'; description[num].notes[i] = '\0'; +#undef NOTE_SIZE continue; } From 6f0b4a4f6d5f129631f7aed997c332afbfe263e0 Mon Sep 17 00:00:00 2001 From: "X.organic" Date: Tue, 6 Apr 2021 03:13:38 +0200 Subject: [PATCH 125/160] Remove some dead code from DEH_LoadDehackedFile Also fixes a buffer overflow, but said overflow generally got caught by the stack smashing protector. Still, it's better for SOC files not to be able to crash the game that easily. --- src/dehacked.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index c2ea28d27..3f066a924 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -188,26 +188,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) dbg_line = -1; // start at -1 so the first line is 0. while (!myfeof(f)) { - char origpos[128]; - INT32 size = 0; - char *traverse; - myfgets(s, MAXLINELEN, f); memcpy(textline, s, MAXLINELEN); if (s[0] == '\n' || s[0] == '#') continue; - traverse = s; - - while (traverse[0] != '\n') - { - traverse++; - size++; - } - - strncpy(origpos, s, size); - origpos[size] = '\0'; - if (NULL != (word = strtok(s, " "))) { strupr(word); if (word[strlen(word)-1] == '\n') From 23759c67aa402a1f474edc8a8db25196393397e9 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 12 Apr 2021 21:26:29 -0500 Subject: [PATCH 126/160] move HWR_GetMappedPatch earlier --- src/hardware/hw_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c2d617eaf..5772b67d9 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4137,6 +4137,11 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) wallVerts[1].z = wallVerts[2].z = spr->z2; } + // cache the patch in the graphics card memory + //12/12/99: Hurdler: same comment as above (for md2) + //Hurdler: 25/04/2000: now support colormap in hardware mode + HWR_GetMappedPatch(gpatch, spr->colormap); + if (spr->flip) { wallVerts[0].s = wallVerts[3].s = ((GLPatch_t *)gpatch->hardware)->max_s; @@ -4156,11 +4161,6 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) wallVerts[0].t = wallVerts[1].t = ((GLPatch_t *)gpatch->hardware)->max_t; } - // cache the patch in the graphics card memory - //12/12/99: Hurdler: same comment as above (for md2) - //Hurdler: 25/04/2000: now support colormap in hardware mode - HWR_GetMappedPatch(gpatch, spr->colormap); - if (!splat) { // if it has a dispoffset, push it a little towards the camera From 0d4d2ed6d8cf25398e6286e0982bbc2795cdb121 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Tue, 13 Apr 2021 12:11:31 -0300 Subject: [PATCH 127/160] Fix blend tables generation --- src/r_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 8625fbab2..9a835ee58 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -274,7 +274,7 @@ static void BlendTab_Modulative(UINT8 *table) static INT32 BlendTab_Count[NUMBLENDMAPS] = { - NUMTRANSTABLES, // blendtab_add + NUMTRANSTABLES+1, // blendtab_add NUMTRANSTABLES+1, // blendtab_subtract NUMTRANSTABLES+1, // blendtab_reversesubtract 1 // blendtab_modulate @@ -294,7 +294,7 @@ static INT32 BlendTab_FromStyle[] = static void BlendTab_GenerateMaps(INT32 tab, INT32 style, void (*genfunc)(UINT8 *, int, UINT8)) { INT32 i = 0, num = BlendTab_Count[tab]; - const float amtmul = (256.0f / (float)(NUMTRANSTABLES)); + const float amtmul = (256.0f / (float)(NUMTRANSTABLES + 1)); for (; i < num; i++) { const size_t offs = (0x10000 * i); From 7b83345c75d8350c1875765d292b588d257a71a2 Mon Sep 17 00:00:00 2001 From: katsy Date: Wed, 14 Apr 2021 19:29:53 -0500 Subject: [PATCH 128/160] need to create the patches here if they don't already exist --- src/y_inter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/y_inter.c b/src/y_inter.c index 6833ca2b5..dca8cd377 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -266,6 +266,14 @@ void Y_LoadIntermissionData(void) case int_ctf: case int_teammatch: { + if (!rflagico) //prevent a crash if we haven't cached our team graphics yet + { + rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); + bflagico = W_CachePatchName("BFLAGICO", PU_HUDGFX); + rmatcico = W_CachePatchName("RMATCICO", PU_HUDGFX); + bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); + } + data.match.redflag = (intertype == int_ctf) ? rflagico : rmatcico; data.match.blueflag = (intertype == int_ctf) ? bflagico : bmatcico; } From 3670af5a31b0810cce9a5f1f4c78158b4914e8db Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Fri, 16 Apr 2021 00:38:34 +0300 Subject: [PATCH 129/160] Fix incorrect values caused by outdated use of timing functions in perfstats 3 --- src/lua_hooklib.c | 2 +- src/m_perfstats.c | 4 ++-- src/m_perfstats.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 637809fd8..1665e36b0 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -473,7 +473,7 @@ void LUAh_ThinkFrame(void) hook_p hookp; // variables used by perf stats int hook_index = 0; - int time_taken = 0; + precise_t time_taken = 0; if (!gL || !(hooksAvailable[hook_ThinkFrame/8] & (1<<(hook_ThinkFrame%8)))) return; diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 1596a87e5..b58599b6d 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -62,7 +62,7 @@ int thinkframe_hooks_capacity = 16; static INT32 draw_row; -void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src) +void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src) { if (!thinkframe_hooks) { @@ -565,7 +565,7 @@ void M_DrawPerfStats(void) len = (int)strlen(str); if (len > 20) str += len - 20; - snprintf(s, sizeof s - 1, "%20s: %u", str, thinkframe_hooks[i].time_taken); + snprintf(s, sizeof s - 1, "%20s: %d", str, I_PreciseToMicros(thinkframe_hooks[i].time_taken)); V_DrawSmallString(x, y, V_MONOSPACE | V_ALLOWLOWERCASE | text_color, s); y += 4; // repeated code! if (y > 192) diff --git a/src/m_perfstats.h b/src/m_perfstats.h index 132bea38c..1ca71957f 100644 --- a/src/m_perfstats.h +++ b/src/m_perfstats.h @@ -30,11 +30,11 @@ extern int ps_lua_mobjhooks; typedef struct { - UINT32 time_taken; + precise_t time_taken; char short_src[LUA_IDSIZE]; } ps_hookinfo_t; -void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src); +void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src); void M_DrawPerfStats(void); From ee578b68f48c338bebc50ff66beb70bc919ae3a6 Mon Sep 17 00:00:00 2001 From: Hannu Hanhi Date: Sat, 17 Apr 2021 03:11:29 +0300 Subject: [PATCH 130/160] Remove bad pointer arithmetic in polygon comparators, that was causing glitches --- src/hardware/hw_batching.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index fb3417158..b13ad03ea 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -137,6 +137,8 @@ static int comparePolygons(const void *p1, const void *p2) PolygonArrayEntry* poly2 = &polygonArray[index2]; int diff; INT64 diff64; + UINT32 downloaded1 = 0; + UINT32 downloaded2 = 0; int shader1 = poly1->shader; int shader2 = poly2->shader; @@ -152,7 +154,11 @@ static int comparePolygons(const void *p1, const void *p2) if (shader1 == -1 && shader2 == -1) return index1 - index2; - diff64 = poly1->texture - poly2->texture; + if (poly1->texture) + downloaded1 = poly1->texture->downloaded; // there should be a opengl texture name here, usable for comparisons + if (poly2->texture) + downloaded2 = poly2->texture->downloaded; + diff64 = downloaded1 - downloaded2; if (diff64 != 0) return diff64; diff = poly1->polyFlags - poly2->polyFlags; @@ -184,16 +190,21 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2) GLMipmap_t *texture1 = poly1->texture; GLMipmap_t *texture2 = poly2->texture; + UINT32 downloaded1 = 0; + UINT32 downloaded2 = 0; if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) texture1 = NULL; if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) texture2 = NULL; - diff64 = texture1 - texture2; - if (diff64 != 0) return diff64; - + if (texture1) + downloaded1 = texture1->downloaded; // there should be a opengl texture name here, usable for comparisons + if (texture2) + downloaded2 = texture2->downloaded; // skywalls and horizon lines must retain their order for horizon lines to work - if (texture1 == NULL && texture2 == NULL) + if (!texture1 && !texture2) return index1 - index2; + diff64 = downloaded1 - downloaded2; + if (diff64 != 0) return diff64; diff = poly1->polyFlags - poly2->polyFlags; if (diff != 0) return diff; From 8f01e85adef84af55ed29ce8adbe789d6abec817 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 20 Apr 2021 22:10:11 -0400 Subject: [PATCH 131/160] Allow spaces in captions defined in SOC --- src/deh_soc.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 5b12ea1b0..eebaf1316 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2839,26 +2839,28 @@ void readsound(MYFILE *f, INT32 num) if (s[0] == '\n') break; + // First remove trailing newline, if there is one + tmp = strchr(s, '\n'); + if (tmp) + *tmp = '\0'; + tmp = strchr(s, '#'); if (tmp) *tmp = '\0'; if (s == tmp) continue; // Skip comment lines, but don't break. - word = strtok(s, " "); - if (word) - strupr(word); + // Get the part before the " = " + tmp = strchr(s, '='); + if (tmp) + *(tmp-1) = '\0'; else break; + strupr(word); - word2 = strtok(NULL, " "); - if (word2) - value = atoi(word2); - else - { - deh_warning("No value for token %s", word); - continue; - } + // Now get the part after + word2 = tmp += 2; + value = atoi(word2); // used for numerical settings if (fastcmp(word, "SINGULAR")) { From ce3c5e081e26b601fc7486281df9bd58dc6c51eb Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 20 Apr 2021 22:19:56 -0400 Subject: [PATCH 132/160] Missed a few lines in the prev commit --- src/deh_soc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/deh_soc.c b/src/deh_soc.c index eebaf1316..60aaf1287 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2850,6 +2850,9 @@ void readsound(MYFILE *f, INT32 num) if (s == tmp) continue; // Skip comment lines, but don't break. + // Set / reset word + word = s; + // Get the part before the " = " tmp = strchr(s, '='); if (tmp) From da56e84d2c1f202789c87afc3aeab6c3b6eb65b1 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Wed, 21 Apr 2021 22:14:37 -0300 Subject: [PATCH 133/160] Change TOL_ERZ3 identifier --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 13423ce77..bd09e4c79 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3506,7 +3506,7 @@ tolinfo_t TYPEOFLEVEL[NUMTOLNAMES] = { {"2D",TOL_2D}, {"MARIO",TOL_MARIO}, {"NIGHTS",TOL_NIGHTS}, - {"OLDBRAK",TOL_ERZ3}, + {"ERZ3",TOL_ERZ3}, {"XMAS",TOL_XMAS}, {"CHRISTMAS",TOL_XMAS}, From 4f2f94d02d4f982d05900e10b5f00be28b0599ac Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Wed, 21 Apr 2021 22:22:37 -0300 Subject: [PATCH 134/160] Compatibility with the current identifier --- src/g_game.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/g_game.c b/src/g_game.c index bd09e4c79..399c4f2bd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3506,6 +3506,7 @@ tolinfo_t TYPEOFLEVEL[NUMTOLNAMES] = { {"2D",TOL_2D}, {"MARIO",TOL_MARIO}, {"NIGHTS",TOL_NIGHTS}, + {"OLDBRAK",TOL_ERZ3}, {"ERZ3",TOL_ERZ3}, {"XMAS",TOL_XMAS}, From e510e71617a2102001d5038dbc48c7abdf855792 Mon Sep 17 00:00:00 2001 From: Radicalicious Date: Fri, 23 Apr 2021 15:50:48 -0400 Subject: [PATCH 135/160] Remove fire shield flash --- src/p_mobj.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..59f306d1d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3283,11 +3283,9 @@ void P_MobjCheckWater(mobj_t *mobj) boolean electric = !!(p->powers[pw_shield] & SH_PROTECTELECTRIC); if (electric || ((p->powers[pw_shield] & SH_PROTECTFIRE) && !(p->powers[pw_shield] & SH_PROTECTWATER) && !(mobj->eflags & MFE_TOUCHLAVA))) { // Water removes electric and non-water fire shields... - P_FlashPal(p, - electric - ? PAL_WHITE - : PAL_NUKE, - 1); + if (electric) + P_FlashPal(p, PAL_WHITE, 1); + p->powers[pw_shield] = p->powers[pw_shield] & SH_STACK; } } From 376d6cd6a200128168f8d6b2c9575257d48aa575 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Sun, 25 Apr 2021 14:26:43 -0300 Subject: [PATCH 136/160] Don't try to free patches in dedicated --- src/y_inter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index dca8cd377..4354a1677 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2069,7 +2069,8 @@ static void Y_AwardSpecialStageBonus(void) // void Y_EndIntermission(void) { - Y_UnloadData(); + if (!dedicated) + Y_UnloadData(); endtic = -1; intertype = int_none; From 65624bf6c0892b2b8f7579fa8eaf1f5cd66a17ee Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Apr 2021 19:01:51 +0100 Subject: [PATCH 137/160] Change numadded counter to UINT16 instead of UINT8, to allow for more sprites properly --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index a7c44c237..5c0e5fda9 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -230,7 +230,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 UINT8 rotation; lumpinfo_t *lumpinfo; softwarepatch_t patch; - UINT8 numadded = 0; + UINT16 numadded = 0; memset(sprtemp,0xFF, sizeof (sprtemp)); maxframe = (size_t)-1; From 70939a7a3dc75faf77ab0d1d7e3c967d8c1f6927 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Apr 2021 21:08:12 +0100 Subject: [PATCH 138/160] Set "allocated" flag to off if setting a string from PossibleValue afterwards, or if not setting a new value at all. --- src/command.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command.c b/src/command.c index 58434ef89..f1bf7dfb5 100644 --- a/src/command.c +++ b/src/command.c @@ -1433,6 +1433,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth) if (var->revert.allocated) { Z_Free(var->revert.v.string); + var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it! } var->revert.v.const_munge = var->PossibleValue[i].strvalue; @@ -1505,6 +1506,7 @@ found: if (var->revert.allocated) { Z_Free(var->revert.v.string); + var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it! } var->revert.v.const_munge = var->PossibleValue[i].strvalue; @@ -1523,6 +1525,7 @@ found: if (var->revert.allocated) { Z_Free(var->revert.v.string); + // Z_StrDup creates a new zone memory block, so we can keep the allocated flag on } var->revert.v.string = Z_StrDup(valstr); @@ -1787,6 +1790,7 @@ void CV_RevertNetVars(void) if (cvar->revert.allocated) { Z_Free(cvar->revert.v.string); + cvar->revert.allocated = false; // no value being held now } cvar->revert.v.string = NULL; From c51c478740d1bb22dbe0a28923c433038ec76cfc Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 25 Apr 2021 21:51:24 -0700 Subject: [PATCH 139/160] Lua: ensure order of MIN, MAX possible values Cvars could now have a range (MIN, MAX) plus some preset values, but Lua could not take advantage of this due to table order not being guaranteed. --- src/lua_consolelib.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 5344fee76..e839d4e15 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -361,6 +361,9 @@ static int lib_cvRegisterVar(lua_State *L) size_t count = 0; CV_PossibleValue_t *cvpv; + const char * const MINMAX[2] = {"MIN", "MAX"}; + int minmax_unset = 3; + lua_pushnil(L); while (lua_next(L, 4)) { count++; @@ -377,16 +380,45 @@ static int lib_cvRegisterVar(lua_State *L) i = 0; lua_pushnil(L); while (lua_next(L, 4)) { + INT32 n; + const char * strval; + // stack: [...] PossibleValue table, index, value // 4 5 6 if (lua_type(L, 5) != LUA_TSTRING || lua_type(L, 6) != LUA_TNUMBER) FIELDERROR("PossibleValue", "custom PossibleValue table requires a format of string=integer, i.e. {MIN=0, MAX=9999}"); - cvpv[i].strvalue = Z_StrDup(lua_tostring(L, 5)); - cvpv[i].value = (INT32)lua_tonumber(L, 6); + + strval = lua_tostring(L, 5); + + if ( + stricmp(strval, MINMAX[n=0]) == 0 || + stricmp(strval, MINMAX[n=1]) == 0 + ){ + /* need to shift forward */ + if (minmax_unset == 3) + { + memmove(&cvpv[2], &cvpv[0], + i * sizeof *cvpv); + } + cvpv[n].strvalue = MINMAX[n]; + minmax_unset &= ~(1 << n); + } + else + { + n = i; + cvpv[n].strvalue = Z_StrDup(strval); + } + + cvpv[n].value = (INT32)lua_tonumber(L, 6); + i++; lua_pop(L, 1); } + + if (minmax_unset) + FIELDERROR("PossibleValue", "custom PossibleValue table requires requires both MIN and MAX keys if one is present"); + cvpv[i].value = 0; cvpv[i].strvalue = NULL; cvar->PossibleValue = cvpv; From 85914cc7cd9143b08353409b1dea2a0d536e31de Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 25 Apr 2021 21:55:04 -0700 Subject: [PATCH 140/160] Free zstring when switching to preset value This is only applicable for bounded cvars (MIN, MAX), since otherwise there's no way to allocate a zstring. --- src/command.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command.c b/src/command.c index f1bf7dfb5..00116a0cb 100644 --- a/src/command.c +++ b/src/command.c @@ -1441,6 +1441,10 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth) return; } + // free the old value string + Z_Free(var->zstring); + var->zstring = NULL; + var->value = var->PossibleValue[i].value; var->string = var->PossibleValue[i].strvalue; goto finish; From 92aeadc36b8e32e1c18b25eaac03e0eb9b86171b Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 25 Apr 2021 22:01:40 -0700 Subject: [PATCH 141/160] It is impossible for a string to be allocated in this case --- src/command.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/command.c b/src/command.c index 00116a0cb..951e3dd09 100644 --- a/src/command.c +++ b/src/command.c @@ -1507,14 +1507,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth) found: if (client && execversion_enabled) { - if (var->revert.allocated) - { - Z_Free(var->revert.v.string); - var->revert.allocated = false; // the below value is not allocated in zone memory, don't try to free it! - } - var->revert.v.const_munge = var->PossibleValue[i].strvalue; - return; } From 34fa9771928961196c46d2e7dbaec46d28bdcfb2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 26 Apr 2021 19:07:11 +0100 Subject: [PATCH 142/160] move the old "can't load the level" error to its proper place, added specific error messages for all the times that unarchiving Lua banks can fail --- src/d_clisrv.c | 1 - src/p_saveg.c | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c2dec6a1..89077ad6c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1567,7 +1567,6 @@ static void CL_LoadReceivedSavegame(boolean reloading) } else { - CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); Z_Free(savebuffer); save_p = NULL; if (unlink(tmpsave) == -1) diff --git a/src/p_saveg.c b/src/p_saveg.c index 03229e740..818596cac 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4190,7 +4190,10 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading) tokenlist = READUINT32(save_p); if (!P_LoadLevel(true, reloading)) + { + CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); return false; + } // get the time leveltime = READUINT32(save_p); @@ -4268,19 +4271,26 @@ static inline boolean P_UnArchiveLuabanksAndConsistency(void) { switch (READUINT8(save_p)) { - case 0xb7: + case 0xb7: // luabanks marker { UINT8 i, banksinuse = READUINT8(save_p); if (banksinuse > NUM_LUABANKS) + { + CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Too many banks in use)\n")); return false; + } for (i = 0; i < banksinuse; i++) luabanks[i] = READINT32(save_p); - if (READUINT8(save_p) != 0x1d) + if (READUINT8(save_p) != 0x1d) // consistency marker + { + CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Failed consistency check)\n")); return false; + } } - case 0x1d: + case 0x1d: // consistency marker break; - default: + default: // anything else is nonsense + CONS_Alert(CONS_ERROR, M_GetText("Failed consistency check (???)\n")); return false; } From cd4cfba5000d141e97a9ac6ef0e3204e6cb8f905 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 26 Apr 2021 21:07:35 +0200 Subject: [PATCH 143/160] Delete faulty return --- src/d_clisrv.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c2dec6a1..c4026d52d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1568,11 +1568,6 @@ static void CL_LoadReceivedSavegame(boolean reloading) else { CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); - Z_Free(savebuffer); - save_p = NULL; - if (unlink(tmpsave) == -1) - CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); - return; } // done @@ -4486,9 +4481,9 @@ static INT16 Consistancy(void) { if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; - + mo = (mobj_t *)th; - + if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY)) { ret -= mo->type; From 0d4d3a520777bf81609df4c28b144330ab66b640 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 26 Apr 2021 21:07:35 +0200 Subject: [PATCH 144/160] Revert "Lua: ensure order of MIN, MAX possible values" This reverts commit c51c478740d1bb22dbe0a28923c433038ec76cfc. --- src/lua_consolelib.c | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index e839d4e15..5344fee76 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -361,9 +361,6 @@ static int lib_cvRegisterVar(lua_State *L) size_t count = 0; CV_PossibleValue_t *cvpv; - const char * const MINMAX[2] = {"MIN", "MAX"}; - int minmax_unset = 3; - lua_pushnil(L); while (lua_next(L, 4)) { count++; @@ -380,45 +377,16 @@ static int lib_cvRegisterVar(lua_State *L) i = 0; lua_pushnil(L); while (lua_next(L, 4)) { - INT32 n; - const char * strval; - // stack: [...] PossibleValue table, index, value // 4 5 6 if (lua_type(L, 5) != LUA_TSTRING || lua_type(L, 6) != LUA_TNUMBER) FIELDERROR("PossibleValue", "custom PossibleValue table requires a format of string=integer, i.e. {MIN=0, MAX=9999}"); - - strval = lua_tostring(L, 5); - - if ( - stricmp(strval, MINMAX[n=0]) == 0 || - stricmp(strval, MINMAX[n=1]) == 0 - ){ - /* need to shift forward */ - if (minmax_unset == 3) - { - memmove(&cvpv[2], &cvpv[0], - i * sizeof *cvpv); - } - cvpv[n].strvalue = MINMAX[n]; - minmax_unset &= ~(1 << n); - } - else - { - n = i; - cvpv[n].strvalue = Z_StrDup(strval); - } - - cvpv[n].value = (INT32)lua_tonumber(L, 6); - + cvpv[i].strvalue = Z_StrDup(lua_tostring(L, 5)); + cvpv[i].value = (INT32)lua_tonumber(L, 6); i++; lua_pop(L, 1); } - - if (minmax_unset) - FIELDERROR("PossibleValue", "custom PossibleValue table requires requires both MIN and MAX keys if one is present"); - cvpv[i].value = 0; cvpv[i].strvalue = NULL; cvar->PossibleValue = cvpv; From 34911128187161136db79cbb9df302cb8c8fccc1 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 26 Apr 2021 21:07:35 +0200 Subject: [PATCH 145/160] Update copyright date --- src/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 23a2c0133..61510d590 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1045,7 +1045,7 @@ void D_SRB2Main(void) // Print GPL notice for our console users (Linux) CONS_Printf( "\n\nSonic Robo Blast 2\n" - "Copyright (C) 1998-2020 by Sonic Team Junior\n\n" + "Copyright (C) 1998-2021 by Sonic Team Junior\n\n" "This program comes with ABSOLUTELY NO WARRANTY.\n\n" "This is free software, and you are welcome to redistribute it\n" "and/or modify it under the terms of the GNU General Public License\n" From f437d6afec08bebab2d44f0d383c316f11df4934 Mon Sep 17 00:00:00 2001 From: Vincent Robinson Date: Mon, 26 Apr 2021 16:27:39 -0700 Subject: [PATCH 146/160] Add linedef specials for multitagging in binary maps --- extras/conf/SRB2-22.cfg | 18 ++++++++++++++++++ src/p_setup.c | 21 +++++++++++++++++++++ src/taglist.c | 6 ++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 3fd4b6ccd..9a8484df5 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -640,6 +640,24 @@ linedeftypes prefix = "(63)"; } + 97 + { + title = "Apply Tag to Front Sector"; + prefix = "(97)"; + } + + 98 + { + title = "Apply Tag to Back Sector"; + prefix = "(98)"; + } + + 99 + { + title = "Apply Tag to Front and Back Sectors"; + prefix = "(99)"; + } + 540 { title = "Floor Friction"; diff --git a/src/p_setup.c b/src/p_setup.c index 40dd1a284..1b060660d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2950,6 +2950,24 @@ static void P_LinkMapData(void) } } +// For maps in binary format, add multi-tags from linedef specials. This must be done +// before any linedef specials have been processed. +static void P_AddBinaryMapTags(void) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + // 97: Apply Tag to Front Sector + // 98: Apply Tag to Back Sector + // 99: Apply Tag to Front and Back Sectors + if (lines[i].special == 97 || lines[i].special == 99) + Tag_Add(&lines[i].frontsector->tags, Tag_FGet(&lines[i].tags)); + if (lines[i].special == 98 || lines[i].special == 99) + Tag_Add(&lines[i].backsector->tags, Tag_FGet(&lines[i].tags)); + } +} + //For maps in binary format, converts setup of specials to UDMF format. static void P_ConvertBinaryMap(void) { @@ -3287,6 +3305,9 @@ static boolean P_LoadMapFromFile(void) P_LinkMapData(); + if (!udmf) + P_AddBinaryMapTags(); + Taglist_InitGlobalTables(); if (!udmf) diff --git a/src/taglist.c b/src/taglist.c index a759f4d02..e8b64d3f4 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -27,11 +27,13 @@ taggroup_t* tags_sectors[MAXTAGS + 1]; taggroup_t* tags_lines[MAXTAGS + 1]; taggroup_t* tags_mapthings[MAXTAGS + 1]; -/// Adds a tag to a given element's taglist. +/// Adds a tag to a given element's taglist. It will not add a duplicate. /// \warning This does not rebuild the global taggroups, which are used for iteration. void Tag_Add (taglist_t* list, const mtag_t tag) { - list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(list->tags), PU_LEVEL, NULL); + if (Tag_Find(list, tag)) + return; + list->tags = Z_Realloc(list->tags, (list->count + 1) * sizeof(mtag_t), PU_LEVEL, NULL); list->tags[list->count++] = tag; } From ea7b332525901bd4bd29eca368fe75ae31e413a4 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Fri, 30 Apr 2021 15:49:09 -0300 Subject: [PATCH 147/160] Visit srb2.org/addons to get & make addons! --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 0fca39801..562779d39 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6234,7 +6234,7 @@ static void M_AddonsOptions(INT32 choice) M_SetupNextMenu(&OP_AddonsOptionsDef); } -#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make add-ons!" +#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/ADDONS\x80 to get & make addons!" //#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make add-ons!" static void M_LoadAddonsPatches(void) From 858cb98e57020be1cf822a114025d79f9d43c57c Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 30 Apr 2021 17:26:09 -0500 Subject: [PATCH 148/160] attempt to resolve teleportation resync issue --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c2dec6a1..62817ea08 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4268,7 +4268,7 @@ static void HandlePacketFromPlayer(SINT8 node) case PT_RECEIVEDGAMESTATE: sendingsavegame[node] = false; resendingsavegame[node] = false; - savegameresendcooldown[node] = I_GetTime() + 15 * TICRATE; + savegameresendcooldown[node] = I_GetTime() + TICRATE; break; // -------------------------------------------- CLIENT RECEIVE ---------- case PT_SERVERTICS: From 815db014385b59664041927a97ca4c2322abe19c Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 30 Apr 2021 20:30:35 -0400 Subject: [PATCH 149/160] adjust cooldown to 5 seconds (bandage fix for 2.2.9) --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 62817ea08..04c34e7bc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4268,7 +4268,7 @@ static void HandlePacketFromPlayer(SINT8 node) case PT_RECEIVEDGAMESTATE: sendingsavegame[node] = false; resendingsavegame[node] = false; - savegameresendcooldown[node] = I_GetTime() + TICRATE; + savegameresendcooldown[node] = I_GetTime() + 5 * TICRATE; break; // -------------------------------------------- CLIENT RECEIVE ---------- case PT_SERVERTICS: From aac3ca320bc1f235e36babdae27b0ba2eb23571c Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Sat, 1 May 2021 10:24:28 -0300 Subject: [PATCH 150/160] Update LOCATIONSTRING2 as well --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 562779d39..13531f1b8 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6235,7 +6235,7 @@ static void M_AddonsOptions(INT32 choice) } #define LOCATIONSTRING1 "Visit \x83SRB2.ORG/ADDONS\x80 to get & make addons!" -//#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make add-ons!" +//#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/ADDONS\x80 to get & make addons!" static void M_LoadAddonsPatches(void) { From ed5a7f51e877ce1c125fdcda6412661f7a521ba5 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 2 May 2021 21:32:07 -0700 Subject: [PATCH 151/160] Revert "Merge branch 'lightmemedata' into 'next'" This reverts commit d4c08a84101d6d5cd75e550bacda5d9929413b72, reversing changes made to e100f21ddaa46c8b82393baaa32cf84d222af616. --- src/lua_baselib.c | 12 +++--------- src/lua_consolelib.c | 18 ++++++++++++++++-- src/lua_script.c | 21 --------------------- src/lua_script.h | 1 - 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index a59ba546e..a265465da 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -242,16 +242,10 @@ static const char *GetUserdataUType(lua_State *L) // or players[0].powers -> "player_t.powers" static int lib_userdataType(lua_State *L) { - int type; lua_settop(L, 1); // pop everything except arg 1 (in case somebody decided to add more) - type = lua_type(L, 1); - if (type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA) - { - lua_pushstring(L, GetUserdataUType(L)); - return 1; - } - else - return luaL_typerror(L, 1, "userdata"); + luaL_checktype(L, 1, LUA_TUSERDATA); + lua_pushstring(L, GetUserdataUType(L)); + return 1; } // Takes a metatable as first and only argument diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 5344fee76..10959324e 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -440,8 +440,22 @@ static int lib_cvRegisterVar(lua_State *L) static int lib_cvFindVar(lua_State *L) { - LUA_PushLightUserdata(L, CV_FindVar(luaL_checkstring(L,1)), META_CVAR); - return 1; + consvar_t *cv; + if (( cv = CV_FindVar(luaL_checkstring(L,1)) )) + { + lua_settop(L,1);/* We only want one argument in the stack. */ + lua_pushlightuserdata(L, cv);/* Now the second value on stack. */ + luaL_getmetatable(L, META_CVAR); + /* + The metatable is the last value on the stack, so this + applies it to the second value, which is the cvar. + */ + lua_setmetatable(L,2); + lua_pushvalue(L,2); + return 1; + } + else + return 0; } static int CVarSetFunction diff --git a/src/lua_script.c b/src/lua_script.c index 7fd5a98e6..9f8432832 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -714,27 +714,6 @@ fixed_t LUA_EvalMath(const char *word) return res; } -/* -LUA_PushUserdata but no userdata is created. -You can't invalidate it therefore. -*/ - -void LUA_PushLightUserdata (lua_State *L, void *data, const char *meta) -{ - if (data) - { - lua_pushlightuserdata(L, data); - luaL_getmetatable(L, meta); - /* - The metatable is the last value on the stack, so this - applies it to the second value, which is the userdata. - */ - lua_setmetatable(L, -2); - } - else - lua_pushnil(L); -} - // Takes a pointer, any pointer, and a metatable name // Creates a userdata for that pointer with the given metatable // Pushes it to the stack and stores it in the registry. diff --git a/src/lua_script.h b/src/lua_script.h index 77fbb7c1d..9311a727a 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -87,7 +87,6 @@ typedef enum { LPUSHED_EXISTING, } lpushed_t; -void LUA_PushLightUserdata(lua_State *L, void *data, const char *meta); void LUA_PushUserdata(lua_State *L, void *data, const char *meta); lpushed_t LUA_RawPushUserdata(lua_State *L, void *data); From aee963f4e96191c14f7506cc5a7c7e06e7734fa0 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 2 May 2021 21:59:23 -0700 Subject: [PATCH 152/160] Replace LUA_PushLightUserdata with LUA_PushUserdata See 7df6a309 and 83a87042. I didn't realize that light userdata's metatable is shared--like numbers or strings. So it cannot be paired with a metatable. I also made a few minor tweaks to Lua cvars, other than accounting for the double pointer in the userdata. --- src/command.c | 2 +- src/lua_consolelib.c | 68 +++++++++++--------------------------------- src/lua_script.h | 2 +- src/lua_skinlib.c | 8 +++--- 4 files changed, 23 insertions(+), 57 deletions(-) diff --git a/src/command.c b/src/command.c index 951e3dd09..d73cde5c2 100644 --- a/src/command.c +++ b/src/command.c @@ -1577,7 +1577,7 @@ finish: } var->flags |= CV_MODIFIED; // raise 'on change' code - LUA_CVarChanged(var->name); // let consolelib know what cvar this is. + LUA_CVarChanged(var); // let consolelib know what cvar this is. if (var->flags & CV_CALL && !stealth) var->func(); diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 10959324e..a8ef6b7c0 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -28,7 +28,7 @@ return luaL_error(L, "HUD rendering code should not call this function!"); #define NOHOOK if (!lua_lumploading)\ return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); -static const char *cvname = NULL; +static consvar_t *this_cvar; void Got_Luacmd(UINT8 **cp, INT32 playernum) { @@ -273,16 +273,13 @@ static int lib_comBufInsertText(lua_State *L) return 0; } -void LUA_CVarChanged(const char *name) +void LUA_CVarChanged(void *cvar) { - cvname = name; + this_cvar = cvar; } static void Lua_OnChange(void) { - I_Assert(gL != NULL); - I_Assert(cvname != NULL); - /// \todo Network this! XD_LUAVAR lua_pushcfunction(gL, LUA_GetErrorMessage); @@ -291,13 +288,10 @@ static void Lua_OnChange(void) // From CV_OnChange registry field, get the function for this cvar by name. lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange"); I_Assert(lua_istable(gL, -1)); - lua_getfield(gL, -1, cvname); // get function + lua_pushlightuserdata(gL, this_cvar); + lua_rawget(gL, -2); // get function - // From the CV_Vars registry field, get the cvar's userdata by name. - lua_getfield(gL, LUA_REGISTRYINDEX, "CV_Vars"); - I_Assert(lua_istable(gL, -1)); - lua_getfield(gL, -1, cvname); // get consvar_t* userdata. - lua_remove(gL, -2); // pop the CV_Vars table. + LUA_RawPushUserdata(gL, this_cvar); LUA_Call(gL, 1, 0, 1); // call function(cvar) lua_pop(gL, 1); // pop CV_OnChange table @@ -312,15 +306,12 @@ static int lib_cvRegisterVar(lua_State *L) luaL_checktype(L, 1, LUA_TTABLE); lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one. NOHOOK - cvar = lua_newuserdata(L, sizeof(consvar_t)); - luaL_getmetatable(L, META_CVAR); - lua_setmetatable(L, -2); + cvar = ZZ_Calloc(sizeof(consvar_t)); + LUA_PushUserdata(L, cvar, META_CVAR); #define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e); #define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1))) - memset(cvar, 0x00, sizeof(consvar_t)); // zero everything by default - lua_pushnil(L); while (lua_next(L, 1)) { // stack: cvar table, cvar userdata, key/index, value @@ -369,7 +360,7 @@ static int lib_cvRegisterVar(lua_State *L) lua_getfield(L, LUA_REGISTRYINDEX, "CV_PossibleValue"); I_Assert(lua_istable(L, 5)); - lua_pushvalue(L, 2); // cvar userdata + lua_pushlightuserdata(L, cvar); cvpv = lua_newuserdata(L, sizeof(CV_PossibleValue_t) * (count+1)); lua_rawset(L, 5); lua_pop(L, 1); // pop CV_PossibleValue registry table @@ -397,8 +388,9 @@ static int lib_cvRegisterVar(lua_State *L) TYPEERROR("func", LUA_TFUNCTION) lua_getfield(L, LUA_REGISTRYINDEX, "CV_OnChange"); I_Assert(lua_istable(L, 5)); + lua_pushlightuserdata(L, cvar); lua_pushvalue(L, 4); - lua_setfield(L, 5, cvar->name); + lua_rawset(L, 5); lua_pop(L, 1); cvar->func = Lua_OnChange; } @@ -415,19 +407,6 @@ static int lib_cvRegisterVar(lua_State *L) if ((cvar->flags & CV_CALL) && !cvar->func) return luaL_error(L, M_GetText("Variable %s has CV_CALL without a function\n"), cvar->name); - // stack: cvar table, cvar userdata - lua_getfield(L, LUA_REGISTRYINDEX, "CV_Vars"); - I_Assert(lua_istable(L, 3)); - - lua_getfield(L, 3, cvar->name); - if (lua_type(L, -1) != LUA_TNIL) - return luaL_error(L, M_GetText("Variable %s is already defined\n"), cvar->name); - lua_pop(L, 1); - - lua_pushvalue(L, 2); - lua_setfield(L, 3, cvar->name); - lua_pop(L, 1); - // actually time to register it to the console now! Finally! cvar->flags |= CV_MODIFIED; CV_RegisterVar(cvar); @@ -440,22 +419,9 @@ static int lib_cvRegisterVar(lua_State *L) static int lib_cvFindVar(lua_State *L) { - consvar_t *cv; - if (( cv = CV_FindVar(luaL_checkstring(L,1)) )) - { - lua_settop(L,1);/* We only want one argument in the stack. */ - lua_pushlightuserdata(L, cv);/* Now the second value on stack. */ - luaL_getmetatable(L, META_CVAR); - /* - The metatable is the last value on the stack, so this - applies it to the second value, which is the cvar. - */ - lua_setmetatable(L,2); - lua_pushvalue(L,2); - return 1; - } - else - return 0; + const char *name = luaL_checkstring(L, 1); + LUA_PushUserdata(L, CV_FindVar(name), META_CVAR); + return 1; } static int CVarSetFunction @@ -464,7 +430,7 @@ static int CVarSetFunction void (*Set)(consvar_t *, const char *), void (*SetValue)(consvar_t *, INT32) ){ - consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR); + consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR); if (cvar->flags & CV_NOLUA) return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name); @@ -496,7 +462,7 @@ static int lib_cvStealthSet(lua_State *L) static int lib_cvAddValue(lua_State *L) { - consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR); + consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR); if (cvar->flags & CV_NOLUA) return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name); @@ -555,7 +521,7 @@ static luaL_Reg lib[] = { static int cvar_get(lua_State *L) { - consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR); + consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR); const char *field = luaL_checkstring(L, 2); if(fastcmp(field,"name")) diff --git a/src/lua_script.h b/src/lua_script.h index 9311a727a..89ba7b6ee 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -56,7 +56,7 @@ void LUA_UnArchive(void); int LUA_PushGlobals(lua_State *L, const char *word); int LUA_CheckGlobals(lua_State *L, const char *word); void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c -void LUA_CVarChanged(const char *name); // lua_consolelib.c +void LUA_CVarChanged(void *cvar); // lua_consolelib.c int Lua_optoption(lua_State *L, int narg, const char *def, const char *const lst[]); void LUAh_NetArchiveHook(lua_CFunction archFunc); diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 56be6bf4f..7e7480be3 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -213,7 +213,7 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->availability); break; case skin_sprites: - LUA_PushLightUserdata(L, skin->sprites, META_SKINSPRITES); + LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES); break; } return 1; @@ -336,13 +336,13 @@ static const char *const sprites_opt[] = { // skin.sprites[i] -> sprites[i] static int lib_getSkinSprite(lua_State *L) { - spritedef_t *sprites = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITES); + spritedef_t *sprites = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITES); playersprite_t i = luaL_checkinteger(L, 2); if (i < 0 || i >= NUMPLAYERSPRITES*2) return luaL_error(L, LUA_QL("skin_t") " field 'sprites' index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1); - LUA_PushLightUserdata(L, &sprites[i], META_SKINSPRITESLIST); + LUA_PushUserdata(L, &sprites[i], META_SKINSPRITESLIST); return 1; } @@ -355,7 +355,7 @@ static int lib_numSkinsSprites(lua_State *L) static int sprite_get(lua_State *L) { - spritedef_t *sprite = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITESLIST); + spritedef_t *sprite = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITESLIST); enum spritesopt field = luaL_checkoption(L, 2, NULL, sprites_opt); switch (field) From 80fe39bbd1433c91131d2cdb36ba709f37d3b5f3 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 3 May 2021 01:40:02 -0400 Subject: [PATCH 153/160] Fix MusicChange hook not returning some values correctly --- src/lua_hooklib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 1665e36b0..a3f4a95d2 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1959,13 +1959,13 @@ boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boo if (lua_isboolean(gL, -4)) *looping = lua_toboolean(gL, -4); // output 4: position override - if (lua_isboolean(gL, -3)) + if (lua_isnumber(gL, -3)) *position = lua_tonumber(gL, -3); // output 5: prefadems override - if (lua_isboolean(gL, -2)) + if (lua_isnumber(gL, -2)) *prefadems = lua_tonumber(gL, -2); // output 6: fadeinms override - if (lua_isboolean(gL, -1)) + if (lua_isnumber(gL, -1)) *fadeinms = lua_tonumber(gL, -1); lua_pop(gL, 7); // Pop returned values and error handler From 3159d5a6e490666324278c3b283c1bf8b02b79bb Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+TatsuruIKR@users.noreply.github.com> Date: Thu, 6 May 2021 21:58:21 -0300 Subject: [PATCH 154/160] 2.2.9 prep --- appveyor.yml | 2 +- src/config.h.in | 5 +++-- src/p_enemy.c | 2 +- src/version.h | 4 ++-- src/win32/Srb2win.rc | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2acc2f712..e94a709cd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.2.8.{branch}-{build} +version: 2.2.9.{branch}-{build} os: MinGW environment: diff --git a/src/config.h.in b/src/config.h.in index a6f43a7d7..6bdb00bab 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -34,12 +34,13 @@ * Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3 * Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3 * Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3 + * Last updated 2020 / 05 / 06 - v2.2.9 - patch.pk3 & zones.pk3 */ #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" -#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" +#define ASSET_HASH_ZONES_PK3 "f8f3e2b5deacf40f14e36686a07d44bb" #define ASSET_HASH_PLAYER_DTA "49dad7b24634c89728cc3e0b689e12bb" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_PK3 "466cdf60075262b3f5baa5e07f0999e8" +#define ASSET_HASH_PATCH_PK3 "7d467a883f7887b3c311798ee2f56b6a" #endif #endif diff --git a/src/p_enemy.c b/src/p_enemy.c index 59176d6cc..51f18f596 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4201,7 +4201,7 @@ void A_CustomPower(mobj_t *actor) return; } - if (locvar1 >= NUMPOWERS) + if (locvar1 >= NUMPOWERS || locvar1 < 0) { CONS_Debug(DBG_GAMELOGIC, "Power #%d out of range!\n", locvar1); return; diff --git a/src/version.h b/src/version.h index ece084beb..4470fbd6e 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ -#define SRB2VERSION "2.2.8"/* this must be the first line, for cmake !! */ +#define SRB2VERSION "2.2.9"/* this must be the first line, for cmake !! */ // The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/showgroups.php ). // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. @@ -9,7 +9,7 @@ // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1". -#define MODVERSION 49 +#define MODVERSION 50 // Define this as a prerelease version suffix // #define BETAVERSION "RC1" diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index d5d59922c..b0eb2532e 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -76,8 +76,8 @@ END #include "../doomdef.h" // Needed for version string VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,2,8,0 - PRODUCTVERSION 2,2,8,0 + FILEVERSION 2,2,9,0 + PRODUCTVERSION 2,2,9,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 8b021ec16bcd78c566995ca65f5da920cbdd6315 Mon Sep 17 00:00:00 2001 From: lachablock Date: Fri, 7 May 2021 12:38:24 +1000 Subject: [PATCH 155/160] but if you close your eyes EH OH, EH OH --- src/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 6bdb00bab..db794cccc 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -34,7 +34,7 @@ * Last updated 2020 / 07 / 10 - v2.2.6 - player.dta & patch.pk3 * Last updated 2020 / 09 / 27 - v2.2.7 - patch.pk3 * Last updated 2020 / 10 / 02 - v2.2.8 - patch.pk3 - * Last updated 2020 / 05 / 06 - v2.2.9 - patch.pk3 & zones.pk3 + * Last updated 2021 / 05 / 06 - v2.2.9 - patch.pk3 & zones.pk3 */ #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" #define ASSET_HASH_ZONES_PK3 "f8f3e2b5deacf40f14e36686a07d44bb" From d325c7e6d314562f79f1890f7d0c5bf5e1496c93 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 7 May 2021 17:45:56 +0200 Subject: [PATCH 156/160] The year is 2021 --- src/am_map.c | 2 +- src/am_map.h | 2 +- src/apng.c | 2 +- src/apng.h | 2 +- src/asm_defs.inc | 2 +- src/b_bot.c | 2 +- src/b_bot.h | 2 +- src/byteptr.h | 2 +- src/command.c | 2 +- src/command.h | 2 +- src/console.c | 2 +- src/console.h | 2 +- src/d_clisrv.c | 2 +- src/d_clisrv.h | 2 +- src/d_event.h | 2 +- src/d_main.c | 2 +- src/d_main.h | 2 +- src/d_net.c | 2 +- src/d_net.h | 2 +- src/d_netcmd.c | 2 +- src/d_netcmd.h | 2 +- src/d_netfil.c | 2 +- src/d_netfil.h | 2 +- src/d_player.h | 2 +- src/d_think.h | 2 +- src/d_ticcmd.h | 2 +- src/deh_lua.c | 2 +- src/deh_lua.h | 2 +- src/deh_soc.c | 2 +- src/deh_soc.h | 2 +- src/deh_tables.c | 2 +- src/deh_tables.h | 2 +- src/dehacked.c | 2 +- src/dehacked.h | 2 +- src/doomdata.h | 2 +- src/doomdef.h | 2 +- src/doomstat.h | 2 +- src/doomtype.h | 2 +- src/endian.h | 2 +- src/f_finale.c | 2 +- src/f_finale.h | 2 +- src/f_wipe.c | 2 +- src/g_demo.c | 2 +- src/g_demo.h | 2 +- src/g_game.c | 2 +- src/g_game.h | 2 +- src/g_input.c | 2 +- src/g_input.h | 2 +- src/g_state.h | 2 +- src/hardware/hw_batching.c | 2 +- src/hardware/hw_batching.h | 2 +- src/hardware/hw_cache.c | 2 +- src/hardware/hw_data.h | 2 +- src/hardware/hw_draw.c | 2 +- src/hardware/hw_drv.h | 2 +- src/hardware/hw_glob.h | 2 +- src/hardware/hw_light.h | 2 +- src/hardware/hw_main.h | 2 +- src/hardware/hw_md2.c | 2 +- src/hardware/hw_md2.h | 2 +- src/hardware/r_opengl/r_opengl.c | 2 +- src/http-mserv.c | 2 +- src/hu_stuff.c | 2 +- src/hu_stuff.h | 2 +- src/i_addrinfo.c | 2 +- src/i_addrinfo.h | 2 +- src/i_joy.h | 2 +- src/i_net.h | 2 +- src/i_sound.h | 2 +- src/i_system.h | 2 +- src/i_tcp.c | 2 +- src/i_tcp.h | 2 +- src/i_threads.h | 2 +- src/i_video.h | 2 +- src/info.c | 2 +- src/info.h | 2 +- src/keys.h | 2 +- src/lua_baselib.c | 2 +- src/lua_blockmaplib.c | 4 ++-- src/lua_consolelib.c | 2 +- src/lua_hook.h | 2 +- src/lua_hooklib.c | 2 +- src/lua_hud.h | 2 +- src/lua_hudlib.c | 2 +- src/lua_infolib.c | 2 +- src/lua_libs.h | 2 +- src/lua_maplib.c | 2 +- src/lua_mathlib.c | 2 +- src/lua_mobjlib.c | 2 +- src/lua_playerlib.c | 2 +- src/lua_polyobjlib.c | 4 ++-- src/lua_script.c | 2 +- src/lua_script.h | 2 +- src/lua_skinlib.c | 2 +- src/lua_taglib.c | 4 ++-- src/lua_thinkerlib.c | 2 +- src/m_aatree.c | 2 +- src/m_aatree.h | 2 +- src/m_anigif.c | 2 +- src/m_anigif.h | 2 +- src/m_argv.c | 2 +- src/m_argv.h | 2 +- src/m_bbox.c | 2 +- src/m_bbox.h | 2 +- src/m_cheat.c | 2 +- src/m_cheat.h | 2 +- src/m_cond.c | 2 +- src/m_cond.h | 2 +- src/m_dllist.h | 2 +- src/m_fixed.c | 2 +- src/m_fixed.h | 2 +- src/m_menu.c | 2 +- src/m_menu.h | 2 +- src/m_misc.c | 2 +- src/m_misc.h | 2 +- src/m_perfstats.c | 2 +- src/m_perfstats.h | 2 +- src/m_queue.c | 2 +- src/m_queue.h | 2 +- src/m_random.c | 2 +- src/m_random.h | 2 +- src/m_swap.h | 2 +- src/mserv.c | 4 ++-- src/mserv.h | 4 ++-- src/p_ceilng.c | 2 +- src/p_enemy.c | 2 +- src/p_floor.c | 2 +- src/p_inter.c | 2 +- src/p_lights.c | 2 +- src/p_local.h | 2 +- src/p_map.c | 2 +- src/p_maputl.c | 2 +- src/p_maputl.h | 2 +- src/p_mobj.c | 2 +- src/p_mobj.h | 2 +- src/p_polyobj.c | 2 +- src/p_polyobj.h | 2 +- src/p_pspr.h | 2 +- src/p_saveg.c | 2 +- src/p_saveg.h | 2 +- src/p_setup.c | 2 +- src/p_setup.h | 2 +- src/p_sight.c | 2 +- src/p_slopes.c | 2 +- src/p_slopes.h | 2 +- src/p_spec.c | 2 +- src/p_spec.h | 2 +- src/p_telept.c | 2 +- src/p_tick.c | 2 +- src/p_tick.h | 2 +- src/p_user.c | 2 +- src/r_bsp.c | 2 +- src/r_bsp.h | 2 +- src/r_data.h | 2 +- src/r_defs.h | 2 +- src/r_draw16.c | 2 +- src/r_draw8_npo2.c | 2 +- src/r_local.h | 2 +- src/r_main.c | 2 +- src/r_main.h | 2 +- src/r_patch.c | 2 +- src/r_patch.h | 2 +- src/r_patchrotation.c | 2 +- src/r_patchrotation.h | 2 +- src/r_picformats.c | 4 ++-- src/r_picformats.h | 4 ++-- src/r_plane.h | 2 +- src/r_portal.c | 2 +- src/r_portal.h | 2 +- src/r_segs.c | 2 +- src/r_segs.h | 2 +- src/r_skins.c | 2 +- src/r_skins.h | 2 +- src/r_sky.c | 2 +- src/r_sky.h | 2 +- src/r_splats.h | 2 +- src/r_state.h | 2 +- src/r_textures.h | 2 +- src/r_things.h | 2 +- src/s_sound.c | 2 +- src/s_sound.h | 2 +- src/screen.c | 2 +- src/screen.h | 2 +- src/sdl/i_system.c | 2 +- src/sdl/i_threads.c | 2 +- src/sdl/i_video.c | 2 +- src/sdl/mixer_sound.c | 4 ++-- src/sdl/ogl_sdl.c | 2 +- src/sdl/ogl_sdl.h | 2 +- src/sdl/sdl_sound.c | 2 +- src/sdl/sdlmain.h | 2 +- src/sounds.c | 2 +- src/sounds.h | 2 +- src/st_stuff.c | 2 +- src/st_stuff.h | 2 +- src/strcasestr.c | 2 +- src/string.c | 2 +- src/tables.c | 2 +- src/tables.h | 2 +- src/taglist.c | 4 ++-- src/taglist.h | 4 ++-- src/tmap.nas | 2 +- src/tmap.s | 2 +- src/tmap_asm.s | 2 +- src/tmap_mmx.nas | 2 +- src/tmap_vc.nas | 2 +- src/v_video.c | 2 +- src/v_video.h | 2 +- src/vid_copy.s | 2 +- src/w_wad.c | 2 +- src/w_wad.h | 2 +- src/win32/Srb2win.rc | 2 +- src/y_inter.c | 2 +- src/y_inter.h | 2 +- src/z_zone.c | 2 +- src/z_zone.h | 2 +- 216 files changed, 226 insertions(+), 226 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 53a7480a5..ef0ebb88c 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/am_map.h b/src/am_map.h index 1c8fa70e4..022a7208b 100644 --- a/src/am_map.h +++ b/src/am_map.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/apng.c b/src/apng.c index 0abbe541d..36b205c60 100644 --- a/src/apng.c +++ b/src/apng.c @@ -1,5 +1,5 @@ /* -Copyright 2019-2020, James R. +Copyright 2019-2021, James R. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/apng.h b/src/apng.h index a8b5c8f24..893b523cb 100644 --- a/src/apng.h +++ b/src/apng.h @@ -1,5 +1,5 @@ /* -Copyright 2019-2020, James R. +Copyright 2019-2021, James R. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/asm_defs.inc b/src/asm_defs.inc index ec286b0bd..9074f20f8 100644 --- a/src/asm_defs.inc +++ b/src/asm_defs.inc @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/b_bot.c b/src/b_bot.c index d3635f32c..5b4124627 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2007-2016 by John "JTE" Muniz. -// Copyright (C) 2011-2020 by Sonic Team Junior. +// Copyright (C) 2011-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/b_bot.h b/src/b_bot.h index 2806bd68f..9f55637d1 100644 --- a/src/b_bot.h +++ b/src/b_bot.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2007-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/byteptr.h b/src/byteptr.h index 01a6293b4..4c8414fae 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/command.c b/src/command.c index d73cde5c2..95b1fd67d 100644 --- a/src/command.c +++ b/src/command.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/command.h b/src/command.h index d4033e6ef..34fd15963 100644 --- a/src/command.h +++ b/src/command.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/console.c b/src/console.c index 1560220f6..8c3703dd8 100644 --- a/src/console.c +++ b/src/console.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/console.h b/src/console.h index 0296f4f6e..28f40d308 100644 --- a/src/console.h +++ b/src/console.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 911a91355..4176b8a11 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 3d67525da..f3eb52423 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_event.h b/src/d_event.h index 3cce8fad1..1fd2e3824 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_main.c b/src/d_main.c index 61510d590..2a608cfc8 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_main.h b/src/d_main.h index 81de0634d..943da8418 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_net.c b/src/d_net.c index d534b1b08..9e5abe24a 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_net.h b/src/d_net.h index ea6b5d4d9..dbc6d8ba5 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 09f9d4651..97a2921a2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_netcmd.h b/src/d_netcmd.h index ac39626a4..fcdd1d4bb 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_netfil.c b/src/d_netfil.c index 50dc2ba60..9618c8073 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_netfil.h b/src/d_netfil.h index 158149477..ddcbcfec3 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_player.h b/src/d_player.h index 2e7afed88..54ab34288 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_think.h b/src/d_think.h index 4bdac4627..c3f91edc4 100644 --- a/src/d_think.h +++ b/src/d_think.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index 2a5ef0981..374585edf 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_lua.c b/src/deh_lua.c index e6a436421..3af97999c 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_lua.h b/src/deh_lua.h index cd927b9fd..9df4028bd 100644 --- a/src/deh_lua.h +++ b/src/deh_lua.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_soc.c b/src/deh_soc.c index 5b12ea1b0..fc764b411 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_soc.h b/src/deh_soc.h index 2bcb52e70..4064deb3f 100644 --- a/src/deh_soc.h +++ b/src/deh_soc.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_tables.c b/src/deh_tables.c index dd6d7d69f..23faf0092 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_tables.h b/src/deh_tables.h index d094bcbad..1f265cc99 100644 --- a/src/deh_tables.h +++ b/src/deh_tables.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/dehacked.c b/src/dehacked.c index c2ea28d27..7d8629567 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/dehacked.h b/src/dehacked.h index 1620314ca..1b200e246 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomdata.h b/src/doomdata.h index b3f7f5c4d..e317fec1b 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomdef.h b/src/doomdef.h index 52abc9597..9dc44d3bb 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomstat.h b/src/doomstat.h index 2d28b81af..843202395 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomtype.h b/src/doomtype.h index 950f50856..a094cbb08 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/endian.h b/src/endian.h index 24d8e35cd..e78204e72 100644 --- a/src/endian.h +++ b/src/endian.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/f_finale.c b/src/f_finale.c index fdcfad279..bfba7cf96 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/f_finale.h b/src/f_finale.h index b3abf1778..4aa2c3f05 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/f_wipe.c b/src/f_wipe.c index 6afb8a6a7..7526aeca3 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_demo.c b/src/g_demo.c index 593fd7723..ea71c9bd4 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_demo.h b/src/g_demo.h index df25042c4..73cf27358 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_game.c b/src/g_game.c index 399c4f2bd..9911baab6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_game.h b/src/g_game.h index 744d6755a..98336ad44 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_input.c b/src/g_input.c index d3c21e774..357081e1d 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_input.h b/src/g_input.h index ce38f6ba9..609141825 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_state.h b/src/g_state.h index e364c5a35..589dc6361 100644 --- a/src/g_state.h +++ b/src/g_state.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index b13ad03ea..3a8eef55e 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_batching.h b/src/hardware/hw_batching.h index 42291a0df..d886dcf2a 100644 --- a/src/hardware/hw_batching.h +++ b/src/hardware/hw_batching.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 83a4e2e03..317efd320 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 7e56a14d0..5aba6a2a9 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index ba4923d10..e83aff0d7 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 8cae144ff..d4a586d41 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 2aba62248..37d77b467 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_light.h b/src/hardware/hw_light.h index fed7db47f..244cc921f 100644 --- a/src/hardware/hw_light.h +++ b/src/hardware/hw_light.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 4ad09aa3d..ba6532c38 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 5caf344f7..9c3aa9e58 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 0f4d2c7bc..9249c034c 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index af06a198f..645a3bbae 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 1998-2020 by Sonic Team Junior. +// Copyright (C) 1998-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/http-mserv.c b/src/http-mserv.c index 7c7d04495..0b9eb2f92 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by James R. +// Copyright (C) 2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 7c4f1acf1..0c073866e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 63d85f1b8..9b7cee2d3 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index e77774549..79709899e 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2011-2020 by Sonic Team Junior. +// Copyright (C) 2011-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h index 7ae006719..397a1969d 100644 --- a/src/i_addrinfo.h +++ b/src/i_addrinfo.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2011-2020 by Sonic Team Junior. +// Copyright (C) 2011-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_joy.h b/src/i_joy.h index 2a2797fc4..0c7c8dd3f 100644 --- a/src/i_joy.h +++ b/src/i_joy.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_net.h b/src/i_net.h index 5d93f191e..dbc82db65 100644 --- a/src/i_net.h +++ b/src/i_net.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_sound.h b/src/i_sound.h index d45c0b323..e38a17626 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_system.h b/src/i_system.h index 12f0d751d..b88ea3177 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_tcp.c b/src/i_tcp.c index ab8a69a9f..679553039 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_tcp.h b/src/i_tcp.h index 738b8b4d1..785734415 100644 --- a/src/i_tcp.h +++ b/src/i_tcp.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_threads.h b/src/i_threads.h index ecb9fce67..924d283c4 100644 --- a/src/i_threads.h +++ b/src/i_threads.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by James R. +// Copyright (C) 2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_video.h b/src/i_video.h index ab48881d4..2d07fcf10 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/info.c b/src/info.c index ee836a372..bb1279b6b 100644 --- a/src/info.c +++ b/src/info.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/info.h b/src/info.h index 60e970246..031a08b43 100644 --- a/src/info.h +++ b/src/info.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/keys.h b/src/keys.h index 6cdd7956c..b19259320 100644 --- a/src/keys.h +++ b/src/keys.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_baselib.c b/src/lua_baselib.c index a265465da..a0c99411b 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c index 1949d56bb..9089d19b6 100644 --- a/src/lua_blockmaplib.c +++ b/src/lua_blockmaplib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2016-2020 by Iestyn "Monster Iestyn" Jealous. -// Copyright (C) 2016-2020 by Sonic Team Junior. +// Copyright (C) 2016-2021 by Iestyn "Monster Iestyn" Jealous. +// Copyright (C) 2016-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index a8ef6b7c0..414d9692a 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hook.h b/src/lua_hook.h index 0d631aa4e..c22309eaa 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index a3f4a95d2..3715aae04 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hud.h b/src/lua_hud.h index 1e9dca00b..a7b1a4cf5 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 8d451e99c..b0548c321 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 6e86f47b7..af2d99a0c 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_libs.h b/src/lua_libs.h index fbe8d4878..05061f118 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 016141796..9031c99f1 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index b6046ab53..a1dca9e15 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 65adceb15..5d5f0e85b 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 0eb54808f..687cee2eb 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_polyobjlib.c b/src/lua_polyobjlib.c index 2a5bcfbf1..cfd6b67d4 100644 --- a/src/lua_polyobjlib.c +++ b/src/lua_polyobjlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Iestyn "Monster Iestyn" Jealous. -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by Iestyn "Monster Iestyn" Jealous. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_script.c b/src/lua_script.c index 9f8432832..aa1db3aeb 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_script.h b/src/lua_script.h index 89ba7b6ee..a9c8762ad 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 7e7480be3..3370f8f72 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_taglib.c b/src/lua_taglib.c index c9f320fe8..55abb09cd 100644 --- a/src/lua_taglib.c +++ b/src/lua_taglib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by James R. -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by James R. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c index 82baa6469..65bf8c313 100644 --- a/src/lua_thinkerlib.c +++ b/src/lua_thinkerlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_aatree.c b/src/m_aatree.c index c0bb739f8..b228ed63d 100644 --- a/src/m_aatree.c +++ b/src/m_aatree.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_aatree.h b/src/m_aatree.h index b784eb17a..5a240394f 100644 --- a/src/m_aatree.h +++ b/src/m_aatree.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_anigif.c b/src/m_anigif.c index 41f99254e..fe04a5cb4 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh. // Copyright (C) 2013 by "Ninji". -// Copyright (C) 2013-2020 by Sonic Team Junior. +// Copyright (C) 2013-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_anigif.h b/src/m_anigif.h index abe05dd96..ca7563b1e 100644 --- a/src/m_anigif.h +++ b/src/m_anigif.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 2013-2020 by Sonic Team Junior. +// Copyright (C) 2013-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_argv.c b/src/m_argv.c index 7d43d96bc..453d6e45c 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_argv.h b/src/m_argv.h index 92770f4e9..f39db513f 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_bbox.c b/src/m_bbox.c index 02d534164..e0505fd95 100644 --- a/src/m_bbox.c +++ b/src/m_bbox.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_bbox.h b/src/m_bbox.h index 9b63c61b6..c56bd22c0 100644 --- a/src/m_bbox.h +++ b/src/m_bbox.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cheat.c b/src/m_cheat.c index 6e0fb8c5c..c958bb4a4 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cheat.h b/src/m_cheat.h index ac2540408..ee4ba5f55 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cond.c b/src/m_cond.c index 36fcd7cf2..a54238ab2 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cond.h b/src/m_cond.h index 9bb162ff3..690b6fb26 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 2012-2020 by Sonic Team Junior. +// Copyright (C) 2012-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_dllist.h b/src/m_dllist.h index 680c2cd80..65303b4a3 100644 --- a/src/m_dllist.h +++ b/src/m_dllist.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2005 by James Haley -// Copyright (C) 2005-2020 by Sonic Team Junior. +// Copyright (C) 2005-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_fixed.c b/src/m_fixed.c index eb10fd5f8..d40ccd98e 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_fixed.h b/src/m_fixed.h index 289ca442a..73adf52f6 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_menu.c b/src/m_menu.c index 13531f1b8..496ce6b4c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_menu.h b/src/m_menu.h index 0465128ef..ba9c326a0 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_misc.c b/src/m_misc.c index 17a398b83..999ee0961 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_misc.h b/src/m_misc.h index c5ef9f9f2..fc5430f01 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_perfstats.c b/src/m_perfstats.c index b58599b6d..c4b2044b3 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_perfstats.h b/src/m_perfstats.h index 1ca71957f..8f87146f2 100644 --- a/src/m_perfstats.h +++ b/src/m_perfstats.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Sonic Team Junior. +// Copyright (C) 2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_queue.c b/src/m_queue.c index 8603ab202..a337ca4ce 100644 --- a/src/m_queue.c +++ b/src/m_queue.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2003 by James Haley -// Copyright (C) 2003-2020 by Sonic Team Junior. +// Copyright (C) 2003-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_queue.h b/src/m_queue.h index 3e9579e11..cc64b8dd7 100644 --- a/src/m_queue.h +++ b/src/m_queue.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2003 by James Haley -// Copyright (C) 2003-2020 by Sonic Team Junior. +// Copyright (C) 2003-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_random.c b/src/m_random.c index 481fdb72b..6b281fc24 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_random.h b/src/m_random.h index 01190e046..df10b4bb3 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_swap.h b/src/m_swap.h index b44d6de8c..6aa347d97 100644 --- a/src/m_swap.h +++ b/src/m_swap.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/mserv.c b/src/mserv.c index dfb417415..f46a3d444 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. -// Copyright (C) 2020 by James R. +// Copyright (C) 1999-2021 by Sonic Team Junior. +// Copyright (C) 2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/mserv.h b/src/mserv.h index d0d5e49df..ff12fa1f8 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. -// Copyright (C) 2020 by James R. +// Copyright (C) 1999-2021 by Sonic Team Junior. +// Copyright (C) 2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_ceilng.c b/src/p_ceilng.c index f12499d5c..ac93e8e2e 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_enemy.c b/src/p_enemy.c index 51f18f596..ca88b7831 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_floor.c b/src/p_floor.c index 7c26065b5..d7e417f5c 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_inter.c b/src/p_inter.c index e9a16a3dd..380040bc8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_lights.c b/src/p_lights.c index d396e92d3..937808ef1 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_local.h b/src/p_local.h index 8568dd4f8..1fcd3050d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_map.c b/src/p_map.c index bf668ba3e..19b999c43 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_maputl.c b/src/p_maputl.c index 90718a41c..efcebe736 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_maputl.h b/src/p_maputl.h index 08b606833..cec344d03 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_mobj.c b/src/p_mobj.c index 49db6daee..690842270 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_mobj.h b/src/p_mobj.h index 5bb7c908e..82cd056a8 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 874edbd50..6431e4624 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by James Haley -// Copyright (C) 2006-2020 by Sonic Team Junior. +// Copyright (C) 2006-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_polyobj.h b/src/p_polyobj.h index 8c2946965..7c814e0bf 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by James Haley -// Copyright (C) 2006-2020 by Sonic Team Junior. +// Copyright (C) 2006-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_pspr.h b/src/p_pspr.h index 231262beb..4525ba14c 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_saveg.c b/src/p_saveg.c index 03229e740..ba4d8a32e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_saveg.h b/src/p_saveg.h index be98953eb..ed9297a4d 100644 --- a/src/p_saveg.h +++ b/src/p_saveg.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_setup.c b/src/p_setup.c index 40dd1a284..5a8248a28 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_setup.h b/src/p_setup.h index 5d13ae7d4..9fa70d516 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_sight.c b/src/p_sight.c index 2e1e49997..e4a37a718 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_slopes.c b/src/p_slopes.c index aa46a8402..05955c5d6 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2004 by Stephen McGranahan -// Copyright (C) 2015-2020 by Sonic Team Junior. +// Copyright (C) 2015-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_slopes.h b/src/p_slopes.h index 46e8dc1e7..ae040ae56 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2004 by Stephen McGranahan -// Copyright (C) 2015-2020 by Sonic Team Junior. +// Copyright (C) 2015-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_spec.c b/src/p_spec.c index 226e58d15..0bb12cf58 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_spec.h b/src/p_spec.h index bba7c4a40..3b8abfcf8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_telept.c b/src/p_telept.c index f6feddf4b..6bac5ad20 100644 --- a/src/p_telept.c +++ b/src/p_telept.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_tick.c b/src/p_tick.c index c0a1c5700..9f00ef8dc 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_tick.h b/src/p_tick.h index 1fb88f3f2..ae481c6a2 100644 --- a/src/p_tick.h +++ b/src/p_tick.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_user.c b/src/p_user.c index 4413cc6cd..29770ccb5 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_bsp.c b/src/r_bsp.c index 6f2a90d2d..5acd4e70c 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_bsp.h b/src/r_bsp.h index e2da8ebaf..40d24ffec 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_data.h b/src/r_data.h index aec52b54b..571fdc54f 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_defs.h b/src/r_defs.h index 9c649fbc4..1be3a1b8c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw16.c b/src/r_draw16.c index 8b1d29e8d..1a2fed773 100644 --- a/src/r_draw16.c +++ b/src/r_draw16.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index a34a20e9a..6bb2880b2 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_local.h b/src/r_local.h index 4ccb766cf..ba78ea87d 100644 --- a/src/r_local.h +++ b/src/r_local.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_main.c b/src/r_main.c index 04bdebc58..be9bbd7d0 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_main.h b/src/r_main.h index 2ac6abf5a..f81447c45 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.c b/src/r_patch.c index 1a08d1892..ef41aa574 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Jaime "Lactozilla" Passos. +// Copyright (C) 2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.h b/src/r_patch.h index 32bcb3909..d4ca8e6ee 100644 --- a/src/r_patch.h +++ b/src/r_patch.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Jaime "Lactozilla" Passos. +// Copyright (C) 2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index 123c4eef2..a6c2b41ce 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Jaime "Lactozilla" Passos. +// Copyright (C) 2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.h b/src/r_patchrotation.h index 2744f71d2..c64a08366 100644 --- a/src/r_patchrotation.h +++ b/src/r_patchrotation.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by Jaime "Lactozilla" Passos. +// Copyright (C) 2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_picformats.c b/src/r_picformats.c index f87362c76..3bbbf82ec 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -2,8 +2,8 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 2005-2009 by Andrey "entryway" Budko. -// Copyright (C) 2018-2020 by Jaime "Lactozilla" Passos. -// Copyright (C) 2019-2020 by Sonic Team Junior. +// Copyright (C) 2018-2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2019-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_picformats.h b/src/r_picformats.h index 8d3999013..b1bb35edd 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 2018-2020 by Jaime "Lactozilla" Passos. -// Copyright (C) 2019-2020 by Sonic Team Junior. +// Copyright (C) 2018-2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2019-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_plane.h b/src/r_plane.h index 0d11c5b72..748a7f007 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_portal.c b/src/r_portal.c index 1aca145ec..3026f4e4c 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_portal.h b/src/r_portal.h index e665a26e6..0effd07b5 100644 --- a/src/r_portal.h +++ b/src/r_portal.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_segs.c b/src/r_segs.c index a6772f964..c9f9bbfe6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_segs.h b/src/r_segs.h index ace5711d4..da7d44ad4 100644 --- a/src/r_segs.h +++ b/src/r_segs.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_skins.c b/src/r_skins.c index 6f150f234..7b6c4517b 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_skins.h b/src/r_skins.h index fbbb38743..3f67bfdab 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_sky.c b/src/r_sky.c index 7cdcfa44d..041cccfc5 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_sky.h b/src/r_sky.h index 55d866b86..f4356dcfa 100644 --- a/src/r_sky.h +++ b/src/r_sky.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_splats.h b/src/r_splats.h index 05d8b66b0..cab3d63b6 100644 --- a/src/r_splats.h +++ b/src/r_splats.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_state.h b/src/r_state.h index 25aa69702..5a606ed8c 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_textures.h b/src/r_textures.h index 74a94a9ed..dd286b6ac 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_things.h b/src/r_things.h index 95b4215af..9315b36e9 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/s_sound.c b/src/s_sound.c index 392a5b453..ea1479cae 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/s_sound.h b/src/s_sound.h index 4ac3c70bf..f736833f9 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/screen.c b/src/screen.c index d37724390..770f1c802 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/screen.h b/src/screen.h index e4944775d..67880e2b9 100644 --- a/src/screen.h +++ b/src/screen.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index a0dd6e1da..df29e348b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -5,7 +5,7 @@ // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sdl/i_threads.c b/src/sdl/i_threads.c index 3b1c20b9a..bf9668584 100644 --- a/src/sdl/i_threads.c +++ b/src/sdl/i_threads.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020 by James R. +// Copyright (C) 2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0ed10463f..5f18720f8 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -4,7 +4,7 @@ // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 412a21ea0..2f1a87266 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -1301,7 +1301,7 @@ boolean I_PlaySong(boolean looping) #if defined (GME_VERSION) && GME_VERSION >= 0x000603 if (looping) gme_set_autoload_playback_limit(gme, 0); -#endif +#endif gme_set_equalizer(gme, &eq); gme_start_track(gme, 0); current_track = 0; diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 52727c056..c426e6792 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h index 748e30bae..8f87f688e 100644 --- a/src/sdl/ogl_sdl.h +++ b/src/sdl/ogl_sdl.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 86e294fb5..058b601c3 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // // Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 2014-2020 by Sonic Team Junior. +// Copyright (C) 2014-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h index e35506114..a9676b5c2 100644 --- a/src/sdl/sdlmain.h +++ b/src/sdl/sdlmain.h @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// Copyright (C) 2006-2020 by Sonic Team Junior. +// Copyright (C) 2006-2021 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/sounds.c b/src/sounds.c index 092bda21f..4c5b11ee9 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/sounds.h b/src/sounds.h index e49dd2f3e..2dd37953c 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/st_stuff.c b/src/st_stuff.c index a1fbbec03..a0457ba53 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/st_stuff.h b/src/st_stuff.h index 4ea307d2b..b1ea2942d 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/strcasestr.c b/src/strcasestr.c index b266278ed..1cbee286a 100644 --- a/src/strcasestr.c +++ b/src/strcasestr.c @@ -2,7 +2,7 @@ strcasestr -- case insensitive substring searching function. */ /* -Copyright 2019-2020 James R. +Copyright 2019-2021 James R. All rights reserved. Redistribution and use in source forms, with or without modification, is diff --git a/src/string.c b/src/string.c index e430c5cc3..f32025612 100644 --- a/src/string.c +++ b/src/string.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by Graue. -// Copyright (C) 2006-2020 by Sonic Team Junior. +// Copyright (C) 2006-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tables.c b/src/tables.c index 70a1ecd0a..9263f42d3 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tables.h b/src/tables.h index 953d891ce..baa3adf36 100644 --- a/src/tables.h +++ b/src/tables.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/taglist.c b/src/taglist.c index a759f4d02..1b4a64ecd 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. -// Copyright (C) 2020 by Nev3r. +// Copyright (C) 1999-2021 by Sonic Team Junior. +// Copyright (C) 2021 by Nev3r. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/taglist.h b/src/taglist.h index a0529ab6b..80100f80a 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. -// Copyright (C) 2020 by Nev3r. +// Copyright (C) 1999-2021 by Sonic Team Junior. +// Copyright (C) 2021 by Nev3r. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tmap.nas b/src/tmap.nas index 69282d0b4..5bf28359e 100644 --- a/src/tmap.nas +++ b/src/tmap.nas @@ -1,7 +1,7 @@ ;; SONIC ROBO BLAST 2 ;;----------------------------------------------------------------------------- ;; Copyright (C) 1998-2000 by DooM Legacy Team. -;; Copyright (C) 1999-2020 by Sonic Team Junior. +;; Copyright (C) 1999-2021 by Sonic Team Junior. ;; ;; This program is free software distributed under the ;; terms of the GNU General Public License, version 2. diff --git a/src/tmap.s b/src/tmap.s index 3a4cf2e1a..62dcf85dc 100644 --- a/src/tmap.s +++ b/src/tmap.s @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tmap_asm.s b/src/tmap_asm.s index 3cd0f87cc..b5a0a51e9 100644 --- a/src/tmap_asm.s +++ b/src/tmap_asm.s @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tmap_mmx.nas b/src/tmap_mmx.nas index 15b97499d..8b6ef91a6 100644 --- a/src/tmap_mmx.nas +++ b/src/tmap_mmx.nas @@ -1,7 +1,7 @@ ;; SONIC ROBO BLAST 2 ;;----------------------------------------------------------------------------- ;; Copyright (C) 1998-2000 by DOSDOOM. -;; Copyright (C) 2010-2020 by Sonic Team Junior. +;; Copyright (C) 2010-2021 by Sonic Team Junior. ;; ;; This program is free software distributed under the ;; terms of the GNU General Public License, version 2. diff --git a/src/tmap_vc.nas b/src/tmap_vc.nas index 49eb21a6d..b6ee26e6b 100644 --- a/src/tmap_vc.nas +++ b/src/tmap_vc.nas @@ -1,7 +1,7 @@ ;; SONIC ROBO BLAST 2 ;;----------------------------------------------------------------------------- ;; Copyright (C) 1998-2000 by DooM Legacy Team. -;; Copyright (C) 1999-2020 by Sonic Team Junior. +;; Copyright (C) 1999-2021 by Sonic Team Junior. ;; ;; This program is free software distributed under the ;; terms of the GNU General Public License, version 2. diff --git a/src/v_video.c b/src/v_video.c index 4713db0d8..9cbf6d792 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/v_video.h b/src/v_video.h index 8a18f82ad..7184e799e 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/vid_copy.s b/src/vid_copy.s index eae435ea4..6a3788356 100644 --- a/src/vid_copy.s +++ b/src/vid_copy.s @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/w_wad.c b/src/w_wad.c index 6149aec6e..cbff5c67b 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/w_wad.h b/src/w_wad.h index d0a86bcb4..130967712 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index b0eb2532e..0a280448b 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -97,7 +97,7 @@ BEGIN VALUE "FileDescription", "Sonic Robo Blast 2\0" VALUE "FileVersion", VERSIONSTRING_RC VALUE "InternalName", "srb2\0" - VALUE "LegalCopyright", "Copyright 1998-2020 by Sonic Team Junior\0" + VALUE "LegalCopyright", "Copyright 1998-2021 by Sonic Team Junior\0" VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0" VALUE "OriginalFilename", "srb2win.exe\0" VALUE "PrivateBuild", "\0" diff --git a/src/y_inter.c b/src/y_inter.c index 4354a1677..dc78a1983 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2004-2020 by Sonic Team Junior. +// Copyright (C) 2004-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/y_inter.h b/src/y_inter.h index 7268b1a47..871142858 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2004-2020 by Sonic Team Junior. +// Copyright (C) 2004-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/z_zone.c b/src/z_zone.c index d7da17e51..34ff3d37e 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by Graue. -// Copyright (C) 2006-2020 by Sonic Team Junior. +// Copyright (C) 2006-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/z_zone.h b/src/z_zone.h index 7b58be8f3..be55bf994 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2020 by Sonic Team Junior. +// Copyright (C) 1999-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. From 07e69c5eb30d83f229e42db460dd180c3188f9dd Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 7 May 2021 18:04:30 +0200 Subject: [PATCH 157/160] Add copyright date ranges for files created in 2020 --- src/hardware/hw_batching.c | 2 +- src/hardware/hw_batching.h | 2 +- src/http-mserv.c | 2 +- src/i_threads.h | 2 +- src/lua_polyobjlib.c | 4 ++-- src/lua_taglib.c | 4 ++-- src/m_perfstats.c | 2 +- src/m_perfstats.h | 2 +- src/mserv.c | 2 +- src/mserv.h | 2 +- src/r_patch.c | 2 +- src/r_patch.h | 2 +- src/r_patchrotation.c | 2 +- src/r_patchrotation.h | 2 +- src/sdl/i_threads.c | 2 +- src/taglist.c | 2 +- src/taglist.h | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 3a8eef55e..0ac33d136 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_batching.h b/src/hardware/hw_batching.h index d886dcf2a..9ccc7de3d 100644 --- a/src/hardware/hw_batching.h +++ b/src/hardware/hw_batching.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/http-mserv.c b/src/http-mserv.c index 0b9eb2f92..f9134ba50 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by James R. +// Copyright (C) 2020-2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_threads.h b/src/i_threads.h index 924d283c4..bc752181f 100644 --- a/src/i_threads.h +++ b/src/i_threads.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by James R. +// Copyright (C) 2020-2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_polyobjlib.c b/src/lua_polyobjlib.c index cfd6b67d4..5d76a912d 100644 --- a/src/lua_polyobjlib.c +++ b/src/lua_polyobjlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Iestyn "Monster Iestyn" Jealous. -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by Iestyn "Monster Iestyn" Jealous. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_taglib.c b/src/lua_taglib.c index 55abb09cd..d0cf385a9 100644 --- a/src/lua_taglib.c +++ b/src/lua_taglib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by James R. -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by James R. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_perfstats.c b/src/m_perfstats.c index c4b2044b3..8a99312e6 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_perfstats.h b/src/m_perfstats.h index 8f87146f2..71208fbc1 100644 --- a/src/m_perfstats.h +++ b/src/m_perfstats.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2020-2021 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/mserv.c b/src/mserv.c index f46a3d444..f64c7bea9 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2021 by Sonic Team Junior. -// Copyright (C) 2021 by James R. +// Copyright (C) 2020-2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/mserv.h b/src/mserv.h index ff12fa1f8..7a3b3d8ec 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2021 by Sonic Team Junior. -// Copyright (C) 2021 by James R. +// Copyright (C) 2020-2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.c b/src/r_patch.c index ef41aa574..6827cd12c 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.h b/src/r_patch.h index d4ca8e6ee..96fbb0e28 100644 --- a/src/r_patch.h +++ b/src/r_patch.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index a6c2b41ce..a9b4a2b8f 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.h b/src/r_patchrotation.h index c64a08366..689b7d411 100644 --- a/src/r_patchrotation.h +++ b/src/r_patchrotation.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2021 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/sdl/i_threads.c b/src/sdl/i_threads.c index bf9668584..f73d00bcf 100644 --- a/src/sdl/i_threads.c +++ b/src/sdl/i_threads.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by James R. +// Copyright (C) 2020-2021 by James R. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/taglist.c b/src/taglist.c index 1b4a64ecd..28fa48c25 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2021 by Sonic Team Junior. -// Copyright (C) 2021 by Nev3r. +// Copyright (C) 2020-2021 by Nev3r. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/taglist.h b/src/taglist.h index 80100f80a..146d76131 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2021 by Sonic Team Junior. -// Copyright (C) 2021 by Nev3r. +// Copyright (C) 2020-2021 by Nev3r. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. From 210c9419e4bddd1fe8e9be7cb66de31119fa0d68 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 8 May 2021 16:48:40 -0700 Subject: [PATCH 158/160] Ignore -Wtrigraphs --- src/CMakeLists.txt | 2 ++ src/Makefile.cfg | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87a0499b6..88ab1cdcb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -604,6 +604,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value) endif() +set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs) + add_definitions(-DCMAKECONFIG) #add_library(SRB2Core STATIC diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 075cd2d3a..79d332f85 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -209,7 +209,7 @@ endif OLDWFLAGS:=$(WFLAGS) # -W -Wno-unused -WFLAGS=-Wall +WFLAGS=-Wall -Wno-trigraphs ifndef GCC295 #WFLAGS+=-Wno-packed endif From 35244fa736cd2b5d1a35b471ef75cfaaba6a3a2a Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 8 May 2021 16:49:23 -0700 Subject: [PATCH 159/160] Clang: fix -Wimplicit-const-int-float-conversion Some of these integers exceed the precision of float. In that case the number is rounded. The rounding shouldn't matter too much anyway, so just shut the compiler up. --- src/hardware/hw_main.c | 2 +- src/m_random.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e94c637e4..dd633d6fc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5715,7 +5715,7 @@ static void HWR_DrawSkyBackground(player_t *player) dimensionmultiply = ((float)textures[texturetranslation[skytexture]]->width/256.0f); - v[0].s = v[3].s = (-1.0f * angle) / ((ANGLE_90-1)*dimensionmultiply); // left + v[0].s = v[3].s = (-1.0f * angle) / (((float)ANGLE_90-1.0f)*dimensionmultiply); // left v[2].s = v[1].s = v[0].s + (1.0f/dimensionmultiply); // right (or left + 1.0f) // use +angle and -1.0f above instead if you wanted old backwards behavior diff --git a/src/m_random.c b/src/m_random.c index 481fdb72b..b00eff60f 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -60,7 +60,7 @@ UINT8 M_RandomByte(void) */ INT32 M_RandomKey(INT32 a) { - return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*a); + return (INT32)((rand()/((float)RAND_MAX+1.0f))*a); } /** Provides a random integer in a given range. @@ -73,7 +73,7 @@ INT32 M_RandomKey(INT32 a) */ INT32 M_RandomRange(INT32 a, INT32 b) { - return (INT32)((rand()/((unsigned)RAND_MAX+1.0f))*(b-a+1))+a; + return (INT32)((rand()/((float)RAND_MAX+1.0f))*(b-a+1))+a; } From 69647eb78d36c0b2f5febecd2c4e55f622325217 Mon Sep 17 00:00:00 2001 From: RJPFonseca Date: Sun, 9 May 2021 19:10:53 +0100 Subject: [PATCH 160/160] Used spaces instead of tabs in Makefile.cfg --- src/Makefile.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 075cd2d3a..e6821a4c9 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -61,10 +61,10 @@ ifeq (,$(filter GCC% CLEANONLY,$(.VARIABLES))) # If this version is not in the list, default to the latest supported ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS))) - define line = + define line = Your compiler version, GCC $(version), is not supported by the Makefile. The Makefile will assume GCC $(LATEST_GCC_VERSION).)) - endef + endef $(call print,$(line)) GCC$(subst .,,$(LATEST_GCC_VERSION))=1 else