Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feat/more-lights
Browse files Browse the repository at this point in the history
  • Loading branch information
atar13 committed Jun 5, 2024
2 parents 78d5253 + 145f0d4 commit f0df856
Show file tree
Hide file tree
Showing 105 changed files with 2,092 additions and 412 deletions.
Binary file added assets/imgs/dm_cooldown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_cooldown_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/imgs/dm_cooldown/dm_selected_cooldown_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/sounds/client_music/maze.mp3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/sounds/client_music/menu.mp3
Binary file not shown.
Binary file removed assets/sounds/client_music/mono-retrowave.mp3
Binary file not shown.
Binary file removed assets/sounds/client_music/piano.wav
Binary file not shown.
Binary file added assets/sounds/client_music/relay_race_players.mp3
Binary file not shown.
Binary file added assets/sounds/client_sfx/victory_players.flac
Binary file not shown.
Binary file removed assets/sounds/client_sfx/vine-boom-mono.mp3
Binary file not shown.
Binary file added assets/sounds/server_sfx/cutscene_gate_open.wav
Binary file not shown.
Binary file added assets/sounds/server_sfx/electric_hum.wav
Binary file not shown.
Binary file added assets/sounds/server_sfx/mirror_shatter.mp3
Binary file not shown.
Binary file added assets/sounds/server_sfx/players_start_theme.mp3
Binary file not shown.
Binary file added assets/sounds/server_sfx/wind.wav
Binary file not shown.
Binary file added assets/sounds/server_sfx/zeus_start_theme.mp3
Binary file not shown.
6 changes: 4 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"directory": "maps",
"procedural": false,
"maze_file": "test/itemRoom.maze"
}
},
"disable_enemies": true
},
"network": {
"server_ip": "localhost",
Expand All @@ -14,7 +15,8 @@
"lobby_name": "Hope you're doing well!1",
"lobby_broadcast": true,
"max_players": 1,
"disable_dm": true
"disable_dm": true,
"skip_intro": true
},
"client": {
"default_name": "Conan O'Brien",
Expand Down
2 changes: 2 additions & 0 deletions include/client/camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class Camera {

glm::mat4 getView();

void setPitch(float pitch);

protected:
// Perspective controls
float FOV; // Field of View Angle (degrees)
Expand Down
43 changes: 41 additions & 2 deletions include/client/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ class Client {
*/
void mouseCallback(GLFWwindow* window, double xposIn, double yposIn);

/**
* @brief Callback which handles scrolling movement.
*
* @param window The GLFWwindow being monitered.
* @param xposIn The current scroll up value.
* @param yposIn The current scroll down value.
*/
void scrollCallback(GLFWwindow* window, double xposIn, double yposIn);

/**
Expand Down Expand Up @@ -166,11 +173,28 @@ class Client {
*/
bool connect(std::string ip_addr);

/**
* @brief get the reference to the Audio manager
*/
AudioManager* getAudioManager();

/**
* @brief get the reference to the Animation manager
*/
AnimationManager* getAnimManager() { return animManager; }

/**
* @brief the current position in the world the player is looking at
*/
void setWorldPos();

/**
* @brief Send down a trap event to the server
*
* @param hover boolean to indicate the DM is only hovering and has not placed yet
* @param place boolean to indicate the DM would like to place a type
* @param trapType ModelType to indicate the type of the trap the DM wants to place
*/
void sendTrapEvent(bool hover, bool place, ModelType trapType);

int curr_fps;
Expand Down Expand Up @@ -221,6 +245,9 @@ class Client {
/* Current game state */
SharedGameState gameState;

/* Stuff for the intro cutscene, contains a whole other SharedGameState */
std::optional<LoadIntroCutsceneEvent> intro_cutscene;

/* Shader objects for various */
std::shared_ptr<Shader> deferred_geometry_shader;
std::shared_ptr<Shader> deferred_lighting_shader;
Expand Down Expand Up @@ -284,7 +311,11 @@ class Client {
*/
RadioButtonState roleSelection;

/**
* @brief Audio Manager to play Client sounds
*/
AudioManager* audioManager;

AnimationManager* animManager;

/* Camera object representing player's current position & orientation */
Expand All @@ -303,17 +334,22 @@ class Client {
bool is_held_left = false;
bool is_held_space = false;

/* DM zooming in and out flags */
bool is_held_i = false;
bool is_held_o = false;

bool is_pressed_p = false;

bool is_left_mouse_down = false;
bool is_right_mouse_down = false;

/* DM Trap Orientation Traps With Directions */
int orientation = 0;

/* Mouse position coordinates */
float mouse_xpos = 0.0f;
float mouse_ypos = 0.0f;

double lastTime = 0.0;

GameConfig config;
tcp::resolver resolver;
tcp::socket socket;
Expand All @@ -330,6 +366,9 @@ class Client {

std::deque<Event> events_received;

/**
* @brief boolean to see if a phase change from LOBBY to GAME already happened
*/
bool phase_change;

// id of last known player which is holding the orb
Expand Down
2 changes: 1 addition & 1 deletion include/client/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define UNIT_WINDOW_WIDTH 1920
#define UNIT_WINDOW_HEIGHT 1080

#define PLAYER_EYE_LEVEL 2.35f
#define PLAYER_EYE_LEVEL 3.45f

// distance threshold of which objects
// to render
Expand Down
7 changes: 6 additions & 1 deletion include/client/gui/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum class GUIState {
TITLE_SCREEN,
LOBBY_BROWSER,
LOBBY,
INTRO_CUTSCENE,
GAME_HUD,
GAME_ESC_MENU,
DEAD_SCREEN,
Expand Down Expand Up @@ -129,8 +130,12 @@ class GUI {
* is down. Note: this is a reference so that if a click is captured it can toggle the
* mouse down flag to false, so that click doesn't get "double counted" in subsequent
* frames.
* @param is_right_mouse_down reference to flag which stores whether or not the right mouse
* is down. Note: this is a reference so that if a click is captured it can toggle the
* mouse down flag to false, so that click doesn't get "double counted" in subsequent
* frames.
*/
void handleInputs(float mouse_xpos, float mouse_ypos, bool& is_left_mouse_down);
void handleInputs(float mouse_xpos, float mouse_ypos, bool& is_left_mouse_down, bool& is_right_mouse_down);
/**
* Renders the current state of the GUI to the screen, based on all of the widgets
* that have been added and any changes caused by inputs.
Expand Down
19 changes: 16 additions & 3 deletions include/client/gui/img/img.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum class ImgID {
FireSpell,
HealSpell,
Orb,
Mirror,
Crosshair,
Scroll,
Dagger,
Expand All @@ -37,6 +38,7 @@ enum class ImgID {
DMRightHotbar,
DMMiddleHotbar,
DMMiddleSelected,
DMMiddleCooldown,
HealthBar,
HealthTickEmpty,
HealthTickFull,
Expand All @@ -58,11 +60,16 @@ enum class ImgID {
Lightning,
ArrowTrap,
SpikeTrap,
DMCD_10, DMCD_9, DMCD_8, DMCD_7, DMCD_6, DMCD_5, DMCD_4, DMCD_3, DMCD_2, DMCD_1,
DMCD_Selected_10, DMCD_Selected_9, DMCD_Selected_8, DMCD_Selected_7, DMCD_Selected_6,
DMCD_Selected_5, DMCD_Selected_4, DMCD_Selected_3, DMCD_Selected_2, DMCD_Selected_1,
Blank,
};

// Sorry for whoever has to look at this :) - ted
#define GET_ALL_IMG_IDS() \
{ ImgID::Yoshi, ImgID::AwesomeSauce, ImgID::HealthPotion, ImgID::UnknownPotion, \
ImgID::InvisPotion, ImgID::FireSpell, ImgID::HealSpell, ImgID::Orb, \
{ImgID::Yoshi, ImgID::AwesomeSauce, ImgID::HealthPotion, ImgID::UnknownPotion, \
ImgID::InvisPotion, ImgID::FireSpell, ImgID::HealSpell, ImgID::Orb, ImgID::Mirror, \
ImgID::Crosshair, ImgID::Scroll, ImgID::Dagger, ImgID::Sword, ImgID::Hammer, \
ImgID::LeftHotbar, ImgID::RightHotbar, ImgID::MiddleHotbar, ImgID::Blank, ImgID::Title, \
ImgID::MiddleSelected, ImgID::HealthBar, ImgID::HealthTickEmpty, ImgID::HealthTickFull, \
Expand All @@ -71,9 +78,15 @@ enum class ImgID {
ImgID::Compass0, ImgID::Compass30, ImgID::Compass60, ImgID::Compass90, \
ImgID::Compass120, ImgID::Compass150, ImgID::Compass180, ImgID::Compass210, \
ImgID::Compass240, ImgID::Compass270, ImgID::Compass300, ImgID::Compass330, \
ImgID::DMLeftHotbar, ImgID::DMRightHotbar, ImgID::DMMiddleHotbar, ImgID::DMMiddleSelected, \
ImgID::FloorSpikeTrap, ImgID::Sungod, ImgID::Teleporter, ImgID::Lightning, \
ImgID::ArrowTrap, ImgID::SpikeTrap, \
ImgID::DMTrapBG, ImgID::Needle, \
ImgID::EventBG, ImgID::DMEventBG, \
ImgID::DMLeftHotbar, ImgID::DMRightHotbar, ImgID::DMMiddleHotbar, ImgID::DMMiddleSelected, ImgID::DMMiddleCooldown, \
ImgID::DMCD_10, ImgID::DMCD_9, ImgID::DMCD_8, ImgID::DMCD_7, ImgID::DMCD_6, \
ImgID::DMCD_5, ImgID::DMCD_4, ImgID::DMCD_3, ImgID::DMCD_2, ImgID::DMCD_1, \
ImgID::DMCD_Selected_10, ImgID::DMCD_Selected_9, ImgID::DMCD_Selected_8, ImgID::DMCD_Selected_7, ImgID::DMCD_Selected_6, \
ImgID::DMCD_Selected_5, ImgID::DMCD_Selected_4, ImgID::DMCD_Selected_3, ImgID::DMCD_Selected_2, ImgID::DMCD_Selected_1, \
}

/**
Expand Down
9 changes: 7 additions & 2 deletions include/server/game/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,19 @@
#define DM_MANA_REGEN 1
#define LIGHTNING_MANA 10

/* Mirror Item */
// Mirror use duration in seconds
#define MIRROR_USE_DURATION 30

/* Game */
#define GRAVITY 0.03f
#define PLAYER_SPEED 1.65f
#define JUMP_SPEED 0.55f


/* DM Constants */
#define MAX_TRAPS 10
#define TRAP_INVENTORY_SIZE 10
#define TRAP_TIME 10
#define TRAP_COOL_DOWN 5
#define TRAP_COOL_DOWN 5
#define ITEM_SPAWN_PROB 0.1
#define ITEM_SPAWN_BOUND 3
45 changes: 45 additions & 0 deletions include/server/game/dungeonmaster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,53 @@ class DungeonMaster : public Creature {
// For lightning usage
void useMana();
void manaRegen();

/**
* @brief Sets the whether the DungeonMaster is paralyzed. If isParalyzed
* is true, then this sets the paralysis duration and marks the timestamp for
* the paralysis start event.
* @param isParalyzed Whether the DungeonMaster should now be paralyzed.
* @param paralysis_duration How long the DungeonMaster should be paralyzed for
* (ignored if isParalyzed is false)
*/
void setParalysis(bool isParalyzed, double paralysis_duration);

/**
* @brief Getter for whether the DungeonMaster is paralyzed.
* @return true if the DungeonMaster is paralyzed and false otherwise.
*/
bool isParalyzed() const;

/**
* @brief Getter for the DungeonMaster's paralysis duration.
* (this value should be ignored if the DungeonMaster's paralyzed boolean
* is false)
* @return double representing the number of seconds that the DungeonMaster
* should be paralyzed since the paralysis_start_time timestamp.
*/
double getParalysisDuration() const;

/**
* @brief Getter for the timestamp of the last time the DungeonMaster was
* paralyzed.
* @return std::chrono::time_point<std::chrono::system_clock> timestamp of
* the last time the DungeonMaster became paralyzed.
*/
std::chrono::time_point<std::chrono::system_clock> getParalysisStartTime() const;

private:
/**
* @brief Duration, in seconds, of the Dungeon Master's current paralysis
* (this value should be ignored if paralyzed is false)
*/
double paralysisDuration;

/**
* @brief Timestamp for the last time the DungeonMaster became paralyzed.
* Set by setParalysis().
*/
std::chrono::time_point<std::chrono::system_clock> paralysis_start_time;

int placedTraps;
std::chrono::system_clock::time_point mana_used;
};
34 changes: 34 additions & 0 deletions include/server/game/introcutscene.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include "server/game/servergamestate.hpp"
#include "shared/utilities/serialize_macro.hpp"
#include "shared/game/sharedgamestate.hpp"

#include <vector>

/**
* @brief config to use for the servergamestate used for the cutscene,
* This mainly just needs to set the room file to load the cutscene room
* from. I dont think the other values will really matter.
*/
GameConfig getCutsceneConfig();

class IntroCutscene {
public:
IntroCutscene();

/**
* update to the next frame of the cutscene
* @returns true if the cutscene is over
*/
bool update();

LoadIntroCutsceneEvent toNetwork();


// just making everything public bc lazy
ServerGameState state;
EntityID pov_eid;
EntityID dm_eid;
std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> lights;
};
50 changes: 50 additions & 0 deletions include/server/game/mirror.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once

#include "server/game/item.hpp"
#include <chrono>

class Mirror : public Item {
public:

/**
* @brief Mirror constructor
* @param corner Corner position of the Mirror
* @param dimensions Dimensions of the Mirror
*/
Mirror(glm::vec3 corner, glm::vec3 dimensions);

/**
* @brief Using the mirror causes it to be held for a few seconds
* @param other Player object that uses the mirror
* @param state Reference to the server's ServerGameState instance
* @param itemSelected Mirror's item index in the player's inventory
*/
void useItem(Object* other, ServerGameState& state, int itemSelected) override;

void dropItem(Object* other, ServerGameState& state, int itemSelected, float dropDistance) override;

/**
* @brief Determines whether the mirror has been used for the mirror holding
* duration and updated the remaining time it will be used.
* @return true if the mirror has been used for the specified duration.
*/
bool timeOut();

/**
* @brief Stop holding the mirror.
* @note This should be called when the use duration times out OR when the player
* selects a different item in their inventory.
* @param state Reference to the server's ServerGameState instance
*/
void revertEffect(ServerGameState& state);
private:
/**
* @brief The time at which the mirror was last used
*/
std::chrono::time_point<std::chrono::system_clock> used_time;

/**
* @brief The last Player that used this mirror object.
*/
Player* used_player;
};
Loading

0 comments on commit f0df856

Please sign in to comment.