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

fix

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