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

bug fix

parent 8eccc80f
#include "client_card.h"
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
ClientCard::ClientCard() {
......
#include "client_field.h"
#include "client_card.h"
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
ClientField::ClientField() {
......
......@@ -2,11 +2,12 @@
#define CLIENT_FIELD_H
#include "config.h"
#include "client_card.h"
#include <vector>
namespace ygo {
class ClientCard;
struct ChainInfo{
irr::core::vector3df chain_pos;
ClientCard* chain_card;
......
......@@ -24,6 +24,7 @@
#ifdef _WIN32
#include <windows.h>
#include <imm.h>
#define myswprintf swprintf
#else
......
......@@ -3,8 +3,6 @@
#include "game.h"
#include <algorithm>
extern ygo::Game* mainGame;
namespace ygo {
bool DeckBuilder::OnEvent(const irr::SEvent& event) {
......
......@@ -3,8 +3,6 @@
#include "game.h"
#include <algorithm>
extern ygo::Game* mainGame;
namespace ygo {
void DeckManager::LoadLFList() {
......
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
void Game::DrawSelectionLine(irr::video::S3DVertex* vec, bool strip, int width, float* cv) {
......
......@@ -3,8 +3,6 @@
#include "network.h"
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
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 @@
#include <dirent.h>
#endif
extern ygo::Game* mainGame;
namespace ygo {
Game* mainGame;
Game::Game() {
}
Game::~Game() {
......@@ -43,6 +43,8 @@ bool Game::Initialize() {
deckManager.LoadLFList();
driver = device->getVideoDriver();
driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS, false);
vdata = driver->getExposedVideoData();
ime.Init(vdata);
imageManager.SetDevice(device);
if(!dataManager.LoadDates("cards.cdb"))
return false;
......
......@@ -11,6 +11,7 @@
#include "network.h"
#include "deck_manager.h"
#include "replay.h"
#include "g_ime.h"
#include <string>
#include "../ocgcore/mtrandom.h"
#include <unordered_map>
......@@ -124,6 +125,7 @@ public:
DeckManager deckManager;
Materials matManager;
Replay lastReplay;
G_IME ime;
std::vector<int> logParam;
unsigned short linePattern;
int waitFrame;
......@@ -161,6 +163,7 @@ public:
DeckBuilder deckBuilder;
irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver;
irr::video::SExposedVideoData vdata;
irr::scene::ISceneManager* smgr;
irr::scene::ICameraSceneNode* camera;
//GUI
......@@ -330,6 +333,8 @@ public:
};
extern Game* mainGame;
}
#define COMMAND_ACTIVATE 0x0001
......
#include "config.h"
#include "game.h"
ygo::Game* mainGame;
int main() {
#ifdef _WIN32
WORD wVersionRequested;
......@@ -13,10 +11,10 @@ int main() {
#else
#endif //_WIN32
ygo::Game _game;
mainGame = &_game;
if(!mainGame->Initialize())
ygo::mainGame = &_game;
if(!ygo::mainGame->Initialize())
return 0;
mainGame->MainLoop();
ygo::mainGame->MainLoop();
#ifdef _WIN32
timeEndPeriod(1);
WSACleanup();
......
#include "image_manager.h"
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
bool ImageManager::Initial() {
......
......@@ -4,8 +4,6 @@
#include <sys/time.h>
#include <algorithm>
extern ygo::Game* mainGame;
#define MSG_REPLAY 0xf0
#define MSG_DUEL_END 0xf1
......
#include "network.h"
#include "game.h"
extern ygo::Game* mainGame;
namespace ygo {
const unsigned short PROTO_VERSION = 0x1011;
bool NetManager::CreateHost() {
wchar_t* pstr;
int wp;
......
......@@ -5,8 +5,6 @@
#include <set>
#include <vector>
#define PROTO_VERSION 0x1011
namespace ygo {
struct HostInfo {
......@@ -99,6 +97,8 @@ public:
};
extern const unsigned short PROTO_VERSION;
}
#define NETWORK_SERVER_ID 0x7428
......
......@@ -5,8 +5,6 @@
#include <algorithm>
#include "lzma/LzmaLib.h"
extern ygo::Game* mainGame;
namespace ygo {
Replay::Replay() {
......
......@@ -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)
end
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 chk==0 then return Duel.IsExistingTarget(c13361027.filter,tp,LOCATION_GRAVE,0,1,nil,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
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
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)
......
......@@ -22,5 +22,5 @@ function c70083723.filter(c)
return c:IsSetCard(0x2a) and c:IsType(TYPE_MONSTER)
end
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
......@@ -37,7 +37,7 @@ function c8062132.initial_effect(c)
local e5=e4:Clone()
e5:SetCode(EFFECT_IMMUNE_EFFECT)
c:RegisterEffect(e5)
--special summon
--win
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(8062132,1))
e6:SetCategory(CATEGORY_COUNTER)
......@@ -63,12 +63,12 @@ function c8062132.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c8062132.target(e,tp,eg,ep,ev,re,r,rp,chk)
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)
end
function c8062132.operation(e,tp,eg,ep,ev,re,r,rp)
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
function c8062132.ctop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -24,10 +24,10 @@ function c93717133.initial_effect(c)
end
function c93717133.spcon(e,c)
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
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)
end
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