Commit f1e3e93e authored by fallenstardust's avatar fallenstardust

sync ocgcore

parent 68a26517
...@@ -195,6 +195,8 @@ bool Game::Initialize() { ...@@ -195,6 +195,8 @@ bool Game::Initialize() {
lpcFont = irr::gui::CGUITTFont::createTTFont(driver, fs, gameConf.numfont, (int)48 * yScale, isAntialias, true); lpcFont = irr::gui::CGUITTFont::createTTFont(driver, fs, gameConf.numfont, (int)48 * yScale, isAntialias, true);
guiFont = irr::gui::CGUITTFont::createTTFont(driver, fs, gameConf.textfont, (int)gameConf.textfontsize * yScale, isAntialias, true); guiFont = irr::gui::CGUITTFont::createTTFont(driver, fs, gameConf.textfont, (int)gameConf.textfontsize * yScale, isAntialias, true);
textFont = guiFont; textFont = guiFont;
if(!numFont || !textFont)
return false;
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"[---]"); device->setWindowCaption(L"[---]");
device->setResizable(false); device->setResizable(false);
......
...@@ -18,6 +18,6 @@ project "ygopro" ...@@ -18,6 +18,6 @@ project "ygopro"
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=c++14", "-fno-rtti" } buildoptions { "-std=c++14", "-fno-rtti" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.3", "/usr/include/lua/5.3", "/usr/include/irrlicht", "/usr/include/freetype2" } includedirs { "/usr/include/irrlicht", "/usr/include/freetype2" }
excludes { "COSOperator.*" } excludes { "COSOperator.*" }
links { "event_pthreads", "GL", "dl", "pthread" } links { "event_pthreads", "GL", "dl", "pthread" }
...@@ -190,6 +190,7 @@ struct processor { ...@@ -190,6 +190,7 @@ struct processor {
event_list sub_solving_event; event_list sub_solving_event;
chain_array select_chains; chain_array select_chains;
chain_array current_chain; chain_array current_chain;
chain_array tmp_chains;
chain_list continuous_chain; chain_list continuous_chain;
chain_list solving_continuous; chain_list solving_continuous;
chain_list sub_solving_continuous; chain_list sub_solving_continuous;
...@@ -556,11 +557,11 @@ public: ...@@ -556,11 +557,11 @@ public:
int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type); int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type);
int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone); int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone);
int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone); int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone);
int32 destroy(uint16 step, group* targets, card* target, uint8 battle); int32 destroy_replace(uint16 step, group* targets, card* target, uint8 battle);
int32 destroy(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player); int32 destroy(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player);
int32 release(uint16 step, group* targets, card* target); int32 release_replace(uint16 step, group* targets, card* target);
int32 release(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player); int32 release(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player);
int32 send_to(uint16 step, group* targets, card* target); int32 send_replace(uint16 step, group* targets, card* target);
int32 send_to(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player); int32 send_to(uint16 step, group* targets, effect* reason_effect, uint32 reason, uint8 reason_player);
int32 discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reason); int32 discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reason);
int32 move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, uint32 is_equip, uint32 zone); int32 move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, uint32 is_equip, uint32 zone);
...@@ -707,9 +708,9 @@ public: ...@@ -707,9 +708,9 @@ public:
#define PROCESSOR_MOVETOFIELD 53 #define PROCESSOR_MOVETOFIELD 53
#define PROCESSOR_CHANGEPOS 54 #define PROCESSOR_CHANGEPOS 54
#define PROCESSOR_OPERATION_REPLACE 55 #define PROCESSOR_OPERATION_REPLACE 55
#define PROCESSOR_DESTROY_STEP 56 #define PROCESSOR_DESTROY_REPLACE 56
#define PROCESSOR_RELEASE_STEP 57 #define PROCESSOR_RELEASE_REPLACE 57
#define PROCESSOR_SENDTO_STEP 58 #define PROCESSOR_SENDTO_REPLACE 58
#define PROCESSOR_SUMMON_RULE 60 #define PROCESSOR_SUMMON_RULE 60
#define PROCESSOR_SPSUMMON_RULE 61 #define PROCESSOR_SPSUMMON_RULE 61
#define PROCESSOR_SPSUMMON 62 #define PROCESSOR_SPSUMMON 62
......
...@@ -608,9 +608,9 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -608,9 +608,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
luaL_getsubtable(lua_state, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); luaL_getsubtable(lua_state, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "io"); lua_setfield(lua_state, -2, "io");
luaL_getsubtable(lua_state, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "os"); lua_setfield(lua_state, -2, "os");
lua_pop(lua_state, 1);
//open all libs //open all libs
luaL_newlib(lua_state, cardlib); luaL_newlib(lua_state, cardlib);
lua_pushstring(lua_state, "__index"); lua_pushstring(lua_state, "__index");
......
...@@ -3087,9 +3087,7 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla ...@@ -3087,9 +3087,7 @@ int32 field::special_summon(uint16 step, effect* reason_effect, uint8 reason_pla
} }
return TRUE; return TRUE;
} }
// destroy: step version int32 field::destroy_replace(uint16 step, group* targets, card* target, uint8 battle) {
// PROCESSOR_DESTROY_STEP goes here
int32 field::destroy(uint16 step, group* targets, card* target, uint8 battle) {
if(target->current.location & (LOCATION_GRAVE | LOCATION_REMOVED)) { if(target->current.location & (LOCATION_GRAVE | LOCATION_REMOVED)) {
target->current.reason = target->temp.reason; target->current.reason = target->temp.reason;
target->current.reason_effect = target->temp.reason_effect; target->current.reason_effect = target->temp.reason_effect;
...@@ -3112,7 +3110,6 @@ int32 field::destroy(uint16 step, group* targets, card* target, uint8 battle) { ...@@ -3112,7 +3110,6 @@ int32 field::destroy(uint16 step, group* targets, card* target, uint8 battle) {
} }
return TRUE; return TRUE;
} }
// PROCESSOR_DESTROY goes here
int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
switch (step) { switch (step) {
case 0: { case 0: {
...@@ -3250,7 +3247,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3250,7 +3247,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
case 1: { case 1: {
for (auto& pcard : targets->container) { for (auto& pcard : targets->container) {
add_process(PROCESSOR_DESTROY_STEP, 0, NULL, targets, 0, 0, 0, 0, pcard); add_process(PROCESSOR_DESTROY_REPLACE, 0, NULL, targets, 0, 0, 0, 0, pcard);
} }
return FALSE; return FALSE;
} }
...@@ -3432,7 +3429,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3432,7 +3429,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
case 11: { case 11: {
for (auto& pcard : targets->container) { for (auto& pcard : targets->container) {
add_process(PROCESSOR_DESTROY_STEP, 0, NULL, targets, 0, TRUE, 0, 0, pcard); add_process(PROCESSOR_DESTROY_REPLACE, 0, NULL, targets, 0, TRUE, 0, 0, pcard);
} }
return FALSE; return FALSE;
} }
...@@ -3445,8 +3442,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3445,8 +3442,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
return TRUE; return TRUE;
} }
// PROCESSOR_RELEASE_STEP goes here int32 field::release_replace(uint16 step, group* targets, card* target) {
int32 field::release(uint16 step, group* targets, card* target) {
if(!(target->current.location & (LOCATION_ONFIELD | LOCATION_HAND))) { if(!(target->current.location & (LOCATION_ONFIELD | LOCATION_HAND))) {
target->current.reason = target->temp.reason; target->current.reason = target->temp.reason;
target->current.reason_effect = target->temp.reason_effect; target->current.reason_effect = target->temp.reason_effect;
...@@ -3465,7 +3461,6 @@ int32 field::release(uint16 step, group* targets, card* target) { ...@@ -3465,7 +3461,6 @@ int32 field::release(uint16 step, group* targets, card* target) {
} }
return TRUE; return TRUE;
} }
// PROCESSOR_RELEASE goes here
int32 field::release(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::release(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
switch (step) { switch (step) {
case 0: { case 0: {
...@@ -3490,7 +3485,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3490,7 +3485,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
} }
case 1: { case 1: {
for (auto& pcard : targets->container) { for (auto& pcard : targets->container) {
add_process(PROCESSOR_RELEASE_STEP, 0, NULL, targets, 0, 0, 0, 0, pcard); add_process(PROCESSOR_RELEASE_REPLACE, 0, NULL, targets, 0, 0, 0, 0, pcard);
} }
return FALSE; return FALSE;
} }
...@@ -3537,8 +3532,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3537,8 +3532,7 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
} }
return TRUE; return TRUE;
} }
// PROCESSOR_SENDTO_STEP goes here int32 field::send_replace(uint16 step, group * targets, card * target) {
int32 field::send_to(uint16 step, group * targets, card * target) {
uint8 playerid = target->sendto_param.playerid; uint8 playerid = target->sendto_param.playerid;
uint8 dest = target->sendto_param.location; uint8 dest = target->sendto_param.location;
if(targets->container.find(target) == targets->container.end()) if(targets->container.find(target) == targets->container.end())
...@@ -3559,9 +3553,6 @@ int32 field::send_to(uint16 step, group * targets, card * target) { ...@@ -3559,9 +3553,6 @@ int32 field::send_to(uint16 step, group * targets, card * target) {
} }
return TRUE; return TRUE;
} }
// PROCESSOR_SENDTO goes here
// step 1: call PROCESSOR_SENDTO_STEP
// step 6: move cards
int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) { int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint32 reason, uint8 reason_player) {
struct exargs { struct exargs {
group* targets; group* targets;
...@@ -3599,7 +3590,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3599,7 +3590,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
case 1: { case 1: {
for(auto& pcard : targets->container) { for(auto& pcard : targets->container) {
add_process(PROCESSOR_SENDTO_STEP, 0, NULL, targets, 0, 0, 0, 0, pcard); add_process(PROCESSOR_SENDTO_REPLACE, 0, NULL, targets, 0, 0, 0, 0, pcard);
} }
return FALSE; return FALSE;
} }
......
...@@ -310,22 +310,22 @@ int32 field::process() { ...@@ -310,22 +310,22 @@ int32 field::process() {
it->step++; it->step++;
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_DESTROY_STEP: { case PROCESSOR_DESTROY_REPLACE: {
if(destroy(it->step, it->ptarget, (card*)it->ptr1, it->arg2)) if(destroy_replace(it->step, it->ptarget, (card*)it->ptr1, it->arg2))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_RELEASE_STEP: { case PROCESSOR_RELEASE_REPLACE: {
if (release(it->step, it->ptarget, (card*)it->ptr1)) if (release_replace(it->step, it->ptarget, (card*)it->ptr1))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_SENDTO_STEP: { case PROCESSOR_SENDTO_REPLACE: {
if (send_to(it->step, it->ptarget, (card*)it->ptr1)) if (send_replace(it->step, it->ptarget, (card*)it->ptr1))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
...@@ -1879,7 +1879,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1879,7 +1879,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
newchain.set_triggering_place(phandler); newchain.set_triggering_place(phandler);
newchain.triggering_player = infos.turn_player; newchain.triggering_player = infos.turn_player;
core.select_chains.push_back(newchain); core.tmp_chains.push_back(newchain);
} }
} }
} }
...@@ -2038,6 +2038,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -2038,6 +2038,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
} }
case 2: { case 2: {
chain newchain; chain newchain;
if(core.tmp_chains.size())
core.select_chains.swap(core.tmp_chains);
for(auto evit = core.point_event.begin(); evit != core.instant_event.end(); ++evit) { for(auto evit = core.point_event.begin(); evit != core.instant_event.end(); ++evit) {
if(evit == core.point_event.end()) if(evit == core.point_event.end())
evit = core.instant_event.begin(); evit = core.instant_event.begin();
......
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