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;
class ClientCard {
public:
/*
irr::video::ITexture* curTexture;
irr::core::matrix4 mTransform;
irr::core::vector3df curPos;
......@@ -112,6 +113,7 @@ public:
void ClearTarget();
static bool client_card_sort(ClientCard* c1, ClientCard* c2);
static bool deck_sort_lv(code_pointer l1, code_pointer l2);
*/
};
}
......
......@@ -2,6 +2,7 @@
#define CLIENT_FIELD_H
#include "config.h"
/*
#include <vector>
namespace ygo {
......@@ -126,7 +127,7 @@ public:
};
}
*/
//special cards
#define CARD_MARINE_DOLPHIN 78734254
#define CARD_TWINKLE_MOSS 13857930
......
......@@ -45,16 +45,18 @@ inline int _wtoi(const wchar_t * s) {
}
#endif
#include <irrlicht.h>
/*
#include <irrlicht.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glu.h>
#endif
#include "CGUITTFont.h"
#include "CGUIImageButton.h"
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
......@@ -67,12 +69,14 @@ inline int _wtoi(const wchar_t * s) {
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/card.h"
/*
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
*/
extern const unsigned short PRO_VERSION;
extern int enable_log;
......
#include "config.h"
#include "game.h"
#include "image_manager.h"
//#include "image_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "replay.h"
#include "materials.h"
#include "duelclient.h"
//#include "materials.h"
//#include "duelclient.h"
#include "netserver.h"
#include "single_mode.h"
//#include "single_mode.h"
#ifdef _WIN32
#include <io.h>
......@@ -69,7 +69,7 @@ void Game::MainServerLoop(int bDuel_mode, int lflist) {
#endif
}
}
/*
bool Game::Initialize() {
srand(time(0));
LoadConfig();
......@@ -598,6 +598,8 @@ bool Game::Initialize() {
hideChatTimer = 0;
return true;
}
*/
/*
void Game::MainLoop() {
wchar_t cap[256];
camera = smgr->addCameraSceneNode(0);
......@@ -687,6 +689,8 @@ void Game::MainLoop() {
SaveConfig();
// device->drop();
}
*/
/*
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)
mProjection[i] = 0;
......@@ -1113,6 +1117,7 @@ void Game::CloseDuelWindow() {
ClearTextures();
closeDoneSignal.Set();
}
*/
int Game::LocalPlayer(int player) {
return dInfo.isFirst ? player : 1 - player;
}
......
......@@ -2,9 +2,9 @@
#define GAME_H
#include "config.h"
#include "client_field.h"
#include "deck_con.h"
#include "menu_handler.h"
//#include "client_field.h"
//#include "deck_con.h"
//#include "menu_handler.h"
#include <unordered_map>
#include <vector>
#include <list>
......@@ -58,7 +58,7 @@ struct DuelInfo {
unsigned short time_limit;
unsigned short time_left[2];
};
/*
struct FadingUnit {
bool signalAction;
bool isFadein;
......@@ -70,13 +70,14 @@ struct FadingUnit {
irr::core::vector2di fadingLR;
irr::core::vector2di fadingDiff;
};
*/
class Game {
public:
bool Initialize();
void MainLoop();
//void MainLoop();
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 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);
......@@ -102,15 +103,17 @@ public:
void AddChatMsg(wchar_t* msg, int player);
void ClearTextures();
void CloseDuelWindow();
*/
int LocalPlayer(int player);
const wchar_t* LocalName(int local_player);
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
irr::gui::IGUIElement* focus = env->getFocus();
/*
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
//irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type);
}
*/
Mutex gMutex;
Mutex gBuffer;
Signal frameSignal;
......@@ -122,7 +125,7 @@ public:
Config gameConf;
DuelInfo dInfo;
std::list<FadingUnit> fadingList;
/*std::list<FadingUnit> fadingList;
std::vector<int> logParam;
std::wstring chatMsg[8];
......@@ -154,8 +157,9 @@ public:
bool is_building;
bool is_siding;
ClientField dField;
*/
/*
ClientField dField;
DeckBuilder deckBuilder;
MenuHandler menuHandler;
irr::IrrlichtDevice* device;
......@@ -378,7 +382,7 @@ public:
irr::gui::IGUIButton* btnReplaySwap;
//surrender/leave
irr::gui::IGUIButton* btnLeaveGame;
*/
};
extern Game* mainGame;
......
......@@ -48,15 +48,12 @@ int main(int argc, char* argv[]) {
return 0;
}
/*
ygo::mainGame = &_game;
if(!ygo::mainGame->Initialize())
return 0;
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') {
ygo::dataManager.LoadDB(&argv[i][2]);
} else if(!strcmp(argv[i], "-j") || !strcmp(argv[i], "-d") || !strcmp(argv[i], "-r") || !strcmp(argv[i], "-s")) {
......@@ -93,7 +90,8 @@ int main(int argc, char* argv[]) {
#ifdef _WIN32
WSACleanup();
#else
#endif //_WIN32
*/
return EXIT_SUCCESS;
}
......@@ -3,10 +3,18 @@ include "lzma"
project "ygopro"
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/**"
includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event"}
links { "ocgcore", "clzma", "sqlite3", "lua" , "event"}
configuration "windows"
files "ygopro.rc"
......
......@@ -1510,7 +1510,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
//mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
if(!fp)
......
......@@ -1619,7 +1619,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
//mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2) {
FILE* fp = fopen("error.log", "at");
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