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

More DM Polish #168

Merged
merged 31 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8f5a928
set cell to empty when item is picked up
EddieJ03 May 29, 2024
861d7c2
ArrowTrap and SunGod trap with rotation (need to test with mouse, i d…
EddieJ03 May 30, 2024
7b7e038
add teleporter trap to DM hot bar
EddieJ03 May 30, 2024
49e8deb
lint fix
EddieJ03 May 30, 2024
d2444e5
get in Ted's updateGUI
EddieJ03 May 30, 2024
9ad3183
add red hotbar background for trap in cooldown
EddieJ03 May 30, 2024
4ccbca6
Merge branch 'dev' of https://github.com/ucsd-cse125-sp24/group3 into…
EddieJ03 May 30, 2024
a5e25d0
rotation should be good
EddieJ03 May 30, 2024
b2e58d0
minor DM info fixes
EddieJ03 May 30, 2024
c648534
CHANGE: NO MORE P FOR PLACEMENT
EddieJ03 May 30, 2024
6a434e7
pull in dev
EddieJ03 May 30, 2024
8b19833
CHANGE: get rid of horizontal and vertical floor spike and move light…
EddieJ03 May 30, 2024
3d2d6e7
add cooldown in hotbar
jhparkt May 31, 2024
c709f15
spawning items in implementation
EddieJ03 May 31, 2024
0aa9bca
Merge branch '88-the-dungeon-master' of https://github.com/ucsd-cse12…
EddieJ03 May 31, 2024
f3a31ee
remove lobby printouts / fix updateTraps()
jhparkt May 31, 2024
6fcffe2
also update IP map with DM info when selecting DM
EddieJ03 May 31, 2024
565058c
Merge branch '88-the-dungeon-master' of https://github.com/ucsd-cse12…
EddieJ03 May 31, 2024
462426c
uncomment care package / fix player connection bug
jhparkt May 31, 2024
506d283
minor bug fixes
EddieJ03 May 31, 2024
4ee5862
pull in updateGUI2 branch
EddieJ03 Jun 2, 2024
4b777a1
item spawn code done (need to test)
EddieJ03 Jun 2, 2024
8b18456
merge in dev
EddieJ03 Jun 3, 2024
966da8d
push gui fix
jhparkt Jun 3, 2024
e558b53
finally items show up!
EddieJ03 Jun 3, 2024
b39e736
make item spawn more random + added some comments
EddieJ03 Jun 3, 2024
9739474
Merge branch 'dev' of https://github.com/ucsd-cse125-sp24/group3 into…
EddieJ03 Jun 3, 2024
408d403
polished item spawn (should be good)
EddieJ03 Jun 3, 2024
4204200
fix DM camera to not point straight ahead after hitting escape
EddieJ03 Jun 4, 2024
e595080
pull in dev
EddieJ03 Jun 4, 2024
c353456
add control help
jhparkt Jun 4, 2024
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
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.
46 changes: 23 additions & 23 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"game": {
"maze": {
"directory": "maps",
"procedural": true,
"maze_file": "test/itemRoom.maze"
"game": {
"maze": {
"directory": "maps",
"procedural": true,
"maze_file": "test/itemRoom.maze"
}
},
"network": {
"server_ip": "localhost",
"server_port": 2355
},
"server": {
"lobby_name": "Hope you're doing well!1",
"lobby_broadcast": true,
"max_players": 1,
"disable_dm": false
},
"client": {
"default_name": "Conan O'Brien",
"lobby_discovery": true,
"fullscreen": false,
"draw_bboxes": false,
"fps_counter": true
}
},
"network": {
"server_ip": "localhost",
"server_port": 2355
},
"server": {
"lobby_name": "Hope you're doing well!1",
"lobby_broadcast": true,
"max_players": 1,
"disable_dm": true
},
"client": {
"default_name": "Conan O'Brien",
"lobby_discovery": true,
"fullscreen": true,
"draw_bboxes": false,
"fps_counter": true
}
}
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
38 changes: 36 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 @@ -282,7 +306,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 @@ -301,12 +329,15 @@ 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;
Expand All @@ -328,6 +359,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;
};

6 changes: 5 additions & 1 deletion include/client/gui/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,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
14 changes: 13 additions & 1 deletion include/client/gui/img/img.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum class ImgID {
DMRightHotbar,
DMMiddleHotbar,
DMMiddleSelected,
DMMiddleCooldown,
HealthBar,
HealthTickEmpty,
HealthTickFull,
Expand All @@ -58,8 +59,13 @@ 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, \
Expand All @@ -71,9 +77,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
4 changes: 3 additions & 1 deletion include/server/game/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@
#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.3
#define ITEM_SPAWN_BOUND 3
6 changes: 3 additions & 3 deletions include/server/game/servergamestate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ class ServerGameState {
*/
std::unordered_set<std::pair<Object*, Object*>, pair_hash> collidedObjects;


std::unordered_map<std::pair<int, int>, std::vector<SolidSurface*>, IntPairHash> solidSurfaceInGridCells;

/**
* @brief Field that stores the current trap the DM is hovering (not placed yet)
*/
Trap* currentGhostTrap;

/**
Expand Down
8 changes: 8 additions & 0 deletions include/server/game/spawner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Spawner {
public:
Item* dummyItem;

Item* smallDummyItem;

Spawner();

/*
Expand Down Expand Up @@ -54,6 +56,12 @@ class Spawner {
void spawnDummy(ServerGameState& state);


/*
* Smaller dummy for empty check
*/
void spawnSmallDummy(ServerGameState& state);


private:
int enemyValueCap;
int currentEnemyValue;
Expand Down
9 changes: 7 additions & 2 deletions include/shared/game/sharedmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ enum class ModelType {
ArrowTrapLeft,
ArrowTrapRight,
SpikeTrap,
SunGod,
TeleporterTrap,
Dagger,
Sword,
Hammer,
Lightning
Lightning,
FireballTrapLeft,
FireballTrapRight,
FireballTrapUp,
FireballTrapDown,
SunGod,
ArrowTrap
};
3 changes: 2 additions & 1 deletion include/shared/game/sharedobject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ struct SharedTrapInventory {
int inventory_size;
std::vector<ModelType> inventory;
std::unordered_map<CellType, std::time_t> trapsInCooldown;
std::unordered_map<CellType, int> trapsCooldown;
int trapsPlaced;

DEF_SERIALIZE(Archive& ar, const unsigned int version) {
ar& selected& inventory_size& inventory& trapsInCooldown& trapsPlaced;
ar& selected& inventory_size& inventory& trapsInCooldown& trapsPlaced & trapsCooldown;
}
};

Expand Down
7 changes: 6 additions & 1 deletion src/client/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ void Camera::updatePos(glm::vec3 pos) {
cameraPos = pos;
}

void Camera::setPitch(float pitch) {
this->pitch = pitch;
}

DungeonMasterCamera::DungeonMasterCamera() : Camera() {
pitch = -89.0f;
this->farClip = 500.0f;
Expand Down Expand Up @@ -148,4 +152,5 @@ void DungeonMasterCamera::update(float xpos, float ypos) {
this->view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);

viewProjMat = this->projection * this->view;
}
}

Loading
Loading