Commit 6dd9a52f authored by edo9300's avatar edo9300

Lua64 bit replay mode

parent b8e1d14d
......@@ -10,6 +10,7 @@ namespace ygo {
#define REPLAY_TAG 0x2
#define REPLAY_DECODED 0x4
#define REPLAY_SINGLE_MODE 0x8
#define REPLAY_LUA64 0x10
struct ReplayHeader {
unsigned int id;
......
......@@ -87,6 +87,7 @@ int ReplayMode::ReplayThread(void* param) {
set_message_handler((message_handler)MessageHandler);
mainGame->dInfo.isSingleMode = false;
}
mainGame->dInfo.lua64 = (rh.flag & REPLAY_LUA64) ? 1 : 0;
pduel = create_duel(rnd.rand());
int start_lp = cur_replay.ReadInt32();
int start_hand = cur_replay.ReadInt32();
......@@ -436,7 +437,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
return false;
}
case MSG_HINT: {
pbuf += 6;
pbuf += (mainGame->dInfo.lua64) ? 10 : 6;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
......@@ -453,7 +454,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_SELECT_BATTLECMD: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11;
pbuf += count * (mainGame->dInfo.lua64) ? 15 : 11;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 8 + 2;
ReplayRefresh();
......@@ -472,24 +473,24 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 7;
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 11 + 3;
pbuf += count * (mainGame->dInfo.lua64) ? 15 : 11 + 3;
ReplayRefresh();
return ReadReplayResponse();
}
case MSG_SELECT_EFFECTYN: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 12;
pbuf += (mainGame->dInfo.lua64) ? 16 : 12;
return ReadReplayResponse();
}
case MSG_SELECT_YESNO: {
player = BufferIO::ReadInt8(pbuf);
pbuf += 4;
pbuf += (mainGame->dInfo.lua64) ? 8 : 4;
return ReadReplayResponse();
}
case MSG_SELECT_OPTION: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += count * 4;
pbuf += count * (mainGame->dInfo.lua64) ? 8 : 4;
return ReadReplayResponse();
}
case MSG_SELECT_CARD:
......@@ -512,7 +513,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_SELECT_CHAIN: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += 10 + count * 13;
pbuf += 10 + count * (mainGame->dInfo.lua64) ? 17 : 13;
return ReadReplayResponse();
}
case MSG_SELECT_PLACE:
......@@ -709,7 +710,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_CHAINING: {
pbuf += 16;
pbuf += (mainGame->dInfo.lua64) ? 20 : 16;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
......@@ -899,16 +900,16 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
case MSG_ANNOUNCE_CARD_FILTER: {
player = BufferIO::ReadInt8(pbuf);
count = BufferIO::ReadInt8(pbuf);
pbuf += 4 * count;
pbuf += (mainGame->dInfo.lua64) ? 8 : 4 * count;
return ReadReplayResponse();
}
case MSG_CARD_HINT: {
pbuf += 9;
pbuf += (mainGame->dInfo.lua64) ? 13 : 9;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
case MSG_PLAYER_HINT: {
pbuf += 6;
pbuf += (mainGame->dInfo.lua64) ? 10 : 6;
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
}
......
......@@ -393,7 +393,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
ReplayHeader rh;
rh.id = 0x31707279;
rh.version = PRO_VERSION;
rh.flag = 0;
rh.flag = REPLAY_LUA64;
time_t seed = time(0);
rh.seed = seed;
last_replay.BeginRecord();
......
......@@ -81,7 +81,7 @@ int SingleMode::SinglePlayThread(void* param) {
ReplayHeader rh;
rh.id = 0x31707279;
rh.version = PRO_VERSION;
rh.flag = REPLAY_SINGLE_MODE;
rh.flag = REPLAY_SINGLE_MODE + REPLAY_LUA64;
rh.seed = seed;
mainGame->gMutex.Lock();
mainGame->HideElement(mainGame->wSinglePlay);
......
......@@ -352,7 +352,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
ReplayHeader rh;
rh.id = 0x31707279;
rh.version = PRO_VERSION;
rh.flag = REPLAY_TAG;
rh.flag = REPLAY_TAG + REPLAY_LUA64;
time_t seed = time(0);
rh.seed = seed;
last_replay.BeginRecord();
......
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