Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skr/more stuff #664

Merged
merged 21 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-linux_fmod_steam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-linux_fmod_steam_eos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -63,4 +63,4 @@ jobs:
# Artifact name
name: Editor_fmod_steam # optional
# A file, directory or wildcard pattern that describes what to upload
path: build-editor/release/editor
path: build-editor/release/editor
Binary file removed fonts/pixel_maz.ttf
Binary file not shown.
Binary file removed fonts/pixel_maz_large.ttf
Binary file not shown.
Binary file removed fonts/pixel_maz_multiline.ttf
Binary file not shown.
Binary file removed fonts/pixelmix.ttf
Binary file not shown.
Binary file removed fonts/pixelmix_bold.ttf
Binary file not shown.
8 changes: 7 additions & 1 deletion src/colors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ constexpr Uint32 uint32ColorPlayer1 = makeColorRGB(64, 255, 64);
constexpr Uint32 uint32ColorPlayer2 = makeColorRGB(86, 180, 233);
constexpr Uint32 uint32ColorPlayer3 = makeColorRGB(240, 228, 66);
constexpr Uint32 uint32ColorPlayer4 = makeColorRGB(204, 121, 167);
constexpr Uint32 uint32ColorPlayerX = makeColorRGB(191, 191, 191);
constexpr Uint32 uint32ColorPlayerX = makeColorRGB(191, 191, 191);

constexpr Uint32 uint32ColorPlayer1_Ally = makeColorRGB(32, 127, 32);
constexpr Uint32 uint32ColorPlayer2_Ally = makeColorRGB(43, 90, 116);
constexpr Uint32 uint32ColorPlayer3_Ally = makeColorRGB(120, 114, 33);
constexpr Uint32 uint32ColorPlayer4_Ally = makeColorRGB(102, 60, 83);
constexpr Uint32 uint32ColorPlayerX_Ally = makeColorRGB(95, 95, 95);
10 changes: 7 additions & 3 deletions src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ void drawEntities3D(view_t* camera, int mode)
{
if ( !entity->flags[OVERDRAW] )
{
if ( !map.vismap[y + x * map.height] )
if ( !map.vismap[y + x * map.height] && !entity->monsterEntityRenderAsTelepath )
{
continue;
}
Expand Down Expand Up @@ -2845,12 +2845,16 @@ void occlusionCulling(map_t& map, const view_t& camera)

#if !defined(EDITOR) && !defined(NDEBUG)
static ConsoleVariable<bool> cvar("/skipculling", false);
if (*cvar)
const bool disabled = *cvar;
#else
const bool disabled = false;
#endif

if (disabled)
{
memset(map.vismap, 1, sizeof(bool) * size);
return;
}
#endif

// clear vismap
const int camx = std::min(std::max(0, (int)camera.x), (int)map.width - 1);
Expand Down
30 changes: 27 additions & 3 deletions src/eos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "interface/ui.hpp"
#include "lobbies.hpp"
#include "prng.hpp"
#include "ui/MainMenu.hpp"

EOSFuncs EOS;

Expand Down Expand Up @@ -400,14 +401,16 @@ void EOS_CALL EOSFuncs::OnCreateLobbyFinished(const EOS_Lobby_CreateLobbyCallbac
EOSFuncs::logError("OnCreateLobbyFinished: null data");
return;
}
else if ( data->ResultCode == EOS_EResult::EOS_Success )

EOS.CurrentLobbyData.LobbyCreationResult = data->ResultCode;
if ( data->ResultCode == EOS_EResult::EOS_Success )
{
EOS.CurrentLobbyData.LobbyId = data->LobbyId;

EOS.CurrentLobbyData.LobbyAttributes.lobbyName = EOS.CurrentUserInfo.Name + "'s lobby";
strncpy(EOS.currentLobbyName, EOS.CurrentLobbyData.LobbyAttributes.lobbyName.c_str(), 31);

Uint32 keygen = local_rng.rand() % (1679615 + 1); // limit of 'zzzz' as base-36 string
Uint32 keygen = local_rng.uniform(0, (36 * 36 * 36 * 36) - 1); // limit of 'zzzz' as base-36 string
EOS.CurrentLobbyData.LobbyAttributes.gameJoinKey = EOS.getLobbyCodeFromGameKey(keygen);
std::chrono::system_clock::duration epochDuration = std::chrono::system_clock::now().time_since_epoch();
EOS.CurrentLobbyData.LobbyAttributes.lobbyCreationTime = std::chrono::duration_cast<std::chrono::seconds>(epochDuration).count();
Expand Down Expand Up @@ -895,11 +898,21 @@ void EOS_CALL EOSFuncs::OnMemberStatusReceived(const EOS_Lobby_LobbyMemberStatus
{
if ( data->CurrentStatus == EOS_ELobbyMemberStatus::EOS_LMS_CLOSED
|| (data->CurrentStatus == EOS_ELobbyMemberStatus::EOS_LMS_KICKED
&& (data->TargetUserId == EOS.CurrentUserInfo.getProductUserIdHandle()))
&& data->TargetUserId == EOS.CurrentUserInfo.getProductUserIdHandle())
)
{
// if lobby closed or we got kicked, then clear data.
LobbyLeaveCleanup(EOS.CurrentLobbyData);
switch (data->CurrentStatus) {
case EOS_ELobbyMemberStatus::EOS_LMS_CLOSED:
//MainMenu::disconnectedFromServer("The host has shutdown the lobby.");
break;
case EOS_ELobbyMemberStatus::EOS_LMS_KICKED:
//MainMenu::disconnectedFromServer("You have been kicked\nfrom the online lobby.");
break;
default:
break;
}
}
else
{
Expand Down Expand Up @@ -1817,6 +1830,17 @@ void EOSFuncs::searchLobbies(LobbyParameters_t::LobbySearchOptions searchType,
{
LobbySearchResults.lastResultWasFiltered = false;

if ( LobbySearchResults.useLobbyCode )
{
for ( int c = 0; c < 4 && EOS.lobbySearchByCode[c] != 0; ++c )
{
if ( EOS.lobbySearchByCode[c] >= 'A' && EOS.lobbySearchByCode[c] <= 'Z' )
{
EOS.lobbySearchByCode[c] = 'a' + (EOS.lobbySearchByCode[c] - 'A'); // to lowercase.
}
}
}

LobbyHandle = EOS_Platform_GetLobbyInterface(PlatformHandle);
logInfo("searchLobbies: starting search");
EOS_Lobby_CreateLobbySearchOptions CreateSearchOptions = {};
Expand Down
1 change: 1 addition & 0 deletions src/eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class EOSFuncs
bool bLobbyHasBasicDetailsRead = false;
bool bAwaitingLeaveCallback = false;
bool bAwaitingCreationCallback = false;
EOS_EResult LobbyCreationResult = EOS_EResult::EOS_Success;
bool bDenyLobbyJoinEvent = false;

class PlayerLobbyData_t {
Expand Down
14 changes: 6 additions & 8 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5826,6 +5826,10 @@ int main(int argc, char** argv)
{
for (c = 1; c < argc; c++)
{
#ifdef STEAMWORKS
cmd_line += argv[c];
cmd_line += " ";
#endif
if ( argv[c] != NULL )
{
if ( !strcmp(argv[c], "-windowed") )
Expand Down Expand Up @@ -6096,14 +6100,8 @@ int main(int argc, char** argv)
printTextFormattedAlpha(font16x16_bmp, (xres / 2) - strlen("Turning Wheel") * 9, yres / 2 + 128, std::min<Uint16>(std::max<Uint16>(0, logoalpha), 255), "Turning Wheel");
if ( logoalpha >= 255 && !fadeout )
{
if ( !skipintro && !strcmp(classtoquickstart, "") )
{
MainMenu::beginFade(MainMenu::FadeDestination::IntroStoryScreen);
}
else
{
MainMenu::beginFade(MainMenu::FadeDestination::TitleScreen);
}
fadeout = true;
fadefinished = false;
}

bool skipButtonPressed = false;
Expand Down
5 changes: 0 additions & 5 deletions src/init_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,6 @@ void deinitGame()
cpp_Free_CSteamID(currentLobby); //TODO: Remove these bodges.
currentLobby = NULL;
}
if ( lobbyToConnectTo )
{
cpp_Free_CSteamID(lobbyToConnectTo);
lobbyToConnectTo = NULL;
}
SheridanR marked this conversation as resolved.
Show resolved Hide resolved
for ( c = 0; c < MAXPLAYERS; c++ )
{
if ( steamIDRemote[c] )
Expand Down
83 changes: 34 additions & 49 deletions src/interface/drawminimap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,67 +403,52 @@ void drawMinimap(const int player, SDL_Rect rect)
}
if ( drawMonsterAlly >= 0 || foundplayer >= 0 || entity->sprite == 239)
{
Uint32 color = makeColor(255, 0, 0, 255);

if (entity->sprite == 239)
{
if (players[player] == nullptr)
{
Uint32 color;
if ( foundplayer >= 0 ) {
if ( players[player] && players[player]->entity
&& players[player]->entity->creatureShadowTaggedThisUid == entity->getUID() ) {
color = uint32ColorPlayerX; // grey
} else {
switch ( foundplayer ) {
case 0: color = uint32ColorPlayer1; break;
case 1: color = uint32ColorPlayer2; break;
case 2: color = uint32ColorPlayer3; break;
case 3: color = uint32ColorPlayer4; break;
default: color = uint32ColorPlayerX; break;
}
}
} else if ( entity->sprite == 239 ) {
if (!players[player] || !players[player]->entity) {
continue;
}
if ( ticks % 120 - ticks % 60 )
{
if ( !minotaur_timer )
{
if ( ticks % 120 - ticks % 60 ) {
if ( !minotaur_timer ) {
playSound(116, 64);
}
minotaur_timer = 1;
}
else
{
} else {
minotaur_timer = 0;
continue;
}
}

if ( foundplayer >= 0 ) {
switch ( foundplayer )
{
case 0: color = uint32ColorPlayer1; break;
case 1: color = uint32ColorPlayer2; break;
case 2: color = uint32ColorPlayer3; break;
case 3: color = uint32ColorPlayer4; break;
default: color = uint32ColorPlayerX; break;
}
if ( players[player] && players[player]->entity
&& players[player]->entity->creatureShadowTaggedThisUid == entity->getUID() ) {
color = uint32ColorPlayerX; // grey
}
} else if ( entity->sprite == 239 ) {
color = makeColor(255, 0, 0, 255);
} else {
switch ( drawMonsterAlly ) {
case 0:
color = makeColor(32, 127, 32, 255); // green
break;
case 1:
color = makeColor(43, 90, 116, 255); // sky blue
break;
case 2:
color = makeColor(120, 114, 33, 255); // yellow
break;
case 3:
color = makeColor(102, 60, 83, 255); // pink
break;
default:
color = makeColor(96, 96, 96, 255); // grey
break;
}
if ( players[player] && players[player]->entity
&& players[player]->entity->creatureShadowTaggedThisUid == entity->getUID() ) {
color = makeColor(96, 96, 96, 255); // grey
color = uint32ColorPlayerX_Ally; // grey
} else {
switch ( drawMonsterAlly ) {
case 0: uint32ColorPlayer1_Ally; break;
case 1: uint32ColorPlayer2_Ally; break;
case 2: uint32ColorPlayer3_Ally; break;
case 3: uint32ColorPlayer4_Ally; break;
default: uint32ColorPlayerX_Ally; break;
}
}
}

const real_t zoom = entity->sprite == 239 ?
minimapObjectZoom / 50.0:
minimapObjectZoom / 100.0;
const real_t x = ((entity->x / 16.0) - xmin) * unitX + rect.x;
const real_t y = ((entity->y / 16.0) - ymin) * unitY + rect.y;
const real_t ang = entity->yaw;
Expand All @@ -482,8 +467,8 @@ void drawMinimap(const int player, SDL_Rect rect)
for (int c = 0; c < num_vertices; ++c) {
const real_t vx = v[c][0] * cos(ang) - v[c][1] * sin(ang);
const real_t vy = v[c][0] * sin(ang) + v[c][1] * cos(ang);
const real_t sx = vx * unitX * (minimapObjectZoom / 100.0);
const real_t sy = vy * unitY * (minimapObjectZoom / 100.0);
const real_t sx = vx * unitX * zoom;
const real_t sy = vy * unitY * zoom;
glVertex2f(x + sx, Frame::virtualScreenY - (y + sy));
}
glEnd();
Expand Down
2 changes: 1 addition & 1 deletion src/interface/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ int loadConfig(char* filename)
// open the config file
if ( (fp = FileIO::open(filename, "rb")) == NULL )
{
printlog("warning: config file '%s' does not exist!\n", filename);
printlog("note: config file '%s' does not exist!\n", filename);
defaultConfig(); //Set up the game with the default config.
return 0;
}
Expand Down
40 changes: 21 additions & 19 deletions src/lobbies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,51 @@ std::string LobbyHandler_t::getLobbyJoinFailedConnectString(int result)
switch ( result )
{
case EResult_LobbyFailures::LOBBY_GAME_IN_PROGRESS:
snprintf(buf, 1023, "Failed to join lobby:\n\nGame in progress not joinable.");
snprintf(buf, 1023, "Failed to join lobby:\nGame in progress not joinable.");
break;
case EResult_LobbyFailures::LOBBY_USING_SAVEGAME:
snprintf(buf, 1023, "Failed to join lobby:\n\nCompatible save required.");
snprintf(buf, 1023, "Failed to join lobby:\nCompatible save required.");
break;
case EResult_LobbyFailures::LOBBY_NOT_USING_SAVEGAME:
snprintf(buf, 1023, "Failed to join lobby:\n\nOnly new characters allowed.");
snprintf(buf, 1023, "Failed to join lobby:\nOnly new characters allowed.");
break;
case EResult_LobbyFailures::LOBBY_WRONG_SAVEGAME:
snprintf(buf, 1023, "Failed to join lobby:\n\nIncompatible save game.");
snprintf(buf, 1023, "Failed to join lobby:\nIncompatible save game.");
break;
case EResult_LobbyFailures::LOBBY_JOIN_CANCELLED:
snprintf(buf, 1023, "Lobby join cancelled.\n\nSafely leaving lobby.");
snprintf(buf, 1023, "Lobby join cancelled.\nSafely leaving lobby.");
break;
case EResult_LobbyFailures::LOBBY_JOIN_TIMEOUT:
snprintf(buf, 1023, "Failed to join lobby:\n\nTimeout waiting for server.");
snprintf(buf, 1023, "Failed to join lobby:\nTimeout waiting for server.");
break;
case EResult_LobbyFailures::LOBBY_NO_OWNER:
snprintf(buf, 1023, "Failed to join lobby:\n\nNo host found for lobby.");
snprintf(buf, 1023, "Failed to join lobby:\nNo host found for lobby.");
break;
case EResult_LobbyFailures::LOBBY_NOT_FOUND:
snprintf(buf, 1023, "Failed to join lobby:\n\nLobby no longer exists.");
snprintf(buf, 1023, "Failed to join lobby:\nLobby no longer exists.");
break;
case EResult_LobbyFailures::LOBBY_TOO_MANY_PLAYERS:
snprintf(buf, 1023, "Failed to join lobby:\n\nLobby is full.");
snprintf(buf, 1023, "Failed to join lobby:\nLobby is full.");
break;
#ifdef USE_EOS
#ifdef STEAMWORKS
case static_cast<int>(EOS_EResult::EOS_InvalidUser):
snprintf(buf, 1023, "Failed to join lobby:\nCrossplay not enabled.");
break;
#else
case static_cast<int>(EOS_EResult::EOS_InvalidUser):
snprintf(buf, 1023, "Failed to join lobby:\nNot connected to Epic Online.");
break;
#endif
case static_cast<int>(EOS_EResult::EOS_NotFound):
snprintf(buf, 1023, "Failed to join lobby:\n\nLobby no longer exists.");
snprintf(buf, 1023, "Failed to join lobby:\nLobby no longer exists.");
break;
case static_cast<int>(EOS_EResult::EOS_Lobby_TooManyPlayers):
snprintf(buf, 1023, "Failed to join lobby:\n\nLobby is full.");
snprintf(buf, 1023, "Failed to join lobby:\nLobby is full.");
break;
#endif
default:
snprintf(buf, 1023, "Failed to join lobby:\n\nError code: %d.", result);
snprintf(buf, 1023, "Failed to join lobby:\nError code: %d.", result);
break;
}
printlog("[Lobbies Error]: %s", buf);
Expand Down Expand Up @@ -713,13 +722,6 @@ void LobbyHandler_t::searchLobbyWithFilter(button_t* my)
{
#ifdef USE_EOS
EOS.LobbySearchResults.showLobbiesInProgress = LobbyHandler.filterShowInProgressLobbies;
for ( int c = 0; c < 4 && EOS.lobbySearchByCode[c] != 0; ++c )
{
if ( EOS.lobbySearchByCode[c] >= 'A' && EOS.lobbySearchByCode[c] <= 'Z' )
{
EOS.lobbySearchByCode[c] = 'a' + (EOS.lobbySearchByCode[c] - 'A'); // to lowercase.
}
}

if ( strcmp(EOS.lobbySearchByCode, "") != 0 )
{
Expand Down
Loading