[50c14b]: Chitem.h Maximize Restore History

Download this file

Chitem.h    1265 lines (1129 with data), 40.1 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
// chitem.h : main header file for the CHITEM application
//
#if !defined(AFX_CHITEM_H__82C8D991_857B_4DDB_9704_0525A2869DD5__INCLUDED_)
#define AFX_CHITEM_H__82C8D991_857B_4DDB_9704_0525A2869DD5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include <afxadv.h>
#include <io.h>
#include "resource.h" // main symbols
#include "structs.h"
#include "item.h"
#include "store.h"
#include "proj.h"
#include "spell.h"
#include "effect.h"
#include "creature.h"
#include "pvr.h"
#include "script.h"
#include "VVC.h"
#include "VEF.h"
#include "WFX.h"
#include "dialog.h"
#include "area.h"
#include "bam.h"
#include "game.h"
#include "map.h"
#include "mos.h"
#include "chui.h"
#include "src.h"
#include "ini.h"
#include "ItemPicker.h"
#include "ColorPicker.h"
#include <MBSTRING.H>
class C2da;
//
#define MAXBUFFSIZE 4096
#define MAXIDSIZE 512
extern char external[MAXBUFFSIZE]; //we need some hacks sometimes
//updatedata flags
#define UD_RETRIEVE TRUE
#define UD_DISPLAY FALSE
//macro for checking a menuitem
#define MF_SET(flg) ((flg)?(MF_BYCOMMAND|MF_CHECKED):(MF_BYCOMMAND|MF_UNCHECKED))
#define MFP_SET(flg) ((flg)?(MF_BYPOSITION|MF_ENABLED):(MF_BYPOSITION|MF_GRAYED))
extern UINT WM_FINDREPLACE;
#define SR_SEARCH 0
#define SR_REPLACE 1
#define SR_ALL 2
//editor maptypes (for ImageView)
#define MT_DEFAULT -1
#define MT_HEIGHT 0
#define MT_LIGHT 1
#define MT_SEARCH 2
#define MT_BLOCK 3
#define MT_OVERLAY 4
#define MT_POLYGON 5
#define MT_WALLPOLYLIST 6
#define MT_DOORPOLYLIST 7
#define MT_REGION 8
#define MT_CONTAINER 9
#define MT_DOOR 10
#define MT_BAM 11
#define MT_EXPLORED 12
#define MT_HEIGHT8 13
#define MT_AMBIENT 14
//getpoint units (for ImageView)
#define GP_POINT 0
#define GP_TILE 1
#define GP_BLOCK 2
#define GP_EXPLORED 3
//bounding box index symbols
#define BBMINX 0
#define BBMINY 1
#define BBMAXX 2
#define BBMAXY 3
#define WBBMINX 0
#define WBBMAXX 1
#define WBBMINY 2
#define WBBMAXY 3
#define MAX_LINE 1000
//#define VIEW_MAXEXTENT 8
//bif res_loc definitions
#define FILE_IDX_MASK 0x03fff
#define TIS_IDX_MASK 0xfc000
//important itemtypes
#define ITM_SCROLL 11
//important opcodes
#define OPC_DAMAGE 12
#define OPC_LEARNSPELL 147
//class definitions
#define CLASS_MAGE 1
#define CLASS_CLERIC 3
#define CLASS_BARD 5
#define CLASS_PALADIN 6
#define FIGHTER_MAGE 7
#define FIGHTER_CLERIC 8
#define CLASS_DRUID 11
#define CLASS_RANGER 12
#define MAGE_THIEF 13
#define CLERIC_MAGE 14
#define CLERIC_THIEF 15
#define FIGHTER_DRUID 16
#define FIGHTER_MAGE_CLERIC 17
#define CLERIC_RANGER 18
#define CLASS_SORCEROR 19
#define EXTENDED_NIGHT 64
//constants
#define NUM_CD 5
//script parameter datatypes
#define SPT_OBJECT 'O'
#define SPT_OVERRIDE 'O1'
#define SPT_SECONDOB 'O2'
#define SPT_ACTION 'A'
#define SPT_TRIGGER 'T' //trigger inside a triggeroverride
#define SPT_POINT 'P'
#define SPT_INTEGER 'I' //1. position
#define SPT_INTEGER2 'I2' //3. (trigger) or 4. (action) position
#define SPT_INTEGER3 'I3' //4. position (trigger) or 5. position for action
#define SPT_STRREF 'IS' //1. position (strref)
#define SPT_STRREF2 '2I'
#define SPT_STRREF3 '3I'
#define SPT_ZERO '0' //argument that isn't required (own feature)
#define SPT_STRING 'S'
#define SPT_STRING1 'S1'
#define SPT_STRING2 'S2'
#define SPT_AREA1 'SA' //area (inserted)
#define SPT_VAR1 'SV' //simple variable
#define SPT_VAR3 'VS' //simple variable, reversed
#define SPT_VAR4 'V2' //simple variable, 2. place reversed
#define SPT_TOKEN1 'ST' //token
#define SPT_COLUMN1 'SX' //xplist column
#define SPT_RESREF1 'SR' //resource (8 chars long)
#define SPT_NUMLIST1 'SN' //number list (4 digits numbers)
#define SPT_DEAD1 'DE' //death variable
#define SPT_AREA2 '2A' //area variable inserted into 2. place
#define SPT_AREA3 '3A' //area (inserted into first place, reversed)
#define SPT_AREA4 '4A' //area (inserted into 2. place, reversed)
#define SPT_VAR2 '2V' //simple variable goes to 2. place
#define SPT_TOKEN2 '2T' //token
#define SPT_COLUMN2 '2X' //xplist column
#define SPT_RESREF2 '2R' //resource (8 chars long)
#define SPT_NUMLIST2 '2N' //number list (3 digits numbers)
#define SPT_DEAD2 '2D' //death variable
#define SPT_1AREA 'AA' //area, 1. variable not inserted
#define SPT_2AREA 'AB' //area, 2. variable not inserted
#define SPT_RES1 'R1' //resource (8 chars long) in 1. string before :
#define SPT_RES2 'R2' //resource (8 chars long) in 1. string after :
#define SPT_RES3 'R3' //resource (8 chars long) in 2. string before :
#define SPT_RES4 'R4' //resource (8 chars long) in 2. string after :
#define NUM_WEAPROF 54
extern int act_num_weaprof;
#define SLOT_SHIELD 2
#define SLOT_WEAPON 9
#define SLOT_QUIVER 35 //offset
#define NUM_ITEMTYPE 0x4a
//itemtype vs. two handed
//bit 1 - 1 handed
//bit 2 - 2 handed
//bit 4 - invalid item in bg2
extern int itvs2h[NUM_ITEMTYPE];
#define IT2H_1HANDED 1
#define IT2H_2HANDED 2
#define IT2H_NOTBG2 4
#define NUM_ANIMTYPES 12
#define NUM_ANIMIDX 52
#define NUM_STYPE 6
#define NUM_STYPE2 4
#define NUM_STORETYPE 6
//store types
#define STT_STORE 0
#define STT_TAVERN 1
#define STT_INN 2
#define STT_TEMPLE 3
#define STT_IWDCONT 4
#define STT_CONT 5
//stored itemflags
#define STI_IDENTIFIED 1
#define STI_NOSTEAL 2
#define STI_STOLEN 4
#define STI_NODROP 8
#define NUM_SPELLTYPE 5
//spell types
#define SP_SPECIAL 0
#define SP_WIZARD 1
#define SP_CLERIC 2
#define SP_INNATE 3
#define IT_BOOK 0
#define IT_ARROW 5
#define IT_BULLET 0xe
#define IT_BOW 0xf
#define IT_DAGGER 0x10
#define IT_MACE 0x11
#define IT_SLING 0x12
#define IT_SHORT 0x13
#define IT_BASTARD 0x14
#define IT_HAMMER 0x15
#define IT_MORNING 0x16
#define IT_FLAIL 0x17
#define IT_DART 0x18
#define IT_AXE 0x19
#define IT_XBOW 0x1b
#define IT_SPEAR 0x1d
#define IT_HALBERD 0x1e
#define IT_BOLT 0x1f
#define IT_GOLD 0x21
#define IT_GEM 0x22
#define IT_BAG 0x24
#define IT_CLUB 0x2c //club in iwd
#define IT_SWORD 0x39 //special sword in iwd
#define IT_CONTAINER 0x3a //container in iwd
#define TBG_ALT 0x8000 //special handling of tbg
//alternate cre - soundset
//alternate gam - tbgn
#define REF_BMP 0x0001 //1
#define REF_MVE 0x0002 //2
#define REF_WAV 0x0004 //3
#define REF_WFX 0x0005 //4
#define REF_PLT 0x0006 //5
#define REF_MUS 0x0ffe //6not in bif?
#define REF_ACM 0x0fff //7not in bif?
#define REF_BAM 0x03e8 //8
#define REF_WED 0x03e9 //9
#define REF_CHU 0x03ea //10
#define REF_TIS 0x03eb //11
#define REF_MOS 0x03ec //12
#define REF_ITM 0x03ed //13
#define REF_SPL 0x03ee //14
#define REF_BCS 0x03ef //15
#define REF_IDS 0x03f0 //16
#define REF_CRE 0x03f1 //17
#define REF_ARE 0x03f2 //18
#define REF_DLG 0x03f3 //19
#define REF_2DA 0x03f4 //20
#define REF_GAM 0x03f5 //21
#define REF_STO 0x03f6 //22
#define REF_WMP 0x03f7 //23
#define REF_EFF 0x03f8 //24
#define REF_BS 0x03f9
#define REF_CHR 0x03fa //25
#define REF_VVC 0x03fb //26
#define REF_VEF 0x03fc //27
#define REF_PRO 0x03fd //28
#define REF_BIO 0x03fe //29
#define REF_WBM 0x03ff //30
#define REF_INI 0x0802 //31
#define REF_SRC 0x0803 //32
#define REF_FNT 0x400 //33
#define REF_GUI 0x402 //34
#define REF_SQL 0x403 //35
#define REF_PVRZ 0x404 //36
#define REF_GLSL 0x405 //37
#define NUM_OBJTYPE 37
#define NUM_FVALUE 3
extern CString proj_facing_desc[NUM_FVALUE];
#define NUM_SPKCOL 13
#define NUM_ARFLAGS 5
//area types
#define AR_NORMAL
#define AR_NOSAVE
#define AR_TUTORIAL
#define NUM_ATYPE 5
//attack types
#define A_NONE 0
#define A_MELEE 1
#define A_PROJ 2
#define A_MAGIC 3
#define A_BOW 4
#define NUM_SFTYPE 3
//spell forms
#define SF_NONE 0
#define SF_NORMAL 1
#define SF_PROJECT 2
#define NUM_LFTYPE 5
//location types
#define LF_NONE 0
#define LF_WEAPON 1 //weapon
#define LF_SPELL 2 //cast spell
#define LF_MAGIC 3 //magic equipment
#define LF_INNATE 4 //innate spell
#define NUM_TTYPE 8
//target types
#define T_INVALID 0
#define T_CREA 1
#define T_INV 2
#define T_DEAD 3
#define T_AREA 4
#define T_SELF 5
#define T_UNKNOWN 6
#define T_NONE 7
#define NUM_AMTYPE 6
extern CString ammo_types[NUM_AMTYPE];
#define NUM_DTYPE 10
//damage types
#define DT_NONE 0
#define DT_PIERCING 1 //magic too
#define DT_BLUNT 2
#define DT_SLASH 3
#define DT_RANGED 4
#define DT_FIST 5
#define DT_BLUNTRANGED 9
#define NUM_CHTYPE 4
//charge types
#define CH_NONE 0
#define CH_DRAINED 1
#define CH_STABLE 2
#define CH_PERDAY 3
#define NUM_MTYPE 3
//missile types
#define M_ARROW 0
#define M_BOLT 1
#define M_BULLET 2
//#define NUM_SLOTTYPE 8
#define NUM_FEATS 458 //hardcoded feature number (iwd2)
#define NUM_TMTYPE 12
//effect duration types
#define TIMING_DURATION 0
#define TIMING_PERMANENT 1
#define TIMING_EQUIPED 2
#define TIMING_DELDDUR 3
#define TIMING_DELAYED 4
#define TIMING_DEL2 5
#define TIMING_DUR2 6
#define TIMING_PERMDEATH 9
#define NUM_ETTYPE 14
//effect target types
#define EFF_TARGET_SELF 1
#define EFF_TARGET_PRE 2
#define NUM_RTYPE 4
#define NUM_RTTYPE 3
//active region types
#define RT_TRAP 0
#define RT_INFO 1
#define RT_TRAVEL 2
#define NUM_FVALUES 16
#define NUM_SPTYPE 5
#define NUM_CITYPE 13
#define OBJECT 0x200
#define TRIGGER 0x100
#define ACTION 0x000
#define LINKTO 0x40000000
#define EXTERNAL 0xc0000000
#define TREESTATE 0x80000000
#define TRANSSTATE 0x00000000
#define TRANSTR 0x20000000
#define STATETR 0x40000000
#define ACTIONBL 0x60000000
#define FLAGMASK 0xe0000000
#define NODEMASK 0x1fffffff
// the special triggers/actions
#define TR_TRUE 0x23
#define TR_FALSE 0x30
#define TR_OR 0x89
#define TR_OVERRIDE 0x40e0 //only BGEE
#define AC_CONTINUE 0x36
#define AC_STARTCUT 120
#define AC_STCUTMD 121
#define AC_ENDCUTMD 122
#define AC_CLRALLACT 123
#define AC_CLRACT 133
#define AC_ADD_JOURNAL 173
//bg2
#define AC_QUESTDONE_BG 235
#define AC_REMOVE_JOURNAL_BG 263
//iwd2
#define AC_REMOVE_JOURNAL_IWD 244
#define AC_QUESTDONE_IWD 245
#define JT_QUEST 1
#define JT_DONE 2
#define CHECKING 0
#define MATCHING 1
#define SCANNING 2
#define JOURNAL 3
extern CString DECOMPILED;
extern CString WEIDU_LOG;
extern CString SELF_REFERENCE;
extern CString DELETED_REFERENCE;
// dialog transition trigger flags
#define HAS_TEXT 1
#define HAS_TRIGGER 2
#define HAS_ACTION 4
#define LEAF_NODE 8
#define HAS_JOURNAL 16 //journal entry
//#define ????? 32 - doubles the line???
#define HAS_QUEST 64 //missing quest
#define REMOVE_QUEST 128 //delete quest
#define HAS_SOLVED 0x100 //solved quest
/////// script/dialog variable checking /////////
#define NO_CHECK 0
#define IS_VAR 1
#define ADD_LOCAL 2
#define ADD_GLOBAL 3
#define ADD_VAR 4
#define ADD_VAR2 5
#define VALID_TAG 6
#define ENTRY_POINT 7
#define ADD_DEAD 8
#define ADD_DEAD2 9
#define CHECK_SOUND 10
#define CHECK_ITEM 11
#define CHECK_SPL 12
#define CHECK_CRE 13
#define CHECK_BCS 14
#define CHECK_DLG 15
#define CHECK_DEAD 16
#define CHECK_AREA 17
#define CHECK_STORE 18
#define CHECK_VVC 19
#define CHECK_2DA 20
#define CHECK_MOS 21
#define CHECK_DSOUND 22 //double sound resource
#define CHECK_MOVIE 23 //mve
#define CHECK_PAL 24 //palette (bmp)
#define CHECK_SRC 25 //pst src file
#define CHECK_GAME 26 //iwd2 party file
#define CHECK_SCOPE 27
#define ADD_VAR3 28
#define CHECK_SOUND2 30
#define CHECK_ITEM2 31
#define CHECK_SPL2 32
#define CHECK_BCS2 34
#define CHECK_DLG2 35
#define CHECK_DEAD2 36
#define CHECK_AREA2 37
#define CHECK_VVC2 39
#define CHECK_2DA2 40
#define CHECK_MOS2 41
#define CHECK_XPLIST 50 //a row in xplist 2da
#define CHECK_NUM 51 //a spell number list (4 digits/number)
#define CHECK_STRREF 0x10000
#define CHECK_ALIGN 0x20000
#define CHECK_POINT 0x40000
#define CHECK_BYTE 0x80000 //only one byte
#define CHECK_ONLYJ 0x100000
#define CHECK_JOURNAL 0x110000 //also set strref
#define INANIMATE 0x200000
#define CHECK_DOOR 0x600000 //inanimate + door
#define CHECK_TRIGGER 0xa00000 //inanimate + trigger
//#define MERGE_VARS 0xff
//store type flags
#define ST_SELL 1
#define ST_BUY 2
#define ST_ID 4
#define ST_STEAL 8
#define ST_DONAT 16
#define ST_CURE 32
#define ST_DRINK 64
#define ST_UNKN1 128 //roulet
#define ST_UNKN2 256 //craps
#define ST_QUALITY1 512
#define ST_QUALITY2 1024
#define ST_WHEEL 2048
#define ST_FENCE 4096
#define ST_UNKN6 8192
#define ST_UNKN7 0x4000
#define ST_UNKN8 0x8000
#define ST_RENT 0x10000 //not in the original flags
//projectile flags
#define PROJ_BAMPALETTE 1
#define PROJ_SMOKE 2
//
#define PROJ_NOLIGHT 8
//
#define PROJ_SHADOW 32
#define PROJ_LIGHTSPOT 64
//projectile aoe flags
#define PROJ_VISIBLE 1
#define PROJ_INANIMATE 2
#define PROJ_TRIGGER 4
#define PROJ_CONTROLLED 8
#define PROJ_NO_PARTY 16
#define PROJ_FRAGMENT 32
#define PROJ_NO_SELF 64
#define PROJ_NO_ENEMY 128
#define PROJ_LEVEL 256
#define PROJ_HAS_VVC 1024
#define PROJ_CONE 2048
#define PROJ_DELAYED 0x4000
#define PROJ_AFFECT_ONE 0x8000
//extended flags for gemrb
#define PROJ_BOUNCE 1 //bounce from walls
#define PROJ_CONTINUE 2 //continue as travel projectile after triggered
#define PROJ_FREEZE 4 //freeze after trigger and slowly fade out
#define PROJ_NO_TRAVEL 8 //appear immediately on target
#define PROJ_TRAIL_FACE 16 //trail bams also use face
#define PROJ_CURVE 32 //curved path
#define PROJ_RANDOM 64 //random starting frame
#define PROJ_PILLAR 128 //pillar projectile
#define PROJ_TRANSLUCENT 256 //half-transparent travel projectile
#define PROJ_TINTED 512 //tinted by gradient (better than paletted animations)
#define PROJ_ITERATION 1024 //create another projectile with projectile ID-1
#define PROJ_DEFSPELL 2048 //always apply default spell on caster
#define PROJ_FALLING 4096 //the projectile will fall from above target (y=target.y, x=target-100)
#define PROJ_INCOMING 8192 //the projectile will fall from above caster (y=caster.y, x=target-100)
#define PROJ_LINE 16384 //solid line from source to target (ignore caster)
#define PROJ_WALL 32768 //diagonal across the AOE circle, firewall type
#define PROJ_BACKGROUND 65536 //draw behind target
#define PROJ_POP 0x20000 //pop in/hold/pop out animation chain (use shadow for hold)
#define PROJ_POP_OUT 0x40000 //internal flag for pop out phase
#define PROJ_FADE 0x80000 //fade after explode
#define PROJ_TEXT 0x100000 //display text when the projectile is created
#define PROJ_WANDERING 0x200000 //the projectile moves randomly
#define PROJ_CYCLE 0x400000 //the projectile will have a random cycle
#define PROJ_RGB 0x800000 //the target will have a single color pulse effect
#define PROJ_TOUCH 0x1000000//an attack roll is needed for success (failure payload will be used if failed)
#define PROJ_NOTIDS 0x2000000//negate the result of the first IDS check
#define PROJ_NOTIDS2 0x4000000//negate the result of the second IDS check
#define PROJ_BOTH 0x8000000//both IDS check must succeed for a pass
#define PROJ_DELAY 0x10000000//delay payload until initial animation finishes
#define PROJ_LIMITPATH 0x20000000//path limited
#define PROJ_UNUSED1 0x40000000//
#define PROJ_UNUSED2 0x80000000//
//extended area flags for gemrb
#define APF_TINT 1 //use tint for spread animation
#define APF_FILL 2 //fill entire area
#define APF_SCATTER 4 //start scattered
#define APF_VVCPAL 8 //use palette for central animation
#define APF_SPREAD 16 //refill emptied slots
#define APF_PALETTE 32 //use palette gradient for spread animation
#define APF_BOTH 64 //halve projectile count and draw both animations
#define APF_MORE 128 //double child projectile count
#define APF_FAILSPELL 256 //apply spell on caster if no one was hit
#define APF_MULTIPLE 512 //shoot multiple single projectiles (based on cone width)
#define APF_COUNT_HD 0x400 //count enemies' HD (only if affect one is set)
#define APF_REVERSE 0x800 //reverse targeting of enemy and ally (party only/enemy)
#define APF_TILE 0x1000//place the spread animation all over the AOE (cone is honoured)
#define TRANSPARENT_GREEN 0x00ff00
#define COLORNUM 256
class colortype
{
public:
COLORREF rgb[12];
CString colorname;
colortype()
{
for(int i=0;i<12;i++) rgb[i]=0xdadada;
colorname="unknown";
}
colortype(const int a, const char *b)
{
for(int i=0;i<12;i++) rgb[i]=a;
colorname=b;
}
colortype(const COLORREF a, CString b)
{
for(int i=0;i<12;i++) rgb[i]=a;
colorname=b;
}
};
typedef struct
{
CString title;
CString initial;
} folderbrowse_t;
extern colortype colors[COLORNUM];
extern void init_colors();
extern CString colortitle(unsigned int value);
extern void init_entries();
extern void init_spawn_entries();
extern int feature_resource(int feature);
extern int *get_strref_opcodes();
CString convert_musiclist(CString tmpstr, bool onlyinternal);
int ModifyCFB(int mode, int featnum, feat_block *cfb);
void ConvertToV10Eff(const creature_effect *v20effect, feat_block *v10effect);
void ConvertToV20Eff(creature_effect *v20effect, const feat_block *v10effect);
int CheckDestination(CString area, CString entrance);
int BrowseForFolder(folderbrowse_t *pfb, HWND hwnd);
int ReadTempCreature(Ccreature *cre, char *&creature, long &esize);
int WriteTempCreature(Ccreature *cre, char *creature, long esize);
extern char BASED_CODE cfbFilter[];
typedef char * charpoi;
class CStringMapCStringMapInt: public CStringMapToCStringMapInt
{
public:
~CStringMapCStringMapInt();
};
class CStringMapArray : public CStringMapTooltip
{
public:
int query_count(CString key);
};
class CStringListLocEntry: public CList<stringloc_entry, stringloc_entry&>
{
public:
void Fixup(int index, int value);
bool RemoveKey(CString ref);
bool Lookup(CString ref, loc_entry &fileloc);
bool SetAt(CString ref, loc_entry &fileloc);
void RemoveAll();
POSITION AddList(CString ref, loc_entry entry);
};
class CStringMapLocEntry: public CMap<CString, LPCSTR, loc_entry, loc_entry&>
{
public:
void Fixup(int index, int value);
int Lookup(CString key, loc_entry &loc);
};
struct quest_entry
{
int strref;
int titleindex;
};
class CQuestList: public CList<quest_entry, quest_entry&>
{
public:
void Add(int value);
};
class CQuest2List: public CStringList
{
public:
int Add(CString value);
};
/*
class CQuestMap: public CIntMapString
{
public:
int Find(CString entry);
};
*/
//global variable definitions
extern CStringMapLocEntry items;
extern CStringMapLocEntry icons;
extern CStringMapLocEntry bitmaps;
extern CStringMapLocEntry creatures;
extern CStringMapLocEntry chars;
extern CStringMapLocEntry spells;
extern CStringMapLocEntry stores;
extern CStringMapLocEntry darefs;
extern CStringMapLocEntry idrefs;
extern CStringMapLocEntry dialogs;
extern CStringMapLocEntry scripts;
extern CStringMapLocEntry projects;
extern CStringMapLocEntry effects;
extern CStringMapLocEntry vvcs;
extern CStringMapLocEntry areas;
extern CStringMapLocEntry chuis;
extern CStringMapLocEntry mos;
extern CStringMapLocEntry weds;
extern CStringMapLocEntry tis;
extern CStringMapLocEntry sounds;
extern CStringMapLocEntry games;
extern CStringMapLocEntry wmaps;
extern CStringMapLocEntry musics;
extern CStringMapLocEntry musiclists;
extern CStringMapLocEntry movies;
extern CStringMapLocEntry wfxs;
extern CStringMapLocEntry strings;
extern CStringMapLocEntry paperdolls;
extern CStringMapLocEntry vefs;
extern CStringMapLocEntry wbms;
extern CStringMapLocEntry fonts;
extern CStringMapLocEntry inis;
extern CStringMapLocEntry guis;
extern CStringMapLocEntry sqls;
extern CStringMapLocEntry pvrzs;
extern CStringMapLocEntry bios;
extern CStringMapLocEntry glsl;
extern CStringMapLocEntry *resources[NUM_OBJTYPE+1];
extern CStringListLocEntry *duplicates[NUM_OBJTYPE+1];
extern CStringMapInt variables;
extern CIntMapJournal journals;
extern CStringMapString usedtis;
extern CStringMapString usedwed;
extern const unsigned char xorblock[64];
extern CString setupname;
extern CString bgfolder;
extern CString descpath;
extern CString weidupath;
extern CString weiduextra;
extern CString weidudecompiled;
extern CString language;
extern int logtype;
extern int tooltips;
extern int do_progress;
extern int readonly;
extern int choosedialog;
extern int whichdialog;
extern unsigned long chkflg;
extern unsigned long editflg;
extern unsigned long optflg;
extern unsigned long weiduflg;
extern unsigned long winsize;
extern COLORREF color1, color2, color3;
extern CStringMapArray tooltipnumbers;
extern CStringMapArray store_spell_desc;
extern CStringMapInt dial_references;
extern CStringList exclude_item;
extern CStringList masterareas;
extern CStringList xplist;
extern CStringList pro_references;
extern CStringList pro_titles;
extern CStringList beastnames;
extern CStringList beastkillvars;
extern CStringList spawngroup;
extern CStringMapInt rnditems;
extern CStringList sectype_names;
extern CStringList school_names;
extern CString2List songlist;
extern CStringMapInt internal_slot_names;
extern int base_slot;
extern CString bg2_slot_names[SLOT_COUNT];
extern CString pst_slot_names[PST_SLOT_COUNT];
extern CString iwd2_slot_names[IWD2_SLOT_COUNT];
extern CString slot_names[IWD2_SLOT_COUNT];
extern CString snd_slots[SND_SLOT_COUNT];
#define MAX_ACTION 370
extern CString action_defs[MAX_ACTION];
#define MAX_TRIGGER 256
extern CString trigger_defs[MAX_TRIGGER];
extern CString itemname;
extern CString lasterrormsg;
extern Citem the_item;
extern Cstore the_store;
extern Cproj the_projectile;
extern Cspell the_spell;
extern Ceffect the_effect;
extern Ccreature the_creature;
extern Cpvr the_pvr;
extern CVVC the_videocell;
extern CVEF the_vef;
extern CWFX the_wfx;
extern Cscript the_script;
extern Cdialog the_dialog;
extern Carea the_area;
extern Cbam the_bam;
extern Cgame the_game;
extern Cmap the_map;
extern Cmos the_mos;
extern Cchui the_chui;
extern Csrc the_src;
extern Cini the_ini;
extern tlk_header tlk_headerinfo[2];
extern tlk_entry *tlk_entries[2];
extern bool global_changed[2];
extern int global_date[2];
extern key_header key_headerinfo;
extern membif_entry *bifs;
extern CString cds[NUM_CD];
extern opcode_struct opcodes[NUM_FEATS];
extern CString weaprofs[NUM_WEAPROF+1];
extern int ammos[NUM_AMTYPE];
extern const CString objexts[NUM_OBJTYPE+1];
extern int menuids[NUM_OBJTYPE+1];
extern const unsigned short objrefs[NUM_OBJTYPE+1];
extern int idstrings[NUM_OBJTYPE+1];
extern char tbgext[NUM_OBJTYPE+1];
extern char BASED_CODE szFilterKey[];
extern char BASED_CODE szFilterTbg[];
extern char BASED_CODE szFilterTp2[];
extern char BASED_CODE szFilterWeidu[];
extern char BASED_CODE szFilterDlg[];
extern char BASED_CODE szFilterWeiduAll[];
extern char BASED_CODE szFilterBifc[];
extern char BASED_CODE szFilterBif[];
extern CString storetypes[NUM_STORETYPE+1];
extern CString spelltypes[NUM_SPELLTYPE+1];
extern CString itemtypes[NUM_ITEMTYPE+1];
extern long weaprofidx[NUM_WEAPROF+1];
extern unsigned short animtypes[NUM_ANIMTYPES][3];
extern CString animnames[NUM_ANIMTYPES];
extern CString itemanimations[NUM_ANIMIDX];
extern unsigned short animidx[NUM_ANIMIDX];
extern CString save_types[NUM_STYPE];
extern CString save_types2[NUM_STYPE2];
extern CString resist_types[NUM_RTYPE];
extern int has_duration[];
extern CStringMapGameProps allgameprops;
extern CStringMapCStringMapInt idsmaps;
extern CIntMapString listspells;
extern CIntMapString listdomains;
extern CIntMapString listinnates;
extern CIntMapString listsongs;
extern CIntMapString listshapes;
extern CStringMapInt ini_entry;
extern CStringMapPoint entries;
#define INI_CREATURE 1
#define INI_SPAWN 2
//area animation flags
#define AA_MIRROR 2048
#define AA_COMBAT 4096
#define AA_WBM 0x2000
//0 button, 1 progress,2 slider, 3 editbox,4 unknown, 5 scrolltext,
#define CC_BUTTON 0
#define CC_PROGRESS 1
#define CC_SLIDER 2
#define CC_EDITBOX 3
#define CC_U2 4
#define CC_TEXT 5
#define CC_LABEL 6
#define CC_SCROLLBAR 7
#define CCNUM 8
#define EA 0
#define GENERAL 1
#define RACE 2
#define CLASS 3
#define SPECIFIC 4
#define GENDER 5
#define ALIGN 6
#define NUM_IDS 7
extern char *idstype[NUM_IDS];
extern CColorPicker colordlg;
extern CItemPicker pickerdlg;
extern CString lastopenedscript;
extern CString lastopenedsave;
extern CString lastopeneddata;
extern CString lastopenedoverride;
extern CString lastopenedmusic;
/////////////////////////////////////////////////////////////////////////////
// CChitemApp:
// See chitem.cpp for the implementation of this class
//
class CChitemApp : public CWinApp
{
public:
CChitemApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChitemApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
CString m_defpath;
CBitmap m_bbmp;
HICON m_hIcon;
// Implementation
CString MyParseCommandLine(char param);
int select_setup(CString setupname);
void save_settings();
void read_game_preferences();
private:
COLORREF ParseColor(CString tmp);
//{{AFX_MSG(CChitemApp)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
extern CChitemApp theApp;
bool MakeBitmapExternal(const COLORREF *pDIBits, int nWidth, int nHeight, HBITMAP &hBitmap);
bool MakeBitmapExternal(const LPBYTE pPixels, const COLORREF *pPalette, int nWidth, int nHeight, HBITMAP &hBitmap);
void SwapPalette(DWORD *palette, int idx1, int idx2);
int fill_destination(CString key, CComboBox *cb);
bool savedtype(CString ext);
int determinemenu(CString commandline);
int determinetype(int reftype);
int WriteString(FILE *fpoi, CString mystring);
int nop();
unsigned long get_hash_size(unsigned long num);
int strtonum(CString str);
bool invalidnumber(CString tmpstr);
CString consolidate(char *poi, int textlength);
int member_array(int member, int *array);
bool checkfile(CString fname, CString magic);
bool file_exists(CString filename);
long file_length(CString filename);
long file_date(CString filename);
bool dir_exists(CString filename);
bool assure_dir_exists(CString filename);
int my_system(CString syscommand);
int copy_file(int finput, int fhandle, int size, int decrypt); //copying data from bifs
int remove_from_sav(CString key, CString ext, int finput, int &maxlen, int fhandle);
int extract_from_cbf(CString key, CString ext, int finput, int override, int &maxlen);
int decompress_bif(CString bifname, CString cdpath); //this must be a cd bifname
int write_tis_header(int fhandle, loc_entry fileloc);
#define LF_IGNOREOVERRIDE 1
#define LF_IGNORECBF 2
int locate_file(loc_entry &fileloc, int ignoreoverride); //file location, ignore override
int resolve_tbg_entry(long reference, tbg_tlk_reference &ref);
CString get_script_type(int i);
CString format_storetype(unsigned int storetype);
CString format_spellslot(unsigned int spellslot);
CString format_spelltype(unsigned int spelltype);
CString format_exclusion(unsigned long exclusion);
CString format_schooltype(unsigned int schooltype);
CString format_sectype(unsigned int sectype);
CString format_itemtype(unsigned int itemtype);
short find_itemtype(CString itemtype);
void Pad(CString &str, int len);
void StoreResref(CString &dlgcontrol, char *itempoi);
void StoreResref16(CString &dlgcontrol, char *itempoi);
void RetrieveResref(CString &dlgcontrol, const char *itempoi, int dot=0);
void StoreAnim(CString &dlgcontrol, char *itempoi);
void RetrieveAnim(CString &dlgcontrol, const char *itempoi);
void StoreVariable(CString &dlgcontrol, char *itempoi, bool noupper=false);
void RetrieveVariable(CString &dlgcontrol, const char *itempoi, bool noupper=false);
void StoreName(CString &dlgcontrol, char *itempoi);
CString format_label(CString label);
CString format_weaprofs(int profnum);
int getproficiencyidx(int profnum);
CString format_animtype(int animtype);
int getanimationidx(int animtype);
int find_animtype(unsigned short *percents);
CString format_spell_id(int id);
int get_max_levels(int type);
CString convert_degree(int value);
CString convert_radius(int value, int direction=0);
CString get_face_value(int fvalue);
CString get_compile_error(int ret);
CString get_spark_colour(int spktype);
CString get_areaflag(unsigned long artype);
CString get_attack_type(int atype);
CString get_attacknum(int anum);
int find_attacknum(CString anum);
CString get_slottype(int slottype);
CString get_spell_form(int sftype);
CString get_location_type(int lftype);
CString get_target_type(int ttype);
CString get_projectile_type(int ptype);
CString get_ammo_type(int amtype);
CString get_damage_type(int dtype);
CString get_charge_type(int chtype);
CString get_missile_type(int mtype);
CString get_opcode_text(int opcode);
CString get_opcode_desc(int opcode, int param2);
CString get_par1_label(int opcode);
CString get_par2_label(int opcode);
CString DamageType(int hex);
CString DamageStyle(int hex);
int ChuiControlSize(int controltype);
CString find_justification(int code);
CString ChuiControlName(int controltype);
CString IDSType(int ids, bool addtwo);
int IDSIndex(CString idsname, bool addtwo);
CString IDSName(int ids, bool addtwo);
CString IDSName2(int ids, bool addtwo);
int IDSKey(CString filename, CString key);
int IDSKey2(CString filename, CString key);
CString IDSToken(CString filename, int value, bool unused);
int get_idsfile(CString idsname, bool forced);
int FillCombo(CString idsname, CComboBox *cb, int len);
void FillProjectile(CComboBox &cb, int start);
CString get_resist_type(int rtype);
CString get_save_type(int stype);
CString get_timing_type(int tmtype);
CString get_duration_label(int tmtype);
CString get_efftarget_type(int ettype);
CString get_resist_type(int rtype);
CString get_projectile_id(int pronum, int offset);
CString format_priesttype(int ptype);
CString get_region_type(int rttype);
CString format_feat(int i, bool flag);
CString format_skill(int idx, int value);
CString format_direction(int dir);
CString jourtype(int type);
CString get_songname(int songidx);
CString get_songfile(int songidx);
CString get_spawntype(int sptype);
CString get_container_icon(int citype);
CString resolve_scriptelement(int opcode, int trigger, int block);
CString implode(CString *array, int count);
CString *explode2(const CString &array, int &count); //clever explode of a parameter list
CString *explode(const CString &array, char separator, int &count); //dumb explode
//qsort helpers for sorting longs
int longsort(const void *a,const void *b); //descending
int longsortb(const void *a,const void *b); //ascending
int shortsortb(const void *a,const void *b); //ascending
#define GREY_TRESHOLD 2048
#define SMALL_DIFF 16
#define DITHER_MAX 20 //for dl1 dithering
//searchmap tile size
#define GR_WIDTH 16
#define GR_HEIGHT 12
extern unsigned short r_offset[256], g_offset[256], b_offset[256];
extern char *dith_max;
extern BYTE *range;
extern unsigned long *squares;
int ChiSquare(BYTE *a,BYTE *b);
//return values from compile
#define CE_MISSING_FUNCTION_NAME -1
#define CE_MISSING_CLOSING_PARENTHESES -2
#define CE_NON_EXISTENT_FUNCTION -3
#define CE_WRONG_ARGUMENT_NUMBER -4
#define CE_WRONG_ARGUMENT_TYPE -5
#define CE_WRONG_QUOTES -6
#define CE_EXTRA_CLOSING_PARENTHESES -7
#define CE_TOO_MANY_ARGUMENTS -8
#define CE_FUNCTION_NOT_TERMINATED -9
#define CE_INVALID_OBJECT -10
#define CE_INVALID_POINT -11
#define CE_INVALID_IDS_SYMBOL -12
#define CE_INVALID_STRING -13
#define CE_INVALID_SCOPE -14
#define CE_INVALID_RESOURCE -15
#define CE_INVALID_VARIABLE -16
#define CE_INVALID_INTEGER -17
#define CE_MISSING_IDS_FILE -18
#define CE_TOO_MANY_STRINGS -19
#define CE_INVALID_TLK_REFERENCE -20
#define CE_MISSING_CLOSING_BRACKET -21
#define CE_EXTRA_CLOSING_BRACKET -22
#define CE_INVALID_OBJECT_SYMBOL -23
#define CE_MAXIMUM_FUNCTION_NESTING -30
#define CE_MAXIMUM_OBJECT_NESTING -31
#define CE_INVALID_ARGUMENT_TYPE -32
#define CE_TRIGGERS_AFTER_FALSE -40
#define CE_EXCESS_TRUE -41
#define CE_INCOMPLETE_OR -42
#define CE_ACTIONS_AFTER_CONTINUE -43
#define CE_EMPTY_TOP_LEVEL -44
#define CE_INVALID_SPELL_LIST -45
#define CE_INVALID_SPELL_NUMBER -46
#define CE_INCORRECT_OR -47
#define CE_INCOMPLETE_TROVERRIDE -48
#define CE_BAD_IF -100
#define CE_BAD_RESPONSE -110
#define CE_BAD_THEN -120
#define CE_BAD_END -130
int compile_trigger(CString line, trigger &trigger);
int compile_action(CString line, action &action, bool inoverride);
int handle_trigger(int opcode);
int handle_action(int opcode);
//void outputtable();
//validity checkers
int check_ids_targeting(int par1, int par2);
int check_probability(int p1, int p2);
int check_alignment(long alignment);
//options
bool old_version_dlg();
bool pst_compatible_var();
bool bg1_compatible_area();
bool iwd2_structures();
bool unlimited_itemtypes();
bool no_compress();
bool bg2_weaprofs();
bool has_xpvar();
bool dltc_weaprofs();
bool tob_specific();
bool is_this_bgee();
CString getitemname(CString filepath);
CString makeitemname(CString ext, int remember);
CString ImageFilter(int mostisbmp);
int GetScanLineLength(int width, int bytes);
int CreateBmpHeader(int fhandle, DWORD width, DWORD height, DWORD bytes);
int CreatePltHeader(int fhandle, DWORD width, DWORD height, DWORD bytes);
CString AssembleWeiduCommandLine(CString filename, CString outpath, bool inout);
unsigned long getfreememory();
afx_msg void DefaultKillFocus();
int CompressBIFC(CString infilename);
int CompressCBForSAV(CString infilename, CString base, int outputhandle);
//graphical, vertex & polygon functions
void CreateMinimap(HWND hwnd);
int SetupSelectPoint(int baseoverlay);
int CanMove(CPoint &point, area_vertex *wedvertex, int count);
void RecalcBox(int count, int idx, POINTS &min, POINTS &max);
int PolygonInBox(area_vertex *wedvertex, int count, CRect rect);
int CheckIntervallum(int value, int first, int count);
int PointInCircle(area_ambient *ad, CPoint point);
int PointInPolygon(area_vertex *wedvertex, int count, CPoint point);
int ReadPolygon(int fhandle, area_vertex **polygon, short *countvertex);
int WritePolygon(int fhandle, area_vertex **polygon, short *countvertex);
int VertexOrder(area_vertex *wedvertex, int count);
CString reduce_tlk_text(CString str);
//readers & writers (they handle the lookup tables)
void UpdateIEResource(CString key, int restype, CString filepath, int size);
int write_area(CString key, CString filepath);
int write_wed(CString key, CString filepath);
int write_tis(CString key, CString filepath);
int read_item(CString key);
int write_item(CString key, CString filepath);
int read_spell(CString key, Cspell *myspell);
int write_spell(CString key, CString filepath);
int read_store(CString key);
int write_store(CString key, CString filepath);
int GetLightMap(bool night);
int GetWed(bool night);
int ReadWed(int res);
int get_script_handle(CString key);
int read_area(CString key, Carea *myarea);
int read_projectile(CString key);
int read_chui(CString key);
int write_chui(CString key, CString filepath);
int read_map(CString key);
int write_map(CString key, CString filepath);
int read_src(CString key);
int read_character(CString key, Ccreature *mycre);
int read_creature(CString key, Ccreature *mycre);
int read_pvrz(CString key, Cpvr *cb, int lazy=0);
int write_creature(CString key, CString filepath);
int write_character(CString key, CString filepath);
//pick 5 values from the gradient list
void MakeGradientArray(unsigned long *, unsigned int GradientIndex);
void MakeGradientBitmap(HBITMAP &hb, unsigned int GradientIndex);
CString GetMapTypeValue(int maptype, int value);
int read_bmp(CString key,HBITMAP &hb);
int read_bmp(CString key, Cbam *cb, int lazy=0); //cb can't be NULL due to polymorphism
int read_bmp(CString key, Cmos *cb, int lazy=0);
int read_bam(CString key, Cbam *cb=NULL, int lazy=0);
int read_bam_preview(CString key, Cbam *cb=NULL, int lazy=0);
int write_bam(CString key, CString filepath, Cbam *cb);
int write_bmp(CString key, CString filepath, Cbam *cb, int frame);
int read_mos(CString key, Cmos *cb=NULL, int lazy=0);
int read_tis(CString key, Cmos *cb=NULL, int lazy=0);
int read_tis_preview(CString key, Cmos *cb, int lazy=0);
int read_dialog(CString key);
int read_vef(CString key);
int write_vef(CString key, CString filepath);
int read_videocell(CString key);
int write_videocell(CString key, CString filepath);
int read_wfx(CString key);
int write_wfx(CString key, CString filepath);
int write_projectile(CString key, CString filepath);
int read_mus(CString key);
int read_worldmap(CString key);
int read_effect(CString key);
int write_effect(CString key, CString filepath);
int read_game(CString key);
int write_game(CString key, CString filepath);
int read_2da(CString key, C2da &da2da);
int write_2da(CString key, CString filepath);
int read_ids(CString key);
int play_acm(CString key, bool acm_or_wavc, int justload);
int write_wav(CString key, void *memory, long samples_written, int wav_or_acm);
int check_reference(long reference, int loretoid = 0, int min = 0, int max = 0);
/// tlk handler
void synchronise();
bool truncate_references(long maxnumber, int which);
CString resolve_tlk_text(long reference, int which=0);
int store_tlk_data(long reference, CString text, CString sound, int which=0);
BOOL match_tlk_text(long reference, CString text, int ignorecase, int which=0);
int store_tlk_text(long reference, CString text, int which=0);
bool resolve_tlk_tag(long reference, int which=0);
bool toggle_tlk_tag(long reference, int which=0);
int store_tlk_soundref(long reference, CString sound, int which=0);
CString resolve_tlk_soundref(long reference, int which=0);
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CHITEM_H__82C8D991_857B_4DDB_9704_0525A2869DD5__INCLUDED_)