Commit 68c7985f authored by fluorohydride's avatar fluorohydride

submodule

parent cf93f6c3
[submodule "ocgcore"]
path = ocgcore
url = git@github.com:Fluorohydride/ygopro-core.git
Subproject commit e8420f07388d2f47adab11ba8d3fd5d3462837dd
This diff is collapsed.
This diff is collapsed.
/*
* common.h
*
* Created on: 2009-1-7
* Author: Argon.Sun
*/
#ifndef COMMON_H_
#define COMMON_H_
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#endif
typedef unsigned long uptr;
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef unsigned char byte;
typedef long ptr;
typedef long long int64;
typedef int int32;
typedef short int16;
typedef char int8;
typedef int BOOL;
#define MATCH_ALL(x,y) (((x)&(y))==(y))
#define MATCH_ANY(x,y) ((x)&(y))
#define ADD_BIT(x,y) ((x)|=(y))
#define REMOVE_BIT(x,y) ((x)&=~(y))
#define OPERATION_SUCCESS 1
#define OPERATION_FAIL 0
#define OPERATION_CANCELED -1
#define TRUE 1
#define FALSE 0
#ifndef NULL
#define NULL 0
#endif
struct card_sort {
bool operator()(void* const & c1, void* const & c2) const;
};
#endif /* COMMON_H_ */
/*
* duel.cpp
*
* Created on: 2010-5-2
* Author: Argon
*/
#include "duel.h"
#include "interpreter.h"
#include "field.h"
#include "card.h"
#include "effect.h"
#include "group.h"
#include "ocgapi.h"
#include <memory.h>
duel::duel() {
lua = new interpreter(this);
game_field = new field(this);
game_field->temp_card = new_card(0);
clear_buffer();
}
duel::~duel() {
for(std::set<card*>::iterator cit = cards.begin(); cit != cards.end(); ++cit)
delete *cit;
for(std::set<group*>::iterator git = groups.begin(); git != groups.end(); ++git)
delete *git;
for(std::set<effect*>::iterator eit = effects.begin(); eit != effects.end(); ++eit)
delete *eit;
delete lua;
delete game_field;
}
void duel::clear() {
for(std::set<card*>::iterator cit = cards.begin(); cit != cards.end(); ++cit)
delete *cit;
for(std::set<group*>::iterator git = groups.begin(); git != groups.end(); ++git)
delete *git;
for(std::set<effect*>::iterator eit = effects.begin(); eit != effects.end(); ++eit)
delete *eit;
delete game_field;
cards.clear();
groups.clear();
effects.clear();
game_field = new field(this);
game_field->temp_card = new_card(0);
}
card* duel::new_card(uint32 code) {
card* pcard = new card(this);
cards.insert(pcard);
if(code)
::read_card(code, &(pcard->data));
pcard->data.code = code;
lua->register_card(pcard);
return pcard;
}
group* duel::register_group(group* pgroup) {
groups.insert(pgroup);
if(lua->call_depth)
sgroups.insert(pgroup);
lua->register_group(pgroup);
return pgroup;
}
group* duel::new_group() {
group* pgroup = new group(this);
return register_group(pgroup);
}
group* duel::new_group(card* pcard) {
group* pgroup = new group(this, pcard);
return register_group(pgroup);
}
group* duel::new_group(const card_set& cset) {
group* pgroup = new group(this, cset);
return register_group(pgroup);
}
effect* duel::new_effect() {
effect* peffect = new effect(this);
effects.insert(peffect);
lua->register_effect(peffect);
return peffect;
}
void duel::delete_card(card* pcard) {
cards.erase(pcard);
delete pcard;
}
void duel::delete_group(group* pgroup) {
lua->unregister_group(pgroup);
groups.erase(pgroup);
sgroups.erase(pgroup);
delete pgroup;
}
void duel::delete_effect(effect* peffect) {
lua->unregister_effect(peffect);
effects.erase(peffect);
delete peffect;
}
int32 duel::read_buffer(byte* buf) {
memcpy(buf, buffer, bufferlen);
return bufferlen;
}
void duel::release_script_group() {
std::set<group*>::iterator sit;
for(sit = sgroups.begin(); sit != sgroups.end(); ++sit) {
group* pgroup = *sit;
if(pgroup->is_readonly == 0) {
lua->unregister_group(pgroup);
groups.erase(pgroup);
delete pgroup;
}
}
sgroups.clear();
}
void duel::restore_assumes() {
std::set<card*>::iterator sit;
for(sit = assumes.begin(); sit != assumes.end(); ++sit)
(*sit)->assume_type = 0;
assumes.clear();
}
void duel::write_buffer32(uint32 value) {
*((uint32*)bufferp) = value;
bufferp += 4;
bufferlen += 4;
}
void duel::write_buffer16(uint16 value) {
*((uint16*)bufferp) = value;
bufferp += 2;
bufferlen += 2;
}
void duel::write_buffer8(uint8 value) {
*((uint8*)bufferp) = value;
bufferp += 1;
bufferlen += 1;
}
void duel::clear_buffer() {
bufferlen = 0;
bufferp = buffer;
}
void duel::set_responsei(uint32 resp) {
game_field->returns.ivalue[0] = resp;
}
void duel::set_responseb(byte* resp) {
memcpy(game_field->returns.bvalue, resp, 64);
}
int32 duel::get_next_integer(int32 l, int32 h) {
return (int32) (random.real() * (h - l + 1)) + l;
}
/*
* duel.h
*
* Created on: 2010-4-8
* Author: Argon
*/
#ifndef DUEL_H_
#define DUEL_H_
#include "common.h"
#include "mtrandom.h"
#include <set>
class card;
class group;
class effect;
class field;
class interpreter;
struct duel_arg {
int16 start_lp;
int8 start_hand;
int8 draw_count;
};
class duel {
public:
typedef std::set<card*, card_sort> card_set;
char strbuffer[256];
byte buffer[0x1000];
uint32 bufferlen;
byte* bufferp;
interpreter* lua;
field* game_field;
mtrandom random;
std::set<card*> cards;
std::set<card*> assumes;
std::set<group*> groups;
std::set<group*> sgroups;
std::set<effect*> effects;
std::set<effect*> uncopy;
duel();
~duel();
void clear();
card* new_card(uint32 code);
group* new_group();
group* new_group(card* pcard);
group* new_group(const card_set& cset);
effect* new_effect();
void delete_card(card* pcard);
void delete_group(group* pgroup);
void delete_effect(effect* peffect);
void release_script_group();
void restore_assumes();
int32 read_buffer(byte* buf);
void write_buffer32(uint32 value);
void write_buffer16(uint16 value);
void write_buffer8(uint8 value);
void clear_buffer();
void set_responsei(uint32 resp);
void set_responseb(byte* resp);
int32 get_next_integer(int32 l, int32 h);
private:
group* register_group(group* pgroup);
};
//Player
#define PLAYER_NONE 2 //
#define PLAYER_ALL 3 //
//Phase
#define PHASE_DRAW 0x01 //
#define PHASE_STANDBY 0x02 //
#define PHASE_MAIN1 0x04 //
#define PHASE_BATTLE 0x08 //
#define PHASE_DAMAGE 0x10 //
#define PHASE_DAMAGE_CAL 0x20 //
#define PHASE_MAIN2 0x40 //
#define PHASE_END 0x80 //
//Options
#define DUEL_TEST_MODE 0x01
#define DUEL_ATTACK_FIRST_TURN 0x02
#define DUEL_NO_CHAIN_HINT 0x04
#define DUEL_OBSOLETE_RULING 0x08
#define DUEL_PSEUDO_SHUFFLE 0x10
#define DUEL_TAG_MODE 0x20
#define DUEL_SIMPLE_AI 0x40
#endif /* DUEL_H_ */
This diff is collapsed.
This diff is collapsed.
/*
* effectset.h
*
* Created on: 2011-10-8
* Author: Argon
*/
#ifndef EFFECTSET_H_
#define EFFECTSET_H_
#include <stdlib.h>
#include <array>
#include <vector>
#include <algorithm>
class effect;
bool effect_sort_id(const effect* e1, const effect* e2);
struct effect_set {
effect_set(): count(0) {}
void add_item(effect* peffect) {
if(count >= 64) return;
container[count++] = peffect;
}
void remove_item(int index) {
if(index >= count)
return;
if(index == count - 1) {
count--;
return;
}
for(int i = index; i < count - 1; ++i)
container[i] = container[i + 1];
count--;
}
void clear() {
count = 0;
}
int size() const {
return count;
}
void sort() {
if(count < 2)
return;
std::sort(container.begin(), container.begin() + count, effect_sort_id);
}
effect* const& get_last() const {
return container[count - 1];
}
effect*& get_last() {
return container[count - 1];
}
effect* const& operator[] (int index) const {
return container[index];
}
effect*& operator[] (int index) {
return container[index];
}
effect* const& at(int index) const {
return container[index];
}
effect*& at(int index) {
return container[index];
}
private:
std::array<effect*, 64> container;
int count;
};
struct effect_set_v {
effect_set_v(): count(0) {}
void add_item(effect* peffect) {
container.push_back(peffect);
count++;
}
void remove_item(int index) {
if(index >= count)
return;
container.erase(container.begin() + index);
count--;
}
void clear() {
container.clear();
count = 0;
}
void sort() {
if(count < 2)
return;
std::sort(container.begin(), container.begin() + count, effect_sort_id);
}
effect*& get_last() {
return container[count - 1];
}
effect*& operator[] (int index) {
return container[index];
}
effect*& at(int index) {
return container[index];
}
std::vector<effect*> container;
int count;
};
#endif //EFFECTSET_H_
This diff is collapsed.
This diff is collapsed.
/*
* group.cpp
*
* Created on: 2010-8-3
* Author: Argon
*/
#include "group.h"
#include "card.h"
#include "duel.h"
group::group(duel* pd) {
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::group(duel* pd, card* pcard) {
container.insert(pcard);
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::group(duel* pd, const card_set& cset): container(cset) {
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::~group() {
}
/*
* group.h
*
* Created on: 2010-5-6
* Author: Argon
*/
#ifndef GROUP_H_
#define GROUP_H_
#include "common.h"
#include <set>
#include <list>
class card;
class duel;
class group {
public:
typedef std::set<card*, card_sort> card_set;
int32 scrtype;
int32 ref_handle;
duel* pduel;
card_set container;
card_set::iterator it;
uint32 is_readonly;
inline bool has_card(card* c) {
return container.find(c) != container.end();
}
explicit group(duel* pd);
group(duel* pd, card* pcard);
group(duel* pd, const card_set& cset);
~group();
};
#endif /* GROUP_H_ */
This diff is collapsed.
/*
* interpreter.h
*
* Created on: 2010-4-28
* Author: Argon
*/
#ifndef INTERPRETER_H_
#define INTERPRETER_H_
extern "C" {
#ifdef WIN32
#include <lua/lua.h>
#include <lua/lauxlib.h>
#include <lua/lualib.h>
#else
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#endif
}
#include "common.h"
#include <unordered_map>
#include <list>
class card;
class effect;
class group;
class duel;
class interpreter {
public:
typedef std::unordered_map<int32, lua_State*> coroutine_map;
typedef std::list<std::pair<void*, uint32> > param_list;
duel* pduel;
char msgbuf[64];
lua_State* lua_state;
lua_State* current_state;
param_list params;
param_list resumes;
coroutine_map coroutines;
int32 no_action;
int32 call_depth;
explicit interpreter(duel* pd);
~interpreter();
int32 register_card(card *pcard);
void register_effect(effect* peffect);
void unregister_effect(effect* peffect);
void register_group(group* pgroup);
void unregister_group(group* pgroup);
int32 load_script(char* buffer);
int32 load_card_script(uint32 code);
void add_param(void* param, int32 type, bool front = false);
void add_param(ptr param, int32 type, bool front = false);
void push_param(lua_State* L, bool is_coroutine = false);
int32 call_function(int32 f, uint32 param_count, uint32 ret_count);
int32 call_card_function(card *pcard, char *f, uint32 param_count, uint32 ret_count);
int32 call_code_function(uint32 code, char *f, uint32 param_count, uint32 ret_count);
int32 check_condition(int32 f, uint32 param_count);
int32 check_matching(card* pcard, int32 findex, int32 extraargs);
int32 get_operation_value(card* pcard, int32 findex, int32 extraargs);
int32 get_function_value(int32 f, uint32 param_count);
int32 call_coroutine(int32 f, uint32 param_count, uint32* yield_value, uint16 step);
static void card2value(lua_State* L, card* pcard);
static void group2value(lua_State* L, group* pgroup);
static void effect2value(lua_State* L, effect* peffect);
static void function2value(lua_State* L, int32 pointer);
static int32 get_function_handle(lua_State* L, int32 index);
static void set_duel_info(lua_State* L, duel* pduel);
static duel* get_duel_info(lua_State* L);
};
#define PARAM_TYPE_INT 0x01
#define PARAM_TYPE_STRING 0x02
#define PARAM_TYPE_CARD 0x04
#define PARAM_TYPE_GROUP 0x08
#define PARAM_TYPE_EFFECT 0x10
#define PARAM_TYPE_FUNCTION 0x20
#define PARAM_TYPE_BOOLEAN 0x40
#define PARAM_TYPE_INDEX 0x80
#define COROUTINE_FINISH 1
#define COROUTINE_YIELD 2
#define COROUTINE_ERROR 3
#endif /* INTERPRETER_H_ */
This diff is collapsed.
/*
* libdebug.cpp
*
* Created on: 2012-2-8
* Author: Argon
*/
#include <string.h>
#include "scriptlib.h"
#include "duel.h"
#include "field.h"
#include "card.h"
#include "effect.h"
#include "ocgapi.h"
int32 scriptlib::debug_message(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
lua_getglobal(L, "tostring");
lua_pushvalue(L, -2);
lua_pcall(L, 1, 1, 0);
sprintf(pduel->strbuffer, "%s", lua_tostring(L, -1));
handle_message(pduel, 2);
return 0;
}
int32 scriptlib::debug_add_card(lua_State *L) {
check_param_count(L, 6);
duel* pduel = interpreter::get_duel_info(L);
int32 code = lua_tointeger(L, 1);
int32 owner = lua_tointeger(L, 2);
int32 playerid = lua_tointeger(L, 3);
int32 location = lua_tointeger(L, 4);
int32 sequence = lua_tointeger(L, 5);
int32 position = lua_tointeger(L, 6);
int32 proc = lua_toboolean(L, 7);
if(owner != 0 && owner != 1)
return 0;
if(playerid != 0 && playerid != 1)
return 0;
if(pduel->game_field->is_location_useable(playerid, location, sequence)) {
card* pcard = pduel->new_card(code);
pcard->owner = owner;
pduel->game_field->add_card(playerid, pcard, location, sequence);
pcard->current.position = position;
if(!(location & LOCATION_ONFIELD) || (position & POS_FACEUP)) {
pcard->enable_field_effect(TRUE);
pduel->game_field->adjust_instant();
}
if((pcard->data.type & TYPE_PENDULUM) && (location == LOCATION_EXTRA) && (position & POS_FACEUP))
pduel->game_field->player[playerid].extra_p_count += 1;
if(proc)
pcard->set_status(STATUS_PROC_COMPLETE, TRUE);
interpreter::card2value(L, pcard);
return 1;
} else if(location == LOCATION_MZONE) {
card* pcard = pduel->new_card(code);
pcard->owner = owner;
card* fcard = pduel->game_field->get_field_card(playerid, location, sequence);
fcard->xyz_materials.push_back(pcard);
pcard->overlay_target = fcard;
pcard->current.controler = PLAYER_NONE;
pcard->current.location = LOCATION_OVERLAY;
pcard->current.sequence = fcard->xyz_materials.size() - 1;
interpreter::card2value(L, pcard);
return 1;
}
return 0;
}
int32 scriptlib::debug_set_player_info(lua_State *L) {
check_param_count(L, 4);
duel* pduel = interpreter::get_duel_info(L);
uint32 playerid = lua_tointeger(L, 1);
uint32 lp = lua_tointeger(L, 2);
uint32 startcount = lua_tointeger(L, 3);
uint32 drawcount = lua_tointeger(L, 4);
if(playerid != 0 && playerid != 1)
return 0;
pduel->game_field->player[playerid].lp = lp;
pduel->game_field->player[playerid].start_count = startcount;
pduel->game_field->player[playerid].draw_count = drawcount;
return 0;
}
int32 scriptlib::debug_pre_equip(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_CARD, 2);
card* equip_card = *(card**) lua_touserdata(L, 1);
card* target = *(card**) lua_touserdata(L, 2);
if((equip_card->current.location != LOCATION_SZONE)
|| (target->current.location != LOCATION_MZONE)
|| (target->current.position & POS_FACEDOWN))
lua_pushboolean(L, 0);
else {
equip_card->equip(target, FALSE);
equip_card->effect_target_cards.insert(target);
target->effect_target_owner.insert(equip_card);
lua_pushboolean(L, 1);
}
return 1;
}
int32 scriptlib::debug_pre_set_target(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
check_param(L, PARAM_TYPE_CARD, 2);
card* t_card = *(card**) lua_touserdata(L, 1);
card* target = *(card**) lua_touserdata(L, 2);
t_card->add_card_target(target);
return 0;
}
int32 scriptlib::debug_pre_add_counter(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 ctype = lua_tointeger(L, 2);
uint32 ccount = lua_tointeger(L, 3);
pcard->counters[ctype] += ccount;
return 0;
}
int32 scriptlib::debug_reload_field_begin(lua_State *L) {
check_param_count(L, 1);
duel* pduel = interpreter::get_duel_info(L);
uint32 flag = lua_tointeger(L, 1);
pduel->clear();
pduel->game_field->core.duel_options = flag;
return 0;
}
int32 scriptlib::debug_reload_field_end(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->core.shuffle_hand_check[0] = FALSE;
pduel->game_field->core.shuffle_hand_check[1] = FALSE;
pduel->game_field->core.shuffle_deck_check[0] = FALSE;
pduel->game_field->core.shuffle_deck_check[1] = FALSE;
pduel->game_field->reload_field_info();
return 0;
}
int32 scriptlib::debug_set_ai_name(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_STRING, 1);
duel* pduel = interpreter::get_duel_info(L);
pduel->write_buffer8(MSG_AI_NAME);
const char* pstr = lua_tostring(L, 1);
int len = strlen(pstr);
if(len > 100)
len = 100;
pduel->write_buffer16(len);
memcpy(pduel->bufferp, pstr, len);
pduel->bufferp += len;
pduel->bufferlen += len;
pduel->write_buffer8(0);
return 0;
}
int32 scriptlib::debug_show_hint(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_STRING, 1);
duel* pduel = interpreter::get_duel_info(L);
pduel->write_buffer8(MSG_SHOW_HINT);
const char* pstr = lua_tostring(L, 1);
int len = strlen(pstr);
if(len > 1024)
len = 1024;
pduel->write_buffer16(len);
memcpy(pduel->bufferp, pstr, len);
pduel->bufferp += len;
pduel->bufferlen += len;
pduel->write_buffer8(0);
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* mem.cpp
*
* Created on: 2011-9-8
* Author: argon
*/
//#define USE_TCMALLOC
#ifdef USE_TCMALLOC
#define PERFTOOLS_DLL_DECL
#include <tcmalloc.h>
void* operator new(size_t size) {
return tc_malloc(size);
}
void* operator new[](size_t size) {
return tc_malloc(size);
}
void* operator new(size_t size, const std::nothrow_t& nt) {
return tc_malloc(size);
}
void* operator new[](size_t size, const std::nothrow_t& nt) {
return tc_malloc(size);
}
void operator delete(void* p) {
return tc_free(p);
}
void operator delete[](void* p) {
return tc_free(p);
}
void operator delete(void* p, const std::nothrow_t& nt) {
return tc_free(p);
}
void operator delete[](void* p, const std::nothrow_t& nt) {
return tc_free(p);
}
#endif //USE_TCMALLOC
/*
* mtrandom.h
*
* Created on: 2009-10-18
* Author: Argon.Sun
*/
#ifndef MTRANDOM_H_
#define MTRANDOM_H_
//Mersenne Twister
class mtrandom {
public:
mtrandom() :
left(1) {
init();
}
explicit mtrandom(unsigned int seed) :
left(1) {
init(seed);
}
mtrandom(unsigned int* init_key, int key_length) :
left(1) {
int i = 1, j = 0;
int k = N > key_length ? N : key_length;
init();
for (; k; --k) {
state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30))
* 1664525UL)) + init_key[j] + j; // non linear
state[i] &= 4294967295UL;
++i;
++j;
if (i >= N) {
state[0] = state[N - 1];
i = 1;
}
if (j >= key_length)
j = 0;
}
for (k = N - 1; k; --k) {
state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30))
* 1566083941UL)) - i;
state[i] &= 4294967295UL;
++i;
if (i >= N) {
state[0] = state[N - 1];
i = 1;
}
}
state[0] = 2147483648UL;
}
void reset(unsigned int rs) {
init(rs);
next_state();
}
unsigned int rand() {
unsigned int y;
if (0 == --left)
next_state();
y = *next++;
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680UL;
y ^= (y << 15) & 0xefc60000UL;
y ^= (y >> 18);
return y;
}
double real() {
return (double) rand() / 0xffffffffUL;
}
double res53() {
unsigned int a = rand() >> 5, b = rand() >> 6;
return (a * 67108864.0 + b) / 9007199254740992.0;
}
void init(unsigned int seed = 19650218UL) {
state[0] = seed & 4294967295UL;
for (int j = 1; j < N; ++j) {
state[j] = (1812433253UL * (state[j - 1] ^ (state[j - 1] >> 30))
+ j);
state[j] &= 4294967295UL; // for >32 bit machines
}
}
private:
void next_state() {
unsigned int* p = state;
int i;
for (i = N - M + 1; --i; ++p)
*p = (p[M] ^ twist(p[0], p[1]));
for (i = M; --i; ++p)
*p = (p[M - N] ^ twist(p[0], p[1]));
*p = p[M - N] ^ twist(p[0], state[0]);
left = N;
next = state;
}
unsigned int mixbits(unsigned int u, unsigned int v) const {
return (u & 2147483648UL) | (v & 2147483647UL);
}
unsigned int twist(unsigned int u, unsigned int v) const {
return ((mixbits(u, v) >> 1) ^ (v & 1UL ? 2567483615UL : 0UL));
}
static const int N = 624, M = 397;
unsigned int state[N];
unsigned int left;
unsigned int* next;
};
#endif /* MTRANDOM_H_ */
This diff is collapsed.
/*
* interface.h
*
* Created on: 2010-4-28
* Author: Argon
*/
#ifndef OCGAPI_H_
#define OCGAPI_H_
#include "common.h"
#ifdef WIN32
#include <windows.h>
#define DECL_DLLEXPORT __declspec(dllexport)
#else
#define DECL_DLLEXPORT
#endif
class card;
struct card_data;
struct card_info;
class group;
class effect;
class interpreter;
typedef byte* (*script_reader)(const char*, int*);
typedef uint32 (*card_reader)(uint32, card_data*);
typedef uint32 (*message_handler)(void*, uint32);
extern "C" DECL_DLLEXPORT void set_script_reader(script_reader f);
extern "C" DECL_DLLEXPORT void set_card_reader(card_reader f);
extern "C" DECL_DLLEXPORT void set_message_handler(message_handler f);
byte* read_script(const char* script_name, int* len);
uint32 read_card(uint32 code, card_data* data);
uint32 handle_message(void* pduel, uint32 message_type);
extern "C" DECL_DLLEXPORT ptr create_duel(uint32 seed);
extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int32 options);
extern "C" DECL_DLLEXPORT void end_duel(ptr pduel);
extern "C" DECL_DLLEXPORT void set_player_info(ptr pduel, int32 playerid, int32 lp, int32 startcount, int32 drawcount);
extern "C" DECL_DLLEXPORT void get_log_message(ptr pduel, byte* buf);
extern "C" DECL_DLLEXPORT int32 get_message(ptr pduel, byte* buf);
extern "C" DECL_DLLEXPORT int32 process(ptr pduel);
extern "C" DECL_DLLEXPORT void new_card(ptr pduel, uint32 code, uint8 owner, uint8 playerid, uint8 location, uint8 sequence, uint8 position);
extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, uint8 location);
extern "C" DECL_DLLEXPORT int32 query_card(ptr pduel, uint8 playerid, uint8 location, uint8 sequence, int32 query_flag, byte* buf, int32 use_cache);
extern "C" DECL_DLLEXPORT int32 query_field_count(ptr pduel, uint8 playerid, uint8 location);
extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint8 location, int32 query_flag, byte* buf, int32 use_cache);
extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf);
extern "C" DECL_DLLEXPORT void set_responsei(ptr pduel, int32 value);
extern "C" DECL_DLLEXPORT void set_responseb(ptr pduel, byte* buf);
extern "C" DECL_DLLEXPORT int32 preload_script(ptr pduel, char* script, int32 len);
byte* default_script_reader(const char* script_name, int* len);
uint32 default_card_reader(uint32 code, card_data* data);
uint32 default_message_handler(void* pduel, uint32 msg_type);
#endif /* OCGAPI_H_ */
This diff is collapsed.
This diff is collapsed.
project "ocgcore"
kind "StaticLib"
files { "**.cc", "**.cpp", "**.c", "**.h" }
configuration "windows"
includedirs { ".." }
configuration "not vs*"
buildoptions { "-std=gnu++0x" }
configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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