Skip to content

Commit

Permalink
make all players load in player 3 to avoid breaking windows rn
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler-Lentz committed Jun 6, 2024
2 parents 82c565d + 5adc128 commit 26bbe3c
Show file tree
Hide file tree
Showing 32 changed files with 311 additions and 231 deletions.
Binary file added assets/imgs/lightcut.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/sounds/server_sfx/minotaur_death.wav
Binary file not shown.
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"game": {
"maze": {
"directory": "maps",
"procedural": false,
"procedural": true,
"maze_file": "test/itemRoom.maze"
}
},
Expand All @@ -14,7 +14,7 @@
"lobby_name": "Hope you're doing well!1",
"lobby_broadcast": true,
"max_players": 1,
"disable_dm": true,
"disable_dm": false,
"skip_intro": false
},
"client": {
Expand Down
2 changes: 1 addition & 1 deletion include/client/animationmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class AnimationManager
{
public:
AnimationManager();
explicit AnimationManager();

void updateAnimation(float dt);

Expand Down
1 change: 0 additions & 1 deletion include/client/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ class Client {
std::unique_ptr<Model> pillar_model;
std::unique_ptr<Model> sungod_model;
std::unique_ptr<Model> slime_model;
std::unique_ptr<Model> minotaur_model;
std::unique_ptr<Model> python_model;
std::unique_ptr<Model> item_model;
std::unique_ptr<Model> spike_trap_model;
Expand Down
3 changes: 2 additions & 1 deletion include/client/gui/img/img.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ enum class ImgID {
Sungod,
Teleporter,
Lightning,
LightCut,
ArrowTrap,
SpikeTrap,
DMCD_10, DMCD_9, DMCD_8, DMCD_7, DMCD_6, DMCD_5, DMCD_4, DMCD_3, DMCD_2, DMCD_1,
Expand Down Expand Up @@ -88,7 +89,7 @@ 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::FloorSpikeTrap, ImgID::Sungod, ImgID::Teleporter, ImgID::Lightning, \
ImgID::FloorSpikeTrap, ImgID::Sungod, ImgID::Teleporter, ImgID::Lightning, ImgID::LightCut, \
ImgID::ArrowTrap, ImgID::SpikeTrap, \
ImgID::DMTrapBG, ImgID::Needle, \
ImgID::EventBG, ImgID::DMEventBG, \
Expand Down
3 changes: 2 additions & 1 deletion include/client/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ Bbox aiBboxToGLM(const aiAABB& bbox);
*/
Bbox combineBboxes(const Bbox& bbox1, const Bbox& bbox2);

glm::quat getGLMQuat(const aiQuaternion& pOrientation);

glm::quat getGLMQuat(const aiQuaternion& pOrientation);
glm::vec3 rotate90DegreesAroundYAxis(const glm::vec3& direction);
8 changes: 6 additions & 2 deletions include/server/game/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define DM_MANA_TOTAL 30
#define DM_MANA_REGEN 1
#define LIGHTNING_MANA 10
#define LIGHT_CUT_MANA 5

/* Mirror Item */
// Mirror use duration in seconds
Expand All @@ -91,8 +92,11 @@

/* DM Constants */
#define MAX_TRAPS 10
#define TRAP_INVENTORY_SIZE 6
#define TRAP_INVENTORY_SIZE 7
#define TRAP_TIME 10
#define TRAP_COOL_DOWN 5
#define ITEM_SPAWN_PROB 0.1
#define ITEM_SPAWN_BOUND 3
#define ITEM_SPAWN_BOUND 3
#define LIGHTNING_LIGHT_CUT_TICKS 100
#define LIGHT_CUT_TICKS 200
#define LIGHT_CUT_RANGE 25.0
30 changes: 26 additions & 4 deletions include/server/game/dungeonmaster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,32 @@ class DungeonMaster : public Creature {
public:
SharedTrapInventory sharedTrapInventory;
SharedDMInfo dmInfo;
Weapon* lightning;

DungeonMaster(glm::vec3 corner, glm::vec3 facing);
~DungeonMaster();

virtual SharedObject toShared() override;

/**
* @brief get the number of traps the DM currently has placed
*/
int getPlacedTraps();

/**
* @brief set the number of traps the DM currently has placed
* @param placedTraps the number of traps the DM has placed
*/
void setPlacedTraps(int placedTraps);

// For lightning usage
void useMana();
/**
* @brief For lightning and light-cut usage
* @param mana the amount of mana the specific DM action takes
*/
void useMana(int mana);

/**
* @brief mana regeneration function
*/
void manaRegen();

/**
Expand Down Expand Up @@ -59,7 +72,12 @@ class DungeonMaster : public Creature {
* the last time the DungeonMaster became paralyzed.
*/
std::chrono::time_point<std::chrono::system_clock> getParalysisStartTime() const;


/**
* @brief The DM's lightning weapon
*/
Weapon* lightning;

private:
/**
* @brief Duration, in seconds, of the Dungeon Master's current paralysis
Expand All @@ -73,6 +91,10 @@ class DungeonMaster : public Creature {
*/
std::chrono::time_point<std::chrono::system_clock> paralysis_start_time;

/**
* @brief the number of traps the DM has placed
*/
int placedTraps;

std::chrono::system_clock::time_point mana_used;
};
22 changes: 20 additions & 2 deletions include/server/game/servergamestate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,6 @@ class ServerGameState {
*/
std::string to_string();

Trap* createTrap(CellType type, glm::vec3 corner);

private:
/**
* list of entities to delete at the end of the tick
Expand Down Expand Up @@ -357,6 +355,26 @@ class ServerGameState {
*/
Trap* currentGhostTrap;

/**
* @brief Field that stores the lightning pos for cutting lights
*/
std::optional<glm::vec3> dmLightningCutLights;

/**
* @brief Field that stores the light cut action for cutting lights
*/
std::optional<glm::vec3> dmActionCutLights;

/**
* @brief last light cut for light cut action
*/
unsigned int lastLightCut;

/**
* @brief last light cut for lightning action
*/
unsigned int lastLightningLightCut;

/**
/**
* @brief helper function to spawn a wall at a specified cell
Expand Down
6 changes: 5 additions & 1 deletion include/server/game/torchlight.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class Torchlight : public Object {
* @brief runs on every server tick to update torchlight flickering
* animations
* @parm current ServerGameState
* @param the position the lightning hit (if exists)
* @param the position of the light cut action (if exists)
*/
void doTick(ServerGameState& state);
void doTick(ServerGameState& state, std::optional<glm::vec3> lightning_light_cut_pos, std::optional<glm::vec3> action_light_cut_pos);

/**
* @brief get current intensity of torch from 0-1
Expand All @@ -72,8 +74,10 @@ class Torchlight : public Object {

// curr_step from 0-1 in flickering animation
float curr_step;

// how much the intensity should change on every server tick
float flickering_speed;

// if the flickering animation is inceasing in
// intensity or decreasing
bool inc_intensity;
Expand Down
34 changes: 34 additions & 0 deletions include/server/game/trap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,51 @@ class Trap : public Object {

SharedObject toShared() override;

/**
* Set the is_dm_trap field
*
* @param boolean for if this trap is a DM trap or not
*/
void setIsDMTrap(bool is_dm_trap);

/**
* Set the SharedTrapInfo info dm_hover field
*
* @param boolean for if this trap is a a DM hover or not
*/
void setIsDMTrapHover(bool is_dm_trap_hover);

/**
* Set the expiration of this trap
*
* @param expiration time
*/
void setExpiration(std::chrono::time_point<std::chrono::system_clock> expiration);

/**
* Gets if this trap is a DM trap or not
*
* @returns True if the trap is a DM trap and false otherwise
*/
bool getIsDMTrap();

/**
* Gets the expiration time of this trap
*
* @returns the expiration time of this trap
*/
std::chrono::time_point<std::chrono::system_clock> getExpiration();

protected:
/**
* is this trap a DM trap?
*/
bool is_dm_trap;

/**
* the expiration time of this trap
*/
std::chrono::time_point<std::chrono::system_clock> expiration;

SharedTrapInfo info;
};
4 changes: 3 additions & 1 deletion include/shared/audio/soundtype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum class ServerSFX {
ElectricHum,
IntroGateOpen,
Wind,
MinotaurDeath
// make sure to add to server sfx len map!
// make sure to add to macro below!
};
Expand Down Expand Up @@ -111,6 +112,7 @@ const std::unordered_map<ServerSFX, std::chrono::milliseconds> SERVER_SFX_LENS =
{ServerSFX::ItemPickUp, 500ms},
{ServerSFX::ItemDrop, 500ms},
{ServerSFX::MirrorShatter, 2000ms},
{ServerSFX::MinotaurDeath, 3100ms},
// dont forget macro below!
};

Expand All @@ -123,7 +125,7 @@ const std::unordered_map<ServerSFX, std::chrono::milliseconds> SERVER_SFX_LENS =
ServerSFX::PlayersStartTheme, ServerSFX::ElectricHum, ServerSFX::IntroGateOpen, ServerSFX::ZeusStartTheme, \
ServerSFX::Wind, \
ServerSFX::Teleport, ServerSFX::Potion, ServerSFX::Spell, ServerSFX::ItemPickUp, ServerSFX::ItemDrop, \
ServerSFX::MirrorShatter \
ServerSFX::MirrorShatter, ServerSFX::MinotaurDeath \
}

// const std::unordered_map<ServerSound, size_t> serverSoundTickLengths = {
Expand Down
1 change: 1 addition & 0 deletions include/shared/game/celltype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ enum class CellType {
Exit,
Lightning,
Mirror,
LightCut,
Unknown
};
3 changes: 2 additions & 1 deletion include/shared/game/sharedmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ enum class ModelType {
FireballTrapDown,
SunGod,
ArrowTrap,
Mirror
Mirror,
LightCut
};
2 changes: 2 additions & 0 deletions src/client/animationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ AnimationManager::AnimationManager() {
m_currentTime = 0.0;
m_currentAnimation = nullptr;

m_deltaTime = 0; // Tyler: is this still used? linter complaining about it not being initialized

m_finalBoneMatrices.reserve(100);

for (int i = 0; i < 100; i++)
Expand Down
Loading

0 comments on commit 26bbe3c

Please sign in to comment.