00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ADIKT_LEVSCRIPT_H
00021 #define ADIKT_LEVSCRIPT_H
00022
00023 struct LEVEL;
00024
00025 #include "globals.h"
00026
00027
00028
00029 enum cmd_groups {
00030
00031 CMD_UNKNOWN = 0x000,
00032 CMD_CONDIT = 0x001,
00033 CMD_PARTY = 0x002,
00034 CMD_AVAIL = 0x003,
00035 CMD_CUSTOBJ = 0x004,
00036 CMD_SETUP = 0x005,
00037 CMD_TRIGER = 0x006,
00038 CMD_CRTRADJ = 0x007,
00039 CMD_COMMNT = 0x008,
00040 CMD_OBSOLT = 0x009,
00041
00042
00043 CMD_PAROBJ = 0x010,
00044 CMD_FLAG = 0x012,
00045 CMD_TIMER = 0x013,
00046 CMD_DOOR = 0x014,
00047 CMD_TRAP = 0x015,
00048 CMD_SPELL = 0x016,
00049 CMD_VARIBL = 0x017,
00050 CMD_OPERATR = 0x018,
00051 CMD_CREATR = 0x019,
00052 CMD_ROOM = 0x01a,
00053 CMD_COMP = 0x01b,
00054 CMD_PLAYER = 0x01c,
00055 CMD_SPECIAL = 0x01d,
00056 CMD_OBJTYPE = 0x01e,
00057
00058
00059 CMD_ORIENT = 0x0fe,
00060 CMD_ADIKTED = 0x0ff,
00061 };
00062
00063
00064
00065
00066
00067
00068
00069
00070 enum cmnds_condit {
00071
00072 COND_IF = 0x001,
00073
00074 IF_AVAILABLE = 0x002,
00075
00076 IF_ACTNPT = 0x003,
00077
00078 COND_ENDIF = 0x004,
00079 };
00080
00081
00082 enum cmnds_party {
00083
00084 CREATE_PARTY = 0x001,
00085
00086 ADD_TUNNELER_TOLEV = 0x002,
00087
00088 ADD_TO_PARTY = 0x003,
00089
00090 ADD_PARTY_TOLEV = 0x004,
00091
00092 ADD_CREATR_TOLEV = 0x005,
00093
00094 ADD_TUNNELLER_PARTY_TOLEV= 0x006,
00095 };
00096
00097
00098 enum cmnds_avail {
00099
00100 ROOM_AVAIL = 0x001,
00101
00102 CREATR_AVAIL = 0x002,
00103
00104 MAGIC_AVAIL = 0x003,
00105
00106 TRAP_AVAIL = 0x004,
00107
00108 DOOR_AVAIL = 0x005,
00109 };
00110
00111
00112 enum cmnds_custobj {
00113
00114 DISPLAY_OBJECTV = 0x001,
00115
00116 DISPLAY_OBJECTV_WPOS=0x002,
00117
00118 DISPLAY_INFO = 0x003,
00119
00120 DISPLAY_INFO_WPOS = 0x004,
00121
00122 BONUS_LEV_TIME = 0x005,
00123
00124 TUTORIAL_FLASH_BTN = 0x006,
00125
00126 QUICK_OBJECTV = 0x007,
00127
00128 QUICK_INFO = 0x008,
00129 };
00130
00131
00132 enum cmnds_setup {
00133
00134 SET_GEN_SPEED = 0x001,
00135
00136 START_MONEY = 0x002,
00137
00138 RESEARCH = 0x003,
00139
00140 COMP_PLAYER = 0x004,
00141
00142 ALLY_PLAYERS = 0x005,
00143
00144 SET_HATE = 0x006,
00145
00146 SET_COMPUTER_GLOBALS= 0x007,
00147
00148 SET_COMPUTER_CHECKS = 0x008,
00149
00150 SET_COMPUTER_EVENT = 0x009,
00151
00152 SET_COMPUTER_PROCESS= 0x00a,
00153
00154 MAX_CREATURES = 0x00b,
00155 };
00156
00157
00158 enum cmnds_triger {
00159
00160 RESET_ACTNPT = 0x001,
00161
00162 NEXT_CMD_REUSABLE = 0x002,
00163
00164 SET_FLAG = 0x003,
00165
00166 SET_TIMER = 0x004,
00167
00168 GAME_LOSE = 0x005,
00169
00170 GAME_WIN = 0x006,
00171
00172 SET_MUSIC = 0x007,
00173 };
00174
00175
00176 enum cmnds_crtradj {
00177
00178 DEAD_CREATURES_RET_TO_POOL=0x001,
00179
00180 ADD_CREATR_TO_POOL = 0x002,
00181
00182 SET_CREATR_MAX_LEVEL=0x003,
00183
00184 SET_CREATR_STRENGTH= 0x004,
00185
00186 SET_CREATR_HEALTH = 0x005,
00187
00188 SET_CREATR_ARMOUR = 0x006,
00189
00190 SET_CREATR_FEAR = 0x007,
00191
00192 CREATR_SWAP = 0x008,
00193 };
00194
00195
00196 enum cmnds_comnt {
00197
00198 EMPTYLN = 0x001,
00199
00200 CMNT_REM = 0x002,
00201 };
00202
00203
00204 enum cmnds_obsolt {
00205 OBSOLT_PRINT = 0x001,
00206 CREATE_TEXT = 0x002,
00207 };
00208
00209
00210 enum cmnds_special {
00211 SPEC_RANDOM = 0x001,
00212 SPEC_NUMBER = 0x002,
00213 };
00214
00215
00216 enum cmnds_objtypes {
00217 OBJTYPE_CREATURE = 0x001,
00218 OBJTYPE_ROOM = 0x003,
00219 OBJTYPE_SPELL = 0x004,
00220 };
00221
00222
00223
00224
00225 #define ALL_DNGNS_DESTROYED 0x001
00226 #define CRTRS_SCAVNG_GAINED 0x002
00227 #define CRTRS_SCAVNG_LOST 0x003
00228 #define DOORS_DESTROYED 0x004
00229 #define TOTAL_GOLD_MINED 0x005
00230 #define DNGN_DESTROYED 0x006
00231 #define GOLD_POTS_STOLEN 0x007
00232 #define TIMES_BROKEN_INTO 0x008
00233 #define SPELLS_STOLEN 0x009
00234 #define ROOMS_DESTROYED 0x00a
00235 #define BATTLES_WON 0x00b
00236 #define BATTLES_LOST 0x00c
00237 #define CREATRS_ANNOYED 0x00d
00238 #define TOTAL_CREATRS_LEFT 0x00e
00239 #define TOTAL_AREA 0x00f
00240 #define TOTAL_DOORS 0x010
00241 #define TOTAL_RESEARCH 0x011
00242 #define TOTAL_CREATRS 0x012
00243 #define TOTAL_IMPS 0x013
00244 #define BREAK_IN 0x014
00245 #define GAME_TURN 0x015
00246 #define MONEY 0x016
00247
00248 #define OBJCTV_DEFEND_PARTY 0x00a
00249 #define OBJCTV_ATTACK_ROOMS 0x009
00250 #define OBJCTV_ATTACK_DNHEART 0x008
00251 #define OBJCTV_ENEMIES 0x007
00252 #define OBJCTV_STEAL_SPELLS 0x006
00253 #define OBJCTV_STEAL_GOLD 0x005
00254
00255 #define OBJCTV_APPROP_DUNG 0x004
00256 #define OBJCTV_DNHEART 0x003
00257 #define OBJCTV_DUNGEON 0x002
00258 #define OBJCTV_ACTNPT 0x001
00259
00260 #define FLAG7 0x007
00261 #define FLAG6 0x006
00262 #define FLAG5 0x005
00263 #define FLAG4 0x004
00264 #define FLAG3 0x003
00265 #define FLAG2 0x002
00266 #define FLAG1 0x001
00267 #define FLAG0 0x000
00268
00269 #define TIMER7 0x007
00270 #define TIMER6 0x006
00271 #define TIMER5 0x005
00272 #define TIMER4 0x004
00273 #define TIMER3 0x003
00274 #define TIMER2 0x002
00275 #define TIMER1 0x001
00276 #define TIMER0 0x000
00277
00278 #define OPER_EQU 0x001
00279 #define OPER_NEQ 0x002
00280 #define OPER_LESS 0x003
00281 #define OPER_GRTR 0x004
00282 #define OPER_LESSEQ 0x005
00283 #define OPER_GRTREQ 0x006
00284
00285
00286
00287
00288 #define COMP_SELL_TRAPSDOORS 0x001
00289 #define COMP_ATTACK_MAGIC 0x002
00290 #define COMP_WAIT_FOR_BRIDGE 0x003
00291 #define COMP_MAGIC_SPEED_UP 0x004
00292 #define COMP_DIG_TO_NEUTRAL 0x005
00293 #define COMP_SLAP_IMPS 0x006
00294 #define COMP_MOVE_CREATRS_TODEFENS 0x007
00295 #define COMP_MOVE_CREATRS_TOPOS 0x008
00296 #define COMP_MOVE_CREATRS_TOROOM 0x009
00297 #define COMP_PICKUP_FOR_ATTACK 0x00a
00298 #define COMP_MAGIC_CALLARMS 0x00b
00299 #define COMP_DIG_TOATTACK 0x00c
00300 #define COMP_DIG_TOGOLD 0x00d
00301 #define COMP_DIG_TOENTRNCE 0x00e
00302 #define COMP_PLACE_ROOM 0x00f
00303 #define COMP_CHECK_ROOM_DUG 0x010
00304 #define COMP_DIG_ROOM 0x011
00305 #define COMP_DIG_ROOM_PASSAGE 0x012
00306
00307 #define MAX_PARTYS 16
00308
00309 #define ERR_SCRIPTPARAM_WHOLE -9
00310 #define ERR_SCRIPTPARAM_NARGS -2
00311
00312
00313 enum cmnds_adikted {
00314 CUSTOM_COLUMN = 0x001,
00315 DEFINE_GRAFFITI = 0x002,
00316 LEVEL_TIMESTAMP = 0x003,
00317 USER_CMNDS_COUNT = 0x004,
00318 LEVEL_VERSION = 0x005,
00319 LEVEL_NAME = 0x006,
00320 LEVEL_DESC = 0x007,
00321 LEVEL_AUTHORS = 0x008,
00322 };
00323
00324 enum object_available {
00325 AVAIL_NO = 0x000,
00326 AVAIL_RESEARCH = 0x001,
00327 AVAIL_INSTANT = 0x002,
00328 };
00329
00330 struct DK_SCRIPT_COMMAND {
00331 int group;
00332 int index;
00333 unsigned char **params;
00334 int param_count;
00335 int level;
00336
00337 };
00338
00339 struct SCRIPT_VERIFY_DATA {
00340 unsigned char *dnhearts;
00341 int dnhearts_count;
00342 unsigned char *herogts;
00343 unsigned int herogts_count;
00344 unsigned char *actnpts;
00345 unsigned int actnpts_count;
00346 int level;
00347 int total_ifs;
00348 int total_in_pool;
00349 char **partys;
00350 };
00351
00352 struct DK_SCRIPT;
00353 struct DK_SCRIPT_PARAMETERS;
00354 struct IPOINT_2D;
00355
00356 typedef int (*func_cmd_index)(const char *cmdtext);
00357 typedef const char *(*func_cmd_text)(int cmdidx);
00358
00359
00360 DLLIMPORT short decompose_script(struct DK_SCRIPT *script,const struct SCRIPT_OPTIONS *optns);
00361 DLLIMPORT short recompose_script(struct DK_SCRIPT *script,const struct SCRIPT_OPTIONS *optns);
00362 DLLIMPORT short recompute_script_levels(struct DK_SCRIPT *script);
00363 DLLIMPORT short decompose_script_command(struct DK_SCRIPT_COMMAND *cmd,
00364 const char *text,const struct SCRIPT_OPTIONS *optns);
00365 DLLIMPORT char *recompose_script_command(const struct DK_SCRIPT_COMMAND *cmd,const struct SCRIPT_OPTIONS *optns);
00366 short renew_cmd_param(const struct DK_SCRIPT_COMMAND *cmd,const unsigned int param_idx,
00367 const struct SCRIPT_OPTIONS *optns);
00368 int recognize_script_word_group_and_idx(int *index,const char *wordtxt,const short is_parameter);
00369
00370 DLLIMPORT short script_decomposed_to_params_cmd(struct DK_SCRIPT_PARAMETERS *par,
00371 struct DK_SCRIPT_COMMAND *cmd,const struct SCRIPT_OPTIONS *optns);
00372 DLLIMPORT short script_decomposed_to_params(struct DK_SCRIPT *script,const struct SCRIPT_OPTIONS *optns);
00373 DLLIMPORT short script_params_to_decomposed(struct DK_SCRIPT *script,const struct SCRIPT_OPTIONS *optns);
00374
00375 DLLIMPORT short execute_script_line(struct LEVEL *lvl,char *line,char *err_msg);
00376 DLLIMPORT short add_stats_to_script(char ***lines,int *lines_count,struct LEVEL *lvl);
00377 DLLIMPORT short add_graffiti_to_script(char ***lines,int *lines_count,struct LEVEL *lvl);
00378
00379 DLLIMPORT short dkscript_verify(const struct LEVEL *lvl, char *err_msg,int *err_line,int *err_param);
00380 DLLIMPORT short txt_verify(const struct LEVEL *lvl, char *err_msg,struct IPOINT_2D *errpt);
00381
00382
00383 DLLIMPORT void text_file_free(char **lines,int lines_count);
00384 DLLIMPORT int text_file_line_add(char ***lines,int *lines_count,char *text);
00385 DLLIMPORT int text_file_linecp_add(char ***lines,int *lines_count,char *text);
00386
00387
00388 int adikted_cmd_arrsize();
00389 int adikted_cmd_index(const char *cmdtext);
00390 DLLIMPORT const char *adikted_cmd_text(int cmdidx);
00391 int orient_cmd_arrsize();
00392 int orient_cmd_index(const char *cmdtext);
00393 DLLIMPORT const char *orient_cmd_text(int cmdidx);
00394 DLLIMPORT unsigned short get_orientation_next(unsigned short orient);
00395 int font_cmd_arrsize();
00396 int font_cmd_index(const char *cmdtext);
00397 DLLIMPORT const char *font_cmd_text(int cmdidx);
00398
00399 int condit_cmd_arrsize();
00400 int condit_cmd_index(const char *cmdtext);
00401 DLLIMPORT const char *condit_cmd_text(int cmdidx);
00402 int party_cmd_arrsize();
00403 int party_cmd_index(const char *cmdtext);
00404 DLLIMPORT const char *party_cmd_text(int cmdidx);
00405 int avail_cmd_arrsize();
00406 int avail_cmd_index(const char *cmdtext);
00407 DLLIMPORT const char *avail_cmd_text(int cmdidx);
00408 int custobj_cmd_arrsize();
00409 int custobj_cmd_index(const char *cmdtext);
00410 DLLIMPORT const char *custobj_cmd_text(int cmdidx);
00411 int setup_cmd_arrsize();
00412 int setup_cmd_index(const char *cmdtext);
00413 DLLIMPORT const char *setup_cmd_text(int cmdidx);
00414 int triger_cmd_arrsize();
00415 int triger_cmd_index(const char *cmdtext);
00416 DLLIMPORT const char *triger_cmd_text(int cmdidx);
00417 int crtradj_cmd_arrsize();
00418 int crtradj_cmd_index(const char *cmdtext);
00419 DLLIMPORT const char *crtradj_cmd_text(int cmdidx);
00420 int obsolt_cmd_arrsize();
00421 int obsolt_cmd_index(const char *cmdtext);
00422 DLLIMPORT const char *obsolt_cmd_text(int cmdidx);
00423 int commnt_cmd_arrsize();
00424 int commnt_cmd_index(const char *cmdtext);
00425 DLLIMPORT const char *commnt_cmd_text(int cmdidx);
00426
00427 int special_cmd_arrsize();
00428 int special_cmd_index(const char *cmdtext);
00429 DLLIMPORT const char *special_cmd_text(int cmdidx,const char *param);
00430 int comp_plyr_cmd_arrsize();
00431 int comp_plyr_cmd_index(const char *cmdtext);
00432 DLLIMPORT const char *comp_plyr_cmd_text(int cmdidx);
00433 int players_cmd_arrsize();
00434 int players_cmd_index(const char *cmdtext);
00435 DLLIMPORT const char *players_cmd_text(int cmdidx);
00436 int creatures_cmd_arrsize();
00437 int creatures_cmd_index(const char *cmdtext);
00438 DLLIMPORT const char *creatures_cmd_text(int cmdidx);
00439 int room_cmd_arrsize();
00440 int room_cmd_index(const char *cmdtext);
00441 DLLIMPORT const char *room_cmd_text(int cmdidx);
00442 int spell_cmd_arrsize();
00443 int spell_cmd_index(const char *cmdtext);
00444 DLLIMPORT const char *spell_cmd_text(int cmdidx);
00445 DLLIMPORT const char *spell_cmd_fullname(int cmdidx);
00446 int trap_cmd_arrsize();
00447 int trap_cmd_index(const char *cmdtext);
00448 DLLIMPORT const char *trap_cmd_text(int cmdidx);
00449 DLLIMPORT const char *trap_cmd_fullname(int cmdidx);
00450 int door_cmd_arrsize();
00451 int door_cmd_index(const char *cmdtext);
00452 DLLIMPORT const char *door_cmd_text(int cmdidx);
00453 DLLIMPORT const char *door_cmd_fullname(int cmdidx);
00454 int objtype_cmd_arrsize();
00455 int objtype_cmd_index(const char *cmdtext);
00456 DLLIMPORT const char *objtype_cmd_text(int cmdidx);
00457 int operator_cmd_arrsize();
00458 int operator_cmd_index(const char *cmdtext);
00459 DLLIMPORT const char *operator_cmd_text(int cmdidx);
00460 int variabl_cmd_arrsize();
00461 int variabl_cmd_index(const char *cmdtext);
00462 DLLIMPORT const char *variabl_cmd_text(int cmdidx);
00463 int timer_cmd_arrsize();
00464 int timer_cmd_index(const char *cmdtext);
00465 DLLIMPORT const char *timer_cmd_text(int cmdidx);
00466 int flag_cmd_arrsize();
00467 int flag_cmd_index(const char *cmdtext);
00468 DLLIMPORT const char *flag_cmd_text(int cmdidx);
00469 int party_objectv_cmd_arrsize();
00470 int party_objectv_cmd_index(const char *cmdtext);
00471 DLLIMPORT const char *party_objectv_cmd_text(int cmdidx);
00472
00473
00474 DLLIMPORT short script_command_param_add(struct DK_SCRIPT_COMMAND *cmd,char *param);
00475 DLLIMPORT void script_command_clear(struct DK_SCRIPT_COMMAND *cmd);
00476 DLLIMPORT struct DK_SCRIPT_COMMAND *script_command_create(void);
00477 DLLIMPORT void script_command_renew(struct DK_SCRIPT_COMMAND **cmd);
00478 DLLIMPORT void script_command_free(struct DK_SCRIPT_COMMAND *cmd);
00479 DLLIMPORT char *get_orientation_shortname(unsigned short orient);
00480 DLLIMPORT char *get_font_longname(unsigned short font);
00481 DLLIMPORT short script_param_to_int(int *val,const char *param);
00482 DLLIMPORT short script_param_to_ulong(unsigned long *val,const char *param);
00483 DLLIMPORT const char *script_cmd_text(const int group,const int cmdidx,const char *prev_val);
00484 DLLIMPORT short is_no_bracket_command(int group,int cmdidx);
00485 DLLIMPORT char *script_strword( const char *str, const short whole_rest );
00486 DLLIMPORT short script_strword_pos( char const **ptr, unsigned int *ptr_len,
00487 const char *str, const short whole_rest );
00488
00489
00490 DLLIMPORT short execute_adikted_command(struct LEVEL *lvl,struct DK_SCRIPT_COMMAND *cmd,char *err_msg);
00491
00492 #endif // ADIKT_LEVSCRIPT_H