Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Dec 30, 2023
2 parents cc09ec0 + d5312a1 commit 3878414
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 45 deletions.
14 changes: 8 additions & 6 deletions COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ Then, after navigating to the project directory:

## Compilation for Windows XP using w64devkit

WARNING: Windows XP support has been deprecated; the steps below may fail with future versions of EDGE-Classic. Issues that prevent EDGE-Classic from running in Windows XP outside of legitimate bugs (i.e., an otherwise good function needs compiler defines and a separate code path to work with XP) will not be addressed by the development team.
WARNING: w64devkit's bundled tools such as GNU Make can produce false positives in Windows Defender; please see https://github.com/skeeto/w64devkit/issues/79 for more information and steps to validate that the Make executable is valid. Any Windows Defender exceptions that are created to account for this are the responsibility of the user and the user alone, and are NOT recommended actions by the development team!

This section assumes that you have downloaded an i686 release from https://github.com/skeeto/w64devkit/releases and extracted it to a folder of your choosing.
NOTE: Windows XP support has been deprecated; the steps below may fail with future versions of EDGE-Classic. Issues that prevent EDGE-Classic from running in Windows XP outside of legitimate bugs (i.e., an otherwise good function needs compiler defines and a separate code path to work with XP) will not be addressed by the development team.

NOTE: The bundled GNU Make program can sometimes produce a false positive in Windows Defender during extraction; please see https://github.com/skeeto/w64devkit/issues/79 for more information and steps to validate that the Make executable is valid.
This section assumes that you have downloaded the `i686` release from https://github.com/skeeto/w64devkit/releases and extracted it to a folder of your choosing. You will also need to download the `SDL2-devel-<version>-mingw` package from https://github.com/libsdl-org/SDL/releases/latest and placed the contents of its `i686-w64-mingw32` folder into the `i686-w64-mingw32` folder of your w64devkit installation.

Launch w64devkit.exe from your extracted w64devkit folder.

Then, after navigating to the project directory:

```
> cmake -B build -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=./cmake/Toolchain-mingw32-minimal.cmake -DCMAKE_BUILD_TYPE=Release
> cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static -lmingw32 -lSDL2main -lSDL2.dll -mwindows" -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1
> cmake --build build (-j# optional, with # being the number of threads/cores you'd like to use)
> strip edge-classic.exe
> strip edge-classic.exe (if desired)
```

## Linux Compilation
Expand Down Expand Up @@ -117,6 +117,8 @@ In all cases (barring the WebGL build per the previous section), the executable
* soundfont
* edge-classic/edge-classic.exe (OS-dependent)
* edge_defs.epk
* SDL2.dll (Windows-only, with the exception of MSYS builds; see below instructions for details)
* SDL2.dll (Windows-only, MSYS and w64devkit builds must have this file moved here manually; see below instructions for details)

MSYS BUILDS: You will need to navigate to the /bin folder for the appropriate architecture in your MSYS2 installation (for example, /mingw64/bin for MinGW 64-bit builds), and copy SDL2.dll into the same directory as edge-classic.exe. If the program has errors on startup regarding other .dlls missing, they can be found in this location as well.

W64DEVKIT BUILDS: You will need to copy SDL2.dll from the /i686-w64-mingw32/bin of your w64devkit install to the directory containing edge-classic.exe
1 change: 1 addition & 0 deletions source_files/edge/e_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void player_s::Reborn()
splashwait = 0;
air_in_lungs = 0;
underwater = false;
airless = false;
swimming = false;
wet_feet = false;

Expand Down
1 change: 1 addition & 0 deletions source_files/edge/e_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ typedef struct player_s
// hurts), and player drowns when health drops to zero.
int air_in_lungs;
bool underwater;
bool airless;
bool swimming;
bool wet_feet;

Expand Down
11 changes: 10 additions & 1 deletion source_files/edge/p_spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,11 @@ static inline void PlayerInProperties(player_t *player, float bz, float tz, floa
}
}

if ((special->special_flags & SECSP_AirLess) && mouth_z >= f_h && mouth_z <= c_h)
{
player->airless = true;
}

if ((special->special_flags & SECSP_Swimming) && mouth_z >= f_h && mouth_z <= c_h)
{
player->swimming = true;
Expand Down Expand Up @@ -1900,12 +1905,14 @@ void P_PlayerInSpecialSector(player_t *player, sector_t *sec, bool should_choke)
float tz = player->mo->z + player->mo->height;

bool was_underwater = player->underwater;
bool was_airless = player->airless;
bool was_swimming = player->swimming;

const sectortype_c *swim_special = NULL;

player->swimming = false;
player->underwater = false;
player->airless = false;
player->wet_feet = false;

// traverse extrafloor list
Expand Down Expand Up @@ -1948,7 +1955,7 @@ void P_PlayerInSpecialSector(player_t *player, sector_t *sec, bool should_choke)
PlayerInProperties(player, bz, tz, floor_h, ceil_h, sec->p, &swim_special, should_choke);

// breathing support: handle gasping when leaving the water
if (was_underwater && !player->underwater)
if ((was_underwater && !player->underwater) || (was_airless && !player->airless))
{
if (player->air_in_lungs <= (player->mo->info->lung_capacity - player->mo->info->gasp_start))
{
Expand All @@ -1961,6 +1968,8 @@ void P_PlayerInSpecialSector(player_t *player, sector_t *sec, bool should_choke)
player->air_in_lungs = player->mo->info->lung_capacity;
}



// -AJA- 2008/01/20: water splash sounds for players
if (!was_swimming && player->swimming)
{
Expand Down
4 changes: 3 additions & 1 deletion source_files/edge/p_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ bool P_PlayerThink(player_t *player, bool extra_tic)
ddf_reverb_ratio = 0;

if (player->mo->props->special || player->mo->subsector->sector->exfloor_used > 0 || player->underwater ||
player->swimming)
player->swimming || player->airless)
{
P_PlayerInSpecialSector(player, player->mo->subsector->sector, should_think);
}
Expand Down Expand Up @@ -1259,6 +1259,8 @@ void P_GiveInitialBenefits(player_t *p, const mobjtype_c *info)
p->health = info->spawnhealth;
p->air_in_lungs = info->lung_capacity;
p->underwater = false;
p->airless = false;


for (i = 0; i < NUMARMOUR; i++)
{
Expand Down
Loading

0 comments on commit 3878414

Please sign in to comment.