Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 618666de43 | |||
| 5c74ecdd72 |
@@ -8,6 +8,7 @@ This game is inspired by classic 2D RPGs, as well as more modern sandbox MMOs. T
|
|||||||
|
|
||||||
Tortuga's full documentation can be found in a separate branch, see [Tortuga/docs](https://github.com/Ratstail91/Tortuga/tree/docs).
|
Tortuga's full documentation can be found in a separate branch, see [Tortuga/docs](https://github.com/Ratstail91/Tortuga/tree/docs).
|
||||||
For Tortuga's primary documentation, please read the [Tortuga Game Design Document](https://github.com/Ratstail91/Tortuga/blob/docs/Tortuga%20Game%20Design%20Document.docx?raw=true).
|
For Tortuga's primary documentation, please read the [Tortuga Game Design Document](https://github.com/Ratstail91/Tortuga/blob/docs/Tortuga%20Game%20Design%20Document.docx?raw=true).
|
||||||
|
For a list of known bugs, see the [GitHub bug tracker](https://github.com/Ratstail91/Tortuga/issues).
|
||||||
|
|
||||||
## External Dependencies
|
## External Dependencies
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
*/
|
*/
|
||||||
#include "restart.hpp"
|
#include "clean_up.hpp"
|
||||||
|
|
||||||
#include "channels.hpp"
|
#include "channels.hpp"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
//Public access members
|
//Public access members
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
Restart::Restart(
|
CleanUp::CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
ConfigUtility* const argConfig,
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
@@ -77,7 +77,7 @@ Restart::Restart(
|
|||||||
startTick = std::chrono::steady_clock::now();
|
startTick = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
Restart::~Restart() {
|
CleanUp::~CleanUp() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,24 +85,23 @@ Restart::~Restart() {
|
|||||||
//Frame loop
|
//Frame loop
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void Restart::Update(double delta) {
|
void CleanUp::Update(double delta) {
|
||||||
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(10)) {
|
if (std::chrono::steady_clock::now() - startTick > std::chrono::duration<int>(10)) {
|
||||||
QuitEvent();
|
QuitEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
while(network.Receive()) {
|
//BUGFIX: Eat incoming packets
|
||||||
//EAT INCOMING PACKETS
|
while(network.Receive());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::RenderFrame() {
|
void CleanUp::RenderFrame() {
|
||||||
SDL_FillRect(GetScreen(), 0, 0);
|
SDL_FillRect(GetScreen(), 0, 0);
|
||||||
Render(GetScreen());
|
Render(GetScreen());
|
||||||
SDL_Flip(GetScreen());
|
SDL_Flip(GetScreen());
|
||||||
fps.Calculate();
|
fps.Calculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::Render(SDL_Surface* const screen) {
|
void CleanUp::Render(SDL_Surface* const screen) {
|
||||||
backButton.DrawTo(screen);
|
backButton.DrawTo(screen);
|
||||||
font.DrawStringTo("You have been disconnected.", screen, 50, 30);
|
font.DrawStringTo("You have been disconnected.", screen, 50, 30);
|
||||||
}
|
}
|
||||||
@@ -111,32 +110,28 @@ void Restart::Render(SDL_Surface* const screen) {
|
|||||||
//Event handlers
|
//Event handlers
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void Restart::QuitEvent() {
|
void CleanUp::QuitEvent() {
|
||||||
SetNextScene(SceneList::MAINMENU);
|
SetNextScene(SceneList::QUIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void CleanUp::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
backButton.MouseMotion(motion);
|
backButton.MouseMotion(motion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
void CleanUp::MouseButtonDown(SDL_MouseButtonEvent const& button) {
|
||||||
backButton.MouseButtonDown(button);
|
backButton.MouseButtonDown(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
void CleanUp::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
||||||
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
|
if (backButton.MouseButtonUp(button) == Button::State::HOVER) {
|
||||||
QuitEvent();
|
SetNextScene(SceneList::MAINMENU);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Restart::KeyDown(SDL_KeyboardEvent const& key) {
|
void CleanUp::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
//
|
||||||
case SDLK_ESCAPE:
|
}
|
||||||
QuitEvent();
|
|
||||||
break;
|
void CleanUp::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Restart::KeyUp(SDL_KeyboardEvent const& key) {
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
* 3. This notice may not be removed or altered from any source
|
* 3. This notice may not be removed or altered from any source
|
||||||
* distribution.
|
* distribution.
|
||||||
*/
|
*/
|
||||||
#ifndef RESTART_HPP_
|
#ifndef CLEANUP_HPP_
|
||||||
#define RESTART_HPP_
|
#define CLEANUP_HPP_
|
||||||
|
|
||||||
//network
|
//network
|
||||||
#include "udp_network_utility.hpp"
|
#include "udp_network_utility.hpp"
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
//std namespace
|
//std namespace
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
class Restart : public BaseScene {
|
class CleanUp : public BaseScene {
|
||||||
public:
|
public:
|
||||||
//Public access members
|
//Public access members
|
||||||
Restart(
|
CleanUp(
|
||||||
ConfigUtility* const argConfig,
|
ConfigUtility* const argConfig,
|
||||||
UDPNetworkUtility* const argNetwork,
|
UDPNetworkUtility* const argNetwork,
|
||||||
int* const argClientIndex,
|
int* const argClientIndex,
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
std::map<int, CharacterData>* argCharacterMap,
|
std::map<int, CharacterData>* argCharacterMap,
|
||||||
std::map<int, EnemyData>* argEnemyMap
|
std::map<int, EnemyData>* argEnemyMap
|
||||||
);
|
);
|
||||||
~Restart();
|
~CleanUp();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Frame loop
|
//Frame loop
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "lobby_menu.hpp"
|
#include "lobby_menu.hpp"
|
||||||
#include "in_world.hpp"
|
#include "in_world.hpp"
|
||||||
#include "in_combat.hpp"
|
#include "in_combat.hpp"
|
||||||
#include "restart.hpp"
|
#include "clean_up.hpp"
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
//Public access members
|
//Public access members
|
||||||
@@ -132,8 +132,8 @@ void ClientApplication::LoadScene(SceneList sceneIndex) {
|
|||||||
case SceneList::INCOMBAT:
|
case SceneList::INCOMBAT:
|
||||||
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
activeScene = new InCombat(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
||||||
break;
|
break;
|
||||||
case SceneList::RESTART:
|
case SceneList::CLEANUP:
|
||||||
activeScene = new Restart(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
activeScene = new CleanUp(&config, &network, &clientIndex, &accountIndex, &characterIndex, &combatMap, &characterMap, &enemyMap);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw(std::logic_error("Failed to recognize the scene index"));
|
throw(std::logic_error("Failed to recognize the scene index"));
|
||||||
|
|||||||
+4
-11
@@ -123,7 +123,7 @@ void InCombat::Render(SDL_Surface* const screen) {
|
|||||||
void InCombat::QuitEvent() {
|
void InCombat::QuitEvent() {
|
||||||
//exit the game AND the server
|
//exit the game AND the server
|
||||||
RequestDisconnect();
|
RequestDisconnect();
|
||||||
SetNextScene(SceneList::MAINMENU);
|
SetNextScene(SceneList::QUIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InCombat::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void InCombat::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
@@ -139,11 +139,7 @@ void InCombat::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InCombat::KeyDown(SDL_KeyboardEvent const& key) {
|
void InCombat::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
//
|
||||||
case SDLK_ESCAPE:
|
|
||||||
QuitEvent();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InCombat::KeyUp(SDL_KeyboardEvent const& key) {
|
void InCombat::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
@@ -167,7 +163,7 @@ void InCombat::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InCombat::HandleDisconnect(SerialPacket* const) {
|
void InCombat::HandleDisconnect(SerialPacket* const) {
|
||||||
SetNextScene(SceneList::RESTART);
|
SetNextScene(SceneList::CLEANUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: more network handlers
|
//TODO: more network handlers
|
||||||
@@ -201,10 +197,7 @@ void InCombat::SendPlayerUpdate() {
|
|||||||
// newPacket.motion = localCharacter->motion;
|
// newPacket.motion = localCharacter->motion;
|
||||||
// newPacket.stats = localCharacter->stats;
|
// newPacket.stats = localCharacter->stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
network.SendTo(Channels::SERVER, &newPacket);
|
network.SendTo(Channels::SERVER, &newPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-12
@@ -135,7 +135,7 @@ void InWorld::Render(SDL_Surface* const screen) {
|
|||||||
|
|
||||||
//draw characters
|
//draw characters
|
||||||
for (auto& it : characterMap) {
|
for (auto& it : characterMap) {
|
||||||
//TODO: drawing order according to Y origin
|
//BUG: #29 drawing order according to Y origin
|
||||||
it.second.DrawTo(screen, camera.x, camera.y);
|
it.second.DrawTo(screen, camera.x, camera.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void InWorld::Render(SDL_Surface* const screen) {
|
|||||||
void InWorld::QuitEvent() {
|
void InWorld::QuitEvent() {
|
||||||
//exit the game AND the server
|
//exit the game AND the server
|
||||||
RequestDisconnect();
|
RequestDisconnect();
|
||||||
SetNextScene(SceneList::MAINMENU);
|
SetNextScene(SceneList::QUIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
void InWorld::MouseMotion(SDL_MouseMotionEvent const& motion) {
|
||||||
@@ -176,11 +176,6 @@ void InWorld::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
|
|
||||||
void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
void InWorld::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
switch(key.keysym.sym) {
|
||||||
case SDLK_ESCAPE: {
|
|
||||||
QuitEvent();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
//player movement
|
//player movement
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
if (localCharacter) {
|
if (localCharacter) {
|
||||||
@@ -282,7 +277,7 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
|
void InWorld::HandleDisconnect(SerialPacket* const argPacket) {
|
||||||
SetNextScene(SceneList::RESTART);
|
SetNextScene(SceneList::CLEANUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
void InWorld::HandleCharacterNew(CharacterPacket* const argPacket) {
|
||||||
@@ -386,10 +381,7 @@ void InWorld::SendPlayerUpdate() {
|
|||||||
newPacket.motion = localCharacter->motion;
|
newPacket.motion = localCharacter->motion;
|
||||||
newPacket.stats = localCharacter->stats;
|
newPacket.stats = localCharacter->stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
network.SendTo(Channels::SERVER, &newPacket);
|
network.SendTo(Channels::SERVER, &newPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ LobbyMenu::LobbyMenu(
|
|||||||
|
|
||||||
//set the server list's position
|
//set the server list's position
|
||||||
listBox = {300, 50, 200, font.GetCharH()};
|
listBox = {300, 50, 200, font.GetCharH()};
|
||||||
|
|
||||||
|
//BUGFIX: Eat incoming packets
|
||||||
|
while(network.Receive());
|
||||||
}
|
}
|
||||||
|
|
||||||
LobbyMenu::~LobbyMenu() {
|
LobbyMenu::~LobbyMenu() {
|
||||||
@@ -187,11 +190,7 @@ void LobbyMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LobbyMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
void LobbyMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
//
|
||||||
case SDLK_ESCAPE:
|
|
||||||
SetNextScene(SceneList::MAINMENU);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LobbyMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
void LobbyMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
@@ -225,7 +224,7 @@ void LobbyMenu::HandleBroadcastResponse(ServerPacket* const argPacket) {
|
|||||||
server.playerCount = argPacket->playerCount;
|
server.playerCount = argPacket->playerCount;
|
||||||
server.version = argPacket->version;
|
server.version = argPacket->version;
|
||||||
|
|
||||||
//NOTE: Check compatibility here
|
//Checking compatibility
|
||||||
server.compatible = server.version == NETWORK_VERSION;
|
server.compatible = server.version == NETWORK_VERSION;
|
||||||
|
|
||||||
//push
|
//push
|
||||||
|
|||||||
@@ -113,11 +113,7 @@ void MainMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
void MainMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
//
|
||||||
case SDLK_ESCAPE:
|
|
||||||
QuitEvent();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
void MainMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
|
|||||||
@@ -90,11 +90,7 @@ void OptionsMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OptionsMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
void OptionsMenu::KeyDown(SDL_KeyboardEvent const& key) {
|
||||||
switch(key.keysym.sym) {
|
//
|
||||||
case SDLK_ESCAPE:
|
|
||||||
SetNextScene(SceneList::MAINMENU);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
void OptionsMenu::KeyUp(SDL_KeyboardEvent const& key) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ enum class SceneList {
|
|||||||
LOBBYMENU,
|
LOBBYMENU,
|
||||||
INWORLD,
|
INWORLD,
|
||||||
INCOMBAT,
|
INCOMBAT,
|
||||||
RESTART,
|
CLEANUP,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ struct CharacterData {
|
|||||||
//base statistics
|
//base statistics
|
||||||
Statistics stats;
|
Statistics stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//methods
|
//methods
|
||||||
void Update(double delta);
|
void Update(double delta);
|
||||||
|
|||||||
@@ -41,12 +41,7 @@ struct EnemyData {
|
|||||||
//gameplay
|
//gameplay
|
||||||
Statistics stats;
|
Statistics stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs, rewards
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//TODO: rewards
|
|
||||||
|
|
||||||
//active gameplay members
|
//active gameplay members
|
||||||
//NOTE: these are lost when unloaded
|
//NOTE: these are lost when unloaded
|
||||||
|
|||||||
@@ -44,10 +44,7 @@ struct CharacterPacket : SerialPacketBase {
|
|||||||
//gameplay
|
//gameplay
|
||||||
Statistics stats;
|
Statistics stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -40,7 +40,7 @@ struct CombatPacket : SerialPacketBase {
|
|||||||
int mapIndex;
|
int mapIndex;
|
||||||
Vector2 origin;
|
Vector2 origin;
|
||||||
|
|
||||||
//TODO: rewards
|
//TODO: gameplay components: rewards
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -33,12 +33,7 @@ struct EnemyPacket : SerialPacketBase {
|
|||||||
//gameplay
|
//gameplay
|
||||||
Statistics stats;
|
Statistics stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs, rewards
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//TODO: rewards
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -148,7 +148,6 @@ void deserializePacket(SerialPacketBase* packet, void* buffer) {
|
|||||||
case SerialPacketType::COMBAT_DELETE:
|
case SerialPacketType::COMBAT_DELETE:
|
||||||
case SerialPacketType::COMBAT_UPDATE:
|
case SerialPacketType::COMBAT_UPDATE:
|
||||||
|
|
||||||
//TODO: is this the best fit?
|
|
||||||
case SerialPacketType::COMBAT_ENTER_REQUEST:
|
case SerialPacketType::COMBAT_ENTER_REQUEST:
|
||||||
case SerialPacketType::COMBAT_ENTER_RESPONSE:
|
case SerialPacketType::COMBAT_ENTER_RESPONSE:
|
||||||
case SerialPacketType::COMBAT_EXIT_REQUEST:
|
case SerialPacketType::COMBAT_EXIT_REQUEST:
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ void serializeCharacter(CharacterPacket* packet, void* buffer) {
|
|||||||
serializeStatistics(&packet->stats, buffer);
|
serializeStatistics(&packet->stats, buffer);
|
||||||
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void deserializeCharacter(CharacterPacket* packet, void* buffer) {
|
void deserializeCharacter(CharacterPacket* packet, void* buffer) {
|
||||||
@@ -73,8 +70,5 @@ void deserializeCharacter(CharacterPacket* packet, void* buffer) {
|
|||||||
deserializeStatistics(&packet->stats, buffer);
|
deserializeStatistics(&packet->stats, buffer);
|
||||||
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void serializeCombat(CombatPacket* packet, void* buffer) {
|
|||||||
SERIALIZE(buffer, &packet->origin.x, sizeof(double));
|
SERIALIZE(buffer, &packet->origin.x, sizeof(double));
|
||||||
SERIALIZE(buffer, &packet->origin.y, sizeof(double));
|
SERIALIZE(buffer, &packet->origin.y, sizeof(double));
|
||||||
|
|
||||||
//TODO: rewards
|
//TODO: gameplay components: rewards
|
||||||
}
|
}
|
||||||
|
|
||||||
void deserializeCombat(CombatPacket* packet, void* buffer) {
|
void deserializeCombat(CombatPacket* packet, void* buffer) {
|
||||||
@@ -60,5 +60,5 @@ void deserializeCombat(CombatPacket* packet, void* buffer) {
|
|||||||
DESERIALIZE(buffer, &packet->origin.x, sizeof(double));
|
DESERIALIZE(buffer, &packet->origin.x, sizeof(double));
|
||||||
DESERIALIZE(buffer, &packet->origin.y, sizeof(double));
|
DESERIALIZE(buffer, &packet->origin.y, sizeof(double));
|
||||||
|
|
||||||
//TODO: rewards
|
//TODO: gameplay components: rewards
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,7 @@ void serializeEnemy(EnemyPacket* packet, void* buffer) {
|
|||||||
serializeStatistics(&packet->stats, buffer);
|
serializeStatistics(&packet->stats, buffer);
|
||||||
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs, rewards
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//TODO: rewards
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void deserializeEnemy(EnemyPacket* packet, void* buffer) {
|
void deserializeEnemy(EnemyPacket* packet, void* buffer) {
|
||||||
@@ -57,10 +52,5 @@ void deserializeEnemy(EnemyPacket* packet, void* buffer) {
|
|||||||
deserializeStatistics(&packet->stats, buffer);
|
deserializeStatistics(&packet->stats, buffer);
|
||||||
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
buffer = reinterpret_cast<char*>(buffer) + sizeof(Statistics);
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs, rewards
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//TODO: rewards
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
//DOCS: memset() is used before sending a packet to remove old data; you don't want to send sensitive data over the network
|
//BUGFIX: memset() is used before sending a packet to remove old data; you don't want to send sensitive data over the network
|
||||||
//NOTE: don't confuse SerialPacket with UDPpacket
|
//NOTE: don't confuse SerialPacket with UDPpacket
|
||||||
|
|
||||||
void UDPNetworkUtility::Open(int port) {
|
void UDPNetworkUtility::Open(int port) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;";
|
|||||||
//Define the methods
|
//Define the methods
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
//TODO: default stats as a parameter? This would be good for differing beggining states or multiple classes
|
//NOTE: default stats as a parameter would be good for different beggining states or multiple classes
|
||||||
int CharacterManager::CreateCharacter(int owner, std::string handle, std::string avatar) {
|
int CharacterManager::CreateCharacter(int owner, std::string handle, std::string avatar) {
|
||||||
//Create the character, failing if it exists
|
//Create the character, failing if it exists
|
||||||
sqlite3_stmt* statement = nullptr;
|
sqlite3_stmt* statement = nullptr;
|
||||||
@@ -157,10 +157,7 @@ int CharacterManager::LoadCharacter(int owner, std::string handle, std::string a
|
|||||||
newChar.stats.evasion = sqlite3_column_double(statement, 20);
|
newChar.stats.evasion = sqlite3_column_double(statement, 20);
|
||||||
newChar.stats.luck = sqlite3_column_double(statement, 21);
|
newChar.stats.luck = sqlite3_column_double(statement, 21);
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//finish the routine
|
//finish the routine
|
||||||
sqlite3_finalize(statement);
|
sqlite3_finalize(statement);
|
||||||
@@ -217,10 +214,7 @@ int CharacterManager::SaveCharacter(int uid) {
|
|||||||
ret |= sqlite3_bind_double(statement, 17, character.stats.evasion) != SQLITE_OK;
|
ret |= sqlite3_bind_double(statement, 17, character.stats.evasion) != SQLITE_OK;
|
||||||
ret |= sqlite3_bind_double(statement, 18, character.stats.luck) != SQLITE_OK;
|
ret |= sqlite3_bind_double(statement, 18, character.stats.luck) != SQLITE_OK;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
//check for binding errors
|
//check for binding errors
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ void ServerApplication::HandleRegionRequest(RegionPacket* const argPacket) {
|
|||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
void ServerApplication::HandleCharacterNew(CharacterPacket* const argPacket) {
|
void ServerApplication::HandleCharacterNew(CharacterPacket* const argPacket) {
|
||||||
|
//BUG: #27 Characters can be created with an invalid account index
|
||||||
//NOTE: misnomer, try to load the character first
|
//NOTE: misnomer, try to load the character first
|
||||||
int characterIndex = characterMgr.LoadCharacter(argPacket->accountIndex, argPacket->handle, argPacket->avatar);
|
int characterIndex = characterMgr.LoadCharacter(argPacket->accountIndex, argPacket->handle, argPacket->avatar);
|
||||||
|
|
||||||
@@ -413,10 +414,7 @@ void ServerApplication::HandleCharacterUpdate(CharacterPacket* const argPacket)
|
|||||||
|
|
||||||
character->stats = argPacket->stats;
|
character->stats = argPacket->stats;
|
||||||
|
|
||||||
//TODO: equipment
|
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||||
//TODO: items
|
|
||||||
//TODO: buffs
|
|
||||||
//TODO: debuffs
|
|
||||||
|
|
||||||
PumpPacket(argPacket);
|
PumpPacket(argPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
TODO: rename restart scene to cleanup scene
|
|
||||||
TODO: encapsulate the data structures
|
TODO: encapsulate the data structures
|
||||||
TODO: Get the rooms working
|
TODO: Get the rooms working
|
||||||
|
|
||||||
TODO: Rejection packets
|
|
||||||
TODO: Authentication
|
TODO: Authentication
|
||||||
TODO: server is slaved to the client
|
TODO: server is slaved to the client
|
||||||
|
|
||||||
TODO: I need to keep the documentation up to date. Namely, the GDD is getting out of date.
|
|
||||||
TODO: I completely forgot about status ailments
|
TODO: I completely forgot about status ailments
|
||||||
TODO: Time delay for requesting region packets
|
TODO: Time delay for requesting region packets
|
||||||
TODO: command line parameters overriding config.cfg settings
|
TODO: command line parameters overriding config.cfg settings
|
||||||
|
|||||||
Reference in New Issue
Block a user