Filthy newline drama?
[craw.git] / craw / d2_functions.hpp
blob1aed102bc27d463acbded637bedbd60bad5de160
1 #pragma once
3 #include <string>
4 #include <vector>
5 #include <ail/types.hpp>
6 #include "d2_data.hpp"
8 typedef std::vector<roster_unit> roster_vector;
10 void initialise_d2win_addresses(unsigned base);
11 void initialise_d2gfx_addresses(unsigned base);
12 void initialise_d2common_addresses(unsigned base);
13 void initialise_d2client_addresses(unsigned base);
14 void initialise_d2net_addresses(unsigned base);
15 void initialise_bnclient_addresses(unsigned base);
17 typedef unsigned (__fastcall * set_font_size_type)(unsigned new_size);
18 typedef void (__fastcall * draw_text_type)(wchar_t const * text, int x, int y, unsigned colour, int unknown);
19 typedef unsigned (__fastcall * get_text_width_type)(wchar_t const * text, unsigned * width, unsigned * file_number);
20 typedef void (__stdcall * draw_line_type)(int start_x, int start_y, int end_x, int end_y, unsigned colour, unsigned unknown);
21 typedef int (__stdcall * get_unit_stat_type)(unit * unit_pointer, unsigned stat, unsigned stat2);
22 typedef unit * (__stdcall * get_player_unit_type)();
23 typedef uchar (__stdcall * get_difficulty_type)();
24 typedef level_data * (__fastcall * get_level_type)(miscellaneous_act_data * act, unsigned level_number);
25 typedef automap_layer_type_2 * (__fastcall * get_layer_type)(unsigned level_number);
26 typedef void (__stdcall * add_room_data_tye)(act_data * act, unsigned level_id, unsigned x, unsigned y, room_data_type_1 * room);
27 typedef void (__stdcall * reveal_automap_room_type)(room_data_type_1 * room, unsigned clip_flag, void * layer);
28 typedef void (__stdcall * remove_room_data_type)(void * act, unsigned level_id, unsigned x, unsigned y, room_data_type_1 * room);
29 typedef void (__stdcall * initialise_level_type)(level_data * level);
30 typedef object_table_entry * (__stdcall * get_object_table_entry_type)(unsigned object_number);
31 typedef automap_cell * (__fastcall * new_automap_cell_type)();
32 typedef void (__fastcall * add_automap_cell_type)(automap_cell * cell, automap_cell ** node);
33 typedef void (__stdcall * send_packet_type)(std::size_t size, unsigned flags, char const * packet);
34 typedef void (__stdcall * leave_game_type)();
35 typedef unit * (__fastcall * get_unit_pointer_type)(unsigned id, unsigned type);
36 typedef unit * (__stdcall * get_inventory_item_type)(void * inventory);
37 typedef unit * (__stdcall * get_next_inventory_item_type)(unit * item);
38 typedef item_text * (__stdcall * get_item_text_type)(unsigned item_number);
39 typedef void (__stdcall * receive_packet_type)(char const * packet, std::size_t size);
40 typedef bool (__stdcall * get_item_name_type)(unit * item, wchar_t * buffer, std::size_t buffer_size);
41 typedef void (__stdcall * map_to_screen_coordinates_type)(int * x, int * y);
42 typedef void (__stdcall * click_map_type)(unsigned flags, int x, int y, unsigned type);
43 typedef unit * (__fastcall * find_server_side_unit_type)(unsigned id, unsigned type);
44 typedef unit * (__fastcall * find_client_side_unit_type)(unsigned id, unsigned type);
45 typedef unsigned (__stdcall * get_skill_level_type)(unit * unit_pointer, skill_data * skill_pointer, bool total);
46 typedef unsigned (__fastcall * get_unit_owner_type)(unsigned unit_id);
47 typedef int (__stdcall * get_unit_state_type)(unit * unit_pointer, unsigned state);
48 typedef void (__stdcall * print_chat_text_type)(wchar_t * message, unsigned colour);
50 extern set_font_size_type d2_set_font_size;
51 extern draw_text_type d2_draw_text;
52 extern get_text_width_type d2_get_text_width;
53 extern draw_line_type d2_draw_line;
54 extern get_unit_stat_type d2_get_unit_stat;
55 extern get_player_unit_type d2_get_player_unit;
56 extern get_difficulty_type d2_get_difficulty;
57 extern get_level_type d2_get_level;
58 extern get_layer_type d2_get_layer;
59 extern add_room_data_tye d2_add_room_data;
60 extern reveal_automap_room_type d2_reveal_automap_room;
61 extern remove_room_data_type d2_remove_room_data;
62 extern initialise_level_type d2_initialise_level;
63 extern get_object_table_entry_type d2_get_object_table_entry;
64 extern new_automap_cell_type d2_new_automap_cell;
65 extern add_automap_cell_type d2_add_automap_cell;
66 extern send_packet_type d2_send_packet;
67 extern leave_game_type d2_leave_game;
68 extern get_unit_pointer_type d2_get_unit_pointer;
69 extern get_inventory_item_type d2_get_inventory_item;
70 extern get_next_inventory_item_type d2_get_next_inventory_item;
71 extern get_item_text_type d2_get_item_text;
72 extern receive_packet_type d2_receive_packet;
73 extern get_item_name_type d2_get_item_name;
74 extern map_to_screen_coordinates_type d2_map_to_screen_coordinates;
75 extern click_map_type d2_click_map;
76 extern find_server_side_unit_type d2_find_server_side_unit;
77 extern find_client_side_unit_type d2_find_client_side_unit;
78 extern get_skill_level_type d2_get_skill_level;
79 extern get_unit_owner_type d2_get_unit_owner;
80 extern get_unit_state_type d2_get_unit_state;
81 extern print_chat_text_type d2_print_chat_text;
83 extern unsigned light_handler_address;
85 extern unsigned automap_handler_address;
86 extern unsigned automap_loop_address;
88 extern unsigned server_token_address;
90 extern unsigned
91 add_unit_address1,
92 add_unit_address2;
94 extern unsigned
95 item_handler_call_address;
97 extern unsigned
98 mouse_x_address,
99 mouse_y_address;
101 extern unsigned
102 unit_is_selectable_address,
103 unit_selection_data_address;
105 void draw_text(std::string const & text, int x, int y, unsigned colour, bool centered);
106 void __stdcall draw_box(int x, int y, unsigned colour);
107 bool get_life(unsigned & current_life, unsigned & maximum_life);
108 bool get_mana(unsigned & current_mana, unsigned & maximum_mana);
109 monster_statistics & get_monster_statistics(std::size_t index);
110 roster_unit * get_player_roster(unsigned player_id);
111 unit * get_player();
112 automap_layer * get_automap_layer();
113 automap_layer_type_2 * initialise_automap_layer(unsigned level_number);
114 automap_cell ** get_layer_objects_pointer();
115 bool get_player_level_number(unsigned & output);
116 bool get_player_id(unsigned & output);
117 wchar_t * get_unit_name(unit * unit_pointer);
118 bool get_name_by_id(unsigned id, std::string & output);
119 bool get_non_empty_tp_tome_id(unsigned & output);
120 bool player_is_in_game();
121 roster_vector get_roster_units();
122 bool get_item_name(unit * input, std::string & name, std::string & special_name);
123 void move_click(int x, int y);
124 bool get_unit_by_id(unsigned id, unsigned type, unit * & output);
125 bool get_skill_level(unsigned skill_id, unsigned & output);
126 bool get_minions(unsigned player_id, std::vector<unit> & output);
127 void print_chat_text(std::string const & message);