Commit 6b06968c authored by mercury233's avatar mercury233

change to server only

parent bd7605d8
...@@ -45,6 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::iterator code_pointer; ...@@ -45,6 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::iterator code_pointer;
class ClientCard { class ClientCard {
public: public:
/*
irr::video::ITexture* curTexture; irr::video::ITexture* curTexture;
irr::core::matrix4 mTransform; irr::core::matrix4 mTransform;
irr::core::vector3df curPos; irr::core::vector3df curPos;
...@@ -112,6 +113,7 @@ public: ...@@ -112,6 +113,7 @@ public:
void ClearTarget(); void ClearTarget();
static bool client_card_sort(ClientCard* c1, ClientCard* c2); static bool client_card_sort(ClientCard* c1, ClientCard* c2);
static bool deck_sort_lv(code_pointer l1, code_pointer l2); static bool deck_sort_lv(code_pointer l1, code_pointer l2);
*/
}; };
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define CLIENT_FIELD_H #define CLIENT_FIELD_H
#include "config.h" #include "config.h"
/*
#include <vector> #include <vector>
namespace ygo { namespace ygo {
...@@ -126,7 +127,7 @@ public: ...@@ -126,7 +127,7 @@ public:
}; };
} }
*/
//special cards //special cards
#define CARD_MARINE_DOLPHIN 78734254 #define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930 #define CARD_TWINKLE_MOSS 13857930
......
...@@ -45,6 +45,7 @@ inline int _wtoi(const wchar_t * s) { ...@@ -45,6 +45,7 @@ inline int _wtoi(const wchar_t * s) {
} }
#endif #endif
/*
#include <irrlicht.h> #include <irrlicht.h>
#ifdef __APPLE__ #ifdef __APPLE__
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
...@@ -55,6 +56,7 @@ inline int _wtoi(const wchar_t * s) { ...@@ -55,6 +56,7 @@ inline int _wtoi(const wchar_t * s) {
#endif #endif
#include "CGUITTFont.h" #include "CGUITTFont.h"
#include "CGUIImageButton.h" #include "CGUIImageButton.h"
*/
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -67,12 +69,14 @@ inline int _wtoi(const wchar_t * s) { ...@@ -67,12 +69,14 @@ inline int _wtoi(const wchar_t * s) {
#include "../ocgcore/ocgapi.h" #include "../ocgcore/ocgapi.h"
#include "../ocgcore/card.h" #include "../ocgcore/card.h"
/*
using namespace irr; using namespace irr;
using namespace core; using namespace core;
using namespace scene; using namespace scene;
using namespace video; using namespace video;
using namespace io; using namespace io;
using namespace gui; using namespace gui;
*/
extern const unsigned short PRO_VERSION; extern const unsigned short PRO_VERSION;
extern int enable_log; extern int enable_log;
......
#include "config.h" #include "config.h"
#include "game.h" #include "game.h"
#include "image_manager.h" //#include "image_manager.h"
#include "data_manager.h" #include "data_manager.h"
#include "deck_manager.h" #include "deck_manager.h"
#include "replay.h" #include "replay.h"
#include "materials.h" //#include "materials.h"
#include "duelclient.h" //#include "duelclient.h"
#include "netserver.h" #include "netserver.h"
#include "single_mode.h" //#include "single_mode.h"
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> #include <io.h>
...@@ -69,7 +69,7 @@ void Game::MainServerLoop(int bDuel_mode, int lflist) { ...@@ -69,7 +69,7 @@ void Game::MainServerLoop(int bDuel_mode, int lflist) {
#endif #endif
} }
} }
/*
bool Game::Initialize() { bool Game::Initialize() {
srand(time(0)); srand(time(0));
LoadConfig(); LoadConfig();
...@@ -598,6 +598,8 @@ bool Game::Initialize() { ...@@ -598,6 +598,8 @@ bool Game::Initialize() {
hideChatTimer = 0; hideChatTimer = 0;
return true; return true;
} }
*/
/*
void Game::MainLoop() { void Game::MainLoop() {
wchar_t cap[256]; wchar_t cap[256];
camera = smgr->addCameraSceneNode(0); camera = smgr->addCameraSceneNode(0);
...@@ -687,6 +689,8 @@ void Game::MainLoop() { ...@@ -687,6 +689,8 @@ void Game::MainLoop() {
SaveConfig(); SaveConfig();
// device->drop(); // device->drop();
} }
*/
/*
void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) { void Game::BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar) {
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)
mProjection[i] = 0; mProjection[i] = 0;
...@@ -1113,6 +1117,7 @@ void Game::CloseDuelWindow() { ...@@ -1113,6 +1117,7 @@ void Game::CloseDuelWindow() {
ClearTextures(); ClearTextures();
closeDoneSignal.Set(); closeDoneSignal.Set();
} }
*/
int Game::LocalPlayer(int player) { int Game::LocalPlayer(int player) {
return dInfo.isFirst ? player : 1 - player; return dInfo.isFirst ? player : 1 - player;
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
#define GAME_H #define GAME_H
#include "config.h" #include "config.h"
#include "client_field.h" //#include "client_field.h"
#include "deck_con.h" //#include "deck_con.h"
#include "menu_handler.h" //#include "menu_handler.h"
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <list> #include <list>
...@@ -58,7 +58,7 @@ struct DuelInfo { ...@@ -58,7 +58,7 @@ struct DuelInfo {
unsigned short time_limit; unsigned short time_limit;
unsigned short time_left[2]; unsigned short time_left[2];
}; };
/*
struct FadingUnit { struct FadingUnit {
bool signalAction; bool signalAction;
bool isFadein; bool isFadein;
...@@ -70,13 +70,14 @@ struct FadingUnit { ...@@ -70,13 +70,14 @@ struct FadingUnit {
irr::core::vector2di fadingLR; irr::core::vector2di fadingLR;
irr::core::vector2di fadingDiff; irr::core::vector2di fadingDiff;
}; };
*/
class Game { class Game {
public: public:
bool Initialize(); bool Initialize();
void MainLoop(); //void MainLoop();
void MainServerLoop(int bDuel_mode, int lflist); void MainServerLoop(int bDuel_mode, int lflist);
/*
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar); void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text); void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0); void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
...@@ -102,14 +103,16 @@ public: ...@@ -102,14 +103,16 @@ public:
void AddChatMsg(wchar_t* msg, int player); void AddChatMsg(wchar_t* msg, int player);
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
*/
int LocalPlayer(int player); int LocalPlayer(int player);
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
/*
bool HasFocus(EGUI_ELEMENT_TYPE type) const { bool HasFocus(EGUI_ELEMENT_TYPE type) const {
irr::gui::IGUIElement* focus = env->getFocus(); //irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type); return focus && focus->hasType(type);
} }
*/
Mutex gMutex; Mutex gMutex;
Mutex gBuffer; Mutex gBuffer;
...@@ -122,7 +125,7 @@ public: ...@@ -122,7 +125,7 @@ public:
Config gameConf; Config gameConf;
DuelInfo dInfo; DuelInfo dInfo;
std::list<FadingUnit> fadingList; /*std::list<FadingUnit> fadingList;
std::vector<int> logParam; std::vector<int> logParam;
std::wstring chatMsg[8]; std::wstring chatMsg[8];
...@@ -154,7 +157,8 @@ public: ...@@ -154,7 +157,8 @@ public:
bool is_building; bool is_building;
bool is_siding; bool is_siding;
*/
/*
ClientField dField; ClientField dField;
DeckBuilder deckBuilder; DeckBuilder deckBuilder;
MenuHandler menuHandler; MenuHandler menuHandler;
...@@ -378,7 +382,7 @@ public: ...@@ -378,7 +382,7 @@ public:
irr::gui::IGUIButton* btnReplaySwap; irr::gui::IGUIButton* btnReplaySwap;
//surrender/leave //surrender/leave
irr::gui::IGUIButton* btnLeaveGame; irr::gui::IGUIButton* btnLeaveGame;
*/
}; };
extern Game* mainGame; extern Game* mainGame;
......
...@@ -48,15 +48,12 @@ int main(int argc, char* argv[]) { ...@@ -48,15 +48,12 @@ int main(int argc, char* argv[]) {
return 0; return 0;
} }
/*
ygo::mainGame = &_game; ygo::mainGame = &_game;
if(!ygo::mainGame->Initialize()) if(!ygo::mainGame->Initialize())
return 0; return 0;
for(int i = 1; i < argc; ++i) { for(int i = 1; i < argc; ++i) {
/*command line args:
* -j: join host (host info from system.conf)
* -d: deck edit
* -r: replay */
if(argv[i][0] == '-' && argv[i][1] == 'e') { if(argv[i][0] == '-' && argv[i][1] == 'e') {
ygo::dataManager.LoadDB(&argv[i][2]); ygo::dataManager.LoadDB(&argv[i][2]);
} else if(!strcmp(argv[i], "-j") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-r") || !strcmp(argv[i], "-s")) { } else if(!strcmp(argv[i], "-j") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-r") || !strcmp(argv[i], "-s")) {
...@@ -95,5 +92,6 @@ int main(int argc, char* argv[]) { ...@@ -95,5 +92,6 @@ int main(int argc, char* argv[]) {
#else #else
#endif //_WIN32 #endif //_WIN32
*/
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -3,10 +3,18 @@ include "lzma" ...@@ -3,10 +3,18 @@ include "lzma"
project "ygopro" project "ygopro"
kind "WindowedApp" kind "WindowedApp"
files { "**.cpp", "**.cc", "**.c", "**.h" } files { "gframe.cpp", "config.h",
"game.cpp", "game.h",
"deck_manager.cpp", "deck_manager.h",
"data_manager.cpp", "data_manager.h",
"replay.cpp", "replay.h",
"netserver.cpp", "netserver.h",
"single_duel.cpp", "single_duel.h",
"tag_duel.cpp", "tag_duel.h",
"**.cc", "**.c"}
excludes "lzma/**" excludes "lzma/**"
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event"} links { "ocgcore", "clzma", "sqlite3", "lua" , "event"}
configuration "windows" configuration "windows"
files "ygopro.rc" files "ygopro.rc"
......
...@@ -1510,7 +1510,7 @@ int SingleDuel::MessageHandler(long fduel, int type) { ...@@ -1510,7 +1510,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
if(enable_log == 1) { if(enable_log == 1) {
wchar_t wbuf[1024]; wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf); BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9); //mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) { } else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at"); FILE* fp = fopen("error.log", "at");
if(!fp) if(!fp)
......
...@@ -1619,7 +1619,7 @@ int TagDuel::MessageHandler(long fduel, int type) { ...@@ -1619,7 +1619,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
if(enable_log == 1) { if(enable_log == 1) {
wchar_t wbuf[1024]; wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf); BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9); //mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) { } else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at"); FILE* fp = fopen("error.log", "at");
if(!fp) if(!fp)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment