Commit 0d6548eb authored by argon.sun's avatar argon.sun

fix

parent 63e41dce
...@@ -63,13 +63,13 @@ public: ...@@ -63,13 +63,13 @@ public:
*str = *wsrc; *str = *wsrc;
++str; ++str;
} else if(*wsrc < 0x800) { } else if(*wsrc < 0x800) {
str[0] = (*wsrc >> 6) & 0x1f | 0xc0; str[0] = ((*wsrc >> 6) & 0x1f) | 0xc0;
str[1] = (*wsrc) & 0x3f | 0x80; str[1] = ((*wsrc) & 0x3f) | 0x80;
str += 2; str += 2;
} else { } else {
str[0] = (*wsrc >> 12) & 0xf | 0xe0; str[0] = ((*wsrc >> 12) & 0xf) | 0xe0;
str[1] = (*wsrc >> 6) & 0x3f | 0x80; str[1] = ((*wsrc >> 6) & 0x3f) | 0x80;
str[2] = (*wsrc) & 0x3f | 0x80; str[2] = ((*wsrc) & 0x3f) | 0x80;
str += 3; str += 3;
} }
wsrc++; wsrc++;
......
...@@ -698,8 +698,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -698,8 +698,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
ancard.clear(); ancard.clear();
for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) { for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) {
if(wcsstr(cit->second.name, pname) != 0) { if(wcsstr(cit->second.name, pname) != 0) {
mainGame->lstANCard->addItem(cit->second.name); auto cp = dataManager.GetCodePointer(cit->first);
ancard.push_back(cit->first); if(!cp->second.alias) {
mainGame->lstANCard->addItem(cit->second.name);
ancard.push_back(cit->first);
}
} }
} }
break; break;
......
...@@ -40,7 +40,6 @@ bool Game::Initialize() { ...@@ -40,7 +40,6 @@ bool Game::Initialize() {
always_chain = false; always_chain = false;
ignore_chain = false; ignore_chain = false;
is_building = false; is_building = false;
exit_window = 0;
memset(&dInfo, 0, sizeof(DuelInfo)); memset(&dInfo, 0, sizeof(DuelInfo));
deckManager.LoadLFList(); deckManager.LoadLFList();
driver = device->getVideoDriver(); driver = device->getVideoDriver();
...@@ -98,7 +97,7 @@ bool Game::Initialize() { ...@@ -98,7 +97,7 @@ bool Game::Initialize() {
wCreateHost->setVisible(false); wCreateHost->setVisible(false);
env->addStaticText(dataManager.GetSysString(1226), rect<s32>(20, 30, 220, 50), false, false, wCreateHost); env->addStaticText(dataManager.GetSysString(1226), rect<s32>(20, 30, 220, 50), false, false, wCreateHost);
cbLFlist = env->addComboBox(rect<s32>(140, 25, 300, 50), wCreateHost); cbLFlist = env->addComboBox(rect<s32>(140, 25, 300, 50), wCreateHost);
for(int i = 0; i < deckManager._lfList.size(); ++i) for(unsigned int i = 0; i < deckManager._lfList.size(); ++i)
cbLFlist->addItem(deckManager._lfList[i].listName, deckManager._lfList[i].hash); cbLFlist->addItem(deckManager._lfList[i].listName, deckManager._lfList[i].hash);
env->addStaticText(dataManager.GetSysString(1225), rect<s32>(20, 60, 220, 80), false, false, wCreateHost); env->addStaticText(dataManager.GetSysString(1225), rect<s32>(20, 60, 220, 80), false, false, wCreateHost);
cbRule = env->addComboBox(rect<s32>(140, 55, 300, 80), wCreateHost); cbRule = env->addComboBox(rect<s32>(140, 55, 300, 80), wCreateHost);
...@@ -342,7 +341,7 @@ bool Game::Initialize() { ...@@ -342,7 +341,7 @@ bool Game::Initialize() {
cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST); cbDBLFList = env->addComboBox(rect<s32>(80, 5, 220, 30), wDeckEdit, COMBOBOX_DBLFLIST);
env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit); env->addStaticText(dataManager.GetSysString(1301), rect<s32>(10, 39, 100, 59), false, false, wDeckEdit);
cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS); cbDBDecks = env->addComboBox(rect<s32>(80, 35, 220, 60), wDeckEdit, COMBOBOX_DBDECKS);
for(int i = 0; i < deckManager._lfList.size(); ++i) for(unsigned int i = 0; i < deckManager._lfList.size(); ++i)
cbDBLFList->addItem(deckManager._lfList[i].listName); cbDBLFList->addItem(deckManager._lfList[i].listName);
btnSaveDeck = env->addButton(rect<s32>(225, 35, 290, 60), wDeckEdit, BUTTON_SAVE_DECK, dataManager.GetSysString(1302)); btnSaveDeck = env->addButton(rect<s32>(225, 35, 290, 60), wDeckEdit, BUTTON_SAVE_DECK, dataManager.GetSysString(1302));
ebDeckname = env->addEditBox(L"", rect<s32>(80, 65, 220, 90), true, wDeckEdit, -1); ebDeckname = env->addEditBox(L"", rect<s32>(80, 65, 220, 90), true, wDeckEdit, -1);
...@@ -460,7 +459,7 @@ void Game::MainLoop() { ...@@ -460,7 +459,7 @@ void Game::MainLoop() {
irr::ITimer* timer = device->getTimer(); irr::ITimer* timer = device->getTimer();
timer->setTime(0); timer->setTime(0);
int fps = 0; int fps = 0;
unsigned int cur_time = 0; int cur_time = 0;
while(device->run()) { while(device->run()) {
linePattern = (linePattern << 1) | (linePattern >> 15); linePattern = (linePattern << 1) | (linePattern >> 15);
atkframe += 0.1f; atkframe += 0.1f;
...@@ -487,11 +486,6 @@ void Game::MainLoop() { ...@@ -487,11 +486,6 @@ void Game::MainLoop() {
if(!signalFrame) if(!signalFrame)
frameSignal.Set(); frameSignal.Set();
} }
if(exit_window && !fadingFrame) {
irr::SEvent sevt;
sevt.EventType = irr::EET_USER_EVENT;
sevt.UserEvent.UserData1 = UEVENT_TOWINDOW;
}
if(waitFrame >= 0) { if(waitFrame >= 0) {
waitFrame++; waitFrame++;
if(waitFrame % 90 == 0) { if(waitFrame % 90 == 0) {
...@@ -628,7 +622,6 @@ void Game::LoadConfig() { ...@@ -628,7 +622,6 @@ void Game::LoadConfig() {
char strbuf[32]; char strbuf[32];
char valbuf[256]; char valbuf[256];
wchar_t wstr[256]; wchar_t wstr[256];
int value;
gameConf.antialias = 0; gameConf.antialias = 0;
gameConf.serverport = 7911; gameConf.serverport = 7911;
gameConf.nickname[0] = 0; gameConf.nickname[0] = 0;
......
...@@ -95,7 +95,6 @@ public: ...@@ -95,7 +95,6 @@ public:
int showcardp; int showcardp;
int is_attacking; int is_attacking;
int attack_sv; int attack_sv;
irr::gui::IGUIElement* exit_window;
irr::core::vector3df atk_r; irr::core::vector3df atk_r;
irr::core::vector3df atk_t; irr::core::vector3df atk_t;
float atkdy; float atkdy;
......
...@@ -106,19 +106,21 @@ class DuelMode { ...@@ -106,19 +106,21 @@ class DuelMode {
public: public:
DuelMode(): host_player(0), pduel(0) {} DuelMode(): host_player(0), pduel(0) {}
virtual ~DuelMode() {} virtual ~DuelMode() {}
virtual void JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {}; virtual void JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {}
virtual void LeaveGame(DuelPlayer* dp) {}; virtual void LeaveGame(DuelPlayer* dp) {}
virtual void ToDuelist(DuelPlayer* dp) {}; virtual void ToDuelist(DuelPlayer* dp) {}
virtual void ToObserver(DuelPlayer* dp) {}; virtual void ToObserver(DuelPlayer* dp) {}
virtual void PlayerReady(DuelPlayer* dp, bool is_ready) {}; virtual void PlayerReady(DuelPlayer* dp, bool is_ready) {}
virtual void PlayerKick(DuelPlayer* dp, unsigned char pos) {}; virtual void PlayerKick(DuelPlayer* dp, unsigned char pos) {}
virtual void UpdateDeck(DuelPlayer* dp, void* pdata) {}; virtual void UpdateDeck(DuelPlayer* dp, void* pdata) {}
virtual void StartDuel(DuelPlayer* dp) {}; virtual void StartDuel(DuelPlayer* dp) {}
virtual void HandResult(DuelPlayer* dp, unsigned char res) {}; virtual void HandResult(DuelPlayer* dp, unsigned char res) {}
virtual void TPResult(DuelPlayer* dp, unsigned char tp) {}; virtual void TPResult(DuelPlayer* dp, unsigned char tp) {}
virtual void Process() {}; virtual void Process() {}
virtual int Analyze(char* msgbuffer, unsigned int len) {}; virtual int Analyze(char* msgbuffer, unsigned int len) {
virtual void GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {}; return 0;
}
virtual void GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {}
virtual void EndDuel() {}; virtual void EndDuel() {};
public: public:
......
...@@ -9,7 +9,7 @@ project "gframe" ...@@ -9,7 +9,7 @@ project "gframe"
links { "ocgcore", "clzma", "irrlicht", "freetype", "sqlite3", "lua" , "event"} links { "ocgcore", "clzma", "irrlicht", "freetype", "sqlite3", "lua" , "event"}
configuration "windows" configuration "windows"
links { "opengl32", "wsock32", "winmm", "gdi32", "kernel32", "user32" } links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
configuration {"windows", "not vs*"} configuration {"windows", "not vs*"}
includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" } includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" }
configuration "not vs*" configuration "not vs*"
......
...@@ -17,64 +17,104 @@ Replay::~Replay() { ...@@ -17,64 +17,104 @@ Replay::~Replay() {
delete comp_data; delete comp_data;
} }
void Replay::BeginRecord() { void Replay::BeginRecord() {
#ifdef _WIN32
if(is_recording)
CloseHandle(recording_fp);
recording_fp = CreateFile("./replay/_LastReplay.yrp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL);
if(recording_fp == INVALID_HANDLE_VALUE)
return;
#else
if(is_recording) if(is_recording)
fclose(fp); fclose(fp);
fp = fopen("./replay/_LastReplay.yrp", "wb"); fp = fopen("./replay/_LastReplay.yrp", "wb");
if(!fp) if(!fp)
return; return;
#endif
pdata = replay_data; pdata = replay_data;
is_recording = true; is_recording = true;
} }
void Replay::WriteHeader(ReplayHeader& header) { void Replay::WriteHeader(ReplayHeader& header) {
pheader = header; pheader = header;
#ifdef _WIN32
DWORD size;
WriteFile(recording_fp, &header, sizeof(header), &size, NULL);
#else
fwrite(&header, sizeof(header), 1, fp); fwrite(&header, sizeof(header), 1, fp);
fflush(fp); fflush(fp);
#endif
} }
void Replay::WriteData(const void* data, unsigned int length, bool flush) { void Replay::WriteData(const void* data, unsigned int length, bool flush) {
if(!is_recording) if(!is_recording)
return; return;
fwrite(data, length, 1, fp);
memcpy(pdata, data, length); memcpy(pdata, data, length);
pdata += length; pdata += length;
#ifdef _WIN32
DWORD size;
WriteFile(recording_fp, data, length, &size, NULL);
#else
fwrite(data, length, 1, fp);
if(flush) if(flush)
fflush(fp); fflush(fp);
#endif
} }
void Replay::WriteInt32(int data, bool flush) { void Replay::WriteInt32(int data, bool flush) {
if(!is_recording) if(!is_recording)
return; return;
fwrite(&data, sizeof(int), 1, fp);
*((int*)(pdata)) = data; *((int*)(pdata)) = data;
pdata += 4; pdata += 4;
#ifdef _WIN32
DWORD size;
WriteFile(recording_fp, &data, sizeof(int), &size, NULL);
#else
fwrite(&data, sizeof(int), 1, fp);
if(flush) if(flush)
fflush(fp); fflush(fp);
#endif
} }
void Replay::WriteInt16(short data, bool flush) { void Replay::WriteInt16(short data, bool flush) {
if(!is_recording) if(!is_recording)
return; return;
fwrite(&data, sizeof(short), 1, fp);
*((short*)(pdata)) = data; *((short*)(pdata)) = data;
pdata += 2; pdata += 2;
#ifdef _WIN32
DWORD size;
WriteFile(recording_fp, &data, sizeof(short), &size, NULL);
#else
fwrite(&data, sizeof(short), 1, fp);
if(flush) if(flush)
fflush(fp); fflush(fp);
#endif
} }
void Replay::WriteInt8(char data, bool flush) { void Replay::WriteInt8(char data, bool flush) {
if(!is_recording) if(!is_recording)
return; return;
fwrite(&data, sizeof(char), 1, fp);
*pdata = data; *pdata = data;
pdata++; pdata++;
#ifdef _WIN32
DWORD size;
WriteFile(recording_fp, &data, sizeof(char), &size, NULL);
#else
fwrite(&data, sizeof(char), 1, fp);
if(flush) if(flush)
fflush(fp); fflush(fp);
#endif
} }
void Replay::Flush() { void Replay::Flush() {
if(!is_recording) if(!is_recording)
return; return;
#ifdef _WIN32
#else
fflush(fp); fflush(fp);
#endif
} }
void Replay::EndRecord() { void Replay::EndRecord() {
if(!is_recording) if(!is_recording)
return; return;
#ifdef _WIN32
CloseHandle(recording_fp);
#else
fclose(fp); fclose(fp);
#endif
pheader.datasize = pdata - replay_data; pheader.datasize = pdata - replay_data;
pheader.flag |= REPLAY_COMPRESSED; pheader.flag |= REPLAY_COMPRESSED;
size_t propsize = 5; size_t propsize = 5;
......
...@@ -42,6 +42,9 @@ public: ...@@ -42,6 +42,9 @@ public:
FILE* fp; FILE* fp;
ReplayHeader pheader; ReplayHeader pheader;
#ifdef _WIN32
HANDLE recording_fp;
#endif
unsigned char* replay_data; unsigned char* replay_data;
unsigned char* comp_data; unsigned char* comp_data;
unsigned char* pdata; unsigned char* pdata;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <array> #include <array>
#include <vector>
#include <algorithm> #include <algorithm>
class effect; class effect;
......
...@@ -22,7 +22,7 @@ solution "ygo" ...@@ -22,7 +22,7 @@ solution "ygo"
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "not vs*" configuration "not vs*"
buildoptions { "-Wall", "-fno-strict-aliasing", "-Wno-multichar" } buildoptions { "-fno-strict-aliasing", "-Wno-multichar" }
configuration {"not vs*", "windows"} configuration {"not vs*", "windows"}
buildoptions { "-static-libgcc" } buildoptions { "-static-libgcc" }
......
...@@ -43,6 +43,6 @@ end ...@@ -43,6 +43,6 @@ end
function c1357146.operation(e,tp,eg,ep,ev,re,r,rp) function c1357146.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,mfalse,POS_FACEUP) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end end
end end
...@@ -31,7 +31,7 @@ function c1802450.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -31,7 +31,7 @@ function c1802450.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(1802450,0)) then and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(1802450,0)) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET) e:SetProperty(EFFECT_FLAG_CARD_TARGET)
local cg=Duel.SelectReleaseGroup(tp,c1802450.cfilter,1,1,nil) local cg=Duel.SelectReleaseGroup(tp,c1802450.cfilter,1,1,nil)
Duel.Release(cg,EASON_COST) Duel.Release(cg,REASON_COST)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,2,nil) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,2,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
e:GetHandler():RegisterFlagEffect(1802450,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1) e:GetHandler():RegisterFlagEffect(1802450,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
...@@ -40,7 +40,7 @@ end ...@@ -40,7 +40,7 @@ end
function c1802450.cost2(e,tp,eg,ep,ev,re,r,rp,chk) function c1802450.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c1802450.cfilter,1,nil) end if chk==0 then return Duel.CheckReleaseGroup(tp,c1802450.cfilter,1,nil) end
local cg=Duel.SelectReleaseGroup(tp,c1802450.cfilter,1,1,nil) local cg=Duel.SelectReleaseGroup(tp,c1802450.cfilter,1,1,nil)
Duel.Release(cg,EASON_COST) Duel.Release(cg,REASON_COST)
end end
function c1802450.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c1802450.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCAITON_GRAVE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chkc then return chkc:IsLocation(LOCAITON_GRAVE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end
......
...@@ -68,7 +68,7 @@ function c19441018.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -68,7 +68,7 @@ function c19441018.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,c19441018.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) local g2=Duel.SelectTarget(tp,c19441018.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst())
g1:Merge(g2) g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0)
end end
function c19441018.desop(e) function c19441018.desop(e)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
......
...@@ -32,6 +32,6 @@ end ...@@ -32,6 +32,6 @@ end
function c20193924.activate(e,tp,eg,ep,ev,re,r,rp) function c20193924.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsFacedown() and tc:IsRelateToEffect(e) then if tc:IsFacedown() and tc:IsRelateToEffect(e) then
Duel.Destroy(sg,REASON_EFFECT) Duel.Destroy(tc,REASON_EFFECT)
end end
end end
...@@ -7,5 +7,5 @@ lastdeck = sixsamurai ...@@ -7,5 +7,5 @@ lastdeck = sixsamurai
textfont = c:/windows/fonts/simsun.ttc textfont = c:/windows/fonts/simsun.ttc
numfont = c:/windows/fonts/arialbd.ttf numfont = c:/windows/fonts/arialbd.ttf
serverport = 7911 serverport = 7911
lastip = 192.168.2.100 lastip = 192.168.3.235
lastport = 7911 lastport = 7911
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