From e4d57ad72ce5720dcfe56064ba246f0553a91dd5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 7 Jun 2016 15:54:08 -0400 Subject: [PATCH 001/124] SDL2: try out relative mouse mode --- src/sdl/i_video.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index b5168dad..0a8b4aa7 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -127,7 +127,8 @@ static Uint8 BitsPerPixel = 16; Uint16 realwidth = BASEVIDWIDTH; Uint16 realheight = BASEVIDHEIGHT; static SDL_bool mousegrabok = SDL_TRUE; -#define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2)) +static SDL_bool wrapmouseok = SDL_FALSE; +#define HalfWarpMouse(x,y) if (wrapmouseok) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2)) static SDL_bool videoblitok = SDL_FALSE; static SDL_bool exposevideo = SDL_FALSE; static SDL_bool usesdl2soft = SDL_FALSE; @@ -417,6 +418,8 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) static void SDLdoUngrabMouse(void) { SDL_SetWindowGrab(window, SDL_FALSE); + wrapmouseok = SDL_FALSE; + SDL_SetRelativeMouseMode(SDL_FALSE); } void SDLforceUngrabMouse(void) @@ -424,6 +427,8 @@ void SDLforceUngrabMouse(void) if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL) { SDL_SetWindowGrab(window, SDL_FALSE); + wrapmouseok = SDL_FALSE; + SDL_SetRelativeMouseMode(SDL_FALSE); } } @@ -760,6 +765,8 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) { D_PostEvent(&event); SDL_SetWindowGrab(window, SDL_TRUE); + if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) + wrapmouseok = SDL_TRUE; HalfWarpMouse(wwidth, wheight); } } From 70ce9421e42174794e430b0257e177aa3c226d6f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 7 Jun 2016 16:19:24 -0400 Subject: [PATCH 002/124] SDL2: fixup ambiguous else in I_StartupMouse() --- src/sdl/i_video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0a8b4aa7..16ccbc6f 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1183,7 +1183,9 @@ void I_StartupMouse(void) return; if (!firsttimeonmouse) + { HalfWarpMouse(realwidth, realheight); // warp to center + } else firsttimeonmouse = SDL_FALSE; if (cv_usemouse.value) From 246e0c21bed6cf7cf208c1d66e5e79f1a93e2d48 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 7 Jun 2016 16:59:32 -0400 Subject: [PATCH 003/124] SDL2: do not use silly math in rel mode --- src/sdl/i_video.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 16ccbc6f..53761f60 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -749,7 +749,12 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) return; } - if ((evt.x == realwidth/2) && (evt.y == realheight/2)) + if (!wrapmouseok) + { + event.data2 = evt.xrel; + event.data3 = evt.yrel; + } + else if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } From 366e870b0e30ce1493a62bea86b5690870a6ce2e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 7 Jun 2016 17:16:11 -0400 Subject: [PATCH 004/124] SDL2: check Rel Mouse Mode directly --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 53761f60..9800c8cc 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -749,7 +749,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) return; } - if (!wrapmouseok) + if (SDL_GetRelativeMouseMode()) { event.data2 = evt.xrel; event.data3 = evt.yrel; From 2d50dd1fd1ad65923acb271717027316c802d4bd Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 00:02:38 +0000 Subject: [PATCH 005/124] A bunch of fixes that allow for proper handling of triggerspecial_touch. Not perfect, but I don't have any more time to spend tonight. --- src/p_floor.c | 39 +++++++++++++++++++++++++++++--- src/p_spec.c | 61 +++++++++++++++++++++++++++++---------------------- 2 files changed, 71 insertions(+), 29 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 91121301..1f3873d9 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2073,6 +2073,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) boolean inAndOut = false; boolean floortouch = false; fixed_t bottomheight, topheight; + msecnode_t *node; for (i = 0; i < MAXPLAYERS; i++) { @@ -2134,8 +2135,22 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if ((netgame || multiplayer) && players[j].spectator) continue; - if (players[j].mo->subsector->sector != targetsec) - continue; + if (players[j].mo->subsector->sector == targetsec) + ; + else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH) + { + boolean insector = false; + for (node = players[j].mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == targetsec) + { + insector = true; + break; + } + } + if (!insector) + continue; + } topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec); bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec); @@ -2184,7 +2199,25 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if ((netgame || multiplayer) && players[i].spectator) continue; - if (players[i].mo->subsector->sector != sec) + if (players[i].mo->subsector->sector == targetsec) + ; + else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH) + { + boolean insector = false; + for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == targetsec) + { + insector = true; + break; + } + } + if (!insector) + continue; + } + + if (!(players[i].mo->subsector->sector == sec + || P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec)) continue; if (floortouch == true && P_IsObjectOnGroundIn(players[i].mo, sec)) diff --git a/src/p_spec.c b/src/p_spec.c index b04c5588..10a8f731 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3606,14 +3606,16 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers { if (roversector) { - if (players[i].mo->subsector->sector != roversector) + if (!(players[i].mo->subsector->sector == roversector + || sector->flags & SF_TRIGGERSPECIAL_TOUCH)) goto DoneSection2; if (!P_ThingIsOnThe3DFloor(players[i].mo, sector, roversector)) goto DoneSection2; } else { - if (players[i].mo->subsector->sector != sector) + if (!(players[i].mo->subsector->sector == sector + || sector->flags & SF_TRIGGERSPECIAL_TOUCH)) goto DoneSection2; if (special == 3 && !P_MobjReadyToTrigger(players[i].mo, sector)) @@ -4364,6 +4366,7 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) { sector_t *sector; ffloor_t *rover; + fixed_t topheight, bottomheight; sector = mo->subsector->sector; if (!sector->ffloors) @@ -4371,8 +4374,6 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) for (rover = sector->ffloors; rover; rover = rover->next) { - fixed_t topheight, bottomheight; - if (!rover->master->frontsector->special) continue; @@ -4420,20 +4421,21 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) return NULL; } +#define TELEPORTED (player->mo->subsector->sector != originalsector) + /** Checks if a player is standing on or is inside a 3D floor (e.g. water) and * applies any specials. * * \param player Player to check. * \sa P_ThingOnSpecial3DFloor, P_PlayerInSpecialSector */ -static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) +static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector, sector_t *originalsector) { ffloor_t *rover; + fixed_t topheight, bottomheight; for (rover = sector->ffloors; rover; rover = rover->next) { - fixed_t topheight, bottomheight; - if (!rover->master->frontsector->special) continue; @@ -4477,7 +4479,10 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) // This FOF has the special we're looking for, but are we allowed to touch it? if (sector == player->mo->subsector->sector || (rover->master->frontsector->flags & SF_TRIGGERSPECIAL_TOUCH)) + { P_ProcessSpecialSector(player, rover->master->frontsector, sector); + if TELEPORTED return; + } } // Allow sector specials to be applied to polyobjects! @@ -4488,7 +4493,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) boolean touching = false; boolean inside = false; - while(po) + while (po) { if (po->flags & POF_NOSPECIALS) { @@ -4564,6 +4569,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) } P_ProcessSpecialSector(player, polysec, sector); + if TELEPORTED return; po = (polyobj_t *)(po->link.next); } @@ -4668,40 +4674,43 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) */ void P_PlayerInSpecialSector(player_t *player) { - sector_t *sector; + sector_t *originalsector; + sector_t *loopsector; msecnode_t *node; if (!player->mo) return; - // Do your ->subsector->sector first - sector = player->mo->subsector->sector; - P_PlayerOnSpecial3DFloor(player, sector); - // After P_PlayerOnSpecial3DFloor, recheck if the player is in that sector, - // because the player can be teleported in between these times. - if (sector == player->mo->subsector->sector) - P_RunSpecialSectorCheck(player, sector); + originalsector = player->mo->subsector->sector; - // Iterate through touching_sectorlist + P_PlayerOnSpecial3DFloor(player, originalsector, originalsector); // Handle FOFs first. + if TELEPORTED return; + + P_RunSpecialSectorCheck(player, originalsector); + if TELEPORTED return; + + // Iterate through touching_sectorlist for SF_TRIGGERSPECIAL_TOUCH for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) { - sector = node->m_sector; + loopsector = node->m_sector; - if (sector == player->mo->subsector->sector) // Don't duplicate + if (loopsector == originalsector) // Don't duplicate continue; // Check 3D floors... - P_PlayerOnSpecial3DFloor(player, sector); + P_PlayerOnSpecial3DFloor(player, loopsector, originalsector); + if TELEPORTED return; - if (!(sector->flags & SF_TRIGGERSPECIAL_TOUCH)) - return; - // After P_PlayerOnSpecial3DFloor, recheck if the player is in that sector, - // because the player can be teleported in between these times. - if (sector == player->mo->subsector->sector) - P_RunSpecialSectorCheck(player, sector); + if (!(loopsector->flags & SF_TRIGGERSPECIAL_TOUCH)) + continue; + + P_RunSpecialSectorCheck(player, loopsector); + if TELEPORTED return; } } +#undef TELEPORTED + /** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up. * * \sa P_CheckTimeLimit, P_CheckPointLimit From 6a2e101ebe0589c228ba0bdf990d8169250fd4ec Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 00:03:07 +0000 Subject: [PATCH 006/124] Forcing on triggerspecial_touch for slopes, because pain slopes and it would be a pain to handle this manually. --- src/p_slopes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_slopes.c b/src/p_slopes.c index d939fee9..c127001c 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -281,6 +281,7 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor || frontceil) { line->frontsector->hasslope = true; // Tell the software renderer that we're sloped + line->frontsector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact origin.z = line->backsector->floorheight; direction.x = nx; @@ -407,6 +408,7 @@ void P_SpawnSlope_Line(int linenum) if(backfloor || backceil) { line->backsector->hasslope = true; // Tell the software renderer that we're sloped + line->backsector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact origin.z = line->frontsector->floorheight; // Backsector @@ -599,6 +601,7 @@ void P_CopySectorSlope(line_t *line) } fsec->hasslope = true; + fsec->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } @@ -718,6 +721,7 @@ void P_ResetDynamicSlopes(void) { *slopetoset = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags); sides[lines[i].sidenum[which]].sector->hasslope = true; + sides[lines[i].sidenum[which]].sector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact } break; From 1e1a6c32f0b8c0ee0d93b4f1008fe6ae0e956cf8 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 09:34:24 +0000 Subject: [PATCH 007/124] Corrected non-complete set of cases. --- src/p_floor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_floor.c b/src/p_floor.c index 1f3873d9..b2c07bce 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2151,6 +2151,8 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if (!insector) continue; } + else + continue; topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec); bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec); @@ -2215,6 +2217,8 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if (!insector) continue; } + else + continue; if (!(players[i].mo->subsector->sector == sec || P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec)) From 1bbbe15ee52600b1404cd65bb9b95591a0728938 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 13:53:52 +0000 Subject: [PATCH 008/124] Fixed a bug with being able to go under the lava because P_CheckSolidLava doesn't take slopes into account. (neither does P_CanRunOnWater, but I don't think it's necessary to make that check more complicated as you probably shouldn't be able to waterrun up steep surfaces anyways) --- src/lua_baselib.c | 5 ++++- src/p_local.h | 2 +- src/p_map.c | 2 +- src/p_maputl.c | 4 ++-- src/p_mobj.c | 6 +++--- src/p_user.c | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index e8e8fd02..00a51927 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -560,12 +560,15 @@ static int lib_pCheckSolidLava(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); + sector_t *bound = *((sector_t **)luaL_checkudata(L, 3, META_SECTOR)); //HUDSAFE if (!mo) return LUA_ErrInvalid(L, "mobj_t"); if (!rover) return LUA_ErrInvalid(L, "ffloor_t"); - lua_pushboolean(L, P_CheckSolidLava(mo, rover)); + if (!bound) + return LUA_ErrInvalid(L, "sector_t"); + lua_pushboolean(L, P_CheckSolidLava(mo, rover, bound)); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 1fd7ada0..ce6aed02 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -238,7 +238,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); +boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover, sector_t *bound); mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); diff --git a/src/p_map.c b/src/p_map.c index 6a555953..7b542660 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1323,7 +1323,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) continue; } - if (thing->player && (P_CheckSolidLava(thing, rover) || P_CanRunOnWater(thing->player, rover))) + if (thing->player && (P_CheckSolidLava(thing, rover, newsubsec->sector) || P_CanRunOnWater(thing->player, rover))) ; else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)) ; diff --git a/src/p_maputl.c b/src/p_maputl.c index fea8530a..3aa9a994 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -646,7 +646,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(mobj, rover, front) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) @@ -690,7 +690,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(mobj, rover, back) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) diff --git a/src/p_mobj.c b/src/p_mobj.c index e7ec2f8b..4f0c8403 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1983,7 +1983,7 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL); bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL); - if (mo->player && (P_CheckSolidLava(mo, rover) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected + if (mo->player && (P_CheckSolidLava(mo, rover, sector) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected ; else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only continue; @@ -2133,14 +2133,14 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) return false; } -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover) +boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover, sector_t *bound) { I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 && !(rover->master->flags & ML_BLOCKMONSTERS) - && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > *rover->topheight - FixedMul(16*FRACUNIT, mo->scale))) + && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > P_GetSpecialTopZ(mo, rover->master->frontsector, bound) - FixedMul(16*FRACUNIT, mo->scale))) return true; return false; diff --git a/src/p_user.c b/src/p_user.c index f8dc942c..801eb595 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2908,7 +2908,7 @@ static void P_DoTeeter(player_t *player) bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); #endif - if (P_CheckSolidLava(player->mo, rover)) + if (P_CheckSolidLava(player->mo, rover, sec)) ; else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) continue; // intangible 3d floor From a2dabd70413ab9085d9b3af113e8aa0d86d1d27c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 14:03:53 +0000 Subject: [PATCH 009/124] Fixed a bunch of things MI pointed out. --- src/p_floor.c | 4 ++-- src/p_spec.c | 48 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index b2c07bce..0af81efe 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2201,14 +2201,14 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if ((netgame || multiplayer) && players[i].spectator) continue; - if (players[i].mo->subsector->sector == targetsec) + if (players[i].mo->subsector->sector == sec) ; else if (sec->flags & SF_TRIGGERSPECIAL_TOUCH) { boolean insector = false; for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) { - if (node->m_sector == targetsec) + if (node->m_sector == sec) { insector = true; break; diff --git a/src/p_spec.c b/src/p_spec.c index 10a8f731..1fd94b2e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3606,16 +3606,49 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers { if (roversector) { - if (!(players[i].mo->subsector->sector == roversector - || sector->flags & SF_TRIGGERSPECIAL_TOUCH)) + if (players[i].mo->subsector->sector == roversector) + ; + else if (sector->flags & SF_TRIGGERSPECIAL_TOUCH) + { + boolean insector = false; + msecnode_t *node; + for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == roversector) + { + insector = true; + break; + } + } + if (!insector) + goto DoneSection2; + } + else goto DoneSection2; + if (!P_ThingIsOnThe3DFloor(players[i].mo, sector, roversector)) goto DoneSection2; } else { - if (!(players[i].mo->subsector->sector == sector - || sector->flags & SF_TRIGGERSPECIAL_TOUCH)) + if (players[i].mo->subsector->sector == sector) + ; + else if (sector->flags & SF_TRIGGERSPECIAL_TOUCH) + { + boolean insector = false; + msecnode_t *node; + for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == sector) + { + insector = true; + break; + } + } + if (!insector) + goto DoneSection2; + } + else goto DoneSection2; if (special == 3 && !P_MobjReadyToTrigger(players[i].mo, sector)) @@ -4429,8 +4462,9 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) * \param player Player to check. * \sa P_ThingOnSpecial3DFloor, P_PlayerInSpecialSector */ -static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector, sector_t *originalsector) +static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) { + sector_t *originalsector = player->mo->subsector->sector; ffloor_t *rover; fixed_t topheight, bottomheight; @@ -4683,7 +4717,7 @@ void P_PlayerInSpecialSector(player_t *player) originalsector = player->mo->subsector->sector; - P_PlayerOnSpecial3DFloor(player, originalsector, originalsector); // Handle FOFs first. + P_PlayerOnSpecial3DFloor(player, originalsector); // Handle FOFs first. if TELEPORTED return; P_RunSpecialSectorCheck(player, originalsector); @@ -4698,7 +4732,7 @@ void P_PlayerInSpecialSector(player_t *player) continue; // Check 3D floors... - P_PlayerOnSpecial3DFloor(player, loopsector, originalsector); + P_PlayerOnSpecial3DFloor(player, loopsector); if TELEPORTED return; if (!(loopsector->flags & SF_TRIGGERSPECIAL_TOUCH)) From 04a38a683bc436ad2e00ebebcc223b1acc059a28 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 20:15:11 +0000 Subject: [PATCH 010/124] Okay, this is a biggun. Pay attention, everyone. Moved the handling of P_PlayerInSpecialSector to P_PlayerAfterThink from P_PlayerThink. * This allows the player to get hurt on sloped lava surfaces that are moving downwards. * Also prevents the player from standing on death pits for 1 tic. * Prevents the player moving 1 extra tic's worth of movement of pain when hit by sector. * Thankfully, no consequences re conveyors. * Like, the only consequences I've found have been positive. However, this DOES need to be thoroughly investigated before it can be allowed anywhere near Next itself. --- src/doomdef.h | 4 ++++ src/p_user.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/doomdef.h b/src/doomdef.h index fb8ab1ca..7d883849 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -495,4 +495,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note You should leave this enabled unless you're working with a future SRB2 version. #define MUSICSLOT_COMPATIBILITY +/// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink. +/// \note Required for proper collision with moving sloped surfaces that have sector specials on them. +#define SECTORSPECIALSAFTERTHINK + #endif // __DOOMDEF__ diff --git a/src/p_user.c b/src/p_user.c index 801eb595..921f1240 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8779,6 +8779,7 @@ void P_PlayerThink(player_t *player) // check water content, set stuff in mobj P_MobjCheckWater(player->mo); +#ifndef SECTORSPECIALSAFTERTHINK #ifdef POLYOBJECTS if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo)) #endif @@ -8787,6 +8788,7 @@ void P_PlayerThink(player_t *player) if (!player->spectator) P_PlayerInSpecialSector(player); +#endif if (player->playerstate == PST_DEAD) { @@ -9148,6 +9150,17 @@ void P_PlayerAfterThink(player_t *player) cmd = &player->cmd; +#ifdef SECTORSPECIALSAFTERTHINK +#ifdef POLYOBJECTS + if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo)) +#endif + player->onconveyor = 0; + // check special sectors : damage & secrets + + if (!player->spectator) + P_PlayerInSpecialSector(player); +#endif + if (splitscreen && player == &players[secondarydisplayplayer]) thiscam = &camera2; else if (player == &players[displayplayer]) From d13ca362d66360c87dc6f53a08b68f3d6501cb01 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 21:34:43 +0000 Subject: [PATCH 011/124] Quicksand now supports slopes and also reverse gravity. --- src/p_user.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 921f1240..f2f0cb77 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1940,6 +1940,7 @@ static void P_CheckQuicksand(player_t *player) { ffloor_t *rover; fixed_t sinkspeed, friction; + fixed_t topheight, bottomheight; if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0)) return; @@ -1951,16 +1952,33 @@ static void P_CheckQuicksand(player_t *player) if (!(rover->flags & FF_QUICKSAND)) continue; - if (*rover->topheight >= player->mo->z && *rover->bottomheight < player->mo->z + player->mo->height) + topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); + bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); + + if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) { sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1; sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT); - player->mo->z -= sinkspeed; + if (player->mo->eflags & MFE_VERTICALFLIP) + { + fixed_t ceilingheight = P_GetCeilingZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL); - if (player->mo->z <= player->mo->subsector->sector->floorheight) - player->mo->z = player->mo->subsector->sector->floorheight; + player->mo->z += sinkspeed; + + if (player->mo->z + player->mo->height >= ceilingheight) + player->mo->z = ceilingheight - player->mo->height; + } + else + { + fixed_t floorheight = P_GetFloorZ(player->mo, player->mo->subsector->sector, player->mo->x, player->mo->y, NULL); + + player->mo->z -= sinkspeed; + + if (player->mo->z <= floorheight) + player->mo->z = floorheight; + } friction = abs(rover->master->v1->y - rover->master->v2->y)>>6; From d21b091b967d2d76d259347e8f6da6dab620fc03 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Mon, 31 Oct 2016 22:14:34 +0000 Subject: [PATCH 012/124] * Slope/gravity support for quicksand complete. * Space sector support complete, bounds of drowning now altered slightly. * Knuckles climb now has symmetrical slope support for both normal and reverse gravity. * All slope-determining topheight and bottomheight code is now identical in form. * Camera postimages now support slopes properly. --- src/p_user.c | 89 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index f2f0cb77..621122e2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1607,9 +1607,8 @@ void P_DoPlayerExit(player_t *player) #define SPACESPECIAL 12 boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space { - sector_t *sector; - - sector = mo->subsector->sector; + sector_t *sector = mo->subsector->sector; + fixed_t topheight, bottomheight; if (GETSECSPECIAL(sector->special, 1) == SPACESPECIAL) return true; @@ -1622,11 +1621,18 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space { if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) continue; +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; +#else + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; +#endif - if (mo->z > *rover->topheight) + if (mo->z + (mo->height/2) > topheight) continue; - if (mo->z + (mo->height/2) < *rover->bottomheight) + if (mo->z + (mo->height/2) < bottomheight) continue; return true; @@ -1638,9 +1644,10 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand { - sector_t *sector; + sector_t *sector = mo->subsector->sector; + fixed_t topheight, bottomheight; - sector = mo->subsector->sector; + fixed_t flipoffset = ((mo->eflags & MFE_VERTICALFLIP) ? (mo->height/2) : 0); if (sector->ffloors) { @@ -1654,10 +1661,18 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand if (!(rover->flags & FF_QUICKSAND)) continue; - if (mo->z > *rover->topheight) +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight; +#else + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; +#endif + + if (mo->z + flipoffset > topheight) continue; - if (mo->z + (mo->height/2) < *rover->bottomheight) + if (mo->z + (mo->height/2) + flipoffset < bottomheight) continue; return true; @@ -1952,8 +1967,13 @@ static void P_CheckQuicksand(player_t *player) if (!(rover->flags & FF_QUICKSAND)) continue; - topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); - bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; +#else + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; +#endif if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) { @@ -2339,11 +2359,11 @@ static void P_DoClimbing(player_t *player) floorclimb = true; #ifdef ESLOPE - bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; #else - bottomheight = *rover->bottomheight; topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #endif // Only supports rovers that are moving like an 'elevator', not just the top or bottom. @@ -2532,13 +2552,20 @@ static void P_DoClimbing(player_t *player) // Is there a FOF directly below that we can move onto? if (glidesector->sector->ffloors) { + fixed_t topheight; ffloor_t *rover; for (rover = glidesector->sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; +#else + topheight = *rover->topheight; +#endif + + if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) { foundfof = true; break; @@ -2916,14 +2943,12 @@ static void P_DoTeeter(player_t *player) { if (!(rover->flags & FF_EXISTS)) continue; +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; +#else topheight = *rover->topheight; bottomheight = *rover->bottomheight; - -#ifdef ESLOPE - if (*rover->t_slope) - topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); - if (*rover->b_slope) - bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); #endif if (P_CheckSolidLava(player->mo, rover, sec)) @@ -8549,13 +8574,23 @@ static void P_CalcPostImg(player_t *player) else if (sector->ffloors) { ffloor_t *rover; + fixed_t topheight; + fixed_t bottomheight; for (rover = sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS)) continue; - if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; +#else + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; +#endif + + if (pviewheight >= topheight || pviewheight <= bottomheight) continue; if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) @@ -8567,13 +8602,23 @@ static void P_CalcPostImg(player_t *player) if (sector->ffloors) { ffloor_t *rover; + fixed_t topheight; + fixed_t bottomheight; for (rover = sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER) continue; - if (pviewheight >= *rover->topheight || pviewheight <= *rover->bottomheight) +#ifdef ESLOPE + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; +#else + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; +#endif + + if (pviewheight >= topheight || pviewheight <= bottomheight) continue; *type = postimg_water; From 7b12820c8298a2abfeb11e3c3f7c3e09839e5840 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 2 Nov 2016 20:32:36 +0000 Subject: [PATCH 013/124] Tweaked P_CheckSolidLava to avoid changing its function signature, and P_CanRunOnWater now supports slopes too. --- src/lua_baselib.c | 5 +---- src/p_local.h | 2 +- src/p_mobj.c | 30 ++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 00a51927..e8e8fd02 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -560,15 +560,12 @@ static int lib_pCheckSolidLava(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); - sector_t *bound = *((sector_t **)luaL_checkudata(L, 3, META_SECTOR)); //HUDSAFE if (!mo) return LUA_ErrInvalid(L, "mobj_t"); if (!rover) return LUA_ErrInvalid(L, "ffloor_t"); - if (!bound) - return LUA_ErrInvalid(L, "sector_t"); - lua_pushboolean(L, P_CheckSolidLava(mo, rover, bound)); + lua_pushboolean(L, P_CheckSolidLava(mo, rover)); return 1; } diff --git a/src/p_local.h b/src/p_local.h index ce6aed02..1fd7ada0 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -238,7 +238,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover, sector_t *bound); +boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); diff --git a/src/p_mobj.c b/src/p_mobj.c index 4f0c8403..6ad84de3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1983,7 +1983,7 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL); bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL); - if (mo->player && (P_CheckSolidLava(mo, rover, sector) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected + if (mo->player && (P_CheckSolidLava(mo, rover) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected ; else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only continue; @@ -2133,15 +2133,23 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) return false; } -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover, sector_t *bound) +boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover) { I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); - if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 - && !(rover->master->flags & ML_BLOCKMONSTERS) - && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > P_GetSpecialTopZ(mo, rover->master->frontsector, bound) - FixedMul(16*FRACUNIT, mo->scale))) - return true; + { + fixed_t topheight = + #ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : + #endif + *rover->topheight; + + if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 + && !(rover->master->flags & ML_BLOCKMONSTERS) + && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale))) + return true; + } return false; } @@ -3076,11 +3084,17 @@ static boolean P_SceneryZMovement(mobj_t *mo) // boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) { + fixed_t topheight = +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : +#endif + *rover->topheight; + if (!(player->pflags & PF_NIGHTSMODE) && !player->homing - && (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-*rover->topheight >= player->mo->height) + && (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-topheight >= player->mo->height) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && !(player->pflags & PF_SLIDING) - && abs(player->mo->z - *rover->topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) + && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) return true; return false; From e67f48df83cd82bc67a0d24fc00333e5d2bba62f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 2 Nov 2016 20:35:53 +0000 Subject: [PATCH 014/124] Forgot to revert the other files. --- src/p_map.c | 2 +- src/p_maputl.c | 4 ++-- src/p_user.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7b542660..6a555953 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1323,7 +1323,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) continue; } - if (thing->player && (P_CheckSolidLava(thing, rover, newsubsec->sector) || P_CanRunOnWater(thing->player, rover))) + if (thing->player && (P_CheckSolidLava(thing, rover) || P_CanRunOnWater(thing->player, rover))) ; else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)) ; diff --git a/src/p_maputl.c b/src/p_maputl.c index 3aa9a994..fea8530a 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -646,7 +646,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover, front) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) @@ -690,7 +690,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover, back) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) diff --git a/src/p_user.c b/src/p_user.c index 621122e2..56ecdf80 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2951,7 +2951,7 @@ static void P_DoTeeter(player_t *player) bottomheight = *rover->bottomheight; #endif - if (P_CheckSolidLava(player->mo, rover, sec)) + if (P_CheckSolidLava(player->mo, rover)) ; else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) continue; // intangible 3d floor From 77399b8fb97711ca9fce68a093a247e9834a5579 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 6 Dec 2016 21:49:59 +0000 Subject: [PATCH 015/124] * Disabled #define SECTORSPECIALSAFTERTHINK. This did not need to be done in next, since it could have subtle consequences which we'd rather not deal with in the hyperextended patch cycle as-is. * Removed the adding of SF_TRIGGERSPECIAL_TOUCH for sectors with slopes in them. Too many undesired consequences, I'll handle them another way. --- src/doomdef.h | 2 +- src/p_slopes.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index f993dadf..bccf433b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -500,6 +500,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink. /// \note Required for proper collision with moving sloped surfaces that have sector specials on them. -#define SECTORSPECIALSAFTERTHINK +//#define SECTORSPECIALSAFTERTHINK #endif // __DOOMDEF__ diff --git a/src/p_slopes.c b/src/p_slopes.c index c127001c..d939fee9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -281,7 +281,6 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor || frontceil) { line->frontsector->hasslope = true; // Tell the software renderer that we're sloped - line->frontsector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact origin.z = line->backsector->floorheight; direction.x = nx; @@ -408,7 +407,6 @@ void P_SpawnSlope_Line(int linenum) if(backfloor || backceil) { line->backsector->hasslope = true; // Tell the software renderer that we're sloped - line->backsector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact origin.z = line->frontsector->floorheight; // Backsector @@ -601,7 +599,6 @@ void P_CopySectorSlope(line_t *line) } fsec->hasslope = true; - fsec->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } @@ -721,7 +718,6 @@ void P_ResetDynamicSlopes(void) { *slopetoset = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags); sides[lines[i].sidenum[which]].sector->hasslope = true; - sides[lines[i].sidenum[which]].sector->flags |= SF_TRIGGERSPECIAL_TOUCH; // you're gonna want to get specials on contact } break; From fca88d2e98da1c73c04d460b372ae4e336084ffe Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 8 Jan 2017 13:54:52 -0500 Subject: [PATCH 016/124] Mingw: disable GetText support --- src/Makefile.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 72404bec..3630c636 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -328,7 +328,7 @@ ifdef MINGW INTERFACE=win32 NASMFORMAT=win32 ifndef NOGETTEXT - GETTEXT=1 + #GETTEXT=1 endif OBJDIR:=$(OBJDIR)/Mingw BIN:=$(BIN)/Mingw From 55925cabe829156847a27cb3a77d0d3609fa7dc5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 8 Jan 2017 14:06:30 -0500 Subject: [PATCH 017/124] win32: fixup printf warnings --- src/win32/win_cd.c | 4 ++-- src/win32/win_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/win32/win_cd.c b/src/win32/win_cd.c index d73b9552..ae13d3e5 100644 --- a/src/win32/win_cd.c +++ b/src/win32/win_cd.c @@ -180,9 +180,9 @@ static LPSTR hms(UINT seconds) hours = minutes / 60; minutes %= 60; if (hours > 0) - sprintf (s, "%lu:%02lu:%02lu", hours, minutes, seconds); + sprintf (s, "%lu:%02lu:%02lu", (long unsigned int)hours, (long unsigned int)minutes, (long unsigned int)seconds); else - sprintf (s, "%2lu:%02lu", minutes, seconds); + sprintf (s, "%2lu:%02lu", (long unsigned int)minutes, (long unsigned int)seconds); return s; } diff --git a/src/win32/win_main.c b/src/win32/win_main.c index 663eddbd..563466dc 100644 --- a/src/win32/win_main.c +++ b/src/win32/win_main.c @@ -470,7 +470,7 @@ static inline BOOL tlErrorMessage(const TCHAR *err) // // warn user if there is one // - printf("Error %Ts..\n", err); + printf("Error %s..\n", err); fflush(stdout); MessageBox(hWndMain, err, TEXT("ERROR"), MB_OK); From 377fc814479f768558114960c5bc8557195b1f01 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 13 May 2017 12:07:37 -0400 Subject: [PATCH 018/124] Appveyor: disable deployment --- appveyor.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 76e1261f..75f3b3ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -63,21 +63,21 @@ after_build: test: off -deploy: - - provider: FTP - protocol: ftps - host: - secure: NsLJEPIBvmwCOj8Tg8RoRQ== - username: - secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= - password: - secure: Hbn6Uy3lT0YZ88yFJ3aW4w== - folder: appveyor - application: - active_mode: false - on: - branch: master - appveyor_repo_tag: true +#deploy: +# - provider: FTP +# protocol: ftps +# host: +# secure: NsLJEPIBvmwCOj8Tg8RoRQ== +# username: +# secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= +# password: +# secure: Hbn6Uy3lT0YZ88yFJ3aW4w== +# folder: appveyor +# application: +# active_mode: false +# on: +# branch: master +# appveyor_repo_tag: true on_finish: From 7d4146870a8b7dd1484af3c8650a2f8979dc79f4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 13 May 2017 12:13:47 -0400 Subject: [PATCH 019/124] Appveyor: keep a stable name version of the archive --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 75f3b3ab..c1f6894e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,8 +58,11 @@ after_build: - cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt - cmd: set /P GITSHORT=<%TMP%/gitshort.txt - set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%-%CONFIGURATION%.7z +- set BUILDSARCHIVE=%APPVEYOR_REPO_BRANCH%-%CONFIGURATION%.7z - cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore - appveyor PushArtifact %BUILD_ARCHIVE% +- cmd: copy %BUILD_ARCHIVE% %BUILDSARCHIVE% +- appveyor PushArtifact %BUILDSARCHIVE% test: off From bdcd9125d299cb59c0d3a49be5b2ce0da0f4195c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 14 May 2017 14:47:09 +0100 Subject: [PATCH 020/124] Fixed that thing where missiles like sliding up slopes for some reason. This isn't a 1:1 fix for non-slopes - they still like stepping up over the borders of sloped sectors - but this fixes the most egregrious issue. --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index fb864801..82640abc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2363,7 +2363,7 @@ static boolean P_ZMovement(mobj_t *mo) mo->z = mo->floorz; #ifdef ESLOPE - if (mo->standingslope) // You're still on the ground; why are we here? + if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here? { mo->momz = 0; return true; From 222807c6f62d73e60c33f1d229f8c7678273b562 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 14:29:31 +0100 Subject: [PATCH 021/124] Fix R_InitExtraColormaps reporting 6 or more colormaps every time you loaded the game, even though we haven't used C_START/C_END in more than a decade now Note to self: W_ functions are awfully confusing with returning with LUMPERROR or INT16_MAX. Should sort out what's going on there if necessary --- src/r_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index 7bad6bb8..4066ca64 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -944,12 +944,12 @@ static void R_InitExtraColormaps(void) for (cfile = clump = 0; cfile < numwadfiles; cfile++, clump = 0) { startnum = W_CheckNumForNamePwad("C_START", cfile, clump); - if (startnum == LUMPERROR) + if (startnum == INT16_MAX) continue; endnum = W_CheckNumForNamePwad("C_END", cfile, clump); - if (endnum == LUMPERROR) + if (endnum == INT16_MAX) I_Error("R_InitExtraColormaps: C_START without C_END\n"); if (WADFILENUM(startnum) != WADFILENUM(endnum)) From f8482421e5dd1666a61e4901b988a62829b1c2d7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 14:38:55 +0100 Subject: [PATCH 022/124] Don't need to use WADFILENUM/LUMPNUM in this function, since W_CheckNumForNamePwad returns just the lump number, not a combined WAD + lump number frankenstein's monster This is just in case someone actually tries to dump in C_START/C_END and "add" colormaps using them, not that they would ever be used currently anyway. --- src/r_data.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index 4066ca64..d19882dd 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -952,15 +952,16 @@ static void R_InitExtraColormaps(void) if (endnum == INT16_MAX) I_Error("R_InitExtraColormaps: C_START without C_END\n"); - if (WADFILENUM(startnum) != WADFILENUM(endnum)) - I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n"); + // This shouldn't be possible when you use the Pwad function, silly + //if (WADFILENUM(startnum) != WADFILENUM(endnum)) + //I_Error("R_InitExtraColormaps: C_START and C_END in different wad files!\n"); if (numcolormaplumps >= maxcolormaplumps) maxcolormaplumps *= 2; colormaplumps = Z_Realloc(colormaplumps, sizeof (*colormaplumps) * maxcolormaplumps, PU_STATIC, NULL); - colormaplumps[numcolormaplumps].wadfile = WADFILENUM(startnum); - colormaplumps[numcolormaplumps].firstlump = LUMPNUM(startnum+1); + colormaplumps[numcolormaplumps].wadfile = cfile; + colormaplumps[numcolormaplumps].firstlump = startnum+1; colormaplumps[numcolormaplumps].numlumps = endnum - (startnum + 1); numcolormaplumps++; } From 093800cb06be63040368adbf4579af0738ae97a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 15:24:40 +0100 Subject: [PATCH 023/124] I_FinishUpdate: OglSdlFinishUpdate should never run for render_soft, even if screens[0] somehow is NULL --- src/sdl/i_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index aa572e6e..73bbe8ac 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -931,7 +931,7 @@ void I_FinishUpdate(void) if (cv_ticrate.value) SCR_DisplayTicRate(); - if (render_soft == rendermode && screens[0]) + if (rendermode == render_soft && screens[0]) { SDL_Rect rect; @@ -958,7 +958,7 @@ void I_FinishUpdate(void) } #ifdef HWRENDER - else + else if (rendermode == render_opengl) { OglSdlFinishUpdate(cv_vidwait.value); } From d1bbd1261e7f3b3dbdbbe9951ae007fa120d0df0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 15:36:51 +0100 Subject: [PATCH 024/124] VID_SetMode: SDLSetMode should use vid.width/vid.height, not windowedModes[modeNum]. If modenum was < 0 or >= MAXWINMODES, that would make windowedModes[modeNum] be out of bounds and possibly crash the game. --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 73bbe8ac..43a293ae 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1188,7 +1188,7 @@ INT32 VID_SetMode(INT32 modeNum) } Impl_SetWindowName("SRB2 "VERSIONSTRING); - SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN); + SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); if (render_soft == rendermode) { From 4979ab6b8ec0de1e684ff87a00978b0fab87df51 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 15:43:31 +0100 Subject: [PATCH 025/124] Not really important or anything, but checking render_soft == rendermode rather than rendermode == render_soft always bugged me. And it's not consistent with the rest of the source code (or at least most of it) anyway. --- src/sdl/i_video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 43a293ae..2df4d527 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -899,7 +899,7 @@ static inline boolean I_SkipFrame(void) { static boolean skip = false; - if (render_soft != rendermode) + if (rendermode != render_soft) return false; skip = !skip; @@ -1190,7 +1190,7 @@ INT32 VID_SetMode(INT32 modeNum) SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); - if (render_soft == rendermode) + if (rendermode == render_soft) { if (bufSurface) { @@ -1483,7 +1483,7 @@ void I_ShutdownGraphics(void) rendermode = render_none; if (icoSurface) SDL_FreeSurface(icoSurface); icoSurface = NULL; - if (render_soft == oldrendermode) + if (oldrendermode == render_soft) { if (vidSurface) SDL_FreeSurface(vidSurface); vidSurface = NULL; From a340f2c8edec7c9e2e84f5aef4372f2423923c5c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 16:19:28 +0100 Subject: [PATCH 026/124] Impl_CreateWindow: re-use "flags" for SDL_RENDERER_* flags, remove unnecessary curly braces --- src/sdl/i_video.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2df4d527..5602ed04 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1209,30 +1209,20 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) int flags = 0; if (rendermode == render_none) // dedicated - { return SDL_TRUE; // Monster Iestyn -- not sure if it really matters what we return here tbh - } if (window != NULL) - { return SDL_FALSE; - } if (fullscreen) - { flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - } if (borderlesswindow) - { flags |= SDL_WINDOW_BORDERLESS; - } #ifdef HWRENDER if (rendermode == render_opengl) - { flags |= SDL_WINDOW_OPENGL; - } #endif // Create a window @@ -1261,7 +1251,13 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #endif if (rendermode == render_soft) { - renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0)); + flags = 0; // Use this to set SDL_RENDERER_* flags now + if (usesdl2soft) + flags |= SDL_RENDERER_SOFTWARE; + else if (cv_vidwait.value) + flags |= SDL_RENDERER_PRESENTVSYNC; + + renderer = SDL_CreateRenderer(window, -1, flags); if (renderer == NULL) { CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError()); From 87085f2475ff5b699a1f95221b73e2e7fc81f5f6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 16:35:32 +0100 Subject: [PATCH 027/124] SDLSetMode: merge wasfullscreen/windowed mode code into one block --- src/sdl/i_video.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 5602ed04..ec9b901c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -181,15 +181,13 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) wasfullscreen = SDL_TRUE; SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); } - else if (wasfullscreen) - { - wasfullscreen = SDL_FALSE; - SDL_SetWindowFullscreen(window, 0); - SDL_SetWindowSize(window, width, height); - SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1)); - } - else + else // windowed mode { + if (wasfullscreen) + { + wasfullscreen = SDL_FALSE; + SDL_SetWindowFullscreen(window, 0); + } // Reposition window only in windowed mode SDL_SetWindowSize(window, width, height); SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED_DISPLAY(1), SDL_WINDOWPOS_CENTERED_DISPLAY(1)); From 17a06dd6c4875f562bbb33ddb6ddb0fa37d8428b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 15 May 2017 18:39:59 +0100 Subject: [PATCH 028/124] I_GetConsoleEvents: Split KEY_EVENT code into a function of its own, like with I_GetEvent's event types One benefit of this is that event_t data need only be created if KEY_EVENT is found, since the other event types never do anything anyway --- src/sdl/i_system.c | 112 ++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 71ee3f79..f72a9857 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -590,70 +590,78 @@ static BOOL I_ReadyConsole(HANDLE ci) static boolean entering_con_command = false; +static void Impl_HandleKeyboardConsoleEvent(KEY_EVENT_RECORD evt, HANDLE co) +{ + event_t event; + CONSOLE_SCREEN_BUFFER_INFO CSBI; + DWORD t; + + memset(&event,0x00,sizeof (event)); + + if (evt.bKeyDown) + { + event.type = ev_console; + entering_con_command = true; + switch (evt.wVirtualKeyCode) + { + case VK_ESCAPE: + case VK_TAB: + event.data1 = KEY_NULL; + break; + case VK_SHIFT: + event.data1 = KEY_LSHIFT; + break; + case VK_RETURN: + entering_con_command = false; + // Fall through. + default: + event.data1 = MapVirtualKey(evt.wVirtualKeyCode,2); // convert in to char + } + if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t)) + { + if (event.data1 && event.data1 != KEY_LSHIFT && event.data1 != KEY_RSHIFT) + { +#ifdef _UNICODE + WriteConsole(co, &evt.uChar.UnicodeChar, 1, &t, NULL); +#else + WriteConsole(co, &evt.uChar.AsciiChar, 1 , &t, NULL); +#endif + } + if (evt.wVirtualKeyCode == VK_BACK + && GetConsoleScreenBufferInfo(co,&CSBI)) + { + WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t); + } + } + } + else + { + event.type = ev_keyup; + switch (evt.wVirtualKeyCode) + { + case VK_SHIFT: + event.data1 = KEY_LSHIFT; + break; + default: + break; + } + } + if (event.data1) D_PostEvent(&event); +} + void I_GetConsoleEvents(void) { - event_t ev = {0,0,0,0}; HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO CSBI; INPUT_RECORD input; DWORD t; while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t) { - memset(&ev,0x00,sizeof (ev)); switch (input.EventType) { case KEY_EVENT: - if (input.Event.KeyEvent.bKeyDown) - { - ev.type = ev_console; - entering_con_command = true; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_ESCAPE: - case VK_TAB: - ev.data1 = KEY_NULL; - break; - case VK_SHIFT: - ev.data1 = KEY_LSHIFT; - break; - case VK_RETURN: - entering_con_command = false; - // Fall through. - default: - ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char - } - if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t)) - { - if (ev.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != KEY_RSHIFT) - { -#ifdef _UNICODE - WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL); -#else - WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1 , &t, NULL); -#endif - } - if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK - && GetConsoleScreenBufferInfo(co,&CSBI)) - { - WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t); - } - } - } - else - { - ev.type = ev_keyup; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_SHIFT: - ev.data1 = KEY_LSHIFT; - break; - default: - break; - } - } - if (ev.data1) D_PostEvent(&ev); + Impl_HandleKeyboardConsoleEvent(input.Event.KeyEvent, co); break; case MOUSE_EVENT: case WINDOW_BUFFER_SIZE_EVENT: From 5a1fc6098ed84aa82bc73afa2640840d17a0845f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 19 May 2017 11:25:28 +0100 Subject: [PATCH 029/124] Attempts to prevent stupid stuff from happening --- src/d_clisrv.c | 7 ++++++- src/d_net.c | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 939d53de..87e51b44 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3936,6 +3936,9 @@ FILESTAMP while (HGetPacket()) { + if (doomcom->remotenode == -1) // ...this should have been ignored already + continue; // might come from PT_NODETIMEOUT somehow though + node = (SINT8)doomcom->remotenode; if (netbuffer->packettype == PT_CLIENTJOIN && server) @@ -3968,8 +3971,10 @@ FILESTAMP if (netbuffer->packettype == PT_PLAYERINFO) continue; // We do nothing with PLAYERINFO, that's for the MS browser. + if (node < 0 || node >= MAXNETNODES) // THIS SHOULDN'T EVEN BE POSSIBLE + ; //CONS_Printf("Received packet from node %d!\n", (int)node); // Packet received from someone already playing - if (nodeingame[node]) + else if (nodeingame[node]) HandlePacketFromPlayer(node); // Packet received from someone not playing else diff --git a/src/d_net.c b/src/d_net.c index 70cdc5f1..68720f5e 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -711,6 +711,10 @@ void Net_CloseConnection(INT32 node) #else INT32 i; boolean forceclose = (node & FORCECLOSE) != 0; + + if (node == -1) + return; // nope, just ignore it + node &= ~FORCECLOSE; if (!node) @@ -718,7 +722,7 @@ void Net_CloseConnection(INT32 node) if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game { - CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); + //CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); return; } @@ -1128,6 +1132,9 @@ boolean HGetPacket(void) doomcom->remotenode = 0; rebound_tail = (rebound_tail+1) % MAXREBOUND; + + if (doomcom->remotenode == -1) // wait hang on what? + return true; // there might still be packets from others though, so don't return false #ifdef DEBUGFILE if (debugfile) DebugPrintpacket("GETLOCAL"); From 1078a642dfee676cf87fcb023d9b8889477ae959 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 19 May 2017 11:52:50 +0100 Subject: [PATCH 030/124] Loop through rebound packets until you found a good one or ran out of them --- src/d_net.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index 68720f5e..8f11f60f 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1124,22 +1124,27 @@ boolean HGetPacket(void) // Get a packet from self if (rebound_tail != rebound_head) { - M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]); - doomcom->datalength = reboundsize[rebound_tail]; - if (netbuffer->packettype == PT_NODETIMEOUT) - doomcom->remotenode = netbuffer->u.textcmd[0]; - else - doomcom->remotenode = 0; + while (true) // loop until we found a valid packet, or we ran out of packets + { // provided MAXREBOUND is not all that large this shouldn't take too long + if (rebound_tail == rebound_head) + break; // just give up, none of them were any good somehow + M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]); + doomcom->datalength = reboundsize[rebound_tail]; + if (netbuffer->packettype == PT_NODETIMEOUT) + doomcom->remotenode = netbuffer->u.textcmd[0]; + else + doomcom->remotenode = 0; - rebound_tail = (rebound_tail+1) % MAXREBOUND; + rebound_tail = (rebound_tail+1) % MAXREBOUND; - if (doomcom->remotenode == -1) // wait hang on what? - return true; // there might still be packets from others though, so don't return false + if (doomcom->remotenode == -1) // wait hang on what? + continue; // ignore it, look for the next packet #ifdef DEBUGFILE - if (debugfile) - DebugPrintpacket("GETLOCAL"); + if (debugfile) + DebugPrintpacket("GETLOCAL"); #endif - return true; + return true; + } } if (!netgame) From 284e539c66817d2448781a29024818d1c620a29c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 19 May 2017 16:31:23 +0100 Subject: [PATCH 031/124] Don't bail out in Y_StartIntermission in dedicated mode, this causes the game not to add on score bonuses for players from the server's view of things! --- 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 b2e1cdf9..2fd37ff3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -965,7 +965,8 @@ void Y_StartIntermission(void) } // We couldn't display the intermission even if we wanted to. - if (dedicated) return; + // But we still need to give the players their score bonuses, dummy. + //if (dedicated) return; // This should always exist, but just in case... if(!mapheaderinfo[prevmap]) From 5aeb4b591949399676d0e5e3e358e539115f0e43 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 20 May 2017 21:29:05 +0100 Subject: [PATCH 032/124] Revert "Loop through rebound packets until you found a good one or ran out of them" On second thought, this was probably unnecessary anyway. This reverts commit 1078a642dfee676cf87fcb023d9b8889477ae959. --- src/d_net.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index 8f11f60f..68720f5e 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1124,27 +1124,22 @@ boolean HGetPacket(void) // Get a packet from self if (rebound_tail != rebound_head) { - while (true) // loop until we found a valid packet, or we ran out of packets - { // provided MAXREBOUND is not all that large this shouldn't take too long - if (rebound_tail == rebound_head) - break; // just give up, none of them were any good somehow - M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]); - doomcom->datalength = reboundsize[rebound_tail]; - if (netbuffer->packettype == PT_NODETIMEOUT) - doomcom->remotenode = netbuffer->u.textcmd[0]; - else - doomcom->remotenode = 0; + M_Memcpy(netbuffer, &reboundstore[rebound_tail], reboundsize[rebound_tail]); + doomcom->datalength = reboundsize[rebound_tail]; + if (netbuffer->packettype == PT_NODETIMEOUT) + doomcom->remotenode = netbuffer->u.textcmd[0]; + else + doomcom->remotenode = 0; - rebound_tail = (rebound_tail+1) % MAXREBOUND; + rebound_tail = (rebound_tail+1) % MAXREBOUND; - if (doomcom->remotenode == -1) // wait hang on what? - continue; // ignore it, look for the next packet + if (doomcom->remotenode == -1) // wait hang on what? + return true; // there might still be packets from others though, so don't return false #ifdef DEBUGFILE - if (debugfile) - DebugPrintpacket("GETLOCAL"); + if (debugfile) + DebugPrintpacket("GETLOCAL"); #endif - return true; - } + return true; } if (!netgame) From 247ed56e1790caa0a69f9f1027dfcb0d0fb5b8e8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 May 2017 16:44:50 +0100 Subject: [PATCH 033/124] Don't allow nonsense PT_ASKINFOVIAMS packets, nor any at all if offline --- src/d_clisrv.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 87e51b44..09843023 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3405,13 +3405,23 @@ static void HandlePacketFromAwayNode(SINT8 node) switch (netbuffer->packettype) { case PT_ASKINFOVIAMS: + if (ms_RoomId < 0) // ignore if we're not actually on the MS right now + { + Net_CloseConnection(node); // and yes, close connection + break; + } if (server && serverrunning) { INT32 clientnode = I_NetMakeNode(netbuffer->u.msaskinfo.clientaddr); - SV_SendServerInfo(clientnode, (tic_t)LONG(netbuffer->u.msaskinfo.time)); - SV_SendPlayerInfo(clientnode); // Send extra info - Net_CloseConnection(clientnode); - // Don't close connection to MS. + if (clientnode != -1) + { + SV_SendServerInfo(clientnode, (tic_t)LONG(netbuffer->u.msaskinfo.time)); + SV_SendPlayerInfo(clientnode); // Send extra info + Net_CloseConnection(clientnode); + // Don't close connection to MS... + } + else + Net_CloseConnection(node); // ...unless the IP address is not valid } break; From 28444c12dd6d57ae43d08186a40dd5b5e8b43019 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 May 2017 16:54:39 +0100 Subject: [PATCH 034/124] Some more things I overlooked in this fix --- src/d_clisrv.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 09843023..17f0b774 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3405,14 +3405,16 @@ static void HandlePacketFromAwayNode(SINT8 node) switch (netbuffer->packettype) { case PT_ASKINFOVIAMS: - if (ms_RoomId < 0) // ignore if we're not actually on the MS right now - { - Net_CloseConnection(node); // and yes, close connection - break; - } + if (server && serverrunning) { - INT32 clientnode = I_NetMakeNode(netbuffer->u.msaskinfo.clientaddr); + INT32 clientnode; + if (ms_RoomId < 0) // ignore if we're not actually on the MS right now + { + Net_CloseConnection(node); // and yes, close connection + return; + } + clientnode = I_NetMakeNode(netbuffer->u.msaskinfo.clientaddr); if (clientnode != -1) { SV_SendServerInfo(clientnode, (tic_t)LONG(netbuffer->u.msaskinfo.time)); @@ -3423,6 +3425,8 @@ static void HandlePacketFromAwayNode(SINT8 node) else Net_CloseConnection(node); // ...unless the IP address is not valid } + else + Net_CloseConnection(node); // you're not supposed to get it, so ignore it break; case PT_ASKINFO: From 3784d765e493d7820f7dd37b5d4c3c66ef7a3f8a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 May 2017 20:47:38 +0100 Subject: [PATCH 035/124] Remove extra whitespace I added --- src/d_clisrv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 17f0b774..36b03be6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3405,7 +3405,6 @@ static void HandlePacketFromAwayNode(SINT8 node) switch (netbuffer->packettype) { case PT_ASKINFOVIAMS: - if (server && serverrunning) { INT32 clientnode; From c70839334e180869279c84f5d40360afdcc43bdc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 May 2017 22:17:51 +0100 Subject: [PATCH 036/124] Added a bunch of missing checks to prevent non-server players from sending other non-server players stuff --- src/d_clisrv.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 36b03be6..c6b8bbd6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3433,8 +3433,8 @@ static void HandlePacketFromAwayNode(SINT8 node) { SV_SendServerInfo(node, (tic_t)LONG(netbuffer->u.askinfo.time)); SV_SendPlayerInfo(node); // Send extra info - Net_CloseConnection(node); } + Net_CloseConnection(node); break; case PT_SERVERREFUSE: // Negative response of client join request @@ -3443,6 +3443,11 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } + if (node != servernode) // nope you're not the server + { + Net_CloseConnection(node); + break; + } if (cl_mode == CL_WAITJOINRESPONSE) { // Save the reason so it can be displayed after quitting the netgame @@ -3474,6 +3479,11 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } + if (node != servernode) // nope you're not the server + { + Net_CloseConnection(node); + break; + } /// \note how would this happen? and is it doing the right thing if it does? if (cl_mode != CL_WAITJOINRESPONSE) break; @@ -3537,11 +3547,20 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } - else - Got_Filetxpak(); + if (node != servernode) // nope you're not the server + { + Net_CloseConnection(node); + break; + } + Got_Filetxpak(); break; case PT_REQUESTFILE: + if (node != servernode) // nope you're not the server + { + Net_CloseConnection(node); + break; + } if (server) Got_RequestFilePak(node); break; @@ -3926,6 +3945,21 @@ FILESTAMP case PT_SERVERCFG: break; case PT_FILEFRAGMENT: + // Only accept PT_FILEFRAGMENT from the server. + if (node != servernode) + { + CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_FILEFRAGMENT", node); + + if (server) + { + XBOXSTATIC UINT8 buf[2]; + buf[0] = (UINT8)node; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + + break; + } if (client) Got_Filetxpak(); break; From fdfd6e1c0bbce1c7c584a906a7b51f7907eba5bb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 22 May 2017 22:20:08 +0100 Subject: [PATCH 037/124] Whoops don't do that for PT_REQUESTFILE --- src/d_clisrv.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c6b8bbd6..76262461 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3556,11 +3556,6 @@ static void HandlePacketFromAwayNode(SINT8 node) break; case PT_REQUESTFILE: - if (node != servernode) // nope you're not the server - { - Net_CloseConnection(node); - break; - } if (server) Got_RequestFilePak(node); break; From 9e3bdc5ee229c061db3550eda3c4cf1c7e4a35fb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 May 2017 16:13:42 +0100 Subject: [PATCH 038/124] Prevent bad PT_TEXTCMD/PT_TEXTCMD2 textcmd[0] sizes? --- src/d_clisrv.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 76262461..4700fcb8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3737,6 +3737,15 @@ FILESTAMP tic_t tic = maketic; UINT8 *textcmd; + // ignore if the textcmd size var is actually larger than it should be + if (BASEPACKETSIZE + netbuffer->u.textcmd[0] > (size_t)doomcom->datalength) + { + DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %d)\n", + BASEPACKETSIZE + netbuffer->u.textcmd[0], doomcom->datalength)); + Net_UnAcknowledgePacket(node); + break; + } + // check if tic that we are making isn't too large else we cannot send it :( // doomcom->numslots+1 "+1" since doomcom->numslots can change within this time and sent time j = software_MAXPACKETLENGTH From ff1cc07a1d20989c0271dc8c875a4d3b248aea94 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 May 2017 16:29:09 +0100 Subject: [PATCH 039/124] Implemented toaster's suggestion to make a macro here --- src/d_clisrv.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4700fcb8..246642b9 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3402,6 +3402,14 @@ static void HandlePacketFromAwayNode(SINT8 node) if (node != servernode) DEBFILE(va("Received packet from unknown host %d\n", node)); +// macro for packets that should only be sent by the server +// if it is NOT from the server, bail out and close the connection! +#define SERVERONLY \ + if (node != servernode) \ + { \ + Net_CloseConnection(node); \ + break; \ + } switch (netbuffer->packettype) { case PT_ASKINFOVIAMS: @@ -3443,11 +3451,7 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } - if (node != servernode) // nope you're not the server - { - Net_CloseConnection(node); - break; - } + SERVERONLY if (cl_mode == CL_WAITJOINRESPONSE) { // Save the reason so it can be displayed after quitting the netgame @@ -3479,11 +3483,7 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } - if (node != servernode) // nope you're not the server - { - Net_CloseConnection(node); - break; - } + SERVERONLY /// \note how would this happen? and is it doing the right thing if it does? if (cl_mode != CL_WAITJOINRESPONSE) break; @@ -3547,11 +3547,7 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; } - if (node != servernode) // nope you're not the server - { - Net_CloseConnection(node); - break; - } + SERVERONLY Got_Filetxpak(); break; @@ -3580,6 +3576,7 @@ static void HandlePacketFromAwayNode(SINT8 node) break; // Ignore it } +#undef SERVERONLY } /** Handles a packet received from a node that is in game From 0b0b738a6f8af4ceb95c05de44f42da11b550408 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 May 2017 16:34:56 +0100 Subject: [PATCH 040/124] Don't allow non-servers to receive PT_RESYNCHGET --- src/d_clisrv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 246642b9..186c25e6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3609,6 +3609,8 @@ FILESTAMP { // -------------------------------------------- SERVER RECEIVE ---------- case PT_RESYNCHGET: + if (client) + break; SV_AcknowledgeResynchAck(netconsole, netbuffer->u.resynchgot); break; case PT_CLIENTCMD: From 7147e0fcafcdf89f65bb2e909e94ea575cdbc3d9 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 May 2017 17:35:32 +0100 Subject: [PATCH 041/124] Improve previous PT_TEXTCMD/PT_TEXTCMD2 check, add another one to ignore zero size textcmds! --- src/d_clisrv.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 186c25e6..a42fcf1d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3736,11 +3736,23 @@ FILESTAMP tic_t tic = maketic; UINT8 *textcmd; - // ignore if the textcmd size var is actually larger than it should be - if (BASEPACKETSIZE + netbuffer->u.textcmd[0] > (size_t)doomcom->datalength) + // ignore if the textcmd has a reported size of zero + // this shouldn't be sent at all + if (!netbuffer->u.textcmd[0]) { - DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %d)\n", - BASEPACKETSIZE + netbuffer->u.textcmd[0], doomcom->datalength)); + DEBFILE(va("GetPacket: Textcmd with size 0 detected! (node %u, player %d)\n", + node, netconsole)); + Net_UnAcknowledgePacket(node); + break; + } + + // ignore if the textcmd size var is actually larger than it should be + // BASEPACKETSIZE + 1 (for size) + textcmd[0] should == datalength + if (netbuffer->u.textcmd[0] > (size_t)doomcom->datalength-BASEPACKETSIZE-1) + { + DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %d, node %u, player %d)\n", + netbuffer->u.textcmd[0], (size_t)doomcom->datalength-BASEPACKETSIZE-1, + node, netconsole)); Net_UnAcknowledgePacket(node); break; } From c92aaa74a41e3ad2477b564eaa9bfe086b518450 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 23 May 2017 18:46:34 +0100 Subject: [PATCH 042/124] I think PT_CLIENT2MIS was meant to do this too, probably --- src/d_clisrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a42fcf1d..27fcd067 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3677,7 +3677,8 @@ FILESTAMP } // Splitscreen cmd - if (netbuffer->packettype == PT_CLIENT2CMD && nodetoplayer2[node] >= 0) + if ((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS) + && nodetoplayer2[node] >= 0) G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]], &netbuffer->u.client2pak.cmd2, 1); From 2aa1215716c28f06a5be7cc3aefc2e7626d22e2c Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 25 May 2017 15:22:32 +0100 Subject: [PATCH 043/124] Fix a thing where the host adds a WAD and you have too many WADs loaded to add it. --- src/d_netcmd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 478772ed..0434e7e4 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3180,10 +3180,15 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) ncs = findfile(filename,md5sum,true); - if (ncs != FS_FOUND) + if (ncs != FS_FOUND || !P_AddWadFile(filename, NULL)) { Command_ExitGame_f(); - if (ncs == FS_NOTFOUND) + if (ncs == FS_FOUND) + { + CONS_Printf(M_GetText("The server tried to add %s,\nbut you have too many files added.\nRestart the game to clear loaded files\nand play on this server."), filename); + M_StartMessage(va("The server added a file \n(%s)\nbut you have too many files added.\nRestart the game to clear loaded files.\n\nPress ESC\n",filename), NULL, MM_NOTHING); + } + else if (ncs == FS_NOTFOUND) { CONS_Printf(M_GetText("The server tried to add %s,\nbut you don't have this file.\nYou need to find it in order\nto play on this server."), filename); M_StartMessage(va("The server added a file \n(%s)\nthat you do not have.\n\nPress ESC\n",filename), NULL, MM_NOTHING); @@ -3201,7 +3206,6 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) return; } - P_AddWadFile(filename, NULL); G_SetGameModified(true); } From 5c302d7ffcdce40003016b2fc4cb81a35606c252 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 25 May 2017 15:34:21 +0100 Subject: [PATCH 044/124] Partial implementation of fix for Got_RequestAddfilecmd (the other half - the limitation on the size of the filesneeded section of the serverinfo packet - will be applied in internal.) --- src/d_netcmd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 0434e7e4..f4916756 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3078,6 +3078,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) filestatus_t ncs = FS_NOTFOUND; UINT8 md5sum[16]; boolean kick = false; + boolean toomany = false; INT32 i; READSTRINGN(*cp, filename, 240); @@ -3104,13 +3105,18 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) return; } - ncs = findfile(filename,md5sum,true); + if (numwadfiles >= MAX_WADFILES) // a more comprehensive check in internal; bare minimum of out-of-bounds for public next + toomany = true; + else + ncs = findfile(filename,md5sum,true); - if (ncs != FS_FOUND) + if (ncs != FS_FOUND || toomany) { char message[256]; - if (ncs == FS_NOTFOUND) + if (toomany) + sprintf(message, M_GetText("Too many files loaded to add %s\n"), filename); + else if (ncs == FS_NOTFOUND) sprintf(message, M_GetText("The server doesn't have %s\n"), filename); else if (ncs == FS_MD5SUMBAD) sprintf(message, M_GetText("Checksum mismatch on %s\n"), filename); From 47e171250f88c4d12f4b594213e159d01d592d1b Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 25 May 2017 16:06:39 +0100 Subject: [PATCH 045/124] * Prevent joining a server if you have too many files loaded to add the remainder. * Made the check in Got_RequestAddfilecmd more comprehensive, since I might as well. Just something to tweak a little later in internal. --- src/d_clisrv.c | 17 ++++++++++++++--- src/d_netcmd.c | 14 +++++++++++++- src/d_netfil.c | 15 +++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 939d53de..76b5c95d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1733,9 +1733,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) { #ifndef NONET INT32 i; -#endif -#ifndef NONET // serverlist is updated by GetPacket function if (serverlistcount > 0) { @@ -1769,7 +1767,20 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) serverlist[i].info.fileneeded); CONS_Printf(M_GetText("Checking files...\n")); i = CL_CheckFiles(); - if (i == 2) // cannot join for some reason + if (i == 3) // too many files + { + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + M_StartMessage(M_GetText( + "You have too many WAD files loaded\n" + "to add ones the server is using.\n" + "Please restart SRB2 before connecting.\n\n" + "Press ESC\n" + ), NULL, MM_NOTHING); + return false; + } + else if (i == 2) // cannot join for some reason { D_QuitNetGame(); CL_Reset(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f4916756..d7bbb0aa 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3080,6 +3080,11 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) boolean kick = false; boolean toomany = false; INT32 i; + size_t packetsize = 0; + serverinfo_pak *dummycheck = NULL; + + // Shut the compiler up. + (void)dummycheck; READSTRINGN(*cp, filename, 240); READMEM(*cp, md5sum, 16); @@ -3105,7 +3110,14 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) return; } - if (numwadfiles >= MAX_WADFILES) // a more comprehensive check in internal; bare minimum of out-of-bounds for public next + // See W_LoadWadFile in w_wad.c + for (i = 0; i < numwadfiles; i++) + packetsize += nameonlylength(wadfiles[i]->filename) + 22; + + packetsize += nameonlylength(filename) + 22; + + if ((numwadfiles >= MAX_WADFILES) + || (packetsize > sizeof(dummycheck->fileneeded))) toomany = true; else ncs = findfile(filename,md5sum,true); diff --git a/src/d_netfil.c b/src/d_netfil.c index bf4e5987..479fd60d 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -330,6 +330,11 @@ INT32 CL_CheckFiles(void) INT32 i, j; char wadfilename[MAX_WADPATH]; INT32 ret = 1; + size_t packetsize = 0; + serverinfo_pak *dummycheck = NULL; + + // Shut the compiler up. + (void)dummycheck; // if (M_CheckParm("-nofiles")) // return 1; @@ -378,6 +383,10 @@ INT32 CL_CheckFiles(void) return 1; } + // See W_LoadWadFile in w_wad.c + for (i = 0; i < numwadfiles; i++) + packetsize += nameonlylength(wadfiles[i]->filename) + 22; + for (i = 1; i < fileneedednum; i++) { CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename); @@ -397,6 +406,12 @@ INT32 CL_CheckFiles(void) if (fileneeded[i].status != FS_NOTFOUND || !fileneeded[i].important) continue; + packetsize += nameonlylength(fileneeded[i].filename) + 22; + + if ((numwadfiles >= MAX_WADFILES) + || (packetsize > sizeof(dummycheck->fileneeded))) + return 3; + fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true); CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status); if (fileneeded[i].status != FS_FOUND) From 58236af6f73f535f5071d5fca84457b993239f5d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 25 May 2017 16:55:59 +0100 Subject: [PATCH 046/124] Tweak to D_MapChange: if you failed to start a server, DON'T send a map change command --- src/d_netcmd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 478772ed..f2354931 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1569,8 +1569,13 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese mapchangepending = 0; // spawn the server if needed // reset players if there is a new one - if (!(adminplayer == consoleplayer) && SV_SpawnServer()) - buf[0] &= ~(1<<1); + if (!(adminplayer == consoleplayer)) + { + if (SV_SpawnServer()) + buf[0] &= ~(1<<1); + if (!Playing()) // you failed to start a server somehow, so cancel the map change + return; + } // Kick bot from special stages if (botskin) From a23e9bc32b6357f5e366246dada0aa55c34c235b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 25 May 2017 18:10:20 +0100 Subject: [PATCH 047/124] Fix size_t printing --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 27fcd067..c095d38a 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3751,8 +3751,8 @@ FILESTAMP // BASEPACKETSIZE + 1 (for size) + textcmd[0] should == datalength if (netbuffer->u.textcmd[0] > (size_t)doomcom->datalength-BASEPACKETSIZE-1) { - DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %d, node %u, player %d)\n", - netbuffer->u.textcmd[0], (size_t)doomcom->datalength-BASEPACKETSIZE-1, + DEBFILE(va("GetPacket: Bad Textcmd packet size! (expected %d, actual %s, node %u, player %d)\n", + netbuffer->u.textcmd[0], sizeu1((size_t)doomcom->datalength-BASEPACKETSIZE-1), node, netconsole)); Net_UnAcknowledgePacket(node); break; From 437780d503e8cac007d9dcc7a30c410bb08a7365 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 25 May 2017 18:40:48 +0100 Subject: [PATCH 048/124] Add missing break for MT_EGGCAPSULE's switch case in P_SpawnMobj (sorry!) --- src/p_mobj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index fb864801..47886ce8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7807,6 +7807,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) break; case MT_EGGCAPSULE: mobj->extravalue1 = -1; // timer for how long a player has been at the capsule + break; case MT_REDTEAMRING: mobj->color = skincolor_redteam; break; From aecc97ded33bbfd7e8e62aca333398a14b3c06d5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 13:39:54 +0100 Subject: [PATCH 049/124] PT_REQUESTFILE checking: * if you sent it to a client rather than the server, game over, your connection is closed * if files that don't exist or are too large are requested are listed, game over, your connection is closed (they should have been checked on YOUR side beforehand, silly) * if the server has downloading disabled anyway, ...yeah, you get the idea Don't worry, I made sure Got_RequestFilePak cleaned up the full file request list for the node in case of failure --- src/d_clisrv.c | 7 +++++- src/d_netfil.c | 64 +++++++++++++++++++++++++++++++++++++++++++++----- src/d_netfil.h | 2 +- 3 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c095d38a..2fc895c2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3553,7 +3553,12 @@ static void HandlePacketFromAwayNode(SINT8 node) case PT_REQUESTFILE: if (server) - Got_RequestFilePak(node); + { + if (!cv_downloading.value || !Got_RequestFilePak(node)) + Net_CloseConnection(node); // close connection if one of the requested files could not be sent, or you disabled downloading anyway + } + else + Net_CloseConnection(node); // nope break; case PT_NODETIMEOUT: diff --git a/src/d_netfil.c b/src/d_netfil.c index bf4e5987..777814ce 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -62,7 +62,9 @@ #include -static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid); +// Prototypes +static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid); +static void SV_RemoveFileSendList(INT32 node); // Sender structure typedef struct filetx_s @@ -303,7 +305,8 @@ boolean CL_SendRequestFile(void) } // get request filepak and put it on the send queue -void Got_RequestFilePak(INT32 node) +// returns false if a requested file was not found or cannot be sent +boolean Got_RequestFilePak(INT32 node) { char wad[MAX_WADPATH+1]; UINT8 *p = netbuffer->u.textcmd; @@ -314,8 +317,13 @@ void Got_RequestFilePak(INT32 node) if (id == 0xFF) break; READSTRINGN(p, wad, MAX_WADPATH); - SV_SendFile(node, wad, id); + if (!SV_SendFile(node, wad, id)) + { + SV_RemoveFileSendList(node); + return false; // don't read the rest of the files + } } + return true; // no problems with any files } /** Checks if the files needed aren't already loaded or on the disk @@ -480,7 +488,7 @@ static INT32 filestosend = 0; * \sa SV_SendRam * */ -static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid) +static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid) { filetx_t **q; // A pointer to the "next" field of the last file in the list filetx_t *p; // The new file request @@ -537,7 +545,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid) free(p->id.filename); free(p); *q = NULL; - return; + return false; // cancel the rest of the requests } // Handle huge file requests (i.e. bigger than cv_maxsend.value KB) @@ -549,7 +557,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid) free(p->id.filename); free(p); *q = NULL; - return; + return false; // cancel the rest of the requests } DEBFILE(va("Sending file %s (id=%d) to %d\n", filename, fileid, node)); @@ -557,6 +565,7 @@ static void SV_SendFile(INT32 node, const char *filename, UINT8 fileid) p->fileid = fileid; p->next = NULL; // End of list filestosend++; + return true; } /** Adds a memory block to the file list for a node @@ -598,6 +607,49 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI filestosend++; } +/** Removes all file requests for a node + * This is needed only if a PT_REQUESTFILE's content gave you something that shouldn't be there + * + * \param node The destination + * \sa Got_RequestFilePak + * + */ +static void SV_RemoveFileSendList(INT32 node) +{ + filetx_t *p = transfer[node].txlist; + + if (p == NULL) + return; // ...well, that was easy + + while (p) + { + // Free the file request according to the freemethod parameter used with SV_SendFile/Ram + switch (p->ram) + { + case SF_FILE: // It's a file, close it and free its filename + if (cv_noticedownload.value) + CONS_Printf("Cancelling file transfer for node %d\n", node); + if (transfer[node].currentfile) + fclose(transfer[node].currentfile); + free(p->id.filename); + break; + case SF_Z_RAM: // It's a memory block allocated with Z_Alloc or the likes, use Z_Free + Z_Free(p->id.ram); + break; + case SF_RAM: // It's a memory block allocated with malloc, use free + free(p->id.ram); + case SF_NOFREERAM: // Nothing to free + break; + } + // Remove the file request from the list + transfer[node].txlist = p->next; + free(p); + // Indicate that the transmission is over (if for some reason it had started) + transfer[node].currentfile = NULL; + filestosend--; + } +} + /** Stops sending a file for a node, and removes the file request from the list, * either because the file has been fully sent or because the node was disconnected * diff --git a/src/d_netfil.h b/src/d_netfil.h index c9085a5b..b9b7b2f2 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -69,7 +69,7 @@ boolean SV_SendingFile(INT32 node); boolean CL_CheckDownloadable(void); boolean CL_SendRequestFile(void); -void Got_RequestFilePak(INT32 node); +boolean Got_RequestFilePak(INT32 node); void SV_AbortSendFiles(INT32 node); void CloseNetFile(void); From 7979f84e258769cf230610a6cd7b4c0161479ba4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 13:58:34 +0100 Subject: [PATCH 050/124] whoops --- src/d_netfil.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_netfil.c b/src/d_netfil.c index 777814ce..8704e05c 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -644,6 +644,7 @@ static void SV_RemoveFileSendList(INT32 node) // Remove the file request from the list transfer[node].txlist = p->next; free(p); + p = transfer[node].txlist; // Indicate that the transmission is over (if for some reason it had started) transfer[node].currentfile = NULL; filestosend--; From 569af9f4c13b3124c7821689b612762d727274eb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 14:19:18 +0100 Subject: [PATCH 051/124] I am dumb, SV_AbortSendFiles already does what SV_RemoveFileSendList was made to do --- src/d_netfil.c | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 8704e05c..84e16aa1 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -64,7 +64,6 @@ // Prototypes static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid); -static void SV_RemoveFileSendList(INT32 node); // Sender structure typedef struct filetx_s @@ -319,7 +318,7 @@ boolean Got_RequestFilePak(INT32 node) READSTRINGN(p, wad, MAX_WADPATH); if (!SV_SendFile(node, wad, id)) { - SV_RemoveFileSendList(node); + SV_AbortSendFiles(node); return false; // don't read the rest of the files } } @@ -607,50 +606,6 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI filestosend++; } -/** Removes all file requests for a node - * This is needed only if a PT_REQUESTFILE's content gave you something that shouldn't be there - * - * \param node The destination - * \sa Got_RequestFilePak - * - */ -static void SV_RemoveFileSendList(INT32 node) -{ - filetx_t *p = transfer[node].txlist; - - if (p == NULL) - return; // ...well, that was easy - - while (p) - { - // Free the file request according to the freemethod parameter used with SV_SendFile/Ram - switch (p->ram) - { - case SF_FILE: // It's a file, close it and free its filename - if (cv_noticedownload.value) - CONS_Printf("Cancelling file transfer for node %d\n", node); - if (transfer[node].currentfile) - fclose(transfer[node].currentfile); - free(p->id.filename); - break; - case SF_Z_RAM: // It's a memory block allocated with Z_Alloc or the likes, use Z_Free - Z_Free(p->id.ram); - break; - case SF_RAM: // It's a memory block allocated with malloc, use free - free(p->id.ram); - case SF_NOFREERAM: // Nothing to free - break; - } - // Remove the file request from the list - transfer[node].txlist = p->next; - free(p); - p = transfer[node].txlist; - // Indicate that the transmission is over (if for some reason it had started) - transfer[node].currentfile = NULL; - filestosend--; - } -} - /** Stops sending a file for a node, and removes the file request from the list, * either because the file has been fully sent or because the node was disconnected * From e09270276ef445a36dae97b147c023b345f63eed Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 14:38:59 +0100 Subject: [PATCH 052/124] Display node's IP when printing the "sending file to node n" message, if noticedownload is turned on --- src/d_netfil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 84e16aa1..2c463c0b 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -495,7 +495,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid) char wadfilename[MAX_WADPATH]; if (cv_noticedownload.value) - CONS_Printf("Sending file \"%s\" to node %d\n", filename, node); + CONS_Printf("Sending file \"%s\" to node %d (%s)\n", filename, node, I_GetNodeAddress(node)); // Find the last file in the list and set a pointer to its "next" field q = &transfer[node].txlist; From ab5835cd3b325b748a1b514bd6a825264779b982 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 15:26:00 +0100 Subject: [PATCH 053/124] Remove cruft from my initial days of fumbling with this branch textcmd[0] for PT_NODETIMEOUT can't hold anything < 0 anyway, and you'd probably have to really try to get >= MAXNETNODES --- src/d_clisrv.c | 7 +------ src/d_net.c | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 2fc895c2..89418dde 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4004,9 +4004,6 @@ FILESTAMP while (HGetPacket()) { - if (doomcom->remotenode == -1) // ...this should have been ignored already - continue; // might come from PT_NODETIMEOUT somehow though - node = (SINT8)doomcom->remotenode; if (netbuffer->packettype == PT_CLIENTJOIN && server) @@ -4039,10 +4036,8 @@ FILESTAMP if (netbuffer->packettype == PT_PLAYERINFO) continue; // We do nothing with PLAYERINFO, that's for the MS browser. - if (node < 0 || node >= MAXNETNODES) // THIS SHOULDN'T EVEN BE POSSIBLE - ; //CONS_Printf("Received packet from node %d!\n", (int)node); // Packet received from someone already playing - else if (nodeingame[node]) + if (nodeingame[node]) HandlePacketFromPlayer(node); // Packet received from someone not playing else diff --git a/src/d_net.c b/src/d_net.c index 68720f5e..b6914f81 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1133,8 +1133,6 @@ boolean HGetPacket(void) rebound_tail = (rebound_tail+1) % MAXREBOUND; - if (doomcom->remotenode == -1) // wait hang on what? - return true; // there might still be packets from others though, so don't return false #ifdef DEBUGFILE if (debugfile) DebugPrintpacket("GETLOCAL"); From 4d1af86431b9b7d4f90b314811df7825ac467fe8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 May 2017 15:30:26 +0100 Subject: [PATCH 054/124] Cleanup part 2, make ye old 2.1.18 warning a debugfile only message, and make the node == -1 have its own debugfile only message too Also get rid of a stray newline --- src/d_net.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index b6914f81..50b6c8cf 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -713,7 +713,10 @@ void Net_CloseConnection(INT32 node) boolean forceclose = (node & FORCECLOSE) != 0; if (node == -1) + { + DEBFILE(M_GetText("Net_CloseConnection: node -1 detected!\n")); return; // nope, just ignore it + } node &= ~FORCECLOSE; @@ -722,7 +725,7 @@ void Net_CloseConnection(INT32 node) if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game { - //CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); + DEBFILE(va(M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node)); return; } @@ -1132,7 +1135,6 @@ boolean HGetPacket(void) doomcom->remotenode = 0; rebound_tail = (rebound_tail+1) % MAXREBOUND; - #ifdef DEBUGFILE if (debugfile) DebugPrintpacket("GETLOCAL"); From db2f8a50bac82d604cf25fcadbb46a439f72256f Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 26 May 2017 16:16:10 +0100 Subject: [PATCH 055/124] Make sure that the number of files you're trying to add is properly considered! --- src/d_netfil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 479fd60d..70e9ce56 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -331,6 +331,7 @@ INT32 CL_CheckFiles(void) char wadfilename[MAX_WADPATH]; INT32 ret = 1; size_t packetsize = 0; + size_t filestoget = 0; serverinfo_pak *dummycheck = NULL; // Shut the compiler up. @@ -408,10 +409,12 @@ INT32 CL_CheckFiles(void) packetsize += nameonlylength(fileneeded[i].filename) + 22; - if ((numwadfiles >= MAX_WADFILES) + if ((numwadfiles+filestoget >= MAX_WADFILES) || (packetsize > sizeof(dummycheck->fileneeded))) return 3; + filestoget++; + fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true); CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status); if (fileneeded[i].status != FS_FOUND) From 86a76a9766c7807283f5a35a09ff7a2593d81211 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 26 May 2017 18:10:53 -0400 Subject: [PATCH 056/124] Makefile: disable GETTEXT by default --- src/Makefile | 2 -- src/Makefile.cfg | 9 --------- 2 files changed, 11 deletions(-) diff --git a/src/Makefile b/src/Makefile index 76f013c5..426dc228 100644 --- a/src/Makefile +++ b/src/Makefile @@ -511,13 +511,11 @@ OBJS:=$(i_main_o) \ # For reference, this is the command I use to build a srb2.pot file from the source code. # (The listed source files are the ones containing translated strings). # FILES=""; for file in `find ./ | grep "\.c" | grep -v svn`; do [ "`grep "M_GetText(" $file`" ] && FILES="$FILES $file"; done; xgettext -d srb2 -o locale/srb2.pot -kM_GetText -F --no-wrap $FILES -ifndef NOGETTEXT ifdef GETTEXT POS:=$(BIN)/en.mo OPTS+=-DGETTEXT endif -endif ifdef DJGPPDOS all: pre-build $(BIN)/$(EXENAME) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 22546fbf..5bf7f247 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -283,9 +283,6 @@ else ifdef LINUX NASMFORMAT=elf -DLINUX SDL=1 -ifndef NOGETTEXT - GETTEXT=1 -endif ifdef LINUX64 OBJDIR:=$(OBJDIR)/Linux64 BIN:=$(BIN)/Linux64 @@ -321,9 +318,6 @@ else ifdef MINGW64 INTERFACE=win32 #NASMFORMAT=win64 -ifndef NOGETTEXT - #GETTEXT=1 -endif OBJDIR:=$(OBJDIR)/Mingw64 BIN:=$(BIN)/Mingw64 else @@ -354,9 +348,6 @@ else ifdef MINGW INTERFACE=win32 NASMFORMAT=win32 -ifndef NOGETTEXT - #GETTEXT=1 -endif OBJDIR:=$(OBJDIR)/Mingw BIN:=$(BIN)/Mingw else From 877e9510f7e0397814e28eb6630625bead5a9165 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 26 May 2017 21:38:49 -0400 Subject: [PATCH 057/124] Update version number to v2.1.19 --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- src/doomdef.h | 8 ++++---- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b768a7..f9364fdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) project(SRB2 - VERSION 2.1.18 + VERSION 2.1.19 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index c1f6894e..cc073ff0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.18.{branch}-{build} +version: 2.1.19.{branch}-{build} os: MinGW environment: diff --git a/src/doomdef.h b/src/doomdef.h index 428972cc..cdb1a7db 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,9 +150,9 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 201 // Game version -#define SUBVERSION 18 // more precise version number -#define VERSIONSTRING "v2.1.18" -#define VERSIONSTRINGW L"v2.1.18" +#define SUBVERSION 19 // more precise version number +#define VERSIONSTRING "v2.1.19" +#define VERSIONSTRINGW L"v2.1.19" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -214,7 +214,7 @@ extern FILE *logstream; // 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.1.0 is not version "1". -#define MODVERSION 23 +#define MODVERSION 24 // ========================================================================= diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index fbf9bacb..68391f99 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.18; + CURRENT_PROJECT_VERSION = 2.1.19; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.18; + CURRENT_PROJECT_VERSION = 2.1.19; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 98a760c7..fada7849 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.18; + CURRENT_PROJECT_VERSION = 2.1.19; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.18; + CURRENT_PROJECT_VERSION = 2.1.19; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( From d20efa5a744ec046cce1e4df8a9fecb45e0c590f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 27 May 2017 19:06:46 +0100 Subject: [PATCH 058/124] Entirely ignore PT_ASKINFOVIAMS packets, since it turns out it's not even sent by the MS anyway --- src/d_clisrv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 89418dde..6adaae19 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3413,6 +3413,7 @@ static void HandlePacketFromAwayNode(SINT8 node) switch (netbuffer->packettype) { case PT_ASKINFOVIAMS: +#if 0 if (server && serverrunning) { INT32 clientnode; @@ -3434,6 +3435,9 @@ static void HandlePacketFromAwayNode(SINT8 node) } else Net_CloseConnection(node); // you're not supposed to get it, so ignore it +#else + Net_CloseConnection(node); +#endif break; case PT_ASKINFO: From c44a935b04cec66913f23e040f26bcc3e0739a04 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Sat, 27 May 2017 14:03:27 -0500 Subject: [PATCH 059/124] Rewrote `thinkers.iterate` to handle invalid pointers elegantly. --- src/lua_thinkerlib.c | 134 +++++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 50 deletions(-) diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c index d5251425..aaa8435e 100644 --- a/src/lua_thinkerlib.c +++ b/src/lua_thinkerlib.c @@ -16,84 +16,118 @@ #include "lua_script.h" #include "lua_libs.h" +#define META_ITERATIONSTATE "iteration state" + static const char *const iter_opt[] = { "all", "mobj", NULL}; +static const actionf_p1 iter_funcs[] = { + NULL, + (actionf_p1)P_MobjThinker +}; + +struct iterationState { + actionf_p1 filter; + int next; +}; + +static int iterationState_gc(lua_State *L) +{ + struct iterationState *it = luaL_checkudata(L, -1, META_ITERATIONSTATE); + if (it->next != LUA_REFNIL) + { + luaL_unref(L, LUA_REGISTRYINDEX, it->next); + it->next = LUA_REFNIL; + } + return 0; +} + +#define push_thinker(th) {\ + if ((th)->function.acp1 == (actionf_p1)P_MobjThinker) \ + LUA_PushUserdata(L, (th), META_MOBJ); \ + else \ + lua_pushlightuserdata(L, (th)); \ +} + static int lib_iterateThinkers(lua_State *L) { - int state = luaL_checkoption(L, 1, "mobj", iter_opt); - - thinker_t *th = NULL; - actionf_p1 searchFunc; - const char *searchMeta; - + thinker_t *th = NULL, *next = NULL; + struct iterationState *it = luaL_checkudata(L, 1, META_ITERATIONSTATE); lua_settop(L, 2); - lua_remove(L, 1); // remove state now. - switch(state) + if (lua_isnil(L, 2)) + th = &thinkercap; + else if (lua_isuserdata(L, 2)) { - case 0: - searchFunc = NULL; - searchMeta = NULL; - break; - case 1: - default: - searchFunc = (actionf_p1)P_MobjThinker; - searchMeta = META_MOBJ; - break; + if (lua_islightuserdata(L, 2)) + th = lua_touserdata(L, 2); + else + { + th = *(thinker_t **)lua_touserdata(L, -1); + if (!th) + { + if (it->next == LUA_REFNIL) + return 0; + + lua_rawgeti(L, LUA_REGISTRYINDEX, it->next); + if (lua_islightuserdata(L, -1)) + next = lua_touserdata(L, -1); + else + next = *(thinker_t **)lua_touserdata(L, -1); + } + } } - if (!lua_isnil(L, 1)) { - if (lua_islightuserdata(L, 1)) - th = (thinker_t *)lua_touserdata(L, 1); - else if (searchMeta) - th = *((thinker_t **)luaL_checkudata(L, 1, searchMeta)); - else - th = *((thinker_t **)lua_touserdata(L, 1)); - } else - th = &thinkercap; + luaL_unref(L, LUA_REGISTRYINDEX, it->next); + it->next = LUA_REFNIL; - if (!th) // something got our userdata invalidated! - return 0; + if (th && !next) + next = th->next; + if (!next) + return luaL_error(L, "next thinker invalidated during iteration"); - if (searchFunc == NULL) - { - if ((th = th->next) != &thinkercap) + for (; next != &thinkercap; next = next->next) + if (!it->filter || next->function.acp1 == it->filter) { - if (th->function.acp1 == (actionf_p1)P_MobjThinker) - LUA_PushUserdata(L, th, META_MOBJ); - else - lua_pushlightuserdata(L, th); + push_thinker(next); + if (next->next != &thinkercap) + { + push_thinker(next->next); + it->next = luaL_ref(L, LUA_REGISTRYINDEX); + } return 1; } - return 0; - } - - for (th = th->next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != searchFunc) - continue; - - LUA_PushUserdata(L, th, searchMeta); - return 1; - } return 0; } static int lib_startIterate(lua_State *L) { - luaL_checkoption(L, 1, iter_opt[0], iter_opt); - lua_pushcfunction(L, lib_iterateThinkers); - lua_pushvalue(L, 1); + struct iterationState *it; + + lua_pushvalue(L, lua_upvalueindex(1)); + it = lua_newuserdata(L, sizeof(struct iterationState)); + luaL_getmetatable(L, META_ITERATIONSTATE); + lua_setmetatable(L, -2); + + it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)]; + it->next = LUA_REFNIL; return 2; } +#undef push_thinker + int LUA_ThinkerLib(lua_State *L) { + luaL_newmetatable(L, META_ITERATIONSTATE); + lua_pushcfunction(L, iterationState_gc); + lua_setfield(L, -2, "__gc"); + lua_pop(L, 1); + lua_createtable(L, 0, 1); - lua_pushcfunction(L, lib_startIterate); + lua_pushcfunction(L, lib_iterateThinkers); + lua_pushcclosure(L, lib_startIterate, 1); lua_setfield(L, -2, "iterate"); lua_setglobal(L, "thinkers"); return 0; From f96844b2620654892de5f73b46c5775288076552 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 29 May 2017 21:28:36 +0100 Subject: [PATCH 060/124] Fix screenshots taken in OpenGL with 1366x768 being messed up This is based on GZDoom's own fix for the same issue, had to add support for glPixelStorei first though --- src/hardware/r_opengl/r_opengl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 3a0bf705..a3c47df8 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -244,6 +244,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) #define pglMaterialfv glMaterialfv /* Raster functions */ +#define pglPixelStorei glPixelStorei #define pglReadPixels glReadPixels /* Texture mapping */ @@ -365,6 +366,8 @@ typedef void (APIENTRY * PFNglMaterialfv) (GLint face, GLenum pname, GLfloat *pa static PFNglMaterialfv pglMaterialfv; /* Raster functions */ +typedef void (APIENTRY * PFNglPixelStorei) (GLenum pname, GLint param); +static PFNglPixelStorei pglPixelStorei; typedef void (APIENTRY * PFNglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); static PFNglReadPixels pglReadPixels; @@ -494,6 +497,7 @@ boolean SetupGLfunc(void) GETOPENGLFUNC(pglLightModelfv , glLightModelfv) GETOPENGLFUNC(pglMaterialfv , glMaterialfv) + GETOPENGLFUNC(pglPixelStorei , glPixelStorei) GETOPENGLFUNC(pglReadPixels , glReadPixels) GETOPENGLFUNC(pglTexEnvi , glTexEnvi) @@ -897,7 +901,9 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, GLubyte*top = (GLvoid*)dst_data, *bottom = top + dst_stride * (height - 1); GLubyte *row = malloc(dst_stride); if (!row) return; + pglPixelStorei(GL_PACK_ALIGNMENT, 1); pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, dst_data); + pglPixelStorei(GL_UNPACK_ALIGNMENT, 1); for(i = 0; i < height/2; i++) { memcpy(row, top, dst_stride); @@ -913,7 +919,9 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 j; GLubyte *image = malloc(width*height*3*sizeof (*image)); if (!image) return; + pglPixelStorei(GL_PACK_ALIGNMENT, 1); pglReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, image); + pglPixelStorei(GL_UNPACK_ALIGNMENT, 1); for (i = height-1; i >= 0; i--) { for (j = 0; j < width; j++) From 6be7693ecb4ecd4136c3b3434f94ab292f167e2b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 29 May 2017 22:52:51 -0400 Subject: [PATCH 061/124] OpenGL: Load the GLU and OpenGL 1.3 multitexturing functions during runtime --- src/hardware/r_opengl/r_opengl.c | 27 +++++---------------------- src/sdl/ogl_sdl.c | 2 -- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index a3c47df8..92e5592e 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -263,15 +263,8 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...) /* texture mapping */ //GL_EXT_copy_texture #ifndef KOS_GL_COMPATIBILITY #define pglCopyTexImage2D glCopyTexImage2D +#endif -/* GLU functions */ -#define pgluBuild2DMipmaps gluBuild2DMipmaps -#endif -#ifndef MINI_GL_COMPATIBILITY -/* 1.3 functions for multitexturing */ -#define pglActiveTexture glActiveTexture -#define pglMultiTexCoord2f glMultiTexCoord2f -#endif #else //!STATIC_OPENGL /* 1.0 functions */ @@ -394,7 +387,7 @@ static PFNglBindTexture pglBindTexture; /* texture mapping */ //GL_EXT_copy_texture typedef void (APIENTRY * PFNglCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); static PFNglCopyTexImage2D pglCopyTexImage2D; - +#endif /* GLU functions */ typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); static PFNgluBuild2DMipmaps pgluBuild2DMipmaps; @@ -406,7 +399,6 @@ static PFNglActiveTexture pglActiveTexture; typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat); static PFNglMultiTexCoord2f pglMultiTexCoord2f; #endif -#endif #ifndef MINI_GL_COMPATIBILITY /* 1.2 Parms */ @@ -523,17 +515,13 @@ boolean SetupGLfunc(void) // This has to be done after the context is created so the version number can be obtained boolean SetupGLFunc13(void) { +#ifdef MINI_GL_COMPATIBILITY + return false; +#else const GLubyte *version = pglGetString(GL_VERSION); int glmajor, glminor; gl13 = false; -#ifdef MINI_GL_COMPATIBILITY - return false; -#else -#ifdef STATIC_OPENGL - gl13 = true; -#else - // Parse the GL version if (version != NULL) { @@ -572,9 +560,6 @@ boolean SetupGLFunc13(void) } else DBG_Printf("GL_ARB_multitexture support: disabled\n"); -#undef GETOPENGLFUNC - -#endif return true; #endif } @@ -1823,13 +1808,11 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) min_filter = GL_NEAREST; #endif } -#ifndef STATIC_OPENGL if (!pgluBuild2DMipmaps) { MipMap = GL_FALSE; min_filter = GL_LINEAR; } -#endif Flush(); //??? if we want to change filter mode by texture, remove this break; diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 21afd831..cd7ced7c 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -71,7 +71,6 @@ INT32 oglflags = 0; void *GLUhandle = NULL; SDL_GLContext sdlglcontext = 0; -#ifndef STATIC_OPENGL void *GetGLFunc(const char *proc) { if (strncmp(proc, "glu", 3) == 0) @@ -83,7 +82,6 @@ void *GetGLFunc(const char *proc) } return SDL_GL_GetProcAddress(proc); } -#endif boolean LoadGL(void) { From 6847a89bc2043d536263e98b41d96207ba976242 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 29 May 2017 23:04:03 -0400 Subject: [PATCH 062/124] OpenGL: check for 1.3+ or 2.0+, not just 1.3/2.X to 4.X --- src/hardware/r_opengl/r_opengl.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 92e5592e..e6ff83e8 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -528,18 +528,10 @@ boolean SetupGLFunc13(void) if (sscanf((const char*)version, "%d.%d", &glmajor, &glminor) == 2) { // Look, we gotta prepare for the inevitable arrival of GL 2.0 code... - switch (glmajor) - { - case 1: - if (glminor == 3) gl13 = true; - break; - case 2: - case 3: - case 4: - gl13 = true; - default: - break; - } + if (glmajor == 1 && glminor >= 3) + gl13 = true; + else if (glmajor > 1) + gl13 = true; } } From 3d86e7135dcf7cbdc1dfa9759847a7cde7a064bf Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 1 Jun 2017 19:01:57 +0100 Subject: [PATCH 063/124] Fix confusion between nodes and players in ping updating code and PT_PING packet sending code --- src/d_clisrv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 312a308a..1f83b8da 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4529,8 +4529,8 @@ static inline void PingUpdate(void) } //send out our ping packets - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) + for (i = 0; i < MAXNETNODES; i++) + if (nodeingame[i]) HSendPacket(i, true, 0, sizeof(INT32) * MAXPLAYERS); pingmeasurecount = 1; //Reset count @@ -4571,9 +4571,9 @@ void NetUpdate(void) if (server) { // update node latency values so we can take an average later. - for (i = 0; i < MAXNETNODES; i++) + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) - realpingtable[i] += G_TicsToMilliseconds(GetLag(i)); + realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i])); pingmeasurecount++; } #endif From fe15305df0b78b5ce3ccb45cf12277ea574907d7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 1 Jun 2017 20:43:24 +0100 Subject: [PATCH 064/124] Merge the two NEWPING parts of NetUpdate into one block --- 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 1f83b8da..bf5bca2f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4560,16 +4560,11 @@ void NetUpdate(void) gametime = nowtime; - if (!(gametime % 255) && netgame && server) - { -#ifdef NEWPING - PingUpdate(); -#endif - } - #ifdef NEWPING if (server) { + if (netgame && !(gametime % 255)) + PingUpdate(); // update node latency values so we can take an average later. for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) From 2e42c9621c6c18badfe8020843701f8cadbfddb2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 1 Jun 2017 20:46:44 +0100 Subject: [PATCH 065/124] Eck, potted another node/player confusion for clients reciving PT_PING --- 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 bf5bca2f..43b684e1 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3971,7 +3971,7 @@ FILESTAMP if (client) { INT32 i; - for (i = 0; i < MAXNETNODES; i++) + for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i]) playerpingtable[i] = (tic_t)netbuffer->u.pingtable[i]; } From 3658b22a7f6d54206d7d81cc90721f652e68aa42 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 3 Jun 2017 14:46:03 +0100 Subject: [PATCH 066/124] wallVerts[].y is actually the map z coord, so use wallVerts[].z instead (which is actually the map y coord) Don't worry I'm not going mad, this is actually how it's supposed to be --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 45b59f9b..fe04a2c4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1084,9 +1084,9 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, float endheight = 0.0f, endbheight = 0.0f; fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); - fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].y); + fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); - fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].y); + fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].z); // not a typo // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly // use this as a temp var to store P_GetZAt's return value each time fixed_t temp; From c3c85bb4d2a4e5a1e39b999aadf919c55973e8c4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 3 Jun 2017 17:47:46 +0100 Subject: [PATCH 067/124] Do not draw segs that belong to polyobjects, if you're drawing subsectors adjacent to them Polyobject segs should ONLY be drawn if the polyobject itself is in the polylist of a subsector being rendered. That way you won't sometimes see polyobject walls through level boundaries, if you happen to be close enough to their pre-spawn locations outside the level (or in them, if you decided to go on a noclip journey). --- src/hardware/hw_main.c | 3 +++ src/r_bsp.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 45b59f9b..e0461071 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3722,6 +3722,9 @@ static void HWR_Subsector(size_t num) while (count--) { +#ifdef POLYOBJECTS + if (!line->polyseg) // ignore segs that belong to polyobjects +#endif HWR_AddLine(line); line++; } diff --git a/src/r_bsp.c b/src/r_bsp.c index 44cb991a..abb11204 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -1222,6 +1222,9 @@ static void R_Subsector(size_t num) while (count--) { // CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime); +#ifdef POLYOBJECTS + if (!line->polyseg) // ignore segs that belong to polyobjects +#endif R_AddLine(line); line++; curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */ From 997eb58c9372c2b18994d1ef8193eadb259d9c61 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 7 Jun 2017 18:24:06 +0100 Subject: [PATCH 068/124] Fix invalid sfx numbers supplied to linedef type 414 crashing the game Had to make P_MobjReadyToTrigger non-inline for this fix though, because the compiler was being stupid --- src/p_spec.c | 124 +++++++++++++++++++++++++++------------------------ 1 file changed, 66 insertions(+), 58 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 48c0f58b..4d893d5d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2437,73 +2437,81 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 414: // Play SFX { - fixed_t sfxnum; + INT32 sfxnum; sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; - if (line->tag != 0 && line->flags & ML_EFFECT5) + if (sfxnum == sfx_None) + return; // Do nothing! + if (sfxnum < sfx_None || sfxnum >= NUMSFX) { - sector_t *sec; - - while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) + CONS_Debug(DBG_GAMELOGIC, "Line type 414 Executor: sfx number %d is invalid!\n", sfxnum); + return; + } + if (line->tag != 0) // Do special stuff only if a non-zero linedef tag is set + { + if (line->flags & ML_EFFECT5) // Repeat Midtexture { - sec = §ors[secnum]; - S_StartSound(&sec->soundorg, sfxnum); + // Additionally play the sound from tagged sectors' soundorgs + sector_t *sec; + + while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) + { + sec = §ors[secnum]; + S_StartSound(&sec->soundorg, sfxnum); + } + } + else if (mo) // A mobj must have triggered the executor + { + // Only trigger if mobj is touching the tag + ffloor_t *rover; + boolean foundit = false; + + for(rover = mo->subsector->sector->ffloors; rover; rover = rover->next) + { + if (rover->master->frontsector->tag != line->tag) + continue; + + if (mo->z > P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)) + continue; + + if (mo->z + mo->height < P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector)) + continue; + + foundit = true; + } + + if (mo->subsector->sector->tag == line->tag) + foundit = true; + + if (!foundit) + return; } } - else if (line->tag != 0 && mo) + + if (line->flags & ML_NOCLIMB) { - // Only trigger if mobj is touching the tag - ffloor_t *rover; - boolean foundit = false; - - for(rover = mo->subsector->sector->ffloors; rover; rover = rover->next) - { - if (rover->master->frontsector->tag != line->tag) - continue; - - if (mo->z > P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector)) - continue; - - if (mo->z + mo->height < P_GetSpecialBottomZ(mo, sectors + rover->secnum, mo->subsector->sector)) - continue; - - foundit = true; - } - - if (mo->subsector->sector->tag == line->tag) - foundit = true; - - if (!foundit) - return; - } - - if (sfxnum < NUMSFX && sfxnum > sfx_None) - { - if (line->flags & ML_NOCLIMB) - { - // play the sound from nowhere, but only if display player triggered it - if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer])) - S_StartSound(NULL, sfxnum); - } - else if (line->flags & ML_EFFECT4) - { - // play the sound from nowhere + // play the sound from nowhere, but only if display player triggered it + if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer])) S_StartSound(NULL, sfxnum); - } - else if (line->flags & ML_BLOCKMONSTERS) - { - // play the sound from calling sector's soundorg - if (callsec) - S_StartSound(&callsec->soundorg, sfxnum); - else if (mo) - S_StartSound(&mo->subsector->sector->soundorg, sfxnum); - } + } + else if (line->flags & ML_EFFECT4) + { + // play the sound from nowhere + S_StartSound(NULL, sfxnum); + } + else if (line->flags & ML_BLOCKMONSTERS) + { + // play the sound from calling sector's soundorg + if (callsec) + S_StartSound(&callsec->soundorg, sfxnum); else if (mo) - { - // play the sound from mobj that triggered it - S_StartSound(mo, sfxnum); - } + S_StartSound(&mo->subsector->sector->soundorg, sfxnum); + } + else if (mo) + { + // play the sound from mobj that triggered it + S_StartSound(mo, sfxnum); } } break; @@ -3476,7 +3484,7 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar // // Is player standing on the sector's "ground"? // -static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) +static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) { if (mo->eflags & MFE_VERTICALFLIP) return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING); From 12266e0f85c8573995c320be31813e9decd885c0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 9 Jun 2017 23:15:41 +0100 Subject: [PATCH 069/124] Set ack and ackreturn to 0 for local packets always This won't really have any in-game effect, this is just so the debugfile doesn't display the ack values of the PREVIOUS sent/got packet --- src/d_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_net.c b/src/d_net.c index 50b6c8cf..4b14e175 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1028,6 +1028,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen #endif return false; } + netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received M_Memcpy(&reboundstore[rebound_head], netbuffer, doomcom->datalength); reboundsize[rebound_head] = doomcom->datalength; From b9828f78e8688ac416ba40f008f74d37cb1515a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 9 Jun 2017 23:22:27 +0100 Subject: [PATCH 070/124] Fix stupid lack of newline with this message --- 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 312a308a..acaca1f6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4077,7 +4077,7 @@ static INT16 Consistancy(void) mobj_t *mo; #endif - DEBFILE(va("TIC %u ", gametic)); + DEBFILE(va("TIC %u\n", gametic)); for (i = 0; i < MAXPLAYERS; i++) { From bae55a3af463f5ce6ecdc9af42aa4762eba25f4c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Jun 2017 16:36:52 +0100 Subject: [PATCH 071/124] Don't display "x set to y" messages twice in the debugfile for consvars with CV_SHOWMODIFONETIME/CV_SHOWMODIF (can't think offhand when those flags are actually used, but oh well) --- src/command.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index a15471c8..f77fb5a4 100644 --- a/src/command.c +++ b/src/command.c @@ -1180,7 +1180,10 @@ finish: CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string); var->flags &= ~CV_SHOWMODIFONETIME; } - DEBFILE(va("%s set to %s\n", var->name, var->string)); + else // display message in debug file only + { + DEBFILE(va("%s set to %s\n", var->name, var->string)); + } var->flags |= CV_MODIFIED; // raise 'on change' code #ifdef HAVE_BLUA From 02c098574cc768cbb564c6a239289edaffea35e1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Jun 2017 17:09:08 +0100 Subject: [PATCH 072/124] ah, turns out the TIC n debugfile print is a remnant of when Doom Legacy printed the consistancy return value... which we'll do here now too, in that case --- src/d_clisrv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index acaca1f6..70631262 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4077,7 +4077,7 @@ static INT16 Consistancy(void) mobj_t *mo; #endif - DEBFILE(va("TIC %u\n", gametic)); + DEBFILE(va("TIC %u ", gametic)); for (i = 0; i < MAXPLAYERS; i++) { @@ -4099,7 +4099,10 @@ static INT16 Consistancy(void) #ifdef MOBJCONSISTANCY if (!thinkercap.next) + { + DEBFILE(va("Consistancy = %u\n", ret)); return ret; + } for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) @@ -4168,6 +4171,8 @@ static INT16 Consistancy(void) } #endif + DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF))); + return (INT16)(ret & 0xFFFF); } From 318d5656b51a527309695caf6930726adb94b594 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 12 Jun 2017 17:55:15 +0100 Subject: [PATCH 073/124] Keeping a total of thinkers saved/loaded and print the total in netplay devmode Not a fix for anything, probably just useful for debugging --- src/p_saveg.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 75f7b3e5..d1ec8e5a 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1653,12 +1653,18 @@ static inline void SaveWhatThinker(const thinker_t *th, const UINT8 type) static void P_NetArchiveThinkers(void) { const thinker_t *th; + UINT32 numsaved = 0; WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS); // save off the current thinkers for (th = thinkercap.next; th != &thinkercap; th = th->next) { + if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed + || th->function.acp1 == (actionf_p1)P_RainThinker + || th->function.acp1 == (actionf_p1)P_SnowThinker)) + numsaved++; + if (th->function.acp1 == (actionf_p1)P_MobjThinker) { SaveMobjThinker(th, tc_mobj); @@ -1846,6 +1852,8 @@ static void P_NetArchiveThinkers(void) #endif } + CONS_Debug(DBG_NETPLAY, "%u thinkers saved\n", numsaved); + WRITEUINT8(save_p, tc_end); } @@ -2610,6 +2618,7 @@ static void P_NetUnArchiveThinkers(void) UINT8 tclass; UINT8 restoreNum = false; UINT32 i; + UINT32 numloaded = 0; if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS) I_Error("Bad $$$.sav at archive block Thinkers"); @@ -2643,6 +2652,7 @@ static void P_NetUnArchiveThinkers(void) if (tclass == tc_end) break; // leave the saved thinker reading loop + numloaded++; switch (tclass) { @@ -2794,6 +2804,8 @@ static void P_NetUnArchiveThinkers(void) } } + CONS_Debug(DBG_NETPLAY, "%u thinkers loaded\n", numloaded); + if (restoreNum) { executor_t *delay = NULL; From ba6d011d7b6ea91047009c3f006e933096cf6f7e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 17 Jun 2017 17:22:45 +0100 Subject: [PATCH 074/124] Scale should be fixed_t not UINT16! This is probably a leftover from how scaling worked in v2.0 I take it --- src/g_game.c | 2 +- src/g_game.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7499fe7a..5774b473 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3872,7 +3872,7 @@ void G_GhostAddColor(ghostcolor_t color) ghostext.color = (UINT8)color; } -void G_GhostAddScale(UINT16 scale) +void G_GhostAddScale(fixed_t scale) { if (!demorecording || !(demoflags & DF_GHOST)) return; diff --git a/src/g_game.h b/src/g_game.h index 6d412551..ada82404 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -139,7 +139,7 @@ void G_GhostAddSpin(void); void G_GhostAddRev(void); void G_GhostAddColor(ghostcolor_t color); void G_GhostAddFlip(void); -void G_GhostAddScale(UINT16 scale); +void G_GhostAddScale(fixed_t scale); void G_GhostAddHit(mobj_t *victim); void G_WriteGhostTic(mobj_t *ghost); void G_ConsGhostTic(void); From 2bd11120b5a029f5b273d95fa7453ed2012e1189 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 19 Jun 2017 14:17:58 -0400 Subject: [PATCH 075/124] Appvenyor: disable OBJDUMP --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cc073ff0..23b9b628 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ before_build: - upx -V - ccache -V - ccache -s -- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC63=1 CCACHE=1 +- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 GCC63=1 CCACHE=1 NOOBJDUMP=1 build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% %CONFIGURATION%=1 clean From da2f5fe0a2432cc3d37d9f4bb518769f31c06c01 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 20 Jun 2017 16:18:51 +0100 Subject: [PATCH 076/124] Fix PlayerSpawn hook not being called if the player is respawned at a starpost --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 5774b473..e3d4ac85 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2288,6 +2288,9 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) if (starpost) //Don't even bother with looking for a place to spawn. { P_MovePlayerToStarpost(playernum); +#ifdef HAVE_BLUA + LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :) +#endif return; } From 9797ae31a669d635223a7f80871b3f3be997497d Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 2 Jul 2017 16:48:58 +0100 Subject: [PATCH 077/124] Fix the springs jumping! The issue was that because both them and the player had MF_SOLID, the tmfloorz of the spring was getting set to above the player (or vicea versa with tmceilingz), forcing it upwards with them under certain circumstances. Now, springs only acknowledge the solidity (for purpose of tmfloorz/tmceilingz) of objects they CAN'T launch. --- src/p_map.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 86776f8d..81bf9ebe 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -956,6 +956,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... return false; // "cancel" P_TryMove via blocking so you keep your current position } + else if (tmthing->flags & MF_SPRING && (thing->player || thing->flags & MF_PUSHABLE)) + ; // Fix a few nasty spring-jumping bugs that happen sometimes. // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) @@ -987,11 +989,13 @@ static boolean PIT_CheckThing(mobj_t *thing) topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways + if (thing->flags & MF_SPRING) + ; // block only when jumping not high enough, // (dont climb max. 24units while already in air) // since return false doesn't handle momentum properly, // we lie to P_TryMove() so it's always too high - if (tmthing->player && tmthing->z + tmthing->height > topz + else if (tmthing->player && tmthing->z + tmthing->height > topz && tmthing->z + tmthing->height < tmthing->ceilingz) { tmfloorz = tmceilingz = topz; // block while in air @@ -1000,8 +1004,6 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif tmfloorthing = thing; // needed for side collision } - else if (thing->flags & MF_SPRING) - ; else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { tmceilingz = topz; @@ -1030,11 +1032,13 @@ static boolean PIT_CheckThing(mobj_t *thing) topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways + if (thing->flags & MF_SPRING) + ; // block only when jumping not high enough, // (dont climb max. 24units while already in air) // since return false doesn't handle momentum properly, // we lie to P_TryMove() so it's always too high - if (tmthing->player && tmthing->z < topz + else if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) { tmfloorz = tmceilingz = topz; // block while in air @@ -1043,8 +1047,6 @@ static boolean PIT_CheckThing(mobj_t *thing) #endif tmfloorthing = thing; // needed for side collision } - else if (thing->flags & MF_SPRING) - ; else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { tmfloorz = topz; From c751971d57a347e11b008af2e26e1cafbab653a5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 2 Jul 2017 16:50:11 +0100 Subject: [PATCH 078/124] Fix integer type slipup in ArchiveValue for saving mobjinfo/state #s that LJSonic spotted Apart from the fact that UnArchiveValue reads UINT16 for both anyway (which alone causes problems), but UINT8 isn't even enough to store the higher end of the object types list and definitely most of the states welp --- src/lua_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index acb30682..991b8fcf 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -566,14 +566,14 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { mobjinfo_t *info = *((mobjinfo_t **)lua_touserdata(gL, myindex)); WRITEUINT8(save_p, ARCH_MOBJINFO); - WRITEUINT8(save_p, info - mobjinfo); + WRITEUINT16(save_p, info - mobjinfo); break; } case ARCH_STATE: { state_t *state = *((state_t **)lua_touserdata(gL, myindex)); WRITEUINT8(save_p, ARCH_STATE); - WRITEUINT8(save_p, state - states); + WRITEUINT16(save_p, state - states); break; } case ARCH_MOBJ: From 60e21381abfe2652fd417aeed8760acffc62e138 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 5 Jul 2017 16:20:23 +0100 Subject: [PATCH 079/124] Don't kick Tails! Also, a movement for the WRITESINT8 to prevent modification to buf if the function bails early. --- src/d_clisrv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 312a308a..5021f9a7 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2587,6 +2587,9 @@ static void Command_Kick(void) XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; UINT8 *p = buf; + if (!netgame) // Don't kick Tails in splitscreen! + return; + if (COM_Argc() == 1) { CONS_Printf(M_GetText("kick : kick a player\n")); @@ -2596,9 +2599,10 @@ static void Command_Kick(void) if (server || adminplayer == consoleplayer) { const SINT8 pn = nametonum(COM_Argv(1)); - WRITESINT8(p, pn); + if (pn == -1 || pn == 0) return; + // Special case if we are trying to kick a player who is downloading the game state: // trigger a timeout instead of kicking them, because a kick would only // take effect after they have finished downloading @@ -2607,6 +2611,9 @@ static void Command_Kick(void) Net_ConnectionTimeout(playernode[pn]); return; } + + WRITESINT8(p, pn); + if (COM_Argc() == 2) { WRITEUINT8(p, KICK_MSG_GO_AWAY); From 9a1e1180ff8479b59dff12cc77159b92d52d0bf1 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Wed, 5 Jul 2017 16:29:21 +0100 Subject: [PATCH 080/124] Also account for bans, pff. --- src/d_clisrv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5021f9a7..3fdd9652 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2525,6 +2525,9 @@ static void Command_Nodes(void) static void Command_Ban(void) { + if (!netgame) // Don't kick Tails in splitscreen! + return; + if (COM_Argc() == 1) { CONS_Printf(M_GetText("Ban : ban and kick a player\n")); @@ -2540,8 +2543,9 @@ static void Command_Ban(void) if (pn == -1 || pn == 0) return; - else - WRITEUINT8(p, pn); + + WRITEUINT8(p, pn); + if (server && I_Ban && !I_Ban(node)) // only the server is allowed to do this right now { CONS_Alert(CONS_WARNING, M_GetText("Too many bans! Geez, that's a lot of people you're excluding...\n")); From aca7a574f82ceacb8a3be63b2267867a8e15c324 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 5 Jul 2017 17:05:39 +0100 Subject: [PATCH 081/124] Copy+paste st_stuff.c functions and macros to accurately draw SCORE/TIME on the tally screen like they are when actually playing the level --- src/y_inter.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 2fd37ff3..ff4b798f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -159,6 +159,20 @@ static void Y_CalculateMatchWinners(void); static void Y_FollowIntermission(void); static void Y_UnloadData(void); +// Stuff copy+pasted from st_stuff.c +static INT32 SCX(INT32 x) +{ + return FixedInt(FixedMul(x< Date: Wed, 5 Jul 2017 19:25:11 +0100 Subject: [PATCH 082/124] Display minutes in full, so 60:00 for instance displays as 60:00 and not 0:00 The normal HUD display while playing a level doesn't do this, only the tally screen does it for some reason --- 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 ff4b798f..bfcb0f5b 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -230,7 +230,7 @@ void Y_IntermissionDrawer(void) INT32 seconds, minutes, tictrn; seconds = G_TicsToSeconds(data.coop.tics); - minutes = G_TicsToMinutes(data.coop.tics, false); + minutes = G_TicsToMinutes(data.coop.tics, true); tictrn = G_TicsToCentiseconds(data.coop.tics); ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes From e8df99c632ecdb91489b601d09e486870b38750f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 5 Jul 2017 22:30:18 +0100 Subject: [PATCH 083/124] They didn't use V_HUDTRANS before and they probably shouldn't, my fault here --- src/y_inter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index bfcb0f5b..acf1c6f2 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -169,9 +169,9 @@ static INT32 SCY(INT32 z) return FixedInt(FixedMul(z< Date: Fri, 7 Jul 2017 22:40:00 +0100 Subject: [PATCH 084/124] Some more tweaks of my own: *Add CONS_Printf messages for !netgame checks *Arg count is checked first regardless of netgame status for both kick and ban, < 2 is checked instead of == 1 just in case these weren't called from console for some stupid reason? *Moved Command_Kick's buffer vars to within the code that actually does kicking stuff --- src/d_clisrv.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3fdd9652..7c21d79f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2525,15 +2525,18 @@ static void Command_Nodes(void) static void Command_Ban(void) { - if (!netgame) // Don't kick Tails in splitscreen! - return; - - if (COM_Argc() == 1) + if (COM_Argc() < 2) { CONS_Printf(M_GetText("Ban : ban and kick a player\n")); return; } + if (!netgame) // Don't kick Tails in splitscreen! + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (server || adminplayer == consoleplayer) { XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; @@ -2588,20 +2591,22 @@ static void Command_Ban(void) static void Command_Kick(void) { - XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; - UINT8 *p = buf; - - if (!netgame) // Don't kick Tails in splitscreen! - return; - - if (COM_Argc() == 1) + if (COM_Argc() < 2) { CONS_Printf(M_GetText("kick : kick a player\n")); return; } + if (!netgame) // Don't kick Tails in splitscreen! + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (server || adminplayer == consoleplayer) { + XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH]; + UINT8 *p = buf; const SINT8 pn = nametonum(COM_Argv(1)); if (pn == -1 || pn == 0) From 2ac566fa85db630ac9be5db9ff5e71376f8a6018 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Jul 2017 15:08:17 +0100 Subject: [PATCH 085/124] Fix whitespace goofup of mine --- 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 acf1c6f2..42f1e223 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -236,7 +236,7 @@ void Y_IntermissionDrawer(void) ST_DrawNumFromHud(HUD_MINUTES, minutes); // Minutes ST_DrawPatchFromHud(HUD_TIMECOLON, sbocolon); // Colon ST_DrawPadNumFromHud(HUD_SECONDS, seconds, 2); // Seconds - + // we should show centiseconds on the intermission screen too, if the conditions are right. if (modeattacking || cv_timetic.value == 2) { From 7d4513f2f1a6c7715e29b37e58efdc8fd9aab0cb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jul 2017 20:47:00 +0100 Subject: [PATCH 086/124] Don't be stupid with FF_BLOCKPLAYER/FF_BLOCKOTHERS flags please --- src/p_user.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 5ea1ae47..7abf8534 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1221,11 +1221,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) if (!(rover->flags & FF_EXISTS)) continue; - // If the FOF is configured to let players through, continue. - if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) + // If the FOF is configured to let the object through, continue. + if (!((rover->flags & FF_BLOCKPLAYER && mo->player) + || (rover->flags & FF_BLOCKOTHERS && !mo->player))) continue; - // If the the platform is intangile from below, continue. + // If the the platform is intangible from below, continue. if (rover->flags & FF_PLATFORM) continue; @@ -1254,11 +1255,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) if (!(rover->flags & FF_EXISTS)) continue; - // If the FOF is configured to let players through, continue. - if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS)) + // If the FOF is configured to let the object through, continue. + if (!((rover->flags & FF_BLOCKPLAYER && mo->player) + || (rover->flags & FF_BLOCKOTHERS && !mo->player))) continue; - // If the the platform is intangile from above, continue. + // If the the platform is intangible from above, continue. if (rover->flags & FF_REVERSEPLATFORM) continue; From 6e5cffba5b6dfe28cbdb4fa3204daadb4e00a056 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 17 Jul 2017 20:56:55 +0100 Subject: [PATCH 087/124] Create static function P_IsObjectOnRealGround for each time thinker to use in place of P_IsObjectOnGroundIn, for non-FOF floor touch specials This fixes solid FOFs activating floor touch specials for normal ground if using an "each time" trigger linedef --- src/p_floor.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/p_floor.c b/src/p_floor.c index 0af81efe..ce35ca12 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -2021,6 +2021,33 @@ foundenemy: P_RemoveThinker(&nobaddies->thinker); } +// +// P_IsObjectOnRealGround +// +// Helper function for T_EachTimeThinker +// Like P_IsObjectOnGroundIn, except ONLY THE REAL GROUND IS CONSIDERED, NOT FOFS +// I'll consider whether to make this a more globally accessible function or whatever in future +// -- Monster Iestyn +// +static boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec) +{ + // Is the object in reverse gravity? + if (mo->eflags & MFE_VERTICALFLIP) + { + // Detect if the player is on the ceiling. + if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec)) + return true; + } + // Nope! + else + { + // Detect if the player is on the floor. + if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec)) + return true; + } + return false; +} + // // P_HavePlayersEnteredArea // @@ -2224,7 +2251,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) || P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec)) continue; - if (floortouch == true && P_IsObjectOnGroundIn(players[i].mo, sec)) + if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec)) { if (i & 1) eachtime->var2s[i/2] |= 1; From 821692fbf7bed2ddf7fc341474c4beb7842d5075 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 24 Jul 2017 17:53:18 +0100 Subject: [PATCH 088/124] This was my fault, whoops --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 8891165f..4ddb90b0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1742,7 +1742,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller case 305: // continuous case 306: // each time case 307: // once - if (!(actor && actor->player && actor->player->charability != dist/10)) + if (!(actor && actor->player && actor->player->charability == dist/10)) return false; break; case 309: // continuous From 35404be1e04f0a8e8dbf5c723bd3e49f0221bef1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 7 Aug 2017 16:37:03 -0400 Subject: [PATCH 089/124] SDL: y input is flipped --- src/sdl/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 1f1fd8a1..2d6698cc 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -624,7 +624,7 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if (SDL_GetRelativeMouseMode()) { event.data2 = evt.xrel; - event.data3 = evt.yrel; + event.data3 = -evt.yrel; } else if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { From 2d661fef18eeb4fa2dc221d1af5713ff75383dcc Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 25 Jun 2017 20:22:01 +0100 Subject: [PATCH 090/124] Turns out we don't need to use SDL_SetWindowTitle on its own, since SDL_CreateWindow already deals with the window title anyway. So I've disabled everything related to Impl_SetWindowName for now Also what were you thinking Fury?!? window shouldn't be NULL for SDL_SetWindowTitle, you backwards person you --- src/sdl/i_video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2d6698cc..2bcef916 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -159,7 +159,7 @@ static INT32 windowedModes[MAXWINMODES][2] = static void Impl_VideoSetupSDLBuffer(void); static void Impl_VideoSetupBuffer(void); static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); -static void Impl_SetWindowName(const char *title); +//static void Impl_SetWindowName(const char *title); static void Impl_SetWindowIcon(void); static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) @@ -1198,7 +1198,7 @@ INT32 VID_SetMode(INT32 modeNum) } vid.modenum = -1; } - Impl_SetWindowName("SRB2 "VERSIONSTRING); + //Impl_SetWindowName("SRB2 "VERSIONSTRING); SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); @@ -1281,14 +1281,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) return SDL_TRUE; } +/* static void Impl_SetWindowName(const char *title) { - if (window != NULL) + if (window == NULL) { return; } SDL_SetWindowTitle(window, title); } +*/ static void Impl_SetWindowIcon(void) { From 720987367ad7a7776d66db901df9548a41af5671 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Tue, 8 Aug 2017 14:27:02 -0500 Subject: [PATCH 091/124] Prevent cvar naming conflicts from pointing Lua to the wrong internal data. --- src/lua_consolelib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 28cc9176..566e7374 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -391,12 +391,21 @@ static int lib_cvRegisterVar(lua_State *L) // 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); + if (cvar->flags & CV_MODIFIED) + return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)"); // return cvar userdata return 1; From 758e9c455888dea5b7cabfa77da267a2ded7e8e8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 19 Aug 2017 21:39:04 +0100 Subject: [PATCH 092/124] Merge all (relative) mouse motion events into one mouse event This fixes SDL2_RelMouse's weaker sensitivity for me on Windows (but apparently not for others??) --- src/sdl/i_video.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2bcef916..d1ec5d44 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -606,6 +606,8 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) if (event.data1) D_PostEvent(&event); } +static int mousemovex, mousemovey; + static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) { event_t event; @@ -623,10 +625,20 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) if (SDL_GetRelativeMouseMode()) { - event.data2 = evt.xrel; - event.data3 = -evt.yrel; + //event.data2 = evt.xrel; + //event.data3 = -evt.yrel; + if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) + { + mousemovex += evt.xrel; + mousemovey += -evt.yrel; + SDL_SetWindowGrab(window, SDL_TRUE); + } + return; } - else if ((evt.x == realwidth/2) && (evt.y == realheight/2)) + + SDL_memset(&event, 0, sizeof(event_t)); + + if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } @@ -792,7 +804,8 @@ void I_GetEvent(void) SDL_Event evt; // We only want the first motion event, // otherwise we'll end up catching the warp back to center. - int mouseMotionOnce = 0; + //int mouseMotionOnce = 0; + mousemovex = mousemovey = 0; if (!graphics_started) { @@ -811,8 +824,9 @@ void I_GetEvent(void) Impl_HandleKeyboardEvent(evt.key, evt.type); break; case SDL_MOUSEMOTION: - if (!mouseMotionOnce) Impl_HandleMouseMotionEvent(evt.motion); - mouseMotionOnce = 1; + //if (!mouseMotionOnce) + Impl_HandleMouseMotionEvent(evt.motion); + //mouseMotionOnce = 1; break; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: @@ -835,6 +849,17 @@ void I_GetEvent(void) } } + if (mousemovex || mousemovey) + { + event_t event; + SDL_memset(&event, 0, sizeof(event_t)); + event.type = ev_mouse; + event.data1 = 0; + event.data2 = mousemovex; + event.data3 = mousemovey; + D_PostEvent(&event); + } + // In order to make wheels act like buttons, we have to set their state to Up. // This is because wheel messages don't have an up/down state. gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0; From 10cbe2c82b5e375a558275265977f2a6f2542243 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 19 Aug 2017 22:54:30 +0100 Subject: [PATCH 093/124] Turns out the issue was with fullscreen! All I have to do is factor in the resolution/real window size ratio apparently (which was already done before) Also changed movemousex/y to INT32 --- src/sdl/i_video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index d1ec5d44..81acb516 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -606,7 +606,7 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) if (event.data1) D_PostEvent(&event); } -static int mousemovex, mousemovey; +static INT32 mousemovex, mousemovey; static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) { @@ -629,8 +629,8 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) //event.data3 = -evt.yrel; if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - mousemovex += evt.xrel; - mousemovey += -evt.yrel; + mousemovex += (INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); + mousemovey += (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); SDL_SetWindowGrab(window, SDL_TRUE); } return; From 821a1810f74771991f535b9f4c27ae4a69821100 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 21 Aug 2017 21:38:29 +0100 Subject: [PATCH 094/124] Moved lrounding of mouse motion events to the actual point an event is made Also did some cleanup and moving around, as well as adding comments --- src/sdl/i_video.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 81acb516..137f4e12 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -107,6 +107,9 @@ static SDL_bool disable_mouse = SDL_FALSE; // first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT static INT32 firstEntry = 0; +// Total mouse motion X/Y offsets +static INT32 mousemovex = 0, mousemovey = 0; + // SDL vars static SDL_Surface *vidSurface = NULL; static SDL_Surface *bufSurface = NULL; @@ -606,8 +609,6 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) if (event.data1) D_PostEvent(&event); } -static INT32 mousemovex, mousemovey; - static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) { event_t event; @@ -623,30 +624,34 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) return; } + // If using relative mouse mode, don't post an event_t just now, + // add on the offsets so we can make an overall event later. if (SDL_GetRelativeMouseMode()) { //event.data2 = evt.xrel; //event.data3 = -evt.yrel; if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - mousemovex += (INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); - mousemovey += (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); + mousemovex += evt.xrel; //(INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); + mousemovey += -evt.yrel; //(INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); SDL_SetWindowGrab(window, SDL_TRUE); } return; } - SDL_memset(&event, 0, sizeof(event_t)); - + // If the event is from warping the pointer back to middle + // of the screen then ignore it. if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } - else - { - event.data2 = (INT32)lround((evt.xrel) * ((float)wwidth / (float)realwidth)); - event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); - } + + SDL_memset(&event, 0, sizeof(event_t)); + + event.type = ev_mouse; + + event.data2 = (INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); + event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); event.type = ev_mouse; @@ -805,13 +810,14 @@ void I_GetEvent(void) // We only want the first motion event, // otherwise we'll end up catching the warp back to center. //int mouseMotionOnce = 0; - mousemovex = mousemovey = 0; if (!graphics_started) { return; } + mousemovex = mousemovey = 0; + while (SDL_PollEvent(&evt)) { switch (evt.type) @@ -849,14 +855,17 @@ void I_GetEvent(void) } } + // Send all relative mouse movement as one single mouse event. if (mousemovex || mousemovey) { event_t event; - SDL_memset(&event, 0, sizeof(event_t)); + int wwidth, wheight; + SDL_GetWindowSize(window, &wwidth, &wheight); + //SDL_memset(&event, 0, sizeof(event_t)); event.type = ev_mouse; event.data1 = 0; - event.data2 = mousemovex; - event.data3 = mousemovey; + event.data2 = (INT32)lround(mousemovex * ((float)wwidth / (float)realwidth)); + event.data3 = (INT32)lround(mousemovey * ((float)wheight / (float)realheight)); D_PostEvent(&event); } From 36977a5eda6e0fac2f2e73ab662688da4ef06687 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 22 Aug 2017 22:53:18 +0100 Subject: [PATCH 095/124] SDL_SetRelativeMouseMode(SDL_TRUE) already does what HalfWarpMouse does Also, don't post an ev_mouse event_t if not in relative mouse mode, so the camera doesn't jerk when the mouse enters the window --- src/sdl/i_video.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 137f4e12..9cebe494 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -611,13 +611,8 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) { - event_t event; - int wwidth, wheight; - if (USE_MOUSEINPUT) { - SDL_GetWindowSize(window, &wwidth, &wheight); - if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window)) { SDLdoUngrabMouse(); @@ -628,40 +623,31 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt) // add on the offsets so we can make an overall event later. if (SDL_GetRelativeMouseMode()) { - //event.data2 = evt.xrel; - //event.data3 = -evt.yrel; if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - mousemovex += evt.xrel; //(INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); - mousemovey += -evt.yrel; //(INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); + mousemovex += evt.xrel; + mousemovey += -evt.yrel; SDL_SetWindowGrab(window, SDL_TRUE); } return; } - // If the event is from warping the pointer back to middle + // If the event is from warping the pointer to middle // of the screen then ignore it. if ((evt.x == realwidth/2) && (evt.y == realheight/2)) { return; } - SDL_memset(&event, 0, sizeof(event_t)); - - event.type = ev_mouse; - - event.data2 = (INT32)lround( evt.xrel * ((float)wwidth / (float)realwidth)); - event.data3 = (INT32)lround(-evt.yrel * ((float)wheight / (float)realheight)); - - event.type = ev_mouse; - + // Don't send an event_t if not in relative mouse mode anymore, + // just grab and set relative mode + // this fixes the stupid camera jerk on mouse entering bug + // -- Monster Iestyn if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window) { - D_PostEvent(&event); SDL_SetWindowGrab(window, SDL_TRUE); - if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) - wrapmouseok = SDL_TRUE; - HalfWarpMouse(wwidth, wheight); + if (SDL_SetRelativeMouseMode(SDL_TRUE) == 0) // already warps mouse if successful + wrapmouseok = SDL_TRUE; // TODO: is wrapmouseok or HalfWarpMouse needed anymore? } } } From 50917d2ee2e3103a1aeac10e3aed2b1d4ad3e75c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 30 Aug 2017 19:21:23 +0100 Subject: [PATCH 096/124] P_FloorzAtPos: Check the normal floor's slope as well as FOF slopes, silly. --- src/p_map.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 81bf9ebe..f319acea 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4000,6 +4000,11 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) sector_t *sec = R_PointInSubsector(x, y)->sector; fixed_t floorz = sec->floorheight; +#ifdef ESLOPE + if (sec->f_slope) + floorz = P_GetZAt(sec->f_slope, x, y); +#endif + // Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002 if (sec->ffloors) { From 8514251ad5c8dda928ca0924a7553429fc183c4f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 9 Sep 2017 21:19:07 +0100 Subject: [PATCH 097/124] fix savegamename not prepending srb2home to itself for custom mods using their own gamedata files --- src/dehacked.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index f03dd73b..b7e874b1 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -11,6 +11,7 @@ /// \brief Load dehacked file and change tables and text #include "doomdef.h" +#include "d_main.h" // for srb2home #include "g_game.h" #include "sounds.h" #include "info.h" @@ -3070,6 +3071,8 @@ static void readmaincfg(MYFILE *f) strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder)); strlcat(savegamename, "%u.ssg", sizeof(savegamename)); + // can't use sprintf since there is %u in savegamename + strcatbf(savegamename, srb2home, PATHSEP); gamedataadded = true; } From c330907dba4f4196a30a0481485deea6e6a9f6ef Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Sep 2017 21:03:20 +0100 Subject: [PATCH 098/124] Added a SDL12=1 flag to all ports whose interface code still lives in the sdl12 folder (and is unsupported by SDL 2.0 officially anyway) This basically causes the makefile to use the sdl12 folder instead of the main sdl folder --- src/Makefile | 8 +++++++- src/Makefile.cfg | 24 ++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Makefile b/src/Makefile index 426dc228..57bd0644 100644 --- a/src/Makefile +++ b/src/Makefile @@ -209,7 +209,13 @@ LIBS+=-lm endif ifdef SDL -include sdl/Makefile.cfg +#SDL 2.0 +ifndef SDL12 + include sdl/Makefile.cfg +#SDL 1.2 +else + include sdl12/Makefile.cfg +endif #ifndef SDL12 endif #ifdef SDL ifdef DISTCC diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 5bf7f247..3f619773 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -322,22 +322,24 @@ ifdef MINGW64 BIN:=$(BIN)/Mingw64 else ifdef WII - INTERFACE=sdl + INTERFACE=sdl12 NONX86=1 STATIC=1 PREFIX?=powerpc-eabi SDL=1 + SDL12=1 SDLMAIN=1 OBJDIR:=$(OBJDIR)/Wii BIN:=$(BIN)/Wii NOUPX=1 else ifdef PS3N - INTERFACE=sdl + INTERFACE=sdl12 NONX86=1 STATIC=1 PREFIX?=ppu SDL=1 + SDL12=1 # unsure? #SDLMAIN=1 # can't compile SDL_mixer for ps3... @@ -352,34 +354,38 @@ ifdef MINGW BIN:=$(BIN)/Mingw else ifdef XBOX - INTERFACE=sdl + INTERFACE=sdl12 NASMFORMAT=win32 PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox SDL=1 + SDL12=1 OBJDIR:=$(OBJDIR)/XBOX BIN:=$(BIN)/XBOX else ifdef PSP - INTERFACE=sdl + INTERFACE=sdl12 NONX86=1 SDL=1 + SDL12=1 OBJDIR:=$(OBJDIR)/PSP BIN:=$(BIN)/PSP NOUPX=1 else ifdef DC - INTERFACE=sdl + INTERFACE=sdl12 NONX86=1 SDL=1 + SDL12=1 OBJDIR:=$(OBJDIR)/DC BIN:=$(BIN)/DC NOUPX=1 else ifdef WINCE - INTERFACE=sdl + INTERFACE=sdl12 NONX86=1 PREFIX?=arm-wince-pe SDL=1 + SDL12=1 OBJDIR:=$(OBJDIR)/WinCE BIN:=$(BIN)/WinCE else @@ -437,7 +443,13 @@ OBJDUMP_OPTS?=--wide --source --line-numbers LD=$(CC) ifdef SDL +# SDL 2.0 +ifndef SDL12 INTERFACE=sdl +# SDL 1.2 +else + INTERFACE=sdl12 +endif OBJDIR:=$(OBJDIR)/SDL endif From 5076861e0fd2fd75969897fb5fe311222c2dd8e2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Sep 2017 21:09:35 +0100 Subject: [PATCH 099/124] Fixed sdl12/Makefile.cfg and sdl12/(port)/Makefile.cfg and related to refer to sdl12/ subfolders, not sdl/ subfolders --- src/sdl12/MakeCYG.cfg | 2 +- src/sdl12/MakeNIX.cfg | 2 +- src/sdl12/Makefile.cfg | 20 ++++++++++---------- src/sdl12/SRB2PS3/Makefile.cfg | 4 ++-- src/sdl12/SRB2PSP/Makefile.cfg | 10 +++++----- src/sdl12/SRB2Pandora/Makefile.cfg | 4 ++-- src/sdl12/SRB2WII/Makefile.cfg | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sdl12/MakeCYG.cfg b/src/sdl12/MakeCYG.cfg index 5907579c..b55d9dc5 100644 --- a/src/sdl12/MakeCYG.cfg +++ b/src/sdl12/MakeCYG.cfg @@ -1,5 +1,5 @@ # -# sdl/makeCYG.cfg for SRB2/Cygwin +# sdl12/makeCYG.cfg for SRB2/Cygwin # # diff --git a/src/sdl12/MakeNIX.cfg b/src/sdl12/MakeNIX.cfg index 457f5230..1278aaf0 100644 --- a/src/sdl12/MakeNIX.cfg +++ b/src/sdl12/MakeNIX.cfg @@ -1,5 +1,5 @@ # -# sdl/makeNIX.cfg for SRB2/?nix +# sdl12/makeNIX.cfg for SRB2/?nix # #Valgrind support diff --git a/src/sdl12/Makefile.cfg b/src/sdl12/Makefile.cfg index 1d404c4c..8d9ebc35 100644 --- a/src/sdl12/Makefile.cfg +++ b/src/sdl12/Makefile.cfg @@ -1,5 +1,5 @@ # -# sdl/makefile.cfg for SRB2/SDL +# sdl12/makefile.cfg for SRB2/SDL # # @@ -7,35 +7,35 @@ # ifdef UNIXCOMMON -include sdl/MakeNIX.cfg +include sdl12/MakeNIX.cfg endif ifdef PANDORA -include sdl/SRB2Pandora/Makefile.cfg +include sdl12/SRB2Pandora/Makefile.cfg endif #ifdef PANDORA ifdef DC -include sdl/SRB2DC/Makefile.cfg +include sdl12/SRB2DC/Makefile.cfg endif #ifdef DC ifdef PS3N -include sdl/SRB2PS3/Makefile.cfg +include sdl12/SRB2PS3/Makefile.cfg endif #ifdef PS3N ifdef PSP -include sdl/SRB2PSP/Makefile.cfg +include sdl12/SRB2PSP/Makefile.cfg endif #ifdef PSP ifdef XBOX -include sdl/SRB2XBOX/Makefile.cfg +include sdl12/SRB2XBOX/Makefile.cfg endif #ifdef XBOX ifdef WINCE -include sdl/SRB2CE/Makefile.cfg +include sdl12/SRB2CE/Makefile.cfg endif #ifef WINCE ifdef CYGWIN32 -include sdl/MakeCYG.cfg +include sdl12/MakeCYG.cfg endif #ifdef CYGWIN32 ifdef SDL_PKGCONFIG @@ -151,7 +151,7 @@ endif # FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order ifdef WII -include sdl/SRB2WII/Makefile.cfg +include sdl12/SRB2WII/Makefile.cfg endif #ifdef WII CFLAGS+=$(SDL_CFLAGS) diff --git a/src/sdl12/SRB2PS3/Makefile.cfg b/src/sdl12/SRB2PS3/Makefile.cfg index a4a01714..80f8db7b 100644 --- a/src/sdl12/SRB2PS3/Makefile.cfg +++ b/src/sdl12/SRB2PS3/Makefile.cfg @@ -27,10 +27,10 @@ PKGNAME?=SRB2PS3.pkg endif DGBNAME?=$(EXENAME).debug -SRB2PS3DIR=sdl/SRB2PS3 +SRB2PS3DIR=sdl12/SRB2PS3 ICON0?=$(SRB2PS3DIR)/ICON0.png SFOXML?=sfo.xml -SRB2TTF?=sdl/srb2.ttf +SRB2TTF?=sdl12/srb2.ttf TITLE=Sonic Robo Blast 2 v2.0.6 APPID=SRB2-PS3 diff --git a/src/sdl12/SRB2PSP/Makefile.cfg b/src/sdl12/SRB2PSP/Makefile.cfg index f9ec6416..5e4c0ba2 100644 --- a/src/sdl12/SRB2PSP/Makefile.cfg +++ b/src/sdl12/SRB2PSP/Makefile.cfg @@ -36,14 +36,14 @@ endif PSP_EBOOT_TITLE=SRB2-PSP vME PSP_EBOOT_SFO=$(BIN)/PARAM.SFO - PSP_EBOOT_ICON=sdl/SRB2PSP/ICON0.png + PSP_EBOOT_ICON=sdl12/SRB2PSP/ICON0.png PSP_EBOOT_ICON1=NULL PSP_EBOOT_UNKPNG=NULL - PSP_EBOOT_PIC1=sdl/SRB2PSP/PIC1.png + PSP_EBOOT_PIC1=sdl12/SRB2PSP/PIC1.png PSP_EBOOT_SND0=NULL PSP_EBOOT_PSAR=NULL - SIGNER?=sdl/SRB2PSP/psp-prxsign/psp-prxsign + SIGNER?=sdl12/SRB2PSP/psp-prxsign/psp-prxsign SDL=1 PREFIX=psp @@ -100,8 +100,8 @@ kxploit: $(BIN)/$(EXENAME) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \ $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR) -sdl/SRB2PSP/psp-prxsign/psp-prxsign: - -$(MAKE) -C sdl/SRB2PSP/psp-prxsign CFLAGS=-pipe CC="$(HOSTCC)" +sdl12/SRB2PSP/psp-prxsign/psp-prxsign: + -$(MAKE) -C sdl12/SRB2PSP/psp-prxsign CFLAGS=-pipe CC="$(HOSTCC)" fix-up: $(BIN)/$(EXENAME) @echo Running psp-fixup-imports on $(EXENAME) diff --git a/src/sdl12/SRB2Pandora/Makefile.cfg b/src/sdl12/SRB2Pandora/Makefile.cfg index c7f0f844..1f057a21 100644 --- a/src/sdl12/SRB2Pandora/Makefile.cfg +++ b/src/sdl12/SRB2Pandora/Makefile.cfg @@ -2,8 +2,8 @@ PNDNAME=SRB2.pnd PNDDIR=$(BIN)/pnd -ICON=sdl/SRB2Pandora/icon.png -PXML=sdl/SRB2Pandora/PXML.xml +ICON=sdl12/SRB2Pandora/icon.png +PXML=sdl12/SRB2Pandora/PXML.xml SED=sed CAT=cat diff --git a/src/sdl12/SRB2WII/Makefile.cfg b/src/sdl12/SRB2WII/Makefile.cfg index 1b186304..778d2c3d 100644 --- a/src/sdl12/SRB2WII/Makefile.cfg +++ b/src/sdl12/SRB2WII/Makefile.cfg @@ -16,8 +16,8 @@ EXENAME?=$(SRB2NAME).elf DBGNAME?=$(SRB2NAME).elf.debug DOLNAME?=$(SRB2NAME).dol -ICONPNG?=sdl/SRB2WII/icon.png -METAXML?=sdl/SRB2WII/meta.xml +ICONPNG?=sdl12/SRB2WII/icon.png +METAXML?=sdl12/SRB2WII/meta.xml APPDIR=apps/$(SRB2NAME) ZIPNAME=$(SRB2NAME).zip From 900bab9b13e23a8ec858b90da0d8648087ad920f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Sep 2017 21:15:38 +0100 Subject: [PATCH 100/124] Fix includes for SDL 1.2-only ports' files --- src/d_clisrv.c | 2 +- src/d_main.c | 2 +- src/filesrch.c | 2 +- src/i_tcp.c | 4 ++-- src/m_fixed.h | 2 +- src/mserv.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c21d79f..1e51a79f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -51,7 +51,7 @@ #endif #ifdef _XBOX -#include "sdl/SRB2XBOX/xboxhelp.h" +#include "sdl12/SRB2XBOX/xboxhelp.h" #endif // diff --git a/src/d_main.c b/src/d_main.c index 4080087c..063d2845 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -82,7 +82,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #endif #ifdef _XBOX -#include "sdl/SRB2XBOX/xboxhelp.h" +#include "sdl12/SRB2XBOX/xboxhelp.h" #endif #ifdef HWRENDER diff --git a/src/filesrch.c b/src/filesrch.c index acc176d6..2463e717 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -22,7 +22,7 @@ #include #endif #ifdef _WIN32_WCE -#include "sdl/SRB2CE/cehelp.h" +#include "sdl12/SRB2CE/cehelp.h" #else #include #endif diff --git a/src/i_tcp.c b/src/i_tcp.c index c65a536a..5681a9d4 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -97,7 +97,7 @@ #include #ifdef _arch_dreamcast -#include "sdl/SRB2DC/dchelp.h" +#include "sdl12/SRB2DC/dchelp.h" #endif #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) @@ -192,7 +192,7 @@ static UINT8 UPNP_support = TRUE; #define close closesocket #ifdef _WIN32_WCE - #include "sdl/SRB2CE/cehelp.h" + #include "sdl12/SRB2CE/cehelp.h" #endif #endif diff --git a/src/m_fixed.h b/src/m_fixed.h index 1cf9abba..0eb045c1 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -21,7 +21,7 @@ #endif #ifdef _WIN32_WCE -#include "sdl/SRB2CE/cehelp.h" +#include "sdl12/SRB2CE/cehelp.h" #endif /*! diff --git a/src/mserv.c b/src/mserv.c index a8e43bbf..76fba835 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -65,7 +65,7 @@ #endif #ifdef _arch_dreamcast -#include "sdl/SRB2DC/dchelp.h" +#include "sdl12/SRB2DC/dchelp.h" #endif #include // timeval,... (TIMEOUT) @@ -92,7 +92,7 @@ #include "m_misc.h" // GetRevisionString() #ifdef _WIN32_WCE -#include "sdl/SRB2CE/cehelp.h" +#include "sdl12/SRB2CE/cehelp.h" #endif #include "i_addrinfo.h" From 9e6ed121ba574110cdb76dbe5001893fc7f1c854 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Sep 2017 21:29:38 +0100 Subject: [PATCH 101/124] Comment out sdl12/SRB2CE/cehelp.h include in m_fixed.h I think it was originally included for defining the "USEASM" macro, but USEASM isn't used by m_fixed.h/c code anymore --- src/m_fixed.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 0eb045c1..77382398 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -20,9 +20,10 @@ #include #endif -#ifdef _WIN32_WCE -#include "sdl12/SRB2CE/cehelp.h" -#endif +// Was this just for the #define USEASM? +//#ifdef _WIN32_WCE +//#include "sdl12/SRB2CE/cehelp.h" +//#endif /*! \brief bits of the fraction From d2a76ca269110036f61f488646318008c066ea01 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 15 Sep 2017 17:12:53 +0100 Subject: [PATCH 102/124] Removed references to console ports and WinCE in sdl/Makefile.cfg --- src/sdl/Makefile.cfg | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index b54f7057..58c4d086 100644 --- a/src/sdl/Makefile.cfg +++ b/src/sdl/Makefile.cfg @@ -14,26 +14,6 @@ ifdef PANDORA include sdl/SRB2Pandora/Makefile.cfg endif #ifdef PANDORA -ifdef DC -include sdl/SRB2DC/Makefile.cfg -endif #ifdef DC - -ifdef PS3N -include sdl/SRB2PS3/Makefile.cfg -endif #ifdef PS3N - -ifdef PSP -include sdl/SRB2PSP/Makefile.cfg -endif #ifdef PSP - -ifdef XBOX -include sdl/SRB2XBOX/Makefile.cfg -endif #ifdef XBOX - -ifdef WINCE -include sdl/SRB2CE/Makefile.cfg -endif #ifef WINCE - ifdef CYGWIN32 include sdl/MakeCYG.cfg endif #ifdef CYGWIN32 @@ -150,15 +130,8 @@ endif endif endif -# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order -ifdef WII -include sdl/SRB2WII/Makefile.cfg -endif #ifdef WII - CFLAGS+=$(SDL_CFLAGS) LIBS:=$(SDL_LDFLAGS) $(LIBS) -ifndef WII ifdef STATIC LIBS+=$(shell $(SDL_CONFIG) --static-libs) endif -endif From 5fb551dd758d676db63b9aafed058e588ecee131 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 15 Sep 2017 17:15:06 +0100 Subject: [PATCH 103/124] Removed 1.2.x version checks in these files, SDL 2.0.x should always have these files --- src/sdl/hwsym_sdl.c | 6 ++---- src/sdl/i_system.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 54f5da3a..0085dfaf 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -41,10 +41,8 @@ #define NOLOADSO #endif -#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO) -#include "SDL_loadso.h" // 1.2.6+ -#elif !defined (NOLOADSO) -#define NOLOADSO +#ifndef NOLOADSO +#include "SDL_loadso.h" #endif #define _CREATE_DLL_ // necessary for Unix AND Windows diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f72a9857..41054a71 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -88,8 +88,8 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #pragma warning(default : 4214 4244) #endif -#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC) -#include "SDL_cpuinfo.h" // 1.2.7 or greater +#ifndef DC +#include "SDL_cpuinfo.h" #define HAVE_SDLCPUINFO #endif From dcb23e01c0d1fad922b7aeedc02d26b31c1d4b04 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 15 Sep 2017 21:22:28 +0100 Subject: [PATCH 104/124] SDL_INIT_NOPARACHUTE does nothing in SDL 2.0, so don't use it anymore --- src/sdl/i_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 41054a71..e3e5d29d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2252,9 +2252,9 @@ INT32 I_StartupSystem(void) I_OutputMsg("Linked with SDL version: %d.%d.%d\n", SDLlinked.major, SDLlinked.minor, SDLlinked.patch); #if 0 //#ifdef GP2X //start up everything - if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0) + if (SDL_Init(SDL_INIT_EVERYTHING) < 0) #else - if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) + if (SDL_Init(0) < 0) #endif I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no.... #ifndef NOMUMBLE From a33bb70a0cbfc8f717b9696b2055de71ba5fd4c4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 16 Sep 2017 20:26:04 +0100 Subject: [PATCH 105/124] Removed all support for Dreamcast, XBox, PSP, PS3, GP2X, Wii, and WinCE from files in the sdl/ folder. If you wanted these ports, use the SDL 1.2 code in sdl12 Also removed GP2X setup from sdl/MakeNIX.cfg, use sdl12 for that too --- src/sdl/MakeNIX.cfg | 31 ----- src/sdl/endtxt.c | 2 - src/sdl/hwsym_sdl.c | 4 - src/sdl/i_main.c | 91 +------------- src/sdl/i_system.c | 283 +++++------------------------------------- src/sdl/i_ttf.c | 12 +- src/sdl/i_ttf.h | 3 +- src/sdl/i_video.c | 2 +- src/sdl/mixer_sound.c | 2 - src/sdl/sdl_sound.c | 42 +------ 10 files changed, 40 insertions(+), 432 deletions(-) diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg index 1a0b5421..47c944eb 100644 --- a/src/sdl/MakeNIX.cfg +++ b/src/sdl/MakeNIX.cfg @@ -65,37 +65,6 @@ ifdef MACOSX LIBS+=-framework CoreFoundation endif -# -#here is GP2x (arm-gp2x-linux) -# -ifdef GP2X - PNG_CONFIG?=$(PREFIX)-libpng12-config -ifdef STATIC #need a better setting name - CFLAGS+=-I$(OPEN2X)/include -ifndef NOMIXER - LIBS+=-lvorbisidec -ifdef MIKMOD - LIBS+=-lmikmod -endif -ifdef SMPEGLIB - LIBS+=-lsmpeg - LD=$(CXX) -endif -endif - NONET=1 -endif -ifndef ARCHNAME -"error" -endif - NONX86=1 - NOHW=1 - NOHS=1 - NOMD5=1 - WFLAGS+=-O0 - OPTS+=-DGP2X -ffast-math -mcpu=arm920t - EXENAME?=SRB2GP2X.gpe -endif - ifndef NOHW OPTS+=-I/usr/X11R6/include LDFLAGS+=-L/usr/X11R6/lib diff --git a/src/sdl/endtxt.c b/src/sdl/endtxt.c index 1d7756b4..1e72ca9a 100644 --- a/src/sdl/endtxt.c +++ b/src/sdl/endtxt.c @@ -33,7 +33,6 @@ void ShowEndTxt(void) { -#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast)) INT32 i; UINT16 j, att = 0; INT32 nlflag = 1; @@ -232,5 +231,4 @@ void ShowEndTxt(void) printf("\n"); Z_Free(data); -#endif } diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index 0085dfaf..f4686d2b 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -37,10 +37,6 @@ #pragma warning(default : 4214 4244) #endif -#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X) -#define NOLOADSO -#endif - #ifndef NOLOADSO #include "SDL_loadso.h" #endif diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 25fccb9f..df4e3cc9 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -26,28 +26,6 @@ #include #endif -#ifdef _WII -#include -#include -#include -#ifdef REMOTE_DEBUGGING -#include -#endif -static char wiicwd[PATH_MAX] = "sd:/"; -static char localip[16] = {0}; -static char gateway[16] = {0}; -static char netmask[16] = {0}; -#endif - -#ifdef _PSP -#include -#include -PSP_HEAP_SIZE_KB(24*1024); -PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU); -PSP_MAIN_THREAD_NAME("SRB2"); -PSP_MAIN_THREAD_STACK_SIZE_KB(256); -#endif - #ifdef HAVE_SDL #ifdef HAVE_TTF @@ -79,23 +57,12 @@ FILE *logstream = NULL; #endif #endif -#if defined (_WIN32) && !defined (_XBOX) +#if defined (_WIN32) #include "../win32/win_dbg.h" typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID); #endif -#ifdef _arch_dreamcast -#include -KOS_INIT_FLAGS(INIT_DEFAULT -//| INIT_NET -//| INIT_MALLOCSTATS -//| INIT_QUIET -//| INIT_OCRAM -//| INIT_NO_DCLOAD -); -#endif - -#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE) +#if defined (_WIN32) static inline VOID MakeCodeWritable(VOID) { #ifdef USEASM // Disable write-protection of code segment @@ -136,13 +103,6 @@ static inline VOID MakeCodeWritable(VOID) \return int */ -#if defined (_XBOX) && defined (__GNUC__) -void XBoxStartup() -{ - const char *logdir = NULL; - myargc = -1; - myargv = NULL; -#else #ifdef FORCESDLMAIN int SDL_main(int argc, char **argv) #else @@ -152,56 +112,19 @@ int main(int argc, char **argv) const char *logdir = NULL; myargc = argc; myargv = argv; /// \todo pull out path to exe from this string -#endif #ifdef HAVE_TTF -#ifdef _PS3 - // apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around - SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1); - I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF); -#elif defined(_WIN32) +#ifdef _WIN32 I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE); #else I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE); #endif #endif -#ifdef _PS3 - // initialise controllers. - //ioPadInit(7); -#endif - -// init Wii-specific stuff -#ifdef _WII - // Start network - if_config(localip, netmask, gateway, TRUE); - -#ifdef REMOTE_DEBUGGING -#if REMOTE_DEBUGGING == 0 - DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828 -#elif REMOTE_DEBUGGING > 2 - DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port -#elif REMOTE_DEBUGGING < 0 - DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1 -#else - DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot -#endif -#endif - // Start FAT filesystem - fatInitDefault(); - - if (getcwd(wiicwd, PATH_MAX)) - I_PutEnv(va("HOME=%ssrb2wii", wiicwd)); -#endif - logdir = D_Home(); #ifdef LOGMESSAGES -#if defined(_WIN32_WCE) || defined(GP2X) - logstream = fopen(va("%s.log",argv[0]), "wt"); -#elif defined (_WII) - logstream = fopen(va("%s/log.txt",logdir), "wt"); -#elif defined (DEFAULTDIR) +#ifdef DEFAULTDIR if (logdir) logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt"); else @@ -211,8 +134,7 @@ int main(int argc, char **argv) //I_OutputMsg("I_StartupSystem() ...\n"); I_StartupSystem(); -#if defined (_WIN32) && !defined (_XBOX) -#ifndef _WIN32_WCE +#if defined (_WIN32) { #if 0 // just load the DLL p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent"); @@ -221,16 +143,13 @@ int main(int argc, char **argv) && !InitBugTrap() #endif ) -#endif { LoadLibraryA("exchndl.dll"); } } #endif prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); -#ifndef _WIN32_WCE MakeCodeWritable(); -#endif #endif // startup SRB2 CONS_Printf("Setting up SRB2...\n"); diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e3e5d29d..3ad57559 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -26,19 +26,12 @@ #include "../config.h.in" #endif -#ifndef _WIN32_WCE #include -#endif -#ifdef _XBOX -#include "SRB2XBOX/xboxhelp.h" -#endif - -#if defined (_WIN32) && !defined (_XBOX) +#ifdef _WIN32 #define RPC_NO_WINDOWS_H #include #include "../doomtype.h" -#ifndef _WIN32_WCE typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); typedef DWORD (WINAPI *p_timeGetTime) (void); @@ -46,7 +39,6 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT); typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR); typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif -#endif #include #include #include @@ -59,18 +51,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -#ifdef _arch_dreamcast -#include -#include -#include -#include -void __set_fpscr(long); // in libgcc / kernel's startup.s? -#else #include -#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#ifdef _WIN32 #include #endif -#endif #ifdef _MSC_VER #pragma warning(disable : 4214 4244) @@ -88,15 +72,10 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #pragma warning(default : 4214 4244) #endif -#ifndef DC #include "SDL_cpuinfo.h" #define HAVE_SDLCPUINFO -#endif -#ifdef _PSP -//#include -#elif !defined(_PS3) -#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII)) +#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) #if defined (__linux__) #include #else @@ -111,20 +90,17 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #include #endif #endif -#endif -#ifndef _PS3 -#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII)) +#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) #ifndef NOTERMIOS #include #include // ioctl #define HAVE_TERMIOS #endif #endif -#endif #ifndef NOMUMBLE -#if defined (__linux__) && !defined(_PS3) // need -lrt +#ifdef __linux__ // need -lrt #include #ifdef MAP_FAILED #define HAVE_SHM @@ -132,7 +108,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #include #endif -#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#ifdef _WIN32 #define HAVE_MUMBLE #define WINMUMBLE #elif defined (HAVE_SHM) @@ -140,10 +116,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #endif #endif // NOMUMBLE -#ifdef _WIN32_WCE -#include "SRB2CE/cehelp.h" -#endif - #ifndef O_BINARY #define O_BINARY 0 #endif @@ -153,44 +125,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #endif // Locations for searching the srb2.srb -#ifdef _arch_dreamcast -#define DEFAULTWADLOCATION1 "/cd" -#define DEFAULTWADLOCATION2 "/pc" -#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data" -#define DEFAULTSEARCHPATH1 "/cd" -#define DEFAULTSEARCHPATH2 "/pc" -//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data" -#elif defined (GP2X) -#define DEFAULTWADLOCATION1 "/mnt/sd" -#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2" -#define DEFAULTWADLOCATION3 "/tmp/mnt/sd" -#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2" -#define DEFAULTSEARCHPATH1 "/mnt/sd" -#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd" -#elif defined (_WII) -#define NOCWD -#define NOHOME -#define NEED_SDL_GETENV -#define DEFAULTWADLOCATION1 "sd:/srb2wii" -#define DEFAULTWADLOCATION2 "usb:/srb2wii" -#define DEFAULTSEARCHPATH1 "sd:/srb2wii" -#define DEFAULTSEARCHPATH2 "usb:/srb2wii" -// PS3: TODO: this will need modification most likely -#elif defined (_PS3) -#define NOCWD -#define NOHOME -#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" -#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3" -#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" -#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3" -#elif defined (_PSP) -#define NOCWD -#define NOHOME -#define DEFAULTWADLOCATION1 "host0:/bin/Resources" -#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP" -#define DEFAULTSEARCHPATH1 "host0:/" -#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP" -#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" #define DEFAULTWADLOCATION2 "/usr/local/games/SRB2" #define DEFAULTWADLOCATION3 "/usr/share/games/SRB2" @@ -198,23 +133,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #define DEFAULTSEARCHPATH1 "/usr/local/games" #define DEFAULTSEARCHPATH2 "/usr/games" #define DEFAULTSEARCHPATH3 "/usr/local" -#elif defined (_XBOX) -#define NOCWD -#ifdef __GNUC__ -#include -#endif -#define DEFAULTWADLOCATION1 "c:\\srb2" -#define DEFAULTWADLOCATION2 "d:\\srb2" -#define DEFAULTWADLOCATION3 "e:\\srb2" -#define DEFAULTWADLOCATION4 "f:\\srb2" -#define DEFAULTWADLOCATION5 "g:\\srb2" -#define DEFAULTWADLOCATION6 "h:\\srb2" -#define DEFAULTWADLOCATION7 "i:\\srb2" -#elif defined (_WIN32_WCE) -#define NOCWD -#define NOHOME -#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO" -#define DEFAULTSEARCHPATH1 "\\Storage Card" #elif defined (_WIN32) #define DEFAULTWADLOCATION1 "c:\\games\\srb2" #define DEFAULTWADLOCATION2 "\\games\\srb2" @@ -270,9 +188,6 @@ static void JoyReset(SDLJoyInfo_t *JoySet) { if (JoySet->dev) { -#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick... - if (SDL_JoystickIndex(JoySet->dev) != 0) -#endif SDL_JoystickClose(JoySet->dev); } JoySet->dev = NULL; @@ -308,7 +223,6 @@ SDL_bool framebuffer = SDL_FALSE; UINT8 keyboard_started = false; -#if !defined (DC) FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num) { //static char msg[] = "oh no! back to reality!\r\n"; @@ -362,7 +276,6 @@ FUNCNORETURN static ATTRNORETURN void quit_handler(int num) raise(num); I_Quit(); } -#endif #ifdef HAVE_TERMIOS // TERMIOS console code from Quake3: thank you! @@ -487,9 +400,7 @@ static void I_StartupConsole(void) signal(SIGTTIN, SIG_IGN); signal(SIGTTOU, SIG_IGN); -#if !defined(GP2X) //read is bad on GP2X consolevent = !M_CheckParm("-noconsole"); -#endif framebuffer = M_CheckParm("-framebuffer"); if (framebuffer) @@ -577,7 +488,7 @@ void I_GetConsoleEvents(void) (void)d; } -#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE)) +#elif defined (_WIN32) static BOOL I_ReadyConsole(HANDLE ci) { DWORD gotinput; @@ -716,17 +627,6 @@ static inline void I_ShutdownConsole(void){} void I_GetConsoleEvents(void){} static inline void I_StartupConsole(void) { -#ifdef _arch_dreamcast - char title[] = "SRB2 for Dreamcast!\n"; - __set_fpscr(0x00040000); /* ignore FPU underflow */ - //printf("\nHello world!\n\n"); - pvr_init_defaults(); - conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE); - conio_set_theme(CONIO_THEME_MATRIX); - conio_clear(); - conio_putstr(title); - //printf("\nHello world!\n\n"); -#endif #ifdef _DEBUG consolevent = !M_CheckParm("-noconsole"); #else @@ -746,7 +646,6 @@ static inline void I_ShutdownConsole(void){} // void I_StartupKeyboard (void) { -#if !defined (DC) #ifdef SIGINT signal(SIGINT , quit_handler); #endif @@ -763,7 +662,6 @@ void I_StartupKeyboard (void) signal(SIGSEGV , signal_handler); signal(SIGABRT , signal_handler); signal(SIGFPE , signal_handler); -#endif } // @@ -775,10 +673,6 @@ void I_OutputMsg(const char *fmt, ...) XBOXSTATIC char txt[8192]; va_list argptr; -#ifdef _arch_dreamcast - if (!keyboard_started) conio_printf(fmt); -#endif - va_start(argptr,fmt); vsprintf(txt, fmt, argptr); va_end(argptr); @@ -788,7 +682,7 @@ void I_OutputMsg(const char *fmt, ...) DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt); #endif -#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER) +#if defined (_WIN32) && defined (_MSC_VER) OutputDebugStringA(txt); #endif @@ -803,7 +697,7 @@ void I_OutputMsg(const char *fmt, ...) } #endif -#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE) +#if defined (_WIN32) #ifdef DEBUGFILE if (debugfile != stderr) #endif @@ -917,22 +811,12 @@ INT32 I_GetKey (void) // void I_JoyScale(void) { -#ifdef GP2X - if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0) - Joystick.bGamepadStyle = true; - else -#endif Joystick.bGamepadStyle = cv_joyscale.value==0; JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value; } void I_JoyScale2(void) { -#ifdef GP2X - if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0) - Joystick.bGamepadStyle = true; - else -#endif Joystick2.bGamepadStyle = cv_joyscale2.value==0; JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value; } @@ -1035,11 +919,6 @@ void I_GetJoystickEvents(void) event.type = ev_keydown; else event.type = ev_keyup; -#ifdef _PSP - if (i == 12) - event.data1 = KEY_ESCAPE; - else -#endif event.data1 = KEY_JOY1 + i; D_PostEvent(&event); } @@ -1090,13 +969,11 @@ void I_GetJoystickEvents(void) axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1); else axisy = 0; -#ifdef _arch_dreamcast // -128 to 127 - axisx = axisx*8; - axisy = axisy*8; -#else // -32768 to 32767 + + // -32768 to 32767 axisx = axisx/32; axisy = axisy/32; -#endif + if (Joystick.bGamepadStyle) { @@ -1214,15 +1091,11 @@ static int joy_open(const char *fname) if (JoyInfo.buttons > JOYBUTTONS) JoyInfo.buttons = JOYBUTTONS; -#ifdef DC - JoyInfo.hats = 0; -#else JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev); if (JoyInfo.hats > JOYHATS) JoyInfo.hats = JOYHATS; JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev); -#endif //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad"); @@ -1379,13 +1252,9 @@ void I_GetJoystick2Events(void) axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1); else axisy = 0; -#ifdef _arch_dreamcast // -128 to 127 - axisx = axisx*8; - axisy = axisy*8; -#else // -32768 to 32767 + // -32768 to 32767 axisx = axisx/32; axisy = axisy/32; -#endif if (Joystick2.bGamepadStyle) { @@ -1504,15 +1373,11 @@ static int joy_open2(const char *fname) if (JoyInfo2.buttons > JOYBUTTONS) JoyInfo2.buttons = JOYBUTTONS; -#ifdef DC - JoyInfo2.hats = 0; -#else JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev); if (JoyInfo2.hats > JOYHATS) JoyInfo2.hats = JOYHATS; JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev); -#endif //Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad"); @@ -1796,7 +1661,7 @@ static void I_ShutdownMouse2(void) if (fdmouse2 != -1) close(fdmouse2); mouse2_started = 0; } -#elif defined (_WIN32) && !defined (_XBOX) +#elif defined (_WIN32) static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE; @@ -1994,7 +1859,7 @@ void I_StartupMouse2(void) } mouse2_started = 1; I_AddExitFunc(I_ShutdownMouse2); -#elif defined (_WIN32) && !defined (_XBOX) +#elif defined (_WIN32) DCB dcb; if (mouse2filehandle != INVALID_HANDLE_VALUE) @@ -2089,7 +1954,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void) return &emptycmd2; } -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#if defined (_WIN32) static HMODULE winmm = NULL; static DWORD starttickcount = 0; // hack for win2k time bug static p_timeGetTime pfntimeGetTime = NULL; @@ -2159,13 +2024,8 @@ static void I_ShutdownTimer(void) // tic_t I_GetTime (void) { -#ifdef _arch_dreamcast - static Uint64 basetime = 0; - Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast -#else static Uint32 basetime = 0; Uint32 ticks = SDL_GetTicks(); -#endif if (!basetime) basetime = ticks; @@ -2174,11 +2034,7 @@ tic_t I_GetTime (void) ticks = (ticks*TICRATE); -#if 0 //#ifdef _WIN32_WCE - ticks = (ticks/10); -#else ticks = (ticks/1000); -#endif return (tic_t)ticks; } @@ -2189,7 +2045,7 @@ tic_t I_GetTime (void) // FUNCMATH void I_StartupTimer(void) { -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#ifdef _WIN32 // for win2k time bug if (M_CheckParm("-gettickcount")) { @@ -2205,9 +2061,6 @@ FUNCMATH void I_StartupTimer(void) pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime"); } I_AddExitFunc(I_ShutdownTimer); -#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads? - if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0) - I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError()); #endif } @@ -2215,35 +2068,14 @@ FUNCMATH void I_StartupTimer(void) void I_Sleep(void) { -#if !(defined (_arch_dreamcast) || defined (_XBOX)) if (cv_sleep.value != -1) SDL_Delay(cv_sleep.value); -#endif } INT32 I_StartupSystem(void) { SDL_version SDLcompiled; SDL_version SDLlinked; -#ifdef _XBOX -#ifdef __GNUC__ - char DP[] =" Sonic Robo Blast 2!\n"; - debugPrint(DP); -#endif - unlink("e:/Games/SRB2/stdout.txt"); - freopen("e:/Games/SRB2/stdout.txt", "w+", stdout); - unlink("e:/Games/SRB2/stderr.txt"); - freopen("e:/Games/SRB2/stderr.txt", "w+", stderr); -#endif -#ifdef _arch_dreamcast -#ifdef _DEBUG - //gdb_init(); -#endif - printf(__FILE__":%i\n",__LINE__); -#ifdef _DEBUG - //gdb_breakpoint(); -#endif -#endif SDL_VERSION(&SDLcompiled) SDL_GetVersion(&SDLlinked); I_StartupConsole(); @@ -2251,11 +2083,7 @@ INT32 I_StartupSystem(void) SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch); I_OutputMsg("Linked with SDL version: %d.%d.%d\n", SDLlinked.major, SDLlinked.minor, SDLlinked.patch); -#if 0 //#ifdef GP2X //start up everything - if (SDL_Init(SDL_INIT_EVERYTHING) < 0) -#else if (SDL_Init(0) < 0) -#endif I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no.... #ifndef NOMUMBLE I_SetupMumble(); @@ -2297,9 +2125,7 @@ void I_Quit(void) I_ShutdownGraphics(); I_ShutdownInput(); I_ShutdownSystem(); -#ifndef _arch_dreamcast SDL_Quit(); -#endif /* if option -noendtxt is set, don't print the text */ if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR) { @@ -2308,10 +2134,6 @@ void I_Quit(void) } death: W_Shutdown(); -#ifdef GP2X - chdir("/usr/gp2x"); - execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); -#endif exit(0); } @@ -2364,10 +2186,8 @@ void I_Error(const char *error, ...) I_ShutdownInput(); if (errorcount == 7) I_ShutdownSystem(); -#ifndef _arch_dreamcast if (errorcount == 8) SDL_Quit(); -#endif if (errorcount == 9) { M_SaveConfig(NULL); @@ -2386,12 +2206,6 @@ void I_Error(const char *error, ...) buffer, NULL); W_Shutdown(); - -#ifdef GP2X - chdir("/usr/gp2x"); - execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); -#endif - exit(-1); // recursive errors detected } } @@ -2427,9 +2241,7 @@ void I_Error(const char *error, ...) I_ShutdownGraphics(); I_ShutdownInput(); I_ShutdownSystem(); -#ifndef _arch_dreamcast SDL_Quit(); -#endif // Implement message box with SDL_ShowSimpleMessageBox, // which should fail gracefully if it can't put a message box up @@ -2449,11 +2261,6 @@ void I_Error(const char *error, ...) *(INT32 *)2 = 4; //Alam: Debug! #endif -#ifdef GP2X - chdir("/usr/gp2x"); - execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); -#endif - exit(-1); } @@ -2516,7 +2323,7 @@ void I_ShutdownSystem(void) for (c = MAX_QUIT_FUNCS-1; c >= 0; c--) if (quit_funcs[c]) (*quit_funcs[c])(); -#ifdef LOGMESSAGES +#ifdef LOGMESSAGES if (logstream) { I_OutputMsg("I_ShutdownSystem(): end of logstream.\n"); @@ -2529,10 +2336,8 @@ void I_ShutdownSystem(void) void I_GetDiskFreeSpace(INT64 *freespace) { -#if defined (_arch_dreamcast) || defined (_PSP) - *freespace = 0; -#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3) +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (SOLARIS) || defined (__HAIKU__) *freespace = INT32_MAX; return; #else // Both Linux and BSD have this, apparently. @@ -2544,7 +2349,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) } *freespace = stfs.f_bavail * stfs.f_bsize; #endif -#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#elif defined (_WIN32) static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static boolean testwin95 = false; ULARGE_INTEGER usedbytes, lfreespace; @@ -2575,13 +2380,6 @@ void I_GetDiskFreeSpace(INT64 *freespace) char *I_GetUserName(void) { -#ifdef GP2X - static char username[MAXPLAYERNAME] = "GP2XUSER"; - return username; -#elif defined (PSP) - static char username[MAXPLAYERNAME] = "PSPUSER"; - return username; -#elif !(defined (_WIN32_WCE) || defined (_XBOX)) static char username[MAXPLAYERNAME]; char *p; #ifdef _WIN32 @@ -2613,7 +2411,6 @@ char *I_GetUserName(void) if (strcmp(username, "") != 0) return username; -#endif return NULL; // dummy for platform independent version } @@ -2622,7 +2419,7 @@ INT32 I_mkdir(const char *dirname, INT32 unixright) //[segabor] #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__) return mkdir(dirname, unixright); -#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) +#elif defined (_WIN32) UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt... return CreateDirectoryA(dirname, NULL); #else @@ -2636,9 +2433,6 @@ char *I_GetEnv(const char *name) { #ifdef NEED_SDL_GETENV return SDL_getenv(name); -#elif defined(_WIN32_WCE) - (void)name; - return NULL; #else return getenv(name); #endif @@ -2648,8 +2442,6 @@ INT32 I_PutEnv(char *variable) { #ifdef NEED_SDL_GETENV return SDL_putenv(variable); -#elif defined(_WIN32_WCE) - return ((variable)?-1:0); #else return putenv(variable); #endif @@ -2789,15 +2581,6 @@ static const char *locateWad(void) if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr)) return envstr; -#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP) - // examine argv[0] - strcpy(returnWadPath, myargv[0]); - pathonly(returnWadPath); - I_PutEnv(va("HOME=%s",returnWadPath)); - if (isWadPathOk(returnWadPath)) - return returnWadPath; -#endif - #ifndef NOCWD I_OutputMsg(",."); // examine current dir @@ -2916,9 +2699,9 @@ const char *I_LocateWad(void) if (waddir) { // change to the directory where we found srb2.srb -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#if defined (_WIN32) SetCurrentDirectoryA(waddir); -#elif !defined (_WIN32_WCE) && !defined (_PS3) +#else if (chdir(waddir) == -1) I_OutputMsg("Couldn't change working directory\n"); #endif @@ -2935,17 +2718,7 @@ const char *I_LocateWad(void) // quick fix for compil UINT32 I_GetFreeMem(UINT32 *total) { -#if defined (_arch_dreamcast) - //Dreamcast! - if (total) - *total = 16<<20; - return 8<<20; -#elif defined (_PSP) - // PSP - if (total) - *total = 32<<20; - return 16<<20; -#elif defined (FREEBSD) +#ifdef FREEBSD struct vmmeter sum; kvm_t *kd; struct nlist namelist[] = @@ -2982,7 +2755,7 @@ UINT32 I_GetFreeMem(UINT32 *total) if (total) *total = 32 << 20; return 32 << 20; -#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX) +#elif defined (_WIN32) MEMORYSTATUS info; info.dwLength = sizeof (MEMORYSTATUS); @@ -3054,7 +2827,7 @@ UINT32 I_GetFreeMem(UINT32 *total) const CPUInfoFlags *I_CPUInfo(void) { -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) +#if defined (_WIN32) static CPUInfoFlags WIN_CPUInfo; SYSTEM_INFO SI; p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); diff --git a/src/sdl/i_ttf.c b/src/sdl/i_ttf.c index 4a41f120..f2cd497e 100644 --- a/src/sdl/i_ttf.c +++ b/src/sdl/i_ttf.c @@ -26,10 +26,7 @@ #include "i_ttf.h" // Search directories to find aforementioned TTF file. -#ifdef _PS3 -#include -#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc" -#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define FONTSEARCHPATH1 "/usr/share/fonts" #define FONTSEARCHPATH2 "/usr/local/share/fonts" #define FONTSEARCHPATH3 "/usr/games/SRB2" @@ -233,16 +230,9 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags) { char *fontpath = NULL; INT32 fontstatus = -1; -#ifdef _PS3 - videoState state; - videoGetState(0, 0, &state); - videoGetResolution(state.displayMode.resolution, &res); - bitsperpixel = 24; -#else res.width = 320; res.height = 200; bitsperpixel = 8; -#endif // what's the point of trying to display an error? // SDL_ttf is not started, can't display anything to screen (presumably)... diff --git a/src/sdl/i_ttf.h b/src/sdl/i_ttf.h index 929c8021..5fae9ed1 100644 --- a/src/sdl/i_ttf.h +++ b/src/sdl/i_ttf.h @@ -57,13 +57,12 @@ int currentfonthinting; int currentfontoutline; #endif -#ifndef _PS3 typedef struct { UINT16 width; UINT16 height; } VideoResolution; -#endif + UINT8 bitsperpixel; typedef enum diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 9cebe494..4dcaf0c5 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -47,7 +47,7 @@ #include "../doomdef.h" -#if defined (_WIN32) +#ifdef _WIN32 #include "SDL_syswm.h" #endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 88bbadd2..71832459 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -43,12 +43,10 @@ #define HAVE_ZLIB #ifndef _MSC_VER -#ifndef _WII #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 0face92e..1a2cabd2 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -49,7 +49,7 @@ #define MIX_CHANNELS 8 #endif -#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) +#ifdef _WIN32 #include #elif defined (__GNUC__) #include @@ -85,21 +85,11 @@ // mixing buffer, and the samplerate of the raw data. // Needed for calling the actual sound output. -#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) -#define NUM_CHANNELS MIX_CHANNELS -#else #define NUM_CHANNELS MIX_CHANNELS*4 -#endif #define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx) -#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) -static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer -#elif defined(GP2X) -static Uint16 samplecount = 128; -#else static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer -#endif typedef struct chan_struct { @@ -151,17 +141,10 @@ static SDL_bool musicStarted = SDL_FALSE; #ifdef HAVE_MIXER static SDL_mutex *Msc_Mutex = NULL; /* FIXME: Make this file instance-specific */ -#ifdef _arch_dreamcast -#define MIDI_PATH "/ram" -#elif defined(GP2X) -#define MIDI_PATH "/mnt/sd/srb2" -#define MIDI_PATH2 "/tmp/mnt/sd/srb2" -#else #define MIDI_PATH srb2home #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define MIDI_PATH2 "/tmp" #endif -#endif #define MIDI_TMPFILE "srb2music" #define MIDI_TMPFILE2 "srb2wav" static INT32 musicvol = 62; @@ -176,7 +159,7 @@ static SDL_bool canlooping = SDL_TRUE; #if SDL_MIXER_VERSION_ATLEAST(1,2,7) #define USE_RWOPS // ok, USE_RWOPS is in here -#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X) +#if 0 // defined(_WIN32) #undef USE_RWOPS #endif #endif @@ -1188,13 +1171,6 @@ void I_StartupSound(void) #endif #ifndef HAVE_MIXER nomidimusic = nodigimusic = true; -#endif -#ifdef DC - //nosound = true; -#ifdef HAVE_MIXER - nomidimusic = true; - nodigimusic = true; -#endif #endif memset(channels, 0, sizeof (channels)); //Alam: Clean it @@ -1243,13 +1219,7 @@ void I_StartupSound(void) audio.samples /= 2; } -#if defined (_PSP) && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice - I_SetChannels(); - sound_started = true; - Snd_Mutex = SDL_CreateMutex(); -#else if (nosound) -#endif return; #ifdef HW3SOUND @@ -1302,7 +1272,7 @@ void I_StartupSound(void) snddev.bps = 16; snddev.sample_rate = audio.freq; snddev.numsfxs = NUMSFX; -#if defined (_WIN32) && !defined (_XBOX) +#if defined (_WIN32) snddev.cooplevel = 0x00000002; snddev.hWnd = vid.WndParent; #endif @@ -1520,9 +1490,7 @@ void I_InitMusic(void) I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n", MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch); #ifdef MIXER_POS -#ifndef _WII if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7) -#endif canlooping = SDL_FALSE; #endif #ifdef USE_RWOPS @@ -1531,13 +1499,11 @@ void I_InitMusic(void) #endif I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n", MIXlinked->major, MIXlinked->minor, MIXlinked->patch); -#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII)) if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz { audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq)); audio.freq = 44100; //Alam: to keep it around the same XX ms } -#endif if (sound_started #ifdef HW3SOUND @@ -1929,7 +1895,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) if (loopstart > 0) { loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs -//#ifdef GP2X//#ifdef PARANOIA +//#ifdef PARANOIA //I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig); //#endif } From b040113246f1178794ce8140a7f466d86cfbe58c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 16 Sep 2017 20:59:35 +0100 Subject: [PATCH 106/124] Removed the wrong endif by mistake --- src/sdl/i_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index df4e3cc9..f1cecad4 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -143,11 +143,11 @@ int main(int argc, char **argv) && !InitBugTrap() #endif ) +#endif { LoadLibraryA("exchndl.dll"); } } -#endif prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); MakeCodeWritable(); #endif From 2c73c1657fc8bb1442d9d33a933592995cc8300b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 17 Sep 2017 17:20:51 +0100 Subject: [PATCH 107/124] Restored all missing objs/bin subfolders from the move to Git, held in place by .gitignores --- bin/DC/.gitignore | 2 ++ bin/Dos/Debug/.gitignore | 2 ++ bin/Dos/Release/.gitignore | 2 ++ bin/FreeBSD/Debug/.gitignore | 2 ++ bin/FreeBSD/Release/.gitignore | 2 ++ bin/SDL/Debug/.gitignore | 2 ++ bin/SDL/Release/.gitignore | 2 ++ bin/WinCE/ARMV4Dbg/.gitignore | 2 ++ bin/WinCE/ARMV4IDbg/.gitignore | 2 ++ bin/WinCE/ARMV4IRel/.gitignore | 2 ++ bin/WinCE/ARMV4Rel/.gitignore | 2 ++ bin/WinCE/ARMV4TDbg/.gitignore | 2 ++ bin/WinCE/ARMV4TRel/.gitignore | 2 ++ bin/WinCE/MIPS16Dbg/.gitignore | 2 ++ bin/WinCE/MIPS16Rel/.gitignore | 2 ++ bin/WinCE/MIPSIIDbg/.gitignore | 2 ++ bin/WinCE/MIPSIIRel/.gitignore | 2 ++ bin/WinCE/MIPSII_FPDbg/.gitignore | 2 ++ bin/WinCE/MIPSII_FPRel/.gitignore | 2 ++ bin/WinCE/MIPSIVDbg/.gitignore | 2 ++ bin/WinCE/MIPSIVRel/.gitignore | 2 ++ bin/WinCE/MIPSIV_FPDbg/.gitignore | 2 ++ bin/WinCE/MIPSIV_FPRel/.gitignore | 2 ++ bin/WinCE/Release/.gitignore | 2 ++ bin/WinCE/SH3Dbg/.gitignore | 2 ++ bin/WinCE/SH3Rel/.gitignore | 2 ++ bin/WinCE/SH4Dbg/.gitignore | 2 ++ bin/WinCE/SH4Rel/.gitignore | 2 ++ bin/WinCE/X86Dbg/.gitignore | 2 ++ bin/WinCE/X86Rel/.gitignore | 2 ++ bin/WinCE/emulatorDbg/.gitignore | 2 ++ bin/WinCE/emulatorRel/.gitignore | 2 ++ bin/dummy/.gitignore | 2 ++ objs/FreeBSD/SDL/Debug/.gitignore | 2 ++ objs/FreeBSD/SDL/Release/.gitignore | 2 ++ objs/MasterClient/.gitignore | 2 ++ objs/MasterServer/.gitignore | 2 ++ objs/XBOX/SDL/Debug/.gitignore | 2 ++ objs/XBOX/SDL/Release/.gitignore | 2 ++ objs/cygwin/Debug/.gitignore | 2 ++ objs/cygwin/Release/.gitignore | 2 ++ objs/dummy/.gitignore | 2 ++ 42 files changed, 84 insertions(+) create mode 100644 bin/DC/.gitignore create mode 100644 bin/Dos/Debug/.gitignore create mode 100644 bin/Dos/Release/.gitignore create mode 100644 bin/FreeBSD/Debug/.gitignore create mode 100644 bin/FreeBSD/Release/.gitignore create mode 100644 bin/SDL/Debug/.gitignore create mode 100644 bin/SDL/Release/.gitignore create mode 100644 bin/WinCE/ARMV4Dbg/.gitignore create mode 100644 bin/WinCE/ARMV4IDbg/.gitignore create mode 100644 bin/WinCE/ARMV4IRel/.gitignore create mode 100644 bin/WinCE/ARMV4Rel/.gitignore create mode 100644 bin/WinCE/ARMV4TDbg/.gitignore create mode 100644 bin/WinCE/ARMV4TRel/.gitignore create mode 100644 bin/WinCE/MIPS16Dbg/.gitignore create mode 100644 bin/WinCE/MIPS16Rel/.gitignore create mode 100644 bin/WinCE/MIPSIIDbg/.gitignore create mode 100644 bin/WinCE/MIPSIIRel/.gitignore create mode 100644 bin/WinCE/MIPSII_FPDbg/.gitignore create mode 100644 bin/WinCE/MIPSII_FPRel/.gitignore create mode 100644 bin/WinCE/MIPSIVDbg/.gitignore create mode 100644 bin/WinCE/MIPSIVRel/.gitignore create mode 100644 bin/WinCE/MIPSIV_FPDbg/.gitignore create mode 100644 bin/WinCE/MIPSIV_FPRel/.gitignore create mode 100644 bin/WinCE/Release/.gitignore create mode 100644 bin/WinCE/SH3Dbg/.gitignore create mode 100644 bin/WinCE/SH3Rel/.gitignore create mode 100644 bin/WinCE/SH4Dbg/.gitignore create mode 100644 bin/WinCE/SH4Rel/.gitignore create mode 100644 bin/WinCE/X86Dbg/.gitignore create mode 100644 bin/WinCE/X86Rel/.gitignore create mode 100644 bin/WinCE/emulatorDbg/.gitignore create mode 100644 bin/WinCE/emulatorRel/.gitignore create mode 100644 bin/dummy/.gitignore create mode 100644 objs/FreeBSD/SDL/Debug/.gitignore create mode 100644 objs/FreeBSD/SDL/Release/.gitignore create mode 100644 objs/MasterClient/.gitignore create mode 100644 objs/MasterServer/.gitignore create mode 100644 objs/XBOX/SDL/Debug/.gitignore create mode 100644 objs/XBOX/SDL/Release/.gitignore create mode 100644 objs/cygwin/Debug/.gitignore create mode 100644 objs/cygwin/Release/.gitignore create mode 100644 objs/dummy/.gitignore diff --git a/bin/DC/.gitignore b/bin/DC/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/DC/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/Dos/Debug/.gitignore b/bin/Dos/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/Dos/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/Dos/Release/.gitignore b/bin/Dos/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/Dos/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/FreeBSD/Debug/.gitignore b/bin/FreeBSD/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/FreeBSD/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/FreeBSD/Release/.gitignore b/bin/FreeBSD/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/FreeBSD/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/SDL/Debug/.gitignore b/bin/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/SDL/Release/.gitignore b/bin/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4Dbg/.gitignore b/bin/WinCE/ARMV4Dbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4Dbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4IDbg/.gitignore b/bin/WinCE/ARMV4IDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4IDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4IRel/.gitignore b/bin/WinCE/ARMV4IRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4IRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4Rel/.gitignore b/bin/WinCE/ARMV4Rel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4Rel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4TDbg/.gitignore b/bin/WinCE/ARMV4TDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4TDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/ARMV4TRel/.gitignore b/bin/WinCE/ARMV4TRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/ARMV4TRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPS16Dbg/.gitignore b/bin/WinCE/MIPS16Dbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPS16Dbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPS16Rel/.gitignore b/bin/WinCE/MIPS16Rel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPS16Rel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIIDbg/.gitignore b/bin/WinCE/MIPSIIDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIIDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIIRel/.gitignore b/bin/WinCE/MIPSIIRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIIRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSII_FPDbg/.gitignore b/bin/WinCE/MIPSII_FPDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSII_FPDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSII_FPRel/.gitignore b/bin/WinCE/MIPSII_FPRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSII_FPRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIVDbg/.gitignore b/bin/WinCE/MIPSIVDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIVDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIVRel/.gitignore b/bin/WinCE/MIPSIVRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIVRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIV_FPDbg/.gitignore b/bin/WinCE/MIPSIV_FPDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIV_FPDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/MIPSIV_FPRel/.gitignore b/bin/WinCE/MIPSIV_FPRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/MIPSIV_FPRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/Release/.gitignore b/bin/WinCE/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/SH3Dbg/.gitignore b/bin/WinCE/SH3Dbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/SH3Dbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/SH3Rel/.gitignore b/bin/WinCE/SH3Rel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/SH3Rel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/SH4Dbg/.gitignore b/bin/WinCE/SH4Dbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/SH4Dbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/SH4Rel/.gitignore b/bin/WinCE/SH4Rel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/SH4Rel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/X86Dbg/.gitignore b/bin/WinCE/X86Dbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/X86Dbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/X86Rel/.gitignore b/bin/WinCE/X86Rel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/X86Rel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/emulatorDbg/.gitignore b/bin/WinCE/emulatorDbg/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/emulatorDbg/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/WinCE/emulatorRel/.gitignore b/bin/WinCE/emulatorRel/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/WinCE/emulatorRel/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/bin/dummy/.gitignore b/bin/dummy/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/bin/dummy/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/FreeBSD/SDL/Debug/.gitignore b/objs/FreeBSD/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/FreeBSD/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/FreeBSD/SDL/Release/.gitignore b/objs/FreeBSD/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/FreeBSD/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/MasterClient/.gitignore b/objs/MasterClient/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/MasterClient/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/MasterServer/.gitignore b/objs/MasterServer/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/MasterServer/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/XBOX/SDL/Debug/.gitignore b/objs/XBOX/SDL/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/XBOX/SDL/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/XBOX/SDL/Release/.gitignore b/objs/XBOX/SDL/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/XBOX/SDL/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/cygwin/Debug/.gitignore b/objs/cygwin/Debug/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/cygwin/Debug/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/cygwin/Release/.gitignore b/objs/cygwin/Release/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/cygwin/Release/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing diff --git a/objs/dummy/.gitignore b/objs/dummy/.gitignore new file mode 100644 index 00000000..42c6dc2c --- /dev/null +++ b/objs/dummy/.gitignore @@ -0,0 +1,2 @@ +# DON'T REMOVE +# This keeps the folder from disappearing From 7f875131ee17cc78880c89ea24fad816ef845590 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 18 Sep 2017 18:14:05 +0100 Subject: [PATCH 108/124] If compiling for GP2X with SDL, make it use SDL 1.2 interface like the others Doing this way because I have no idea if the GP2X port was SUPPOSED to use SDL or not in the first place --- src/Makefile.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 3f619773..663d2387 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -410,6 +410,12 @@ endif endif endif +ifdef GP2X +ifdef SDL + SDL12=1 +endif +endif + ifdef ARCHNAME OBJDIR:=$(OBJDIR)/$(ARCHNAME) BIN:=$(BIN)/$(ARCHNAME) From 7e23014d5fab80bd4ee2509aa09e14efed25db1c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 09:04:36 -0400 Subject: [PATCH 109/124] Makefile: support GCC 6.4 --- src/Makefile.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 5bf7f247..50cc32dd 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -8,6 +8,10 @@ # +ifdef GCC64 +GCC64=1 +endif + ifdef GCC63 GCC62=1 endif From bdba212b2a9653734afe6b3b6b4c08fa104980c5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 09:13:01 -0400 Subject: [PATCH 110/124] Makefile: add support for GCC 7.1 and 7.2 --- .travis.yml | 15 +++++++++++++++ src/Makefile.cfg | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/.travis.yml b/.travis.yml index e5dbb58e..285eebd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,6 +100,21 @@ matrix: compiler: gcc-6 env: WFLAGS="-Wno-tautological-compare" #gcc-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - gcc-7 + compiler: gcc-7 + env: WFLAGS="-Wno-tautological-compare" + #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux compiler: clang #clang version 3.5.0 (tags/RELEASE_350/final) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 50cc32dd..7620a3d6 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,13 @@ # and other things # +ifdef GCC72 +GCC71=1 +endif + +ifdef GCC71 +GCC64=1 +endif ifdef GCC64 GCC64=1 From 55f377ba3df6497b7ade878e4c58879c23e50717 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 09:13:46 -0400 Subject: [PATCH 111/124] Build: kill GCC 7's format-overflow warnings --- src/d_net.c | 2 +- src/f_wipe.c | 2 +- src/g_game.c | 2 +- src/sounds.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index 50b6c8cf..c335d21c 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -1363,7 +1363,7 @@ boolean D_CheckNetGame(void) #else if (M_CheckParm("-debugfile")) { - char filename[20]; + char filename[21]; INT32 k = doomcom->consoleplayer - 1; if (M_IsNextParm()) k = atoi(M_GetNextParm()) - 1; diff --git a/src/f_wipe.c b/src/f_wipe.c index a0b685a3..e45f2e85 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -94,7 +94,7 @@ static fixed_t paldiv; * \return fademask_t for lump */ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { - static char lumpname[9] = "FADEmmss"; + static char lumpname[10] = "FADEmmss"; static fademask_t fm = {NULL,0,0,0,0,0}; lumpnum_t lumpnum; UINT8 *lump, *mask; diff --git a/src/g_game.c b/src/g_game.c index 7499fe7a..f1b176f2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -726,7 +726,7 @@ void G_SetGameModified(boolean silent) */ const char *G_BuildMapName(INT32 map) { - static char mapname[9] = "MAPXX"; // internal map name (wad resource name) + static char mapname[10] = "MAPXX"; // internal map name (wad resource name) I_Assert(map > 0); I_Assert(map <= NUMMAPS); diff --git a/src/sounds.c b/src/sounds.c index 8ad42ac9..53e3b618 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -477,7 +477,7 @@ void S_InitRuntimeSounds (void) { sfxenum_t i; INT32 value; - char soundname[7]; + char soundname[10]; for (i = sfx_freeslot0; i <= sfx_lastskinsoundslot; i++) { From 2ccd397d11e8ec97ad46f99c1373ce88d21350c6 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 09:39:47 -0400 Subject: [PATCH 112/124] Build: kill GCC 7's implicit-fallthrough warning --- src/blua/ldebug.c | 2 +- src/blua/llex.c | 25 +++++++++++++++---------- src/blua/ltable.c | 1 + src/d_clisrv.c | 3 +++ src/d_netcmd.c | 2 +- src/m_menu.c | 5 +++++ src/p_ceilng.c | 5 ++++- src/p_enemy.c | 2 +- src/p_floor.c | 2 ++ src/p_inter.c | 4 +++- src/p_mobj.c | 3 ++- src/p_spec.c | 10 +++++++++- src/sdl/i_video.c | 1 + src/v_video.c | 8 ++++++++ src/y_inter.c | 2 ++ 15 files changed, 58 insertions(+), 17 deletions(-) diff --git a/src/blua/ldebug.c b/src/blua/ldebug.c index 497d5498..542e209a 100644 --- a/src/blua/ldebug.c +++ b/src/blua/ldebug.c @@ -412,7 +412,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) { case OP_FORLOOP: case OP_FORPREP: checkreg(pt, a+3); - /* go through */ + /* FALLTHRU */ case OP_JMP: { int dest = pc+1+b; /* not full check and jump is forward and do not skip `lastpc'? */ diff --git a/src/blua/llex.c b/src/blua/llex.c index 0b328dca..9e3dc292 100644 --- a/src/blua/llex.c +++ b/src/blua/llex.c @@ -306,11 +306,12 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { save_and_next(ls); /* skip $ */ seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, luaZ_bufflen(ls->buff) - 2); - ls->refstr++; /* expect '\' anytime soon */ + ls->refstr++; /* expect '\' anytime soon */ lua_assert(ls->lookahead.token == TK_EOS); - ls->lookahead.token = TK_CONCAT; - return; - } + ls->lookahead.token = TK_CONCAT; + return; + } + /* FALLTHRU */ default: { if (!isdigit(ls->current)) save_and_next(ls); /* handles \\, \", \', and \? */ @@ -340,7 +341,8 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { }; switch (i) { - case 4: save( ls, (c>>8) & 0xff ); // pass-through.. + case 4: save( ls, (c>>8) & 0xff ); + /* FALLTHRU */ case 2: save( ls, c&0xff ); break; case 5: @@ -350,7 +352,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { } continue; - // "\u0000".."\x10FFFF": UTF-8 encoded Unicode + // "\u0000".."\x10FFFF": UTF-8 encoded Unicode // // Note that although codes are entered like this (must have min. four digit, // just to tease you!) the actual outcome in the string will vary between @@ -482,20 +484,22 @@ static int llex (LexState *ls, SemInfo *seminfo) { else if (sep == -1) return '['; else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); } + /* FALLTHRU */ case '=': { next(ls); if (ls->current != '=') return '='; else { next(ls); return TK_EQ; } } + /* FALLTHRU */ case '<': { next(ls); - if (ls->current == '<') { next(ls); return TK_SHL; } + if (ls->current == '<') { next(ls); return TK_SHL; } if (ls->current != '=') return '<'; else { next(ls); return TK_LE; } } case '>': { next(ls); - if (ls->current == '>') { next(ls); return TK_SHR; } + if (ls->current == '>') { next(ls); return TK_SHR; } if (ls->current != '=') return '>'; else { next(ls); return TK_GE; } } @@ -547,9 +551,10 @@ static int llex (LexState *ls, SemInfo *seminfo) { } case '\\': if (ls->refstr) { ls->refstr--; - ls->current = '"'; /* whacky! */ - return TK_CONCAT; + ls->current = '"'; /* whacky! */ + return TK_CONCAT; } + /* FALLTHRU */ default: { if (isspace(ls->current)) { lua_assert(!currIsNewline(ls)); diff --git a/src/blua/ltable.c b/src/blua/ltable.c index 9f4d91ff..0ddd9ef4 100644 --- a/src/blua/ltable.c +++ b/src/blua/ltable.c @@ -478,6 +478,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) { return luaH_getnum(t, k); /* use specialized version */ /* else go through */ } + /* FALLTHRU */ default: { Node *n = mainposition(t, key); do { /* check whether `key' is somewhere in the chain */ diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7c21d79f..c1f2f8ed 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1883,6 +1883,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic break; // exit the case cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now + /* FALLTHRU */ case CL_ASKJOIN: CL_LoadServerFiles(); @@ -3605,6 +3606,7 @@ static void HandlePacketFromAwayNode(SINT8 node) // Do not remove my own server (we have just get a out of order packet) if (node == servernode) break; + /* FALLTHRU */ default: DEBFILE(va("unknown packet received (%d) from unknown host\n",netbuffer->packettype)); @@ -3761,6 +3763,7 @@ FILESTAMP break; case PT_TEXTCMD2: // splitscreen special netconsole = nodetoplayer2[node]; + /* FALLTHRU */ case PT_TEXTCMD: if (client) break; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b5563f4e..83bbc7aa 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2453,7 +2453,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) error = true; break; } - //fall down + /* FALLTHRU */ case GT_TAG: switch (NetPacket.packet.newteam) { diff --git a/src/m_menu.c b/src/m_menu.c index 45b3d7e5..5b699dcb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3022,6 +3022,7 @@ static void M_DrawGenericMenu(void) W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE)); } } + /* FALLTHRU */ case IT_NOTHING: case IT_DYBIGSPACE: y += LINEHEIGHT; @@ -3073,6 +3074,7 @@ static void M_DrawGenericMenu(void) break; case IT_STRING2: V_DrawString(x, y, 0, currentMenu->menuitems[i].text); + /* FALLTHRU */ case IT_DYLITLSPACE: y += SMALLLINEHEIGHT; break; @@ -3085,6 +3087,7 @@ static void M_DrawGenericMenu(void) case IT_TRANSTEXT: if (currentMenu->menuitems[i].alphaKey) y = currentMenu->y+currentMenu->menuitems[i].alphaKey; + /* FALLTHRU */ case IT_TRANSTEXT2: V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text); y += SMALLLINEHEIGHT; @@ -3297,6 +3300,7 @@ static void M_DrawCenteredMenu(void) W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE)); } } + /* FALLTHRU */ case IT_NOTHING: case IT_DYBIGSPACE: y += LINEHEIGHT; @@ -3347,6 +3351,7 @@ static void M_DrawCenteredMenu(void) break; case IT_STRING2: V_DrawCenteredString(x, y, 0, currentMenu->menuitems[i].text); + /* FALLTHRU */ case IT_DYLITLSPACE: y += SMALLLINEHEIGHT; break; diff --git a/src/p_ceilng.c b/src/p_ceilng.c index db30b5ca..27d73941 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -79,7 +79,7 @@ void T_MoveCeiling(ceiling_t *ceiling) P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL); if (ceiling->texture > -1) // flat changing ceiling->sector->ceilingpic = ceiling->texture; - // don't break + /* FALLTHRU */ case raiseToHighest: // case raiseCeilingByLine: case moveCeilingByFrontTexture: @@ -182,6 +182,7 @@ void T_MoveCeiling(ceiling_t *ceiling) // except generalized ones, reset speed, start back up case crushAndRaise: ceiling->speed = CEILSPEED; + /* FALLTHRU */ case fastCrushAndRaise: ceiling->direction = 1; break; @@ -200,6 +201,7 @@ void T_MoveCeiling(ceiling_t *ceiling) if (ceiling->texture > -1) // flat changing ceiling->sector->ceilingpic = ceiling->texture; // don't break + /* FALLTHRU */ // in all other cases, just remove the active ceiling case lowerAndCrush: @@ -427,6 +429,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) case crushAndRaise: ceiling->crush = true; ceiling->topheight = sec->ceilingheight; + /* FALLTHRU */ case lowerAndCrush: ceiling->bottomheight = sec->floorheight; ceiling->bottomheight += 4*FRACUNIT; diff --git a/src/p_enemy.c b/src/p_enemy.c index 649c7883..9de735ed 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -6169,7 +6169,7 @@ void A_Boss7Chase(mobj_t *actor) break; } actor->threshold++; - // fall into... + /* FALLTHRU */ case 1: // Chaingun Goop A_FaceTarget(actor); P_SetMobjState(actor, S_BLACKEGG_SHOOT1); diff --git a/src/p_floor.c b/src/p_floor.c index 91121301..8438050f 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -312,6 +312,7 @@ void T_MoveFloor(floormove_t *movefloor) case moveFloorByFrontSector: if (movefloor->texture < -1) // chained linedef executing P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); + /* FALLTHRU */ case instantMoveFloorByFrontSector: if (movefloor->texture > -1) // flat changing movefloor->sector->floorpic = movefloor->texture; @@ -360,6 +361,7 @@ void T_MoveFloor(floormove_t *movefloor) case moveFloorByFrontSector: if (movefloor->texture < -1) // chained linedef executing P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); + /* FALLTHRU */ case instantMoveFloorByFrontSector: if (movefloor->texture > -1) // flat changing movefloor->sector->floorpic = movefloor->texture; diff --git a/src/p_inter.c b/src/p_inter.c index 4892d977..407e091f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -383,9 +383,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) case MT_REDTEAMRING: if (player->ctfteam != 1) return; + /* FALLTHRU */ case MT_BLUETEAMRING: // Yes, I'm lazy. Oh well, deal with it. if (special->type == MT_BLUETEAMRING && player->ctfteam != 2) return; + /* FALLTHRU */ case MT_RING: case MT_FLINGRING: if (!(P_CanPickupItem(player, false))) @@ -3127,7 +3129,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da P_SetMobjState(target, target->info->meleestate); // go to pinch pain state break; } - // fallthrough + /* FALLTHRU */ default: P_SetMobjState(target, target->info->painstate); break; diff --git a/src/p_mobj.c b/src/p_mobj.c index 9fdbc37f..f5201151 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7138,7 +7138,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->z = mobj->ceilingz - mobj->height; else mobj->z = mobj->floorz; - // THERE IS NO BREAK HERE ON PURPOSE + /* FALLTHRU */ default: // check mobj against possible water content, before movement code P_MobjCheckWater(mobj); @@ -8185,6 +8185,7 @@ void P_PrecipitationEffects(void) { case PRECIP_RAIN: // no lightning or thunder whatsoever sounds_thunder = false; + /* FALLTHRU */ case PRECIP_STORM_NOSTRIKES: // no lightning strikes specifically effects_lightning = false; break; diff --git a/src/p_spec.c b/src/p_spec.c index 48c0f58b..ad8d7337 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3625,6 +3625,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers goto DoneSection2; } } + /* FALLTHRU */ case 4: // Linedef executor that doesn't require touching floor case 5: // Linedef executor case 6: // Linedef executor (7 Emeralds) @@ -4632,6 +4633,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) // requires touching floor. break; } + /* FALLTHRU */ + case 1: // Starpost activator case 5: // Fan sector case 6: // Super Sonic Transform @@ -5711,6 +5714,8 @@ void P_SpawnSpecials(INT32 fromnetsave) EV_DoFloor(&lines[i], bounceFloor); if (lines[i].special == 54) break; + /* FALLTHRU */ + case 55: // New super cool and awesome moving ceiling type if (lines[i].backsector) EV_DoCeiling(&lines[i], bounceCeiling); @@ -5722,7 +5727,8 @@ void P_SpawnSpecials(INT32 fromnetsave) EV_DoFloor(&lines[i], bounceFloorCrush); if (lines[i].special == 57) - break; //only move the floor + break; //only move the floor + /* FALLTHRU */ case 58: // New super cool and awesome moving ceiling crush type if (lines[i].backsector) @@ -6828,6 +6834,7 @@ static void P_SpawnScrollers(void) Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); if (special != 533) break; + /* FALLTHRU */ case 523: // carry objects on ceiling dx = FixedMul(dx, CARRYFACTOR); @@ -6842,6 +6849,7 @@ static void P_SpawnScrollers(void) Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); if (special != 530) break; + /* FALLTHRU */ case 520: // carry objects on floor dx = FixedMul(dx, CARRYFACTOR); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 9cebe494..707c66dd 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -941,6 +941,7 @@ static inline boolean I_SkipFrame(void) case GS_LEVEL: if (!paused) return false; + /* FALLTHRU */ case GS_TIMEATTACK: case GS_WAITINGPLAYERS: return skip; // Skip odd frames diff --git a/src/v_video.c b/src/v_video.c index 64bb3214..cc81cedb 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1083,6 +1083,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string) { case V_MONOSPACE: spacewidth = 8; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 8; break; @@ -1160,6 +1161,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) { case V_MONOSPACE: spacewidth = 8; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 8; break; @@ -1269,6 +1271,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) { case V_MONOSPACE: spacewidth = 4; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 4; break; @@ -1370,6 +1373,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) { case V_MONOSPACE: spacewidth = 5; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 5; break; @@ -1463,6 +1467,7 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { case V_MONOSPACE: spacewidth = 8; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 8; break; @@ -1747,6 +1752,7 @@ INT32 V_StringWidth(const char *string, INT32 option) { case V_MONOSPACE: spacewidth = 8; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 8; break; @@ -1785,6 +1791,7 @@ INT32 V_SmallStringWidth(const char *string, INT32 option) { case V_MONOSPACE: spacewidth = 4; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 4; break; @@ -1823,6 +1830,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option) { case V_MONOSPACE: spacewidth = 5; + /* FALLTHRU */ case V_OLDSPACING: charwidth = 5; break; diff --git a/src/y_inter.c b/src/y_inter.c index 42f1e223..cfdc2a08 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1004,6 +1004,7 @@ void Y_StartIntermission(void) // fall back into the coop intermission for now intertype = int_coop; + /* FALLTHRU */ case int_coop: // coop or single player, normal level { // award time and ring bonuses @@ -1117,6 +1118,7 @@ void Y_StartIntermission(void) // fall back into the special stage intermission for now intertype = int_spec; + /* FALLTHRU */ case int_spec: // coop or single player, special stage { // Update visitation flags? From 7f98c5c8044611b036d94e723375a3c142f1260e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 10:02:08 -0400 Subject: [PATCH 113/124] Build: do not error on fallthrough --- .travis.yml | 2 +- src/m_misc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 285eebd5..9c82909b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: WFLAGS="-Wno-tautological-compare" + env: WFLAGS="-Wno-error=implicit-fallthrough" #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux compiler: clang diff --git a/src/m_misc.c b/src/m_misc.c index d88643ec..8193571e 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1079,7 +1079,7 @@ void M_StartMovie(void) moviemode = M_StartMovieGIF(pathname); break; } - // fall thru + /* FALLTHRU */ case MM_APNG: moviemode = M_StartMovieAPNG(pathname); break; From 1ffdd2e945321ca235892100be3b51b532d6e91c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 10:15:10 -0400 Subject: [PATCH 114/124] Travis: still need to keep -Wno-tautological-compare for GCC 7 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c82909b..afb04758 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: WFLAGS="-Wno-error=implicit-fallthrough" + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough" #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux compiler: clang From 9adf5f811bf1f9fe03f7110d1c74bc0be9638f23 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 11:06:57 -0400 Subject: [PATCH 115/124] CircleCI: remove blank lines --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5c43d01..ca910568 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,6 +58,3 @@ jobs: key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }} paths: - /root/.ccache - - - From 0eafaafca1dc3f10dcef62e0b19d8c9aa1eedad9 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 13:49:57 -0400 Subject: [PATCH 116/124] Travis: drop sdl2_mixer from MacPorts and use SDL 2.0.6 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index afb04758..5365d445 100644 --- a/.travis.yml +++ b/.travis.yml @@ -234,9 +234,9 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install game-music-emu p7zip; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.4.dmg; hdiutil attach SDL2-2.0.4.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi - mkdir -p $HOME/srb2_cache From a356beac2c704510539bb506b99f003d7f692144 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 15:31:34 -0400 Subject: [PATCH 117/124] Travis: install SDL2 2.0.6 and SDL2_Mixer 2.0.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5365d445..3f755411 100644 --- a/.travis.yml +++ b/.travis.yml @@ -234,7 +234,7 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install game-music-emu p7zip; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2@2.0.6 sdl2_mixer@2.0.1 game-music-emu p7zip; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi From 92aa0e000efe98aec86ec99ba0f8e93ee80e304c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 16:24:22 -0400 Subject: [PATCH 118/124] Travis: can not use set version with sdl2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f755411..ee440503 100644 --- a/.travis.yml +++ b/.travis.yml @@ -234,7 +234,7 @@ before_script: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2@2.0.6 sdl2_mixer@2.0.1 game-music-emu p7zip; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2 sdl2_mixer game-music-emu p7zip; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi From 01602fa1f12eab8eae00550dcc85d6bb3ba37462 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Sep 2017 16:54:26 -0400 Subject: [PATCH 119/124] Build: fixup warnings in Debug builds --- src/m_menu.c | 2 +- src/m_menu.h | 2 +- src/p_enemy.c | 2 ++ src/y_inter.c | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 5b699dcb..ea93d1e2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4625,7 +4625,7 @@ static void M_ReadSavegameInfo(UINT32 slot) savegameinfo[slot].botskin = 0; if (savegameinfo[slot].botskin) - snprintf(savegameinfo[slot].playername, 32, "%s & %s", + snprintf(savegameinfo[slot].playername, 36, "%s & %s", skins[savegameinfo[slot].skinnum].realname, skins[savegameinfo[slot].botskin-1].realname); else diff --git a/src/m_menu.h b/src/m_menu.h index 2ff1cea9..4d6e2fac 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -190,7 +190,7 @@ typedef struct // savegame struct for save game menu typedef struct { - char playername[32]; + char playername[37]; char levelname[32]; UINT8 actnum; UINT8 skincolor; diff --git a/src/p_enemy.c b/src/p_enemy.c index 9de735ed..f2e54a58 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4812,9 +4812,11 @@ void A_UnidusBall(mobj_t *actor) case 0: // at least one frame where not dashing if (!skull) ++actor->extravalue2; else break; + /* FALLTHRU */ case 1: // at least one frame where ARE dashing if (skull) ++actor->extravalue2; else break; + /* FALLTHRU */ case 2: // not dashing again? if (skull) break; // launch. diff --git a/src/y_inter.c b/src/y_inter.c index cfdc2a08..e7df165b 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -57,7 +57,7 @@ typedef union { struct { - char passed1[14]; // KNUCKLES GOT / CRAWLA HONCHO + char passed1[21]; // KNUCKLES GOT / CRAWLA HONCHO char passed2[16]; // THROUGH THE ACT / PASSED THE ACT INT32 passedx1; INT32 passedx2; @@ -77,7 +77,7 @@ typedef union struct { - char passed1[SKINNAMESIZE+1]; // KNUCKLES GOT / CRAWLA HONCHO + char passed1[29]; // KNUCKLES GOT / CRAWLA HONCHO char passed2[17]; // A CHAOS EMERALD / GOT THEM ALL! char passed3[15]; // CAN NOW BECOME char passed4[SKINNAMESIZE+7]; // SUPER CRAWLA HONCHO From 03ba14640fa6d103cbc39c9bbf9116cdafac3b33 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Sep 2017 17:43:20 -0400 Subject: [PATCH 120/124] Travis: test building with clang 3.9, 4.0 and 5.0 --- .travis.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.travis.yml b/.travis.yml index ee440503..8ead5f1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -177,6 +177,51 @@ matrix: - clang-3.8 compiler: clang-3.8 #clang version 3.8.1-svn271127-1~exp1 (branches/release_38) + - os: linux + addons: + apt: + sources: + - llvm-toolchain-precise-3.9 + - ubuntu-toolchain-r-test + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - clang-3.9 + compiler: clang-3.9 + #clang version 3.9.X + - os: linux + addons: + apt: + sources: + - llvm-toolchain-precise-4.0 + - ubuntu-toolchain-r-test + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - clang-4.0 + compiler: clang-4.0 + #clang version 4.0.X + - os: linux + addons: + apt: + sources: + - llvm-toolchain-precise-5.0 + - ubuntu-toolchain-r-test + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - clang-5.0 + compiler: clang-5.0 + #clang version 5.0.X # - os: osx # osx_image: beta-xcode6.1 # #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) @@ -207,6 +252,9 @@ matrix: - compiler: clang-3.6 - compiler: clang-3.7 - compiler: clang-3.8 + - compiler: clang-3.9 + - compiler: clang-4.0 + - complier: clang-5.0 cache: apt: true From 472c74907e09e86e420d6fb6e933b99214d5eb40 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Sep 2017 17:52:12 -0400 Subject: [PATCH 121/124] Travis: fix misspelling --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8ead5f1f..22fce17f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough" + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3" #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux compiler: clang @@ -254,7 +254,7 @@ matrix: - compiler: clang-3.8 - compiler: clang-3.9 - compiler: clang-4.0 - - complier: clang-5.0 + - compiler: clang-5.0 cache: apt: true From 075c4e09565f5adf828e9a1f28f0d8077b6923d7 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Sep 2017 17:57:03 -0400 Subject: [PATCH 122/124] Travis: clang 4.0 and 5.0 is not up for trusy --- .travis.yml | 60 ++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22fce17f..4648ae56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -192,36 +192,36 @@ matrix: - clang-3.9 compiler: clang-3.9 #clang version 3.9.X - - os: linux - addons: - apt: - sources: - - llvm-toolchain-precise-4.0 - - ubuntu-toolchain-r-test - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - clang-4.0 - compiler: clang-4.0 - #clang version 4.0.X - - os: linux - addons: - apt: - sources: - - llvm-toolchain-precise-5.0 - - ubuntu-toolchain-r-test - packages: - - libsdl2-mixer-dev - - libpng-dev - - libgl1-mesa-dev - - libgme-dev - - p7zip-full - - clang-5.0 - compiler: clang-5.0 - #clang version 5.0.X +# - os: linux +# addons: +# apt: +# sources: +# - llvm-toolchain-precise-4.0 +# - ubuntu-toolchain-r-test +# packages: +# - libsdl2-mixer-dev +# - libpng-dev +# - libgl1-mesa-dev +# - libgme-dev +# - p7zip-full +# - clang-4.0 +# compiler: clang-4.0 +# #clang version 4.0.X +# - os: linux +# addons: +# apt: +# sources: +# - llvm-toolchain-precise-5.0 +# - ubuntu-toolchain-r-test +# packages: +# - libsdl2-mixer-dev +# - libpng-dev +# - libgl1-mesa-dev +# - libgme-dev +# - p7zip-full +# - clang-5.0 +# compiler: clang-5.0 +# #clang version 5.0.X # - os: osx # osx_image: beta-xcode6.1 # #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) From 6fbdf37b18106c07612e3fcb20d50966df75a601 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 30 Sep 2017 08:54:17 -0400 Subject: [PATCH 123/124] Build: support building with clang 5.0 --- src/hardware/hw_data.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index a6525a2f..d76fcc1c 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -64,7 +64,7 @@ typedef struct GLMipmap_s GLMipmap_t; // struct GLTexture_s { - GLMipmap_t mipmap; + GLMipmap_t mipmap; float scaleX; //used for scaling textures on walls float scaleY; }; @@ -88,7 +88,7 @@ struct GLPatch_s UINT16 wadnum; // the software patch lump num for when the hardware patch UINT16 lumpnum; // was flushed, and we need to re-create it GLMipmap_t mipmap; -} ATTRPACK; +}; typedef struct GLPatch_s GLPatch_t; #endif //_HWR_DATA_ From 1b576bacf3e1ffa3bbc1ec5b5e610f5bfd456389 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 30 Sep 2017 23:07:47 -0400 Subject: [PATCH 124/124] Build: support GCC 8 --- src/Makefile.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 1b323ca0..31721839 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,10 @@ # and other things # +ifdef GCC80 +GCC72=1 +endif + ifdef GCC72 GCC71=1 endif