This repository has been archived by the owner on May 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathHexen_specs.txt
2650 lines (1717 loc) · 71.1 KB
/
Hexen_specs.txt
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
HEXEN Specs v0.9 Page 1
The Official Hexen Technical Specs
Author: Ben Morris ([email protected])
Information from Raven provided by Ben Gokey
[Disclaimer]
The text contained in this document is for informational
purposes only. If you decide to use this information in any
way, neither id Software, Raven Software, nor Ben Morris
can be held responsible for any damages or losses (including,
but not limited to: dismembered bodily parts, telefrags and
lack of sleep) incurred by this information's use. Although
this is an "Official" specification, some of the information
contained within might be old, or just plain typed in wrong.
You have been warned.
!!!
NB: This version of the specs, 0.9, is a preliminary release. Most of
the information here is tried and true, but there's a good
chance there are errors in the file. If something doesn't
look right, or really IS wrong, please contact me (Ben Morris)
at the address above. Please do NOT contact me about new
versions of the specs; I will release the new versions when
they are ready. Thanks.
** Set your tab width to 4.
Page 1
HEXEN Specs v0.9 Page 2
ÚÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ þ ³ Table of Contents
ÀÄÄÄÙ
No, this isn't finished.
ÚÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ þ ³ Definitions used in this File
ÀÄÄÄÙ
Angle [0..255] Used in "angle" parameters to Special types:
0 East 32 Northeast
64 North 96 Northwest
128 West 160 Southwest
192 South 224 Southeast
* NOTE that this differs from DOOM/Heretic in that 45/90
degree increments are not used. However, this difference
does _not_ apply for the angles used for the THINGS in
map editing - they are the same as DOOM's (eg: 0 = East,
90 = North, etc.)
Tics Time unit of length 1/35 second. So, 35 tics = 1 second.
Octics Time unit of length 8 tics. So, 8 octics = 1 second.
Page 2
HEXEN Specs v0.9 Page 3
ÚÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ i ³ About This File
ÀÄÄÄÙ
This file was written for those who are interested in the inner workings of
Hexen. It doesn't contain playing tips or information on how to get Hexen
working on your system.
This file is intended to be supplementary to Matt Fell's "Unofficial DOOM
Specs", which probably came with your copy of DOOM or DOOM ][. Wherever
it's relevant, this file refers to a specific section in the DOOM specs (be
sure you have version 1.666!), so it's a good idea to have a copy at hand.
ÚÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ i ³ Introduction to Hexen
ÀÄÄÄÙ
Hexen is the sequel to Heretic, Raven Software's first collaboration with id
Software.
[..]
Hexen's major difference from Heretic and DOOM is its programmability. Hexen
features a powerful script language that can be used to create a wide variety
of in-game effects such as traps, puzzles and even earthquakes!
[...]
Page 3
HEXEN Specs v0.9 Page 4
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 3-0 ³ Hexen Data Structures
ÀÄÄÄÄÄÙ
This section outlines the format of the new data blocks in a Hexen map - the
LINEDEF and THING structures. These structures have changed from the
versions used in DOOM and Heretic.
[DOOM Specs ref]
[3-1] The Hexen LINEDEF structure
---------------------------------
Offset Size Meaning
---------------------------------------------------
0 word the line's start-vertex
2 word the line's end-vertex
4 word line flags (see below)
6 byte special type (see [Specials])
7 5 bytes special arguments
12 word the line's right sidedef number
14 word the line's left sidedef number
[3-1-1] Line Flags
------------------
The following flags are starred with an asterisk if they're new for
Hexen:
Bits Meaning when Set
---------------------------------------------------
0 impassable - the line cannot be crossed.
1 impassable to monsters only.
2 two-sided
3 upper texture is unpegged (drawn from top-down)
4 lower/middle texture is unpegged (drawn from bottom-up)
5 secret - the line appears as impassable on the automap.
6 sound can't travel through the line, but only
for monsters' ears.
7 never draw the line on the auto-map, even with the
map cheat enabled.
8 the line is always drawn on the auto-map, even if it
hasn't been seen by the player.
* 9 the line's special ([3-1]) is repeatable, ie: it can
be activated more than once.
* 10..12 the line's special activation, ie: how the special is
Page 4
HEXEN Specs v0.9 Page 5
activated.
Value Activated when...
---------------------------------------------
0 Player crosses the line
1 Player uses the line with the use key
2 Monster crosses the line
3 Projectile impacts the wall
4 Player pushes the wall
5 Projectile crosses the line
To get the special activation, use the following formula:
activation := (line.flags BITAND 0x1C00) BITSHIFTRIGHT 10
[3-2] The Hexen THING structure
-------------------------------
Offset Size Meaning
---------------------------------------------------
* 0 word thing ID - used in scripts and specials to
identify a THING or a set of THINGs.
2 word x-position on the map
4 word y-position on the map
* 6 word starting altitude on the map - the THING
is created at this altitude above the floor
of the sector it's in when the map is entered,
and is immediately subjected to gravity.
8 word the angle the thing is facing when the map
is entered.
10 word the thing type (see [3-2-2].)
* 12 word thing flags (see [3-2-1].)
14 byte special type (see [Specials]). a thing's
special is activated when the thing is
killed (Monster), destroyed (Tree, Urn, etc.),
or picked up (Artifact, Puzzle Piece.)
15 5 bytes special arguments
[3-2-1] Thing Flags
-------------------
The following flags are starred with an asterisk if they're new for
Hexen:
Bits Meaning when Set
---------------------------------------------------
0 the thing appears on the Easy skill settings (1-2)
1 the thing appears on the Normal skill setting (3)
Page 5
HEXEN Specs v0.9 Page 6
2 the thing appears on the Hard skill settings (4-5)
3 the thing is deaf - it sits around until it's
hurt, or until it sees a player.
* 4 the thing is dormant - it never wakes up until it's
activated using the Thing_Activate() special.
* 5 the thing appears for the Fighter class.
* 6 the thing appears for the Cleric class.
* 7 the thing appears for the Mage class.
* 8 the thing appears in single-player games.
* 9 the thing appears in cooperative games.
* 10 the thing appears in deathmatch games.
Each "thing appears" flag must be set for each condition under which the
thing is to appear. For multi-player games involving more than one
class, a thing that is set for one of the classes involved will also appear
for the other two classes in the game.
For example, if you set the three pieces of the Fighter's sword to appear
for only the Fighter (bit 5 is set) and in Deathmatch (bit 10 is set),
if a Mage or a Cleric is also playing, the pieces of the sword will be
visible to them, too.
[3-2-2] Thing Types
-------------------
Creatures as well as some objects can be activated and/or deactivated with
the ThingActivate and ThingDeactivate line specials.
Creatures will freeze when deactivated and resume when activated.
Activation can also be used to bring a "dormant" creature to life.
If a creature has a special, that special will be activated upon its death.
Also, if the creature is teleported away using the banishment device
(teleport other), the special will be activated and then removed from the
creature.
Type Name
-----------------------------------------------------------
1 Player_1_start
2 Player_2_start
3 Player_3_start
4 Player_4_start
11 Player_Deathmatch
14 Player_TeleportSpot
10 2C_SerpentStaff
8010 2F_Axe
53 2M_ConeOfShards
Page 6
HEXEN Specs v0.9 Page 7
8009 3C_Firestorm
123 3F_Hammer
8040 3M_Lightning
20 4C_1Shaft
19 4C_2Cross
18 4C_3Arc
16 4F_1Hilt
13 4F_2Crosspiece
12 4F_3Blade
23 4M_1Stick
22 4M_2Stub
21 4M_3Skull
10110 A_Flechette
8003 A_BoostMana
8002 A_BootsOfSpeed
8041 A_Bracers
84 A_IconOfDefender
30 A_Porkelator
83 A_WingsOfWrath
32 A_HealingComplete (Urn)
82 A_HealingHefty (Flask)
81 A_HealingWimpy (Vial)
10120 A_HealRadius
8000 A_Repulsion
86 A_DarkServant
36 A_ChaosDevice
33 A_Torch
10040 A_Banishment
8008 Ar_Amulet
8005 Ar_Armor
8007 Ar_Helmet
8006 Ar_Shield
114 C_Bishop
107 C_Centaur
115 C_CentaurLeader
10101 C_ClericBoss
31 C_Demon
8080 C_Demon2
254 C_Dragon
10030 C_Ettin
10100 C_FighterBoss
10060 C_FireImp
112 C_Fly
10080 C_Heresiarch
8020 C_IceGuy
10200 C_Korax
10102 C_MageBoss
Page 7
HEXEN Specs v0.9 Page 8
121 C_Serpent
120 C_SerpentLeader
34 C_Wraith
10011 C_Wraith2
8032 K_AxeKey
8034 K_CastleKey
8031 K_CaveKey
8035 K_DungeonKey
8033 K_FireKey
8200 K_GoldKey
8037 K_RustyKey
8036 K_SilverKey
8030 K_SteelKey
8039 K_SwampKey
8038 K_WasteKey
122 Mana_1
124 Mana_2
8004 ManaCombined
3000 PO_Anchor
3001 PO_StartSpot
3002 PO_StartSpot_Crush
1410 SE_Wind
10225 Spawn_Bat
10000 Spawn_Fog
10001 Spawn_Fog_a
10002 Spawn_Fog_b
10003 Spawn_Fog_c
113 Spawn_Leaf
10090 Spike_Down
10091 Spike_Up
1403 SS_Creak
1408 SS_EarthCrack
1401 SS_Heavy
1407 SS_Ice
1405 SS_Lava
1402 SS_Metal
1409 SS_Metal2
1404 SS_Silent
1400 SS_Stone
1406 SS_Water
9001 X_MapSpot
9013 X_MapSpotGravity
Page 8
HEXEN Specs v0.9 Page 9
8064 Z_ArmorSuit
77 Z_Banner
8100 Z_Barrel
8065 Z_Bell
8066 Z_BlueCandle
8061 Z_BrassBrazier
8103 Z_Bucket
119 Z_Candle
8069 Z_Cauldron
8070 Z_Cauldron_Unlit
8071 Z_Chain32
8072 Z_Chain64
8073 Z_ChainHeart
8074 Z_ChainLHook
8075 Z_ChainSHook
8077 Z_ChainSkull
8076 Z_ChainSpikeBall
17 Z_Chandelier
8063 Z_Chandelier_Unlit
8042 Z_FireBull
8043 Z_FireBull_Unlit
8060 Z_FireSkull
118 Z_GlitterBridge
10503 Z_LargeFlame_Permanent
10502 Z_LargeFlame_Timed
10501 Z_SmallFlame_Permanent
10500 Z_SmallFlame_Timed
140 Z_TeleportSmoke
116 Z_TwinedTorch
117 Z_TwinedTorch_Unlit
103 Z_VasePillar
54 Z_Wall_Torch_Lit
55 Z_Wall_Torch_Unlit
5 Z_WingedStatue
6 ZC_Rock1
7 ZC_Rock2
9 ZC_Rock3
15 ZC_Rock4
41 ZC_ShroomLarge
42 ZC_ShroomSmall1
44 ZC_ShroomSmall2
45 ZC_ShroomSmall3
52 ZC_StalactiteLarge
56 ZC_StalactiteMedium
57 ZC_StalactiteSmall
48 ZC_Stalagmite_Pillar
49 ZC_StalagmiteLarge
50 ZC_StalagmiteMedium
51 ZC_StalagmiteSmall
Page 9
HEXEN Specs v0.9 Page 10
8062 ZF_DestructibleTree
8068 ZF_Hedge
8104 ZF_ShroomBoom
39 ZF_ShroomLarge1
40 ZF_ShroomLarge2
46 ZF_ShroomSmall1
47 ZF_ShroomSmall2
8101 ZF_Shrub1
8102 ZF_Shrub2
29 ZF_StumpBare
28 ZF_StumpBurned
24 ZF_TreeDead
25 ZF_TreeDestructible
80 ZF_TreeGnarled1
87 ZF_TreeGnarled2
78 ZF_TreeLarge1
79 ZF_TreeLarge2
111 ZG_BloodPool
71 ZG_CorpseHanging
61 ZG_CorpseKabob
108 ZG_CorpseLynched
109 ZG_CorpseNoHeart
110 ZG_CorpseSitting
62 ZG_CorpseSleeping
8067 ZG_IronMaiden
65 ZG_TombstoneBigCross
69 ZG_TombstoneBrianP
66 ZG_TombstoneBrianR
67 ZG_TombstoneCrossCircle
63 ZG_TombstoneRIP
64 ZG_TombstoneShane
68 ZG_TombstoneSmallCross
93 ZI_IceSpikeLarge
94 ZI_IceSpikeMedium
95 ZI_IceSpikeSmall
89 ZI_IcicleLarge
90 ZI_IcicleMedium
91 ZI_IcicleSmall
8502 ZM_CandleWeb
8509 ZM_CleaverMeat
8508 ZM_GobletSilver
8507 ZM_GobletSmall
8505 ZM_GobletSpill
8506 ZM_GobletTall
8504 ZM_LgCandle
8500 ZM_LgStein
104 ZM_Pot1
105 ZM_Pot2
106 ZM_Pot3
100 ZM_Rubble1
Page 10
HEXEN Specs v0.9 Page 11
101 ZM_Rubble2
102 ZM_Rubble3
8503 ZM_SmCandle
8501 ZM_SmStein
8051 ZP_GargBrnzShort
8047 ZP_GargBrnzTall
8044 ZP_GargCorrode
76 ZP_GargIceShort
73 ZP_GargIceTall
8050 ZP_GargLavaBrtShort
8046 ZP_GargLavaBrtTall
8049 ZP_GargLavaDrkShort
8045 ZP_GargLavaDrkTall
74 ZP_GargPortalShort
72 ZP_GargPortalTall
8052 ZP_GargStlShort
8048 ZP_GargStlTall
88 ZS_Log
58 ZS_Moss1
59 ZS_Moss2
37 ZS_Stump1
38 ZS_Stump2
27 ZS_Tree1
26 ZS_Tree2
60 ZS_Vine
99 ZW_RockBlack
97 ZW_RockBrownLarge
98 ZW_RockBrownSmall
9003 ZZ_BigGem
9007 ZZ_Book1
9008 ZZ_Book2
9016 ZZ_CWeapon
9015 ZZ_FWeapon
9018 ZZ_Gear
9019 ZZ_Gear2
9020 ZZ_Gear3
9021 ZZ_Gear4
9006 ZZ_GemBlue1
9010 ZZ_GemBlue2
9005 ZZ_GemGreen1
9009 ZZ_GemGreen2
9012 ZZ_GemPedestal
9004 ZZ_GemRed
9017 ZZ_MWeapon
9002 ZZ_Skull
9014 ZZ_Skull2
9011 ZZ_WingedStatueNoSkull
Page 11
HEXEN Specs v0.9 Page 12
ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
³ 4-0 ³ Hexen Script Language
ÀÄÄÄÄÄÙ
The Hexen Script Language is called the "Action Code Script", or ACS.
Each map has an ACS file that contains the scripts specific to that map. The
scripts within it are identified using numbers that the general special
ACS_Execute() uses. A script itself can call the ACS_Execute() special
(actually quite common), which will spawn another script that will run
concurrently with the rest of the scripts. A script can also be declared as
OPEN, which will make it run automatically upon entering the map. This is
used for perpetual type effects, level initialization, etc. The compiler
takes the ACS file and produces and object file that is the last lump in the
map WAD (BEHAVIOR).
To create a compiled ACS file from a text script, use the DOS command:
c:\hexen> acs filename [enter]
This command will produce 'filename.o' from 'filename.acs'. The contents of
the output file (filename.o) can be directly used as the BEHAVIOR lump of the
map it's used with.
Map scripts should start with #include "common.acs", which is just...
#include "specials.acs"
#include "defs.acs"
#include "wvars.acs"
The file "specials.acs" defines all the general specials. These are used
within scripts just like function calls. The file "defs.acs" defines a
bunch of constants that are used by the scripts. The file "wvars.acs"
defines all the world variables. It needs to be included by all maps so
they use consistent indexing.
[4-1] Variables and their Scope
--------------------------------
There is only one data type ACS, a 4 byte integer. Use the keyword int to
declare an integer variable. You may also use the keyword str, it is
synonymous with int. It's used to indicate that you'll be using the
variable as a string. The compiler doesn't use string pointers, it uses
string handles, which are just integers.
Declaring a variable is simple. There are two "types" of variable - "str"
and "int":
Page 12
HEXEN Specs v0.9 Page 13
str mystring;
int myint;
or:
str texture, sound;
int i, tid;
* Note: You can't assign a variable in its declaration; you must give it a
value in a different expression.
The SCOPE of a variable is one of World-scope, Map-scope, or Script-scope.
- World-scope variables are global, and can be accessed in any map.
Hexen maintains [n] permanent globals, numbered 0-[n-1]. You must
assign one of the globals a name in order to access it, like this:
world int 5:Grunt;
This tells Hexen to reference world global number 5 whenever it
encounters the name "Grunt".
- Map-scope variables are local to the current map. They must be
declared outside of any script code, but without the world keyword.
These variables can't be accessed in any other map.
- Script-scope variables are local to the current script - they
can't be accessed by any other script or map.
Here's some code that shows the declaration of all three scopes:
world int 3:DungeonAccess; // World-scope
int mapTimer; // Map-scope
script 4 (void)
{
int x, y; // Script-scope
...
}
[4-2] Language Structure
------------------------
Here is a quick reference manual type definition of the language. It
ends with a description of all the internal functions.
Page 13
HEXEN Specs v0.9 Page 14
[4-2-1] Keywords
----------------
The following identifiers are reserved for use as keywords, and may
not be used otherwise:
break
case
const
continue
default
define
do
else
goto
if
include
int
open
print
printbold
restart
script
special
str
suspend
switch
terminate
until
void
while
world
[4-2-2] Comments
----------------
Comments are ignored by the script compiler.
/*
This is a comment.
*/
int a; // And this is a comment
[4-2-3] World-variable definitions
----------------------------------
world int <constant-expression> : <identifier> ;
Page 14
HEXEN Specs v0.9 Page 15
world int <constant-expression> : <identifier> , ... ;
[4-2-4] Map-variable definitions
--------------------------------
Declares a variable local to the current map.
int <identifier> ;
str <identifier> ;
int <identifier> , ... ;
[4-2-5] Include Directive
-------------------------
Includes the source of the specified file and compiles it.
#include <string-literal>
[4-2-5] Define Directive
------------------------
Replaces an identifier with a constant expression.
#define <identifier> <constant-expression>
[4-2-6] Constant Expressions
----------------------------
<integer-constant>:
decimal 200
hexadecimal 0x00a0, 0x00A0
fixed point 32.0, 0.5, 103.329
any radix <radix>_digits
binary 2_01001010
octal 8_072310
decimal 10_50025
hexadecimal 16_00a03f2
[4-2-7] String Literals
-----------------------
<string-literal>: "string"
Page 15
HEXEN Specs v0.9 Page 16
[4-2-6] Script Definitions
--------------------------
To define a script:
<script-definition>:
script <constant-expression> ( <arglist> ) { <statement> }
script <constant-expression> OPEN { <statement> }
eg:
script 10 (void) { ... }
script 5 OPEN { ... }
* Note that OPEN scripts do not take arguments.
[4-2-6] Statements
------------------
<statement>:
<declaration-statement>
<assignment-statement>
<compound-statement>
<switch-statement>
<jump-statement>
<selection-statement>
<iteration-statement>
<function-statement>
<linespecial-statement>
<print-statement>
<control-statement>
[4-2-6-1] Declaration Statements
--------------------------------
Delcaration statements create script variables.
<declaration-statement>:
int <variable> ;
int <variable> , <variable> , ... ;
[4-2-6-1] Assignment Statements
-------------------------------
Assigns an expression to a variable.
Page 16
HEXEN Specs v0.9 Page 17
<assignment-statement>:
<variable> <assignment-operator> <expression> ;
<assignment-operator>:
=
+=
-=
*=
/=
%=
* Note: An assignment of the form V <op>= E is equivalent to V = V <op> E.
For example:
A += 5; is the same as
A = A + 5;
[4-2-6-2] Compound Statements
-----------------------------
<compound-statement>:
{ <statement-list> }
<statement-list>:
<statement> <statement> <...>
[4-2-6-3] Switch Statements
---------------------------
A switch statement evaluates an integral expression and passes control to the
code following the matched case.
<switch-statement>:
switch ( <expression> ) { <labeled-statement-list> }
<labeled-statement>:
case <constant-expression> : <statement>
default : <statement>
Example:
switch (a)
{
case 1: // when a == 1
b = 1; // .. this is executed,
break; // and this breaks out of the switch().
case 2: // when a == 2
Page 17
HEXEN Specs v0.9 Page 18
b = 8; // .. this is executed,
// but there is no break, so it continues to the next
// case, even though a != 3.
case 3: // when a == 3
b = 666; // .. this is executed,
break; // and this breaks out of the switch().
default: // when none of the other cases match,
b = 777; // .. this is executed.
}
* Note for C users: While C only allows integral expressions in a switch
statement, ACS allows full expressions such as "a + 10".
[4-2-6-4] Jump Statements
-------------------------
A jump statement passes control to another portion of the script.
<jump-statement>:
continue ;
break ;
restart ;
[4-2-6-5] Iteration Statements
------------------------------
<iteration-statement>:
while ( <expression> ) <statement>
until ( <expression> ) <statement>
do <statement> while ( <expression> ) ;
do <statement> until ( <expression> ) ;
for ( <assignment-statement> ; <expression> ; <assignment-statement> )
<statement>
The continue, break and restart keywords can be used in an iteration
statement:
- the continue keyword jumps to the end of the last <statement> in the
iteration-statement. The loop continues.
- the break keyword jumps right out of the iteration-statement.
[4-2-6-6] Function Statements
-----------------------------
Page 18
HEXEN Specs v0.9 Page 19
A function statement calls a Hexen internal-function, or a Hexen
linespecial-function.
<function-statement>:
<internal-function> | <linespecial-statement>
<internal-function>:
<identifier> ( <expression> , ... ) ;
<identifier> ( const : <constant-expression> , ... ) ;
<linespecial-statement>: