-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.h
executable file
·1804 lines (1609 loc) · 56.5 KB
/
global.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
// global.h
// These are the variable structures. You really shouldn't change these.
// The comments are partial, intermittent, and may be wrong.
#pragma once
typedef char t_coord; // variable type of outdoor and town location coordinate
const size_t kSizeOfScenario_data_type = 7480; // actual sizeof() value is 4 byte larger than this value
const size_t kSizeOfOutdoor_record_type = 12892; // because of inheritance
const size_t kSizeOfTown_record_type = 16346; // but I dont't know the reason,
const size_t kSizeOfBig_tr_type = 20480; // only town_record_type is 6 byte larger than original
const size_t kSizeOfAve_tr_type = 11520; // Anyway, these constant is needed because the structure (class) size
const size_t kSizeOfTiny_tr_type = 5120; // is varied by the byte alignment setting.
#define SLEEP_TICKS 0L
#define MOUSE_REGION 0L
#define DRAG_EDGE 15
#define NIL 0L
#define NUM_BUTTONS 16
#define NUM_P_PER_TOWN 20
#define NUM_DLOG_B 53
#define MAX_TOWN_SIZE 64
#define OUTDOOR_SIZE 48
#define TER_RECT_UL_X 20
#define TER_RECT_UL_Y 20
#define TERRAIN_BORDER_WIDTH 15
#define LEFT_TEXT_LINE_ULX 15
#define LEFT_TEXT_LINE_ULY 540
#define LEFT_TEXT_LINE_WIDTH 240
#define TEXT_LINE_HEIGHT 12
#define TER_BUTTON_SIZE 16
#define RIGHT_TEXT_LINE_ULX 15
#define RIGHT_TEXT_LINE_ULY 500
#define RIGHT_BUTTONS_X_SHIFT 540
#define PALETTE_BUT_UL_X 17
#define PALETTE_BUT_UL_Y 382
#define PALETTE_BUT_HEIGHT 17
#define PALETTE_BUT_WIDTH 25
#define NUM_PC_I 34
#define NUM_TALK_NODES 100
#define NUM_SCEN_ITEMS 500
#define SMALL_SPACE_SIZE 8
#define MEDIUM_SPACE_SIZE 16
#define BIG_SPACE_SIZE 48
// q_3DModStart
#define SPACE_X_DISPLACEMENT_3D 24
#define SPACE_Y_DISPLACEMENT_3D 16
#define ELEVATION_Y_DISPLACEMENT_3D 23
#define PICT_BOX_WIDTH_3D 46
#define PICT_BOX_HEIGHT_3D 55
#define ITEM_BOX_SIZE_3D 28
#define OUTDOOR_CREATURE_WIDTH_3D 11
#define OUTDOOR_CREATURE_HEIGHT_3D 16
#define TER_BUTTON_HEIGHT_3D 19
// q_3DModEnd
// new blades consts
#define CDGT cd_retrieve_text_edit_str
#define CDGN cd_retrieve_text_edit_num
#define CDST cd_set_text_edit_str
#define CDSN cd_set_text_edit_num
#define MAX_NUM_SHEETS_IN_LIBRARY 200
#define NUM_WAYPOINTS 10
#define NUM_TER_SCRIPTS 100
#define NUM_TOWN_PLACED_ITEMS 144
#define NUM_TOWN_PLACED_FIELDS 60
#define NUM_TOWN_PLACED_CREATURES 80
#define NUM_TOWN_PLACED_SPECIALS 60
#define NUM_OUT_PLACED_SPECIALS 30
#define kNO_TOWN_SPECIALS 0xFF // No Special encounter on town map
#define kNO_OUT_SPECIALS -1 // No special encounter on outdoor map
#define kNO_OUT_TOWN_ENTRANCE -1 // No town entrance on outdoor map
#define kINVAL_LOC_XY -1 // invalid location, x or y
#define kINVAL_LOC {kINVAL_LOC_XY, kINVAL_LOC_XY} // invalid location
#define SCRIPT_NAME_LEN 14
#define SDF_RANGE_X 300
#define SDF_RANGE_Y 30
typedef char Boolean;
typedef struct
{
PBYTE * ppRow ; // must be first field for macros!
int iSignature ;
HBITMAP hBitmap ;
BYTE * pBits ;
DIBSECTION ds ;
int iRShift[3] ;
int iLShift[3] ;
}
DIBSTRUCT, * PDIBSTRUCT ;
typedef void * HDIB ;
typedef struct {
char x,y;
} location;
typedef struct {
short top,left,bottom,right;
} macRECT;
//typedef struct {
// short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto;
// } special_node_type;
typedef struct {
short which_state,which_personality;
short condition1[4],condition2[4];
short action_when_selected,default_jump_state;
short action_mods[4];
} talking_node_type;
typedef struct {
unsigned char short_strlens[NUM_TALK_NODES];
unsigned char strlens[NUM_TALK_NODES * 2];
char char_names[NUM_P_PER_TOWN][20];
short p_start_node[NUM_P_PER_TOWN];
short p_start_state[NUM_P_PER_TOWN];
talking_node_type talk_nodes[NUM_TALK_NODES];
} talking_record_type;
// The data for the locaiton for an icon in memory.
class graphic_id_type {
public:
graphic_id_type();
void clear_graphic_id_type();
Boolean not_legit();
short which_sheet; // the resource number of the graphic
short which_icon; // the icon in the resource. icons are in resources
// 16 icons per row
short graphic_adjust; // not yet used
};
class floor_type_type {
public:
floor_type_type();
void clear_floor_values();
char floor_name[20];
graphic_id_type pic; // regular picture location for ground
graphic_id_type ed_pic; // picture location for editor graphic for icon
short blocked; // 0 no 1 yes
char step_sound; // -1 no sound, otherwise sound when stepped on
char light_radius; // radius terrain sends its light out to, 0 - no light
short floor_height; // in pixels, positive is up, shows how many vertical pixels
// to offset graphics when drawn
short num_anim_steps;
// special properties of floor
short special; // floor special property
short effect_adjust; // intensity of special effect
// described in the editor docs
// special editor and movement toggles
Boolean is_water; // water?
Boolean is_floor; // a human built (stone or wood) floor
Boolean is_ground; // regular grass, cave floor?
Boolean is_rough; // rought errain? (i.e. desert or rough cave)
Boolean fly_over; // can this terrain be flied over?
Boolean shimmers; // does this graphic get drawn with graphical effects?
// 0 - none
// 1 - glows light/dark
// 2 - water effect
short outdoor_combat_town_used; // The town that is loaded when party fights an outdoor
// combat on this terrain type. If 0-999, loads the town in the current scenario/
// If 1000 + x, loads town x in file Blades of Avernum Out Fight
// 0 -
unsigned char shortcut_key;
short extra[6];
};
class terrain_type_type {
public:
terrain_type_type();
void clear_terrain_values();
char ter_name[20];
graphic_id_type pic; // regular picture location for when above ground
graphic_id_type cut_away_pic; // picture when the terrain is being drawn cut away
graphic_id_type ed_pic; // picture location for editor graphic for icon
// the icon can be drawn with a certain pixel offset.
short icon_offset_x,icon_offset_y;
// a terrain spot can have a second icon drawn, which must be in the same sheet as the first icon.
// it affects the outdoor and underground terrain versions equally.
// there can be a different icon for the front and cut away view.
short second_icon,second_icon_offset_x,second_icon_offset_y;
short cut_away_second_icon,cut_away_offset_x,cut_away_offset_y;
// For now, cut_away_offset_x & cut_away_offset_y are UNUSED
// Use other offsets instead.
short anim_steps; // number of icons in this terrain's animation. uses icons after
// first icon in sheet for animation
unsigned char move_block[4]; // 0 - no block, 1 - block movement, 0 - n, 1 - w, 2 - s, 3 - e
unsigned char see_block[4]; // 0 - no block, 1 - sight movement, 0 - n, 1 - w, 2 - s, 3 - e
unsigned char blocks_view[4]; // 0 - draw after pc in spot, 1 - draw before, 0 - n, 1 - w, 2 - s, 3 - e
short height_adj; // pixels up to draw chars/items in this space
unsigned char suppress_floor; // 0 - no, if 1, floor type under terrain type is ignored
unsigned char light_radius; // radius of light coming from this spot
char step_sound; // -1 - no sound, takes precedence over floor sound
unsigned char shortcut_key;
// various special properties
short crumble_type; // 0 - won't crumble, 1-5 - strength of speel needed to make crumble
short beam_hit_type; // 0 - blocks beam, 1 - allows beam through
// 3 - crumbles when beam hits
short terrain_to_crumble_to;
short hidden_town_terrain; // -1 - unused. otherwise, terrain to place here if this is
// icon for a hidden town
short swap_terrain; // ter to swap to if a swap terrain special call is used
Boolean is_bridge; // allows people to cross this space even if floor is a blocking type
Boolean is_road;
Boolean can_look_at; // a terrain which is always selected to be inspected when player looks
Boolean draw_on_automap;
char default_script[SCRIPT_NAME_LEN]; // the name of the default script
Boolean shimmers; // does this graphic get drawn with graphical effects?
// 0 - none
// 1 - glows light/dark
// 2 - water effect
short outdoor_combat_town_used; // The town that is loaded when party fights an outdoor
// combat on this terrain type. If 0-999, loads the town in the current scenario/
// If 1000 + x, loads town x in file Blades of Avernum Out Fight
// 0 -
// special properties of terrain
short special; // floor special property
short effect_adjust; // intensity of special effect
// below may be out of date. full info inj editor docs
// special effect effect_adjust
// 0 none
// 1 fire damage amt. of damage
// 2 cold damage amt. of damage
// 3 magic damage amt. of damage
// 4 poison amt. of damage
// 5 disease amt. of damage
// 6 blocks monsts
// Hill abilities
// 19 hill, up to west
// 20 hill, up to southwest
// 21 hill, up to south
// 22 hill, up to southeast
// 23 hill, up to east
// 24 hill, up to northeast
// 25 hill, up to north
// 26 hill, up to northwest
// 27 hill, down to southeast
// 28 hill, down to northeast
// 29 hill, down to northwest
// 30 hill, down to southwest
// Beam abilities
// 31 beam power source, if charged by beam
// 32 fires beam north
// 33 fires beam west
// 34 fires beam south
// 35 fires beam east
// 36 nw/se mirror
// 37 ne/sw mirror
// 38 beam power source
// 39 sign
// 40 container
// 41 acts as table
// 42 glows
// 43 waterfall - south
// 44 waterfall - west
// 45 destroyed by quickfire
} ;
class out_wandering_type {
public:
out_wandering_type();
void clear_out_wandering_type();
void port();
short hostile[4],hostile_amount[4];
short friendly[3],friendly_amount[3];
short cant_flee;
// this encounter can ever be evaded?
short end_spec1,end_spec2;
// if this flag is set, this encounter never appears.
short killed_flag1,killed_flag2;
// this flag is set to 1 when enc killed.
// can, and probably should, be same as end_spec
short forced; // if > 0, party encoutners this immediately
short check_every_turn; // most encoutners checked every 10 turns.
// if this is 1, check this one every turn
short move_type;
// 0 - seek party 1 - no move 2 - random move 3 - follow roads 4 - flee party
// +10 - always stays within 10 spaces of starting spot
location start_loc; // location encounter first appears
short start_state_when_encountered;
short start_state_when_defeated;
short start_state_when_fled;
short random_move_chance; // chance (0-100) that this creature will move randomly at
// any move instead of doing what it wants
} ;
class outdoor_record_type {
public:
outdoor_record_type();
void clear_outdoor_record_type();
void port();
void SetSurface( short onSurface );
char name[20];
unsigned char floor[48][48];
unsigned char height[48][48];
short terrain[48][48];
macRECT special_rects[NUM_OUT_PLACED_SPECIALS];
short spec_id[NUM_OUT_PLACED_SPECIALS];
macRECT exit_rects[8];
short exit_dests[8];
// signs
location sign_locs[8];
char sign_text[8][256];
// wandering
out_wandering_type wandering[4],special_enc[4],preset[8];
location wandering_locs[4];
macRECT info_rect[8];
char info_rect_text[8][30];
// scripts and special flags
char section_script[SCRIPT_NAME_LEN]; // the name of the default script
short is_on_surface;
short extra[10];
} ;
class creature_type {
public:
creature_type();
void clear_creature_type();
char name[20];
short level; // level of creature
short which_to_add_to[6]; // which 6 skills to give bonuses to
short how_much[6]; // how much to add to each skill
short items[8]; // numbers of items it has
short item_chances[8]; // chance, from 0 to 100, of the item being present
short hp_bonus;
short sp_bonus;
short spec_abil;
// 0 -
short default_attitude; // 0 - PC, 1 - PC aid, 2 friendly, 3 - neutral, 4 - hostile A, 5 - hostile B
short species;
// 0 - human
// 1 - humanoid
// 2 - nephil
// 3 - slith
// 4 - giant
// 5 - reptile
// 6 - beast
// 7 - demon
// 8 - undead
// 9 - insect
// 10 - slime
// 11 - stone/golem
// 12 - special
// 13 - vahnatai
// 14-19 - other/ scenario designed
unsigned char immunities[6];
// 0 - fire, 1 - cold, 2 - magic, 3 - mental, 4 - poison/acid, 5 - melee
short natural_armor; // like armor, starts at 0
// graphic
graphic_id_type char_graphic;
short char_upper_graphic_sheet;
short small_or_large_template;
short a[3],a1_type,a23_type;
// attack types
// 0 - strike
// 1 - claw
// 2 - bite
// 3 - slimes
// 4 - punches
// 5 - stings
// 6 - clubs
// 7 - burns
// 8 - harms
// 9 - stabs
short ap_bonus;
char default_script[SCRIPT_NAME_LEN];
short default_strategy;
// 0 - default, regular attack
// 1 - archer/caster, so maintain distance
// 2-9 - reserved
short default_aggression,default_courage;
short summon_class; // -1 - never summoned, otherwise, number from 0-6, higher = harder to summon
short extra[10];
};
class item_record_type {
public:
item_record_type();
void clear_item_record_type();
short variety;
// 0 - null item
// 1 - 1 handed weapon
// 2 - 2 handed Weapon
// 3 - Gold
// 4 - Food
// 5 - Thrown Missile
// 6 - Bow
// 7 - Potion
// 8 - Scroll
// 9 - Wand
// 10 - Tool
// 11 - Pants
// 12 - Shield
// 13 - Armor
// 14 - Helm
// 15 - Gloves
// 16 - Boots
// 17 - Cloak
// 18 - Ring
// 19 - Necklace
// 20 - Bracelet
// 21 - Object
// 22 - Crossbow
// 23 - Arrows
// 24 - Bolts
short damage; // weapons do (1 - damage/2) + (1 - damage/2)
char bonus; // amt. added to weapon damage, and to hit increased by %5 * bonus
char weap_type; // number of skill used for weapon, such as 4 for melee
char protection; // prevents (1 - protection/2) + (1 - protection/2) melee damage
char charges;
short encumbrance;
graphic_id_type item_floor_graphic;
short inven_icon;
short missile_anim_type;
// item abilities
short ability_in_slot[4]; // -1 or 0 - no abil
// otherwise, number of ability
// probably out of date. consult editor docs for full list
// PASSIVE ABILITIES
// 1 - 49 - Affects statistic x + 1. So if 3, affects statistic 2 (Intelligence)
// 50 - Melee to hit chance
// 51 - Melee damage
// 52 - Missile to hit chance
// 53 - Missile damage
// 54 - Resist all hostile effects
// 55 - Resist fire
// 56 - Resist cold
// 57 - Resist magic
// 58 - Resist mental
// 59 - Resist poison
// 60 - Resist acid
// 61 - Affect action points
// 62 - Affect melee statistics
// 63 - Affect magic statistics
// 64 - Affect all statistics
// 65 - Affect rune reading
// 70 - Extra fire damage (only has effect on a weapon)
// 71 - Extra acid damage (only has effect on a weapon)
// 72 - Extra poison damage (only has effect on a weapon)
// 73 - Extra damage to humanoids (only has effect on a weapon)
// 74 - Extra damage to undead (only has effect on a weapon)
// 75 - Extra damage to demons (only has effect on a weapon)
// 76 - Extra damage to giants (only has effect on a weapon)
// 77 - Drains life, adds to wielder (only has effect on a melee weapon)
// 78 - Extra damage to reptiles (only has effect on a weapon)
// 79 - Extra damage to aliens (only has effect on a weapon)
// 80 - Encumbers
// 81 - Resist melee damage
// 82 - Resist all damage
// 83 - Affects chance to be hit in combat
// 84 - Protects from petrification
// ACTIVE ABILITIES
// 100-119 - Casts mage spell 100 + x.
// 120-139 - Casts priest spell 120 + x.
// 150 - 199 - Affects status 150 + x.
// 200 - heals damage
// 201 - cures bad effects
// 202 - Adds experience.
// 203 - Adds skill points.
// 204 - Adds spell energy.
// 205 - Cleanses webs and disease.
// 207 - Calls a scenario script state. Doesn't lose a charge when used. Items with this ability can't be carried between scenarios
// 208 - Calls a scenario script state. Loses a charge when used. Items with this ability can't be carried between scenarios
// 209 - Whole party resists mental effects
// 210 - Increases light.
// 211 - is a lockpick.
// 212 - Is a First Aid Kit.
// 213 - Gives whole party flight.
// 214 - Afflicts user with bad effects.
// 215 - Permanently change 1 statistic.
short ability_strength[4]; // strength of ability, -50 to 50
short special_class; // 0 - no class
short value;
short weight;
short value_class; // Represents the item's value for random treasures
// from 0 - 10, if -1, no class.
// property flags
unsigned char ident; // if 1, always ident
unsigned char magic; // if 1, magic item
unsigned char cursed; // if 1, cursed
unsigned char once_per_day; // if 1, always ident
unsigned char junk_item; // if 1, can delete this item to make room in town
unsigned char extra[4];
char full_name[30],name[20];
short augment_item;
} ;
class item_type {
public:
item_type();
void clear_item_type();
Boolean exists();
void port();
short which_item;
// -1 - null item
// if 0 - 399, item from scenario list
// if 1000 + x, is item x is party imported_items list
location item_loc;
unsigned char charges;
unsigned char properties;
// bit 0 - ident 1 - property 2 - contained 3 - cursed 4 - used today
location item_shift;
} ;
class creature_start_type {
public:
creature_start_type();
void clear_creature_start_type();
Boolean exists();
void port();
short number; // numebr of creature in roster, -1 for none here
short facing;
short start_attitude;// 0 - PC, 1 - PC aid, 2 friendly, 3 - neutral, 4 - hostile A, 5 - hostile B
location start_loc;
short personality;
short extra_item;
short extra_item_chance_1;
short extra_item_2;
short extra_item_chance_2;
short hidden_class;
short character_id;
// a number from 0-20000, a unique id for this character
// timing variable
short time_flag;
// Indicates when this char appears. Types 0-9 are only there if
// the town has not been destroyed.
// 0 - always here (unless town has been destroyed)
// 1 - appear at time t, unless town destroyed
// 2 - disappear at time t
// 3 - appear if event attached_event not done by time t
// 4 - disappear if event attached_event not done by time t
// 5 - appear if event attached_event done
// 6 - disappear if event attached_event done
// 7 - here on day 0-2 of every 9 days
// 8 - here on day 3-5 of every 9 days
// 9 - here on day 6-8 of every 9 days
// 10 - here if and only if town has been destroyed
short creature_time;
short attached_event;
// the event that this character is tied to (like a troglo to the
// troglos killed event)
short unique_char;
// scripting
char char_script[SCRIPT_NAME_LEN]; // the name of the default script
short memory_cells[10];
short act_at_distance;
short extra[4];
};
class preset_field_type {
public:
preset_field_type();
void clear_preset_field_type();
void port();
location field_loc;
short field_type;
} ;
// when a terrain spot has a script, the detains for that script are remembered in
// this record. It a terrain spot has a script, it MUST has a corresponding
// record of this sort active
class in_town_on_ter_script_type {
public:
in_town_on_ter_script_type();
void clear_in_town_on_ter_script_type();
void port();
short exists;
location loc; // location of the terrain spot this is for
char script_name[SCRIPT_NAME_LEN];
short memory_cells[10];
};
class town_record_type {
public:
town_record_type();
void clear_town_record_type();
void set_start_locs(short town_size);
void port();
char town_name[20];
short respawn_monsts[4][6];
location respawn_locs[6];
macRECT special_rects[NUM_TOWN_PLACED_SPECIALS];
unsigned char spec_id[NUM_TOWN_PLACED_SPECIALS];
short lighting;
location sign_locs[15];
char sign_text[15][256];
location start_locs[4];
location exit_locs[4];
macRECT in_town_rect;
item_type preset_items[NUM_TOWN_PLACED_ITEMS];
preset_field_type preset_fields[NUM_TOWN_PLACED_FIELDS];
short wall_1_sheet,wall_1_height,wall_2_sheet,wall_2_height,cliff_sheet;
short beam_type;
short environmental_sound; // sound to play in background
short is_on_surface;
short town_kill_day,town_linked_event;
short external_floor_type;
short monster_respawn_chance;
char town_script[SCRIPT_NAME_LEN];
in_town_on_ter_script_type ter_scripts[NUM_TER_SCRIPTS];
macRECT room_rect[16];
char info_rect_text[16][30];
creature_start_type creatures[NUM_TOWN_PLACED_CREATURES];
short extra[20];
location waypoints[NUM_WAYPOINTS];
short exit_specs[4];
short spec_on_entry,spec_on_entry_if_dead;
} ;
class ave_tr_type;
class tiny_tr_type;
class big_tr_type {
public:
big_tr_type();
big_tr_type( big_tr_type& bigTR );
void clear_big_tr_type();
void port();
big_tr_type& operator = ( const ave_tr_type& aveTR );
big_tr_type& operator = ( const tiny_tr_type& tnyTR );
short terrain[64][64];
unsigned char floor[64][64];
unsigned char height[64][64];
unsigned char lighting[64][64];
} ;
class ave_tr_type {
public:
ave_tr_type();
ave_tr_type( big_tr_type& bigTR );
void clear_ave_tr_type();
void port();
ave_tr_type& operator = ( const big_tr_type& bigTR );
short terrain[48][48];
unsigned char floor[48][48];
unsigned char height[48][48];
unsigned char lighting[48][48];
} ;
class tiny_tr_type {
public:
tiny_tr_type();
tiny_tr_type( big_tr_type& bigTR );
void clear_tiny_tr_type();
void port();
tiny_tr_type& operator = ( const big_tr_type& bigTR );
short terrain[32][32];
unsigned char floor[32][32];
unsigned char height[32][32];
unsigned char lighting[32][32];
} ;
typedef struct {
short ter_type,item_num[10],item_odds[10],property;
} item_storage_shortcut_type;
class scen_item_data_type {
public:
scen_item_data_type();
void clear_scen_item_data_type();
item_record_type scen_items[NUM_SCEN_ITEMS];
floor_type_type scen_floors[256];
terrain_type_type scen_ter_types[512];
creature_type scen_creatures[256];
} ;
//town i's name is stored in town_names[i]
//outdoor section i,j's name is stored in
// section_names[i+out_width*j]
class zone_names_data_type {
public:
char town_names[200][20];
char section_names[100][20];
int out_width;
int out_height;
//width and height are stored seperately here as these data structures may
//be used to store information about scenarios from which zones are being imported
};
class boat_record_type {
public:
boat_record_type();
void clear_boat_record_type();
location boat_loc,boat_loc_in_sec,boat_sector;
short which_town;
Boolean exists,property;
} ;
class horse_record_type {
public:
horse_record_type();
void clear_horse_record_type();
location horse_loc,horse_loc_in_sec,horse_sector;
short which_town;
Boolean exists,property;
} ;
class scenario_data_type {
public:
scenario_data_type();
void clear_scenario_data_type();
short scenario_platform();
void port();
unsigned char flag1, flag2, flag3, flag4;
// for mac, flags are 97 215 7 33
// for win, flags are 199 61 2 53
unsigned char ver[3];
unsigned char min_run_ver;
unsigned char prog_make_ver[3];
unsigned char num_towns;
short out_width,out_height;
short min_level,max_level;
short rating;
// labels when selecting scen
char scen_name[50];
short scen_label_pic;
char scen_desc[256];
// credits text
char credits_text[2][256];
char comments_text[2][256];
// intro stuff, plays when scen started
short intro_pic_resources[3];
char intro_text[3][6][256];
// town data
unsigned char town_size[200]; // 0 - large, 1 - medium, 2 - small
unsigned char town_starts_hidden[200];
// starting loc
short start_in_what_town;
location what_start_loc_in_town;
location what_outdoor_section_start_in;
location start_where_in_outdoor_section;
// changing town entrances
short town_to_add_to[10];
short flag_to_add_to_town[10][2];
boat_record_type scen_boats[30];
horse_record_type scen_horses[30];
item_storage_shortcut_type storage_shortcuts[10];
location last_out_edited;
short last_town_edited;
} ;
// general script records
// Script stuff
#define MAX_DESCRIBER_LEN 30
#define NUM_SCRIPT_STRINGS 750
#define SCRIPT_VAR_NAME_LEN 20
#define NUM_SCRIPT_INTS 20
#define NUM_SCRIPT_LOCATIONS 10
#define NUM_SCRIPT_STRING_VARS 20
#define NUM_PROCEDURE_PASS_VARS 5
// a block of text, loaded in from a file.
class text_block_type
{
public:
text_block_type();
~text_block_type();
Boolean load_text_file_into_buffer(char* file_name_to_load,short file_location);
void preprocess_text();
short estimate_num_of_tokens();
char* text_block;
long block_length;
};
// A token, a basic unit of meaning in a script (like a procedure name, or a number).
// The list of 20-odd different token types can be found in tokntype.h.
class token_type
{
public:
token_type();
unsigned char type;
short line;
short what_sort;
};
// A token, a basic unit of meaning in a script.
typedef struct
{
char token_text[MAX_DESCRIBER_LEN];
} token_describer_type;
// Stores a loaded script, in tokenized form.
class script_type
{
public:
script_type();
~script_type();
void flush_data();
Boolean load_script(short type_of_script_to_load,char* script_to_load,short file_location);
Boolean IsWhiteSpace(char c);
Boolean IsIdentifier(char c);
Boolean IsNumber(char c);
Boolean IsOperatorCharacter (char c);
short IsVariable (char* string, int length, token_type *token);
short IsBlockDefiner (char* string, int length, short *value);
short IsVarDefiner (char* string, int length, short *value);
short IsVarArrayDefiner (char* string, int length, short *value);
short IsVarStringDefiner (char* string, int length, short *value);
short IsNewVariableDefiner (char* string, int length, short *value);
short IsFlowController (char* string, int length, short *value);
short IsConstant (char* string, int length, short *value);
short IsOperator (char* string, int length, short *value);
short IsFunction (char* string, int length, short *value);
short IsProcedure (char* string, int length, short *value);
short IsBinaryFunction (char* string, int length, short *value);
short IsTrinaryFunction (char* string, int length, short *value);
short IsLocationFunction (char* string, int length, short *value);
Boolean process_scenario_data();
// Boolean process_creature_data();
Boolean token_type_match(short which_token,short type);
// Boolean token_sort_match(short which_token,short what_sort);
Boolean token_match(short which_token,short type,short what_sort);
// short find_first_matching_token(short type_of_token,short what_sort = -1);
// short find_next_matching_token(short start_token,short type_of_token,short what_sort = -1);
// Boolean semicolon_check(short check_token);
// short find_start_of_state(short which_state);
// Boolean run_script(short next_token);
// Boolean evaluate_int_expression(short next_token,short *result,short *new_position);
// Boolean higher_precedence (token_type op1, token_type op2);
// short evaluate_unary_function(short fcn_type,short op1,short which_line);
// short evaluate_binary_function(short fcn_type,short op1,short op2,short which_line);
// Boolean run_procedure(short which_procedure,short which_line);
// short find_previous_matching_token(short start_token,short type_of_token,short what_sort);
// short find_matching_bracket(short start_token);
// short end_of_current_line(short start_token);
// short find_conditional_matching_bracket(short start_token);
// location location_function_value(short what_function,short what_passed,short what_line);
// Boolean run_creature_script();
// short evaluate_trinary_function(short fcn_type,short op1,short op2,short op3,short which_line);
short IsNoParameterFunction (char* string, int length, short *value);
// short evaluate_no_param_function(short fcn_type,short which_line);
// Boolean run_zone_script();
// Boolean process_dialogue_data();
// basic script information
char script_name[20];
short type_of_script;
// -1 - undefined
// 0 - Scenario data
// 1 - Scenario script
// 2 - Town - specials
// 3 - Town - dialogue
// 4 - Outdoor - specials
// 5 - Outdoor - dialogue
// 6 - Creature
// 7 - Terrain Spot
token_type *token_list;
short num_tokens;
Boolean script_killed; // If the script hits a run-time error,
// this makes sure it's never called again.
short which_object; // The number of the creature/object this is for.
// only relevant if type_of_script is 2,3.
// script variables
char int_var_names[NUM_SCRIPT_INTS][SCRIPT_VAR_NAME_LEN];
short int_var_values[NUM_SCRIPT_INTS];
char location_var_names[NUM_SCRIPT_LOCATIONS][SCRIPT_VAR_NAME_LEN];
location location_var_values[NUM_SCRIPT_LOCATIONS];
char string_var_names[NUM_SCRIPT_STRING_VARS][SCRIPT_VAR_NAME_LEN];
char* string_var_values[NUM_SCRIPT_STRING_VARS];
// temporary holder for the script text
char* string_data[NUM_SCRIPT_STRINGS];
// stacks for running procedures
short procedure_passed_variable_types[NUM_PROCEDURE_PASS_VARS];
// 0 - int 1 - loc 2 - string constant 3 - string variable
short procedure_passed_values[NUM_PROCEDURE_PASS_VARS];
location procedure_passed_locations[NUM_PROCEDURE_PASS_VARS];
};
/*
class boe_outdoor_record_type{
public:
void clear_boe_outdoor_record_type();
unsigned char terrain_variety[48][48];
old_blades_outdoor_record_type;
};
*/
// begin Blades of Exile records
// This junk only used for routines to port BoE scenarios.
typedef struct {
short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto;
} old_blades_special_node_type;
typedef struct {
short personality,type;
char link1[4],link2[4];
short extras[4];
} old_blades_talking_node_type;
typedef struct {
unsigned char strlens[200];
old_blades_talking_node_type talk_nodes[60];
} old_blades_talking_record_type;
typedef struct {
short picture;
unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over;
unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3;
} old_blades_terrain_type_type;
typedef struct {
unsigned char monst[4];
} old_blades_wandering_type;
typedef struct {
unsigned char monst[7];
unsigned char friendly[3];
short spec_on_meet,spec_on_win,spec_on_flee,cant_flee;
short end_spec1,end_spec2;
} old_blades_out_wandering_type;