[2] | 1 | #ifndef _OBJECTS_HPP_ |
---|
| 2 | #define _OBJECTS_HPP_ |
---|
| 3 | #include "input.hpp" |
---|
| 4 | #include "chars.hpp" |
---|
| 5 | #include "sound.hpp" |
---|
| 6 | #include "morpher.hpp" |
---|
| 7 | #include "loader2.hpp" |
---|
| 8 | #include "view.hpp" |
---|
| 9 | #include "extend.hpp" |
---|
| 10 | |
---|
| 11 | class view; |
---|
| 12 | |
---|
| 13 | extern char **object_names; |
---|
| 14 | extern int total_objects; |
---|
| 15 | |
---|
| 16 | #define NOT_BLOCKED 0 |
---|
| 17 | #define BLOCKED_LEFT 1 |
---|
| 18 | #define BLOCKED_RIGHT 2 |
---|
| 19 | #define BLOCKED_UP 4 |
---|
| 20 | #define BLOCKED_DOWN 8 |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #define FIRST_ATTACK atk_fast |
---|
| 25 | #define LAST_ATTACK attack_special |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | #define RC_C 0 |
---|
| 31 | #define RC_S 1 |
---|
| 32 | #define RC_L 2 |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | #define TOTAL_OBJECT_VARS 28 |
---|
| 39 | struct obj_desc { char *name; int type; } ; |
---|
| 40 | extern obj_desc object_descriptions[TOTAL_OBJECT_VARS]; |
---|
| 41 | int RC_type_size(int type); |
---|
| 42 | //void init_object_offsets(); |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | class game_object : public simple_object |
---|
| 46 | { |
---|
| 47 | sequence *current_sequence() { return figures[otype]->get_sequence(state); } |
---|
| 48 | public : |
---|
| 49 | game_object *next,*next_active; |
---|
| 50 | long *lvars; |
---|
| 51 | |
---|
| 52 | int size(); |
---|
| 53 | int decide(); // returns 0 if you want to be deleted |
---|
| 54 | int type() { return otype; } |
---|
| 55 | ifield *make_fields(int ystart, ifield *Next) { return NULL ; } |
---|
| 56 | void gather_input(input_manager *inm) { ; } |
---|
| 57 | int hurt_all() { return figures[otype]->get_cflag(CFLAG_HURT_ALL); } |
---|
| 58 | int stoppable() { return figures[otype]->get_cflag(CFLAG_STOPPABLE); } |
---|
| 59 | int can_block() { return figures[otype]->get_cflag(CFLAG_CAN_BLOCK); } |
---|
| 60 | |
---|
| 61 | int hurtable() { return figures[otype]->get_cflag(CFLAG_HURTABLE); } |
---|
| 62 | int pushable() { return figures[otype]->get_cflag(CFLAG_PUSHABLE); } |
---|
| 63 | |
---|
| 64 | void draw(); |
---|
| 65 | void map_draw(); |
---|
| 66 | void draw_trans(int count, int max); |
---|
| 67 | void draw_tint(int tint_id); |
---|
| 68 | void draw_double_tint(int tint_id1, int tint_id2); |
---|
| 69 | void draw_predator(); |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | void drawer(); |
---|
| 73 | void draw_above(view *v); |
---|
| 74 | void do_damage(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel); |
---|
| 75 | void damage_fun(int amount, game_object *from, long hitx, long hity, long push_xvel, long push_yvel); |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | void note_attack(game_object *whom); |
---|
| 79 | void recieve_signal(long singal) { ; } |
---|
| 80 | int push_range(); |
---|
| 81 | int can_hurt(game_object *who); // collision checking will ask first to see if you |
---|
| 82 | // can hurt this person before calculating weither you actually do |
---|
| 83 | |
---|
| 84 | void load(int type, bFILE *fp, unsigned char *state_remap); |
---|
| 85 | int tick(); // should be called from decide, does the physics on the people, returns blocked status |
---|
| 86 | void *float_tick(); // returns T or blocked structure = |
---|
| 87 | // (block_flags 'tile tilex tiley) |
---|
| 88 | // (block_flags 'object obj) |
---|
| 89 | |
---|
| 90 | void next_sequence(); |
---|
| 91 | |
---|
| 92 | int facing_attacker(int attackerx); |
---|
| 93 | void set_state(character_state s, int frame_direction=1); |
---|
| 94 | int has_sequence(character_state s) { return figures[otype]->has_sequence(s); } |
---|
| 95 | |
---|
| 96 | game_object *try_move(long x, long y, long &xv, long &yv, int checks); // 1=down,2=up,3=both |
---|
| 97 | game_object *bmove(int &whit, game_object *exclude); // ballestic move, return hit object, |
---|
| 98 | // or NULL (whit is 1 if hit wall) |
---|
| 99 | trans_image *picture() { return current_sequence()->get_frame(current_frame,direction); } |
---|
| 100 | |
---|
| 101 | int next_picture(); |
---|
| 102 | long x_center(); |
---|
| 103 | long height(); |
---|
| 104 | |
---|
| 105 | void stop_acel() { set_xacel(0); set_yacel(0); set_fxacel(0); set_fyacel(0); } |
---|
| 106 | void stop_vel() { set_xvel(0); set_yvel(0); set_fxvel(0); set_fyvel(0); } |
---|
| 107 | void stop_x() { set_xvel(0); set_fxvel(0); set_xacel(0); set_fxacel(0); } |
---|
| 108 | void stop() |
---|
| 109 | { set_xvel(0); set_yvel(0); set_fxvel(0); set_fyvel(0); |
---|
| 110 | set_xacel(0); set_yacel(0); set_fxacel(0); set_fyacel(0); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | int move(int cx, int cy, int button); // return blocked status |
---|
| 114 | int mover(int cx, int cy, int button); |
---|
| 115 | figure *current_figure() { return current_sequence()->get_figure(current_frame); } |
---|
| 116 | int total_frames() { return current_sequence()->length(); } |
---|
| 117 | void picture_space(long &x1, long &y1,long &x2, long &y2); |
---|
| 118 | int tx(int x) { if (direction>0) return x-x_center(); else return x_center()-x; } |
---|
| 119 | int ty(int y) { return y-picture()->height()+1; } |
---|
| 120 | void defaults(); |
---|
| 121 | game_object(int Type, int load=0); |
---|
| 122 | int is_playable() { return hurtable(); } |
---|
| 123 | void add_power(int amount); |
---|
| 124 | void add_hp(int amount); |
---|
| 125 | int can_morph_into(int type); |
---|
| 126 | void morph_into(int type, void (*stat_fun)(int), int anneal, int frames); |
---|
| 127 | void do_flinch(game_object *from); |
---|
| 128 | void set_aimemory(game_object *p) { add_object(p); p->set_flags(p->flags()|KNOWN_FLAG); } |
---|
| 129 | int alive() { if (state==dead || hp()<=0) return 0; else return 1; } |
---|
| 130 | void frame_advance(); |
---|
| 131 | object_node *make_not_list(object_node *first); |
---|
| 132 | int reduced_state(); |
---|
| 133 | void reload_notify(); |
---|
| 134 | |
---|
| 135 | void change_type(int new_type); |
---|
| 136 | int set_var_by_name(char *name, long value); |
---|
| 137 | long get_var_by_name(char *name, int &error); |
---|
| 138 | game_object *copy(); |
---|
| 139 | void change_aitype(int new_type); |
---|
| 140 | ~game_object(); |
---|
| 141 | } ; |
---|
| 142 | |
---|
| 143 | class object_node // used to create various list of objects |
---|
| 144 | { |
---|
| 145 | public : |
---|
| 146 | game_object *me; |
---|
| 147 | object_node *next; |
---|
| 148 | object_node(game_object *Me, object_node *Next) { me=Me; next=Next; } |
---|
| 149 | } ; |
---|
| 150 | |
---|
| 151 | extern game_object *current_object; |
---|
| 152 | extern view *current_view; |
---|
| 153 | game_object *create(int type, long x, long y, int skip_constructor=0, int aitype=0); |
---|
| 154 | int base_size(); |
---|
| 155 | |
---|
| 156 | void delete_object_list(object_node *first); |
---|
| 157 | int object_to_number_in_list(game_object *who, object_node *list); |
---|
| 158 | game_object *number_to_object_in_list(long x, object_node *list); |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | #endif |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | |
---|