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

fix

parent d0007b49
......@@ -87,8 +87,10 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->mTransform.setRotationRadians(pcard->curRot);
}
}
ClientCard* ClientField::GetCard(int controler, int location, int sequence) {
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0;
bool is_xyz = (location & 0x80);
location &= 0x7f;
switch(location) {
case LOCATION_DECK:
lst = &deck[controler];
......@@ -114,9 +116,19 @@ ClientCard* ClientField::GetCard(int controler, int location, int sequence) {
}
if(!lst)
return 0;
if(sequence >= lst->size())
return 0;
return (*lst)[sequence];
if(is_xyz) {
if(sequence >= lst->size())
return 0;
ClientCard* scard = (*lst)[sequence];
if(scard && scard->overlayed.size() > sub_seq)
return scard->overlayed[sub_seq];
else
return 0;
} else {
if(sequence >= lst->size())
return 0;
return (*lst)[sequence];
}
}
void ClientField::AddCard(ClientCard* pcard, int controler, int location, int sequence) {
pcard->controler = controler;
......@@ -393,6 +405,20 @@ void ClientField::ReplaySwap() {
std::swap(grave[0], grave[1]);
std::swap(remove[0], remove[1]);
std::swap(extra[0], extra[1]);
RefreshAllCards();
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
for(int i = 0; i < 16; ++i)
std::swap(mainGame->dInfo.strLP[0][i], mainGame->dInfo.strLP[1][i]);
for(int i = 0; i < 20; ++i)
std::swap(mainGame->dInfo.hostname[i], mainGame->dInfo.clientname[i]);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
chit->controler = 1 - chit->controler;
GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos);
}
disabled_field = (disabled_field >> 16) | (disabled_field << 16);
}
void ClientField::RefreshAllCards() {
for(int p = 0; p < 2; ++p) {
for(auto cit = deck[p].begin(); cit != deck[p].end(); ++cit) {
(*cit)->controler = 1 - (*cit)->controler;
......@@ -455,17 +481,6 @@ void ClientField::ReplaySwap() {
(*cit)->mTransform.setRotationRadians((*cit)->curRot);
(*cit)->is_moving = false;
}
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
for(int i = 0; i < 16; ++i)
std::swap(mainGame->dInfo.strLP[0][i], mainGame->dInfo.strLP[1][i]);
for(int i = 0; i < 20; ++i)
std::swap(mainGame->dInfo.hostname[i], mainGame->dInfo.clientname[i]);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
chit->controler = 1 - chit->controler;
GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos);
}
disabled_field = (disabled_field >> 16) | (disabled_field << 16);
}
void ClientField::GetChainLocation(int controler, int location, int sequence, irr::core::vector3df* t) {
t->X = 0;
......
......@@ -72,7 +72,7 @@ public:
ClientField();
void Clear();
void Initial(int player, int deckc, int extrac);
ClientCard* GetCard(int controler, int location, int sequence);
ClientCard* GetCard(int controler, int location, int sequence, int sub_seq = 0);
void AddCard(ClientCard* pcard, int controler, int location, int sequence);
ClientCard* RemoveCard(int controler, int location, int sequence);
void UpdateCard(int controler, int location, int sequence, char* data);
......@@ -82,6 +82,7 @@ public:
void ClearChainSelect();
void ShowSelectCard(bool buttonok = false);
void ReplaySwap();
void RefreshAllCards();
void GetChainLocation(int controler, int location, int sequence, irr::core::vector3df* t);
void GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, irr::core::vector3df* r, bool setTrans = false);
......
......@@ -53,14 +53,19 @@ void Game::DrawBackGround() {
im.setTranslation(vector3df(0, 0, -0.01));
driver->setTransform(irr::video::ETS_WORLD, im);
//dark shade
matManager.mSelField.AmbientColor = 0xff000000;
matManager.mSelField.DiffuseColor = 0xa0000000;
driver->setMaterial(matManager.mSelField);
for(int i = 0; i < 120; i += 4)
driver->drawVertexPrimitiveList(&matManager.vFields[i], 4, matManager.iRectangle, 2);
// matManager.mSelField.AmbientColor = 0xff000000;
// matManager.mSelField.DiffuseColor = 0xa0000000;
// driver->setMaterial(matManager.mSelField);
// for(int i = 0; i < 120; i += 4)
// driver->drawVertexPrimitiveList(&matManager.vFields[i], 4, matManager.iRectangle, 2);
// driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
// driver->setMaterial(matManager.mBackLine);
// driver->drawVertexPrimitiveList(matManager.vBackLine, 76, matManager.iBackLine, 58, irr::video::EVT_STANDARD, irr::scene::EPT_LINES);
//draw field
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
driver->setMaterial(matManager.mBackLine);
driver->drawVertexPrimitiveList(matManager.vBackLine, 76, matManager.iBackLine, 58, irr::video::EVT_STANDARD, irr::scene::EPT_LINES);
matManager.mTexture.setTexture(0, imageManager.tField);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vField, 4, matManager.iRectangle, 2);
//select field
if(dInfo.curMsg == MSG_SELECT_PLACE || dInfo.curMsg == MSG_SELECT_DISFIELD) {
float cv[4] = {0.0f, 0.0f, 1.0f, 1.0f};
......
This diff is collapsed.
......@@ -29,6 +29,7 @@ struct Config {
struct DuelInfo {
bool isStarted;
bool isReplay;
bool isReplaySkiping;
bool isFirst;
bool isTag;
bool isSingleMode;
......
......@@ -22,6 +22,7 @@ bool ImageManager::Initial() {
tHand[1] = driver->getTexture("textures/f2.jpg");
tHand[2] = driver->getTexture("textures/f3.jpg");
tBackGround = driver->getTexture("textures/bg.jpg");
tField = driver->getTexture("textures/field.png");
return true;
}
void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
......
......@@ -35,6 +35,7 @@ public:
irr::video::ITexture* tLim;
irr::video::ITexture* tHand[3];
irr::video::ITexture* tBackGround;
irr::video::ITexture* tField;
};
extern ImageManager imageManager;
......
......@@ -37,6 +37,10 @@ Materials::Materials() {
vActivate[1] = S3DVertex(vector3df(0.5, -0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 0));
vActivate[2] = S3DVertex(vector3df(-0.5, 0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 1));
vActivate[3] = S3DVertex(vector3df(0.5, 0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 1));
vField[0] = S3DVertex(vector3df(0.0, -4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 0));
vField[1] = S3DVertex(vector3df(8.0, -4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 0));
vField[2] = S3DVertex(vector3df(0.0, 4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 1));
vField[3] = S3DVertex(vector3df(8.0, 4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 1));
//background grids
for (int i = 0; i < 6; ++i) {
vBackLine[i * 6 + 0] = S3DVertex(vector3df(1.2f + i * 1.1f, 0.5f, -0.01f), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 0));
......
......@@ -15,6 +15,7 @@ public:
S3DVertex vNegate[4];
S3DVertex vChainNum[4];
S3DVertex vActivate[4];
S3DVertex vField[4];
S3DVertex vBackLine[76];
S3DVertex vFields[128];
S3DVertex vArrow[40];
......
......@@ -160,7 +160,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->dField.Clear();
mainGame->HideElement(mainGame->wReplay);
mainGame->device->setEventReceiver(&mainGame->dField);
ReplayMode::StartReplay();
ReplayMode::StartReplay(0);
break;
}
case BUTTON_CANCEL_REPLAY: {
......
......@@ -15,9 +15,11 @@ bool ReplayMode::is_pausing = false;
bool ReplayMode::is_paused = false;
bool ReplayMode::is_swaping = false;
bool ReplayMode::exit_pending = false;
int ReplayMode::skip_turn = 0;
wchar_t ReplayMode::event_string[256];
bool ReplayMode::StartReplay() {
bool ReplayMode::StartReplay(int skipturn) {
skip_turn = skipturn;
Thread::NewThread(ReplayThread, 0);
return true;
}
......@@ -134,6 +136,13 @@ int ReplayMode::ReplayThread(void* param) {
char engineBuffer[0x1000];
is_continuing = true;
exit_pending = false;
if(skip_turn < 0)
skip_turn = 0;
if(skip_turn) {
mainGame->dInfo.isReplaySkiping = true;
mainGame->gMutex.Lock();
} else
mainGame->dInfo.isReplaySkiping = false;
int len = 0, flag = 0;
while (is_continuing && !exit_pending) {
int result = process(pduel);
......@@ -183,6 +192,8 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
switch (mainGame->dInfo.curMsg) {
case MSG_RETRY: {
if(mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock();
mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage);
......@@ -344,6 +355,14 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_NEW_TURN: {
if(skip_turn) {
skip_turn--;
if(skip_turn == 0) {
mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
}
}
player = BufferIO::ReadInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
......@@ -365,7 +384,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
int cp = pbuf[11];
pbuf += 16;
DuelClient::ClientAnalyze(offset, pbuf - offset);
if(pl != cl || pc != cc)
if(cl && !(cl & 0x80) && (pl != cl || pc != cc))
ReplayRefreshSingle(cc, cl, cs);
break;
}
......
......@@ -18,12 +18,13 @@ private:
static bool is_paused;
static bool is_swaping;
static bool exit_pending;
static int skip_turn;
static wchar_t event_string[256];
public:
static Replay cur_replay;
public:
static bool StartReplay();
static bool StartReplay(int skipturn);
static void StopReplay(bool is_exiting = false);
static void SwapField();
static void Pause(bool is_pause, bool is_step);
......
......@@ -341,7 +341,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
int cp = pbuf[11];
pbuf += 16;
DuelClient::ClientAnalyze(offset, pbuf - offset);
if(pl != cl || pc != cc)
if(cl && !(cl & 0x80) && (pl != cl || pc != cc))
SinglePlayRefreshSingle(cc, cl, cs);
break;
}
......
......@@ -878,15 +878,15 @@ void card::reset(uint32 id, uint32 reset_type) {
if (rrm->second & 0xffff0000 & id)
relations.erase(rrm);
}
if(id & 0x7c0000)
if(id & 0x47c0000)
relate_effect.clear();
if(id & 0x1fc0000) {
if(id & 0x5fc0000) {
announced_cards.clear();
attacked_cards.clear();
announce_count = 0;
attacked_count = 0;
}
if(id & 0x1fe0000) {
if(id & 0x5fe0000) {
battled_cards.clear();
reset_effect_count();
auto pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
......
......@@ -2493,7 +2493,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) | (redirect << 8) | redirect_seq;
}
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & REASON_DESTROY)) {
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & (REASON_DESTROY | REASON_EFFECT))) {
pcard->current.reason |= REASON_DESTROY | REASON_BATTLE;
raise_single_event(pcard, 0, EVENT_DESTROY, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
destroying.insert(pcard);
......
......@@ -17,15 +17,27 @@ function c61314842.xyzfilter(c,mg)
if c.xyz_count~=2 then return false end
return c:IsXyzSummonable(mg)
end
function c61314842.mfilter1(c,exg)
return exg:IsExists(c61314842.mfilter2,1,nil,c)
end
function c61314842.mfilter2(c,mc)
return c.xyz_filter(mc)
end
function c61314842.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(c61314842.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and mg:GetCount()>1
and Duel.IsExistingMatchingCard(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end
local exg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=mg:FilterSelect(tp,c61314842.mfilter1,1,1,nil,exg)
local tc1=sg1:GetFirst()
local exg2=exg:Filter(c61314842.mfilter2,nil,tc1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=mg:Select(tp,2,2,nil)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0)
local sg2=mg:FilterSelect(tp,c61314842.mfilter1,1,1,tc1,exg2)
sg1:Merge(sg2)
Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0)
end
function c61314842.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......@@ -37,6 +49,7 @@ function c61314842.activate(e,tp,eg,ep,ev,re,r,rp)
local xyzg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
if xyzg:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
Duel.XyzSummon(tp,xyz,g)
......
......@@ -3,7 +3,7 @@ function c96704018.initial_effect(c)
--lv change
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(96704018,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c96704018.operation)
c:RegisterEffect(e1)
......
......@@ -362,11 +362,11 @@
!victory 0x2 没有卡可抽
!victory 0x3 超时
!victory 0x4 失去连接
!victory 0x10 封印されしエクゾディア
!victory 0x11 終焉のカウントダウン
!victory 0x12 毒蛇神ヴェノミナーガ
!victory 0x13 光の創造神 ホルアクティ
!victory 0x14 究極封印神エクゾディオス
!victory 0x10 「被封印的艾克佐迪亚」效果胜利
!victory 0x11 「终焉的倒计时」效果胜利
!victory 0x12 「毒蛇神 维诺米纳迦」效果胜利
!victory 0x13 「光之创造神 哈拉克提」效果胜利
!victory 0x14 「究极封印神 艾克佐迪奥斯」效果胜利
#counters
!counter 0x3001 魔力指示物
!counter 0x2 楔指示物
......
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