Commit a56e464e authored by argon.sun's avatar argon.sun

bug fix

parent 8eccc80f
#include "client_card.h" #include "client_card.h"
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
ClientCard::ClientCard() { ClientCard::ClientCard() {
......
#include "client_field.h" #include "client_field.h"
#include "client_card.h"
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
ClientField::ClientField() { ClientField::ClientField() {
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
#define CLIENT_FIELD_H #define CLIENT_FIELD_H
#include "config.h" #include "config.h"
#include "client_card.h"
#include <vector> #include <vector>
namespace ygo { namespace ygo {
class ClientCard;
struct ChainInfo{ struct ChainInfo{
irr::core::vector3df chain_pos; irr::core::vector3df chain_pos;
ClientCard* chain_card; ClientCard* chain_card;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <imm.h>
#define myswprintf swprintf #define myswprintf swprintf
#else #else
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "game.h" #include "game.h"
#include <algorithm> #include <algorithm>
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
bool DeckBuilder::OnEvent(const irr::SEvent& event) { bool DeckBuilder::OnEvent(const irr::SEvent& event) {
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "game.h" #include "game.h"
#include <algorithm> #include <algorithm>
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
void DeckManager::LoadLFList() { void DeckManager::LoadLFList() {
......
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv) { void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv) {
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "network.h" #include "network.h"
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
bool ClientField::OnEvent(const irr::SEvent& event) { bool ClientField::OnEvent(const irr::SEvent& event) {
......
#include "g_ime.h"
namespace ygo {
#ifdef _WIN32
HIMC G_IME::hIMC;
HWND G_IME::hWindow;
HHOOK G_IME::hHook;
void G_IME::Init(irr::video::SExposedVideoData& vdata) {
hWindow = (HWND)vdata.OpenGLWin32.HWnd;
hHook = SetWindowsHookEx(WH_GETMESSAGE, CharHookProc, NULL, GetCurrentThreadId());
hIMC = ImmGetContext(hWindow);
ImmAssociateContext(hWindow, hIMC);
}
LRESULT CALLBACK G_IME::CharHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
if(nCode < 0)
return CallNextHookEx(hHook, nCode, wParam, lParam);
if(!ImmIsIME(GetKeyboardLayout(0)))
return CallNextHookEx(hHook, nCode, wParam, lParam);
MSG* msg = (MSG*)lParam;
switch(msg->message) {
case WM_IME_CHAR: {
break;
}
/* case WM_CHAR: {
switch(msg->wParam) {
case VK_RETURN:
break;
default: {
input_count ++;
if(msg->wParam > 128) {
if(input_count == 1)
input_buffer[1] = msg->wParam;
else if(input_count == 2) {
input_buffer[0] = msg->wParam;
input_count = 0;
}
} else {
input_count = 0;
}
return true;
}
break;
}
}*/
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
#else
void G_IME::Init(irr::video::SExposedVideoData&) {
}
#endif
}
#ifndef G_IME_H
#define G_IME_H
#include "config.h"
namespace ygo {
#ifdef _WIN32
class G_IME{
public:
void Init(irr::video::SExposedVideoData&);
static LRESULT CALLBACK CharHookProc(int nCode, WPARAM wParam, LPARAM lParam);
private:
static HIMC hIMC;
static HWND hWindow;
static HHOOK hHook;
};
#else
class G_IME{
void Init(irr::video::SExposedVideoData&);
};
#endif
}
#endif //G_IME_H
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include <dirent.h> #include <dirent.h>
#endif #endif
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
Game* mainGame;
Game::Game() { Game::Game() {
} }
Game::~Game() { Game::~Game() {
...@@ -43,6 +43,8 @@ bool Game::Initialize() { ...@@ -43,6 +43,8 @@ bool Game::Initialize() {
deckManager.LoadLFList(); deckManager.LoadLFList();
driver = device->getVideoDriver(); driver = device->getVideoDriver();
driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS, false); driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS, false);
vdata = driver->getExposedVideoData();
ime.Init(vdata);
imageManager.SetDevice(device); imageManager.SetDevice(device);
if(!dataManager.LoadDates("cards.cdb")) if(!dataManager.LoadDates("cards.cdb"))
return false; return false;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "network.h" #include "network.h"
#include "deck_manager.h" #include "deck_manager.h"
#include "replay.h" #include "replay.h"
#include "g_ime.h"
#include <string> #include <string>
#include "../ocgcore/mtrandom.h" #include "../ocgcore/mtrandom.h"
#include <unordered_map> #include <unordered_map>
...@@ -124,6 +125,7 @@ public: ...@@ -124,6 +125,7 @@ public:
DeckManager deckManager; DeckManager deckManager;
Materials matManager; Materials matManager;
Replay lastReplay; Replay lastReplay;
G_IME ime;
std::vector<int> logParam; std::vector<int> logParam;
unsigned short linePattern; unsigned short linePattern;
int waitFrame; int waitFrame;
...@@ -161,6 +163,7 @@ public: ...@@ -161,6 +163,7 @@ public:
DeckBuilder deckBuilder; DeckBuilder deckBuilder;
irr::IrrlichtDevice* device; irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver; irr::video::IVideoDriver* driver;
irr::video::SExposedVideoData vdata;
irr::scene::ISceneManager* smgr; irr::scene::ISceneManager* smgr;
irr::scene::ICameraSceneNode* camera; irr::scene::ICameraSceneNode* camera;
//GUI //GUI
...@@ -330,6 +333,8 @@ public: ...@@ -330,6 +333,8 @@ public:
}; };
extern Game* mainGame;
} }
#define COMMAND_ACTIVATE 0x0001 #define COMMAND_ACTIVATE 0x0001
......
#include "config.h" #include "config.h"
#include "game.h" #include "game.h"
ygo::Game* mainGame;
int main() { int main() {
#ifdef _WIN32 #ifdef _WIN32
WORD wVersionRequested; WORD wVersionRequested;
...@@ -13,10 +11,10 @@ int main() { ...@@ -13,10 +11,10 @@ int main() {
#else #else
#endif //_WIN32 #endif //_WIN32
ygo::Game _game; ygo::Game _game;
mainGame = &_game; ygo::mainGame = &_game;
if(!mainGame->Initialize()) if(!ygo::mainGame->Initialize())
return 0; return 0;
mainGame->MainLoop(); ygo::mainGame->MainLoop();
#ifdef _WIN32 #ifdef _WIN32
timeEndPeriod(1); timeEndPeriod(1);
WSACleanup(); WSACleanup();
......
#include "image_manager.h" #include "image_manager.h"
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
bool ImageManager::Initial() { bool ImageManager::Initial() {
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include <sys/time.h> #include <sys/time.h>
#include <algorithm> #include <algorithm>
extern ygo::Game* mainGame;
#define MSG_REPLAY 0xf0 #define MSG_REPLAY 0xf0
#define MSG_DUEL_END 0xf1 #define MSG_DUEL_END 0xf1
......
#include "network.h" #include "network.h"
#include "game.h" #include "game.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
const unsigned short PROTO_VERSION = 0x1011;
bool NetManager::CreateHost() { bool NetManager::CreateHost() {
wchar_t* pstr; wchar_t* pstr;
int wp; int wp;
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include <set> #include <set>
#include <vector> #include <vector>
#define PROTO_VERSION 0x1011
namespace ygo { namespace ygo {
struct HostInfo { struct HostInfo {
...@@ -99,6 +97,8 @@ public: ...@@ -99,6 +97,8 @@ public:
}; };
extern const unsigned short PROTO_VERSION;
} }
#define NETWORK_SERVER_ID 0x7428 #define NETWORK_SERVER_ID 0x7428
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include <algorithm> #include <algorithm>
#include "lzma/LzmaLib.h" #include "lzma/LzmaLib.h"
extern ygo::Game* mainGame;
namespace ygo { namespace ygo {
Replay::Replay() { Replay::Replay() {
......
...@@ -25,8 +25,8 @@ function c13361027.filter(c,e,sp) ...@@ -25,8 +25,8 @@ function c13361027.filter(c,e,sp)
return c:IsLevelBelow(4) and c:IsRace(RACE_WINDBEAST) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) return c:IsLevelBelow(4) and c:IsRace(RACE_WINDBEAST) and c:IsCanBeSpecialSummoned(e,0,sp,false,false)
end end
function c13361027.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c13361027.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetLocation()==LOCATION_GRAVE and chkc:GetControler()==tp and c48964966.filter2(chkc,e,tp) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c48964966.filter2(chkc,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c13361027.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end\ if chk==0 then return Duel.IsExistingTarget(c13361027.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c13361027.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local g=Duel.SelectTarget(tp,c13361027.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
......
...@@ -22,5 +22,5 @@ function c70083723.filter(c) ...@@ -22,5 +22,5 @@ function c70083723.filter(c)
return c:IsSetCard(0x2a) and c:IsType(TYPE_MONSTER) return c:IsSetCard(0x2a) and c:IsType(TYPE_MONSTER)
end end
function c70083723.atkval(e,c) function c70083723.atkval(e,c)
return Duel.GetMatchingGroupCount(c70083723.filter,tp,LOCATION_GRAVE,0,nil)*200 return Duel.GetMatchingGroupCount(c70083723.filter,c:GetControler(),LOCATION_GRAVE,0,nil)*200
end end
...@@ -37,7 +37,7 @@ function c8062132.initial_effect(c) ...@@ -37,7 +37,7 @@ function c8062132.initial_effect(c)
local e5=e4:Clone() local e5=e4:Clone()
e5:SetCode(EFFECT_IMMUNE_EFFECT) e5:SetCode(EFFECT_IMMUNE_EFFECT)
c:RegisterEffect(e5) c:RegisterEffect(e5)
--special summon --win
local e6=Effect.CreateEffect(c) local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(8062132,1)) e6:SetDescription(aux.Stringid(8062132,1))
e6:SetCategory(CATEGORY_COUNTER) e6:SetCategory(CATEGORY_COUNTER)
...@@ -63,12 +63,12 @@ function c8062132.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -63,12 +63,12 @@ function c8062132.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c8062132.target(e,tp,eg,ep,ev,re,r,rp,chk) function c8062132.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,true) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end end
function c8062132.operation(e,tp,eg,ep,ev,re,r,rp) function c8062132.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,true,false,POS_FACEUP) Duel.SpecialSummon(e:GetHandler(),0,tp,tp,true,true,POS_FACEUP)
end end
end end
function c8062132.ctop(e,tp,eg,ep,ev,re,r,rp) function c8062132.ctop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -24,10 +24,10 @@ function c93717133.initial_effect(c) ...@@ -24,10 +24,10 @@ function c93717133.initial_effect(c)
end end
function c93717133.spcon(e,c) function c93717133.spcon(e,c)
if c==nil then return true end if c==nil then return true end
return Duel.CheckReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,nil,1000) return Duel.CheckReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,nil,2000)
end end
function c93717133.spop(e,tp,eg,ep,ev,re,r,rp,c) function c93717133.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,2,nil,1000) local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,2,nil,2000)
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c93717133.rmcon(e,tp,eg,ep,ev,re,r,rp) function c93717133.rmcon(e,tp,eg,ep,ev,re,r,rp)
......
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