Commit 234a80bb authored by argon.sun's avatar argon.sun

fix

parent 57e9db08
...@@ -124,7 +124,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se ...@@ -124,7 +124,7 @@ void ClientField::AddCard(ClientCard* pcard, int controler, int location, int se
pcard->sequence = sequence; pcard->sequence = sequence;
switch(location) { switch(location) {
case LOCATION_DECK: { case LOCATION_DECK: {
if (sequence != 1 || deck[controler].size() == 0) { if (sequence != 0 || deck[controler].size() == 0) {
deck[controler].push_back(pcard); deck[controler].push_back(pcard);
pcard->sequence = deck[controler].size() - 1; pcard->sequence = deck[controler].size() - 1;
} else { } else {
......
...@@ -441,14 +441,16 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -441,14 +441,16 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->replaySignal.Reset(); mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait(); mainGame->replaySignal.Wait();
if(mainGame->actionParam) { if(mainGame->actionParam || !is_host) {
char* prep = pdata; char* prep = pdata;
Replay new_replay; Replay new_replay;
memcpy(&new_replay.pheader, prep, sizeof(ReplayHeader)); memcpy(&new_replay.pheader, prep, sizeof(ReplayHeader));
prep += sizeof(ReplayHeader); prep += sizeof(ReplayHeader);
memcpy(new_replay.comp_data, prep, len - sizeof(ReplayHeader) - 1); memcpy(new_replay.comp_data, prep, len - sizeof(ReplayHeader) - 1);
new_replay.comp_size = len - sizeof(ReplayHeader) - 1; new_replay.comp_size = len - sizeof(ReplayHeader) - 1;
new_replay.SaveReplay(mainGame->ebRSName->getText()); if(mainGame->actionParam)
new_replay.SaveReplay(mainGame->ebRSName->getText());
else new_replay.SaveReplay(L"_LastReplay");
} }
break; break;
} }
...@@ -1232,19 +1234,22 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) { ...@@ -1232,19 +1234,22 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame->dField.selectable_cards.clear(); mainGame->dField.selectable_cards.clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf); code = BufferIO::ReadInt32(pbuf);
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); pbuf += 3;
l = BufferIO::ReadInt8(pbuf); pcard = *(mainGame->dField.deck[player].rbegin() + i);
s = BufferIO::ReadInt8(pbuf);
pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0) if (code != 0)
pcard->SetCode(code); pcard->SetCode(code);
}
for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.deck[player].rbegin() + i);
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code)); myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code); mainGame->logParam.push_back(code);
float shift = -0.15f; float shift = -0.15f;
if (player == 1) shift = 0.15f; if (player == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0); pcard->dPos = irr::core::vector3df(shift, 0, 0);
pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0); if(!mainGame->dField.deck_reversed)
pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0);
else pcard->dRot = irr::core::vector3df(0, 0, 0);
pcard->is_moving = true; pcard->is_moving = true;
pcard->aniFrame = 5; pcard->aniFrame = 5;
mainGame->WaitFrameSignal(45); mainGame->WaitFrameSignal(45);
...@@ -1279,7 +1284,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) { ...@@ -1279,7 +1284,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
float shift = -0.15f; float shift = -0.15f;
if (c == 0 && l == 0x40) shift = 0.15f; if (c == 0 && l == 0x40) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0); pcard->dPos = irr::core::vector3df(shift, 0, 0);
pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0); if((l == LOCATION_DECK) && mainGame->dField.deck_reversed)
pcard->dRot = irr::core::vector3df(0, 0, 0);
else pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0);
pcard->is_moving = true; pcard->is_moving = true;
pcard->aniFrame = 5; pcard->aniFrame = 5;
mainGame->WaitFrameSignal(45); mainGame->WaitFrameSignal(45);
...@@ -1596,9 +1603,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) { ...@@ -1596,9 +1603,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame->dField.AddCard(pcard, cc, cl, cs); mainGame->dField.AddCard(pcard, cc, cl, cs);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
if (pl == cl && pc == cc && (cl & 0x71)) { if (pl == cl && pc == cc && (cl & 0x71)) {
pcard->dPos = irr::core::vector3df(-0.2f, 0, 0); pcard->dPos = irr::core::vector3df(-0.3f, 0, 0);
pcard->dRot = irr::core::vector3df(0, 0, 0); pcard->dRot = irr::core::vector3df(0, 0, 0);
if (pc == 1) pcard->dPos.X = 0.2f; if (pc == 1) pcard->dPos.X = 0.3f;
pcard->is_moving = true; pcard->is_moving = true;
pcard->aniFrame = 5; pcard->aniFrame = 5;
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
...@@ -1963,10 +1970,13 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) { ...@@ -1963,10 +1970,13 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
ClientCard* pcard; ClientCard* pcard;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int code = BufferIO::ReadInt32(pbuf); int code = BufferIO::ReadInt32(pbuf);
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1 - i);
if(code)
pcard->SetCode(code);
}
for (int i = 0; i < count; ++i) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1); pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
if(code || !mainGame->dField.deck_reversed)
pcard->SetCode(code);
mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1); mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1);
mainGame->dField.AddCard(pcard, player, LOCATION_HAND, 0); mainGame->dField.AddCard(pcard, player, LOCATION_HAND, 0);
for(int i = 0; i < mainGame->dField.hand[player].size(); ++i) for(int i = 0; i < mainGame->dField.hand[player].size(); ++i)
......
...@@ -258,8 +258,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i ...@@ -258,8 +258,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i
return TRUE; return TRUE;
} }
int32 effect::is_condition_check(uint8 playerid, tevent& e) { int32 effect::is_condition_check(uint8 playerid, tevent& e) {
if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) && (!handler->is_position(POS_FACEUP)))
&& (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED)))
return FALSE; return FALSE;
if(!condition) if(!condition)
return TRUE; return TRUE;
......
...@@ -947,8 +947,12 @@ int32 field::process() { ...@@ -947,8 +947,12 @@ int32 field::process() {
tc[count - i - 1]->current.sequence = player[target_player].list_main.size() - 1; tc[count - i - 1]->current.sequence = player[target_player].list_main.size() - 1;
} }
} }
pduel->write_buffer8(MSG_REFRESH_DECK); if(core.deck_reversed) {
pduel->write_buffer8(target_player); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(target_player);
pduel->write_buffer8(0);
pduel->write_buffer32((*player[target_player].list_main.rbegin())->data.code);
}
core.units.pop_front(); core.units.pop_front();
} }
return pduel->bufferlen; return pduel->bufferlen;
......
...@@ -41,6 +41,7 @@ function c87624166.destg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -41,6 +41,7 @@ function c87624166.destg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end end
function c87624166.desop(e,tp,eg,ep,ev,re,r,rp) function c87624166.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(c87624166.desfilter,Duel.GetTurnPlayer(),LOCATION_MZONE,LOCATION_MZONE,nil) local g=Duel.GetMatchingGroup(c87624166.desfilter,Duel.GetTurnPlayer(),LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.Destroy(g,REASON_EFFECT) Duel.Destroy(g,REASON_EFFECT)
end end
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