diff options
author | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
---|---|---|
committer | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
commit | f52e1007fe08c67003c0bc4c78231904dd3fd5cc (patch) | |
tree | 99907d827264e501774e58ab4630e41fa7103c02 /src/map/unit.h | |
parent | 2410110dece79b4598c12f1c953219f1d0d1904a (diff) | |
parent | 769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (diff) | |
download | hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.gz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.bz2 hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.xz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.zip |
Merge pull request #1 from HerculesWS/master
Update from original
Diffstat (limited to 'src/map/unit.h')
-rw-r--r-- | src/map/unit.h | 154 |
1 files changed, 68 insertions, 86 deletions
diff --git a/src/map/unit.h b/src/map/unit.h index 9d1c02a31..9b95bae41 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -1,18 +1,17 @@ -// Copyright (c) Athena Dev Teams - Licensed under GNU GPL -// For more information, see LICENCE in the main folder +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file +// Portions Copyright (c) Athena Dev Teams -#ifndef _UNIT_H_ -#define _UNIT_H_ - -//#include "map.h" -struct block_list; -struct unit_data; -struct map_session_data; +#ifndef MAP_UNIT_H +#define MAP_UNIT_H #include "clif.h" // clr_type -#include "map.h" // struct block_list #include "path.h" // struct walkpath_data -#include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset +#include "skill.h" // 'MAX_SKILLTIMERSKILL, struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset +#include "../common/cbasetypes.h" + +struct map_session_data; +struct block_list; struct unit_data { struct block_list *bl; @@ -30,10 +29,10 @@ struct unit_data { int target_to; int attacktimer; int walktimer; - int chaserange; - unsigned int attackabletime; - unsigned int canact_tick; - unsigned int canmove_tick; + int chaserange; + int64 attackabletime; + int64 canact_tick; + int64 canmove_tick; uint8 dir; unsigned char walk_count; unsigned char target_count; @@ -68,78 +67,61 @@ struct view_data { unsigned dead_sit : 2; }; -// PC, MOB, PET に共通する処理を1つにまとめる計画 - -// 歩行開始 -// 戻り値は、0 ( 成功 ), 1 ( 失敗 ) -int unit_walktoxy( struct block_list *bl, short x, short y, int easy); -int unit_walktobl( struct block_list *bl, struct block_list *target, int range, int easy); -int unit_run(struct block_list *bl); -int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir); - -// 歩行停止 -// typeは以下の組み合わせ : -// 1: 位置情報の送信( この関数の後に位置情報を送信する場合は不要 ) -// 2: ダメージディレイ有り -// 4: 不明(MOBのみ?) -int unit_stop_walking(struct block_list *bl,int type); -int unit_can_move(struct block_list *bl); -int unit_is_walking(struct block_list *bl); -int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type); - -int unit_escape(struct block_list *bl, struct block_list *target, short dist); -// 位置の強制移動(吹き飛ばしなど) -int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath); -int unit_warp(struct block_list *bl, short map, short x, short y, clr_type type); -int unit_setdir(struct block_list *bl,unsigned char dir); -uint8 unit_getdir(struct block_list *bl); -int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag); - -// そこまで歩行でたどり着けるかの判定 -bool unit_can_reach_pos(struct block_list *bl,int x,int y,int easy); -bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y); - -// 攻撃関連 -int unit_stop_attack(struct block_list *bl); -int unit_attack(struct block_list *src,int target_id,int continuous); -int unit_cancel_combo(struct block_list *bl); - -// スキル使用 -int unit_skilluse_id(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv); -int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv); - -// スキル使用( 補正済みキャスト時間、キャンセル不可設定付き ) -int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); -int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); - -// 詠唱キャンセル -int unit_skillcastcancel(struct block_list *bl,int type); - -int unit_counttargeted(struct block_list *bl); -int unit_set_target(struct unit_data* ud, int target_id); - -// unit_data の初期化処理 -void unit_dataset(struct block_list *bl); +extern const short dirx[8]; +extern const short diry[8]; -int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2); -// その他 -struct unit_data* unit_bl2ud(struct block_list *bl); -void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype); -void unit_free_pc(struct map_session_data *sd); -#define unit_remove_map(bl,clrtype) unit_remove_map_(bl,clrtype,__FILE__,__LINE__,__func__) -int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func); -int unit_free(struct block_list *bl, clr_type clrtype); -int unit_changeviewsize(struct block_list *bl,short size); +struct unit_interface { + int (*init) (bool minimal); + int (*final) (void); + /* */ + struct unit_data* (*bl2ud) (struct block_list *bl); + struct unit_data* (*bl2ud2) (struct block_list *bl); + int (*attack_timer) (int tid, int64 tick, int id, intptr_t data); + int (*walktoxy_timer) (int tid, int64 tick, int id, intptr_t data); + int (*walktoxy_sub) (struct block_list *bl); + int (*delay_walktoxy_timer) (int tid, int64 tick, int id, intptr_t data); + int (*walktoxy) (struct block_list *bl, short x, short y, int flag); + int (*walktobl_sub) (int tid, int64 tick, int id, intptr_t data); + int (*walktobl) (struct block_list *bl, struct block_list *tbl, int range, int flag); + bool (*run) (struct block_list *bl, struct map_session_data *sd, enum sc_type type); + void (*run_hit) (struct block_list *bl, struct status_change *sc, struct map_session_data *sd, enum sc_type type); + int (*escape) (struct block_list *bl, struct block_list *target, short dist); + int (*movepos) (struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath); + int (*setdir) (struct block_list *bl, unsigned char dir); + uint8 (*getdir) (struct block_list *bl); + int (*blown) (struct block_list *bl, int dx, int dy, int count, int flag); + int (*warp) (struct block_list *bl, short m, short x, short y, clr_type type); + int (*stop_walking) (struct block_list *bl, int type); + int (*skilluse_id) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv); + int (*is_walking) (struct block_list *bl); + int (*can_move) (struct block_list *bl); + int (*resume_running) (int tid, int64 tick, int id, intptr_t data); + int (*set_walkdelay) (struct block_list *bl, int64 tick, int delay, int type); + int (*skilluse_id2) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); + int (*skilluse_pos) (struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv); + int (*skilluse_pos2) (struct block_list *src, short skill_x, short skill_y, uint16 skill_id, uint16 skill_lv, int casttime, int castcancel); + int (*set_target) (struct unit_data *ud, int target_id); + int (*stop_attack) (struct block_list *bl); + int (*unattackable) (struct block_list *bl); + int (*attack) (struct block_list *src, int target_id, int continuous); + int (*cancel_combo) (struct block_list *bl); + bool (*can_reach_pos) (struct block_list *bl, int x, int y, int easy); + bool (*can_reach_bl) (struct block_list *bl, struct block_list *tbl, int range, int easy, short *x, short *y); + int (*calc_pos) (struct block_list *bl, int tx, int ty, uint8 dir); + int (*attack_timer_sub) (struct block_list *src, int tid, int64 tick); + int (*skillcastcancel) (struct block_list *bl, int type); + void (*dataset) (struct block_list *bl); + int (*counttargeted) (struct block_list *bl); + int (*fixdamage) (struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2); + int (*changeviewsize) (struct block_list *bl, short size); + int (*remove_map) (struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func); + void (*remove_map_pc) (struct map_session_data *sd, clr_type clrtype); + void (*free_pc) (struct map_session_data *sd); + int (*free) (struct block_list *bl, clr_type clrtype); +}; -// 初期化ルーチン -int do_init_unit(void); -int do_final_unit(void); -/** - * Ranger - **/ -int unit_wugdash(struct block_list *bl, struct map_session_data *sd); +struct unit_interface *unit; -extern const short dirx[8]; -extern const short diry[8]; +void unit_defaults(void); -#endif /* _UNIT_H_ */ +#endif /* MAP_UNIT_H */ |