-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathChitem.h
1276 lines (1140 loc) · 39.6 KB
/
Chitem.h
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
// 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 8192
#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
//special container type
#define CONT_PILE 4
//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 7
//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 CHECK_WORLDMAP 28
#define ADD_VAR3 29
#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 CHECK_ZERO 0x1000000
//#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//IWD style ids targeting
#define PROJ_UNUSED2 0x80000000//apply every hit on self
//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 APF_BRIGHTEST 0x2000//brightest flag (blend1)
#define APF_GLOW 0x4000//glow flag (blend2)
#define APF_16 0x8000
#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 CStringList containericons;
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;
extern CIntMapInt statdesc;
extern CStringList campaignrefs;
#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);