forked from gaiusm/chisel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththe_diffs
18555 lines (18468 loc) · 622 KB
/
the_diffs
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
diff --git a/Makefile.in b/Makefile.in
index 01f5d5e..21103bd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -187,7 +187,7 @@ CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/m2/Makefile.in \
$(top_srcdir)/shell/pen2map.in $(top_srcdir)/shell/txt2pen.in \
- AUTHORS COPYING ChangeLog INSTALL NEWS README compile \
+ AUTHORS COPYING ChangeLog INSTALL NEWS README TODO compile \
config.guess config.sub depcomp install-sh missing py-compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
diff --git a/autom4te.cache/requests b/autom4te.cache/requests
index 3ba17a5..7a646bc 100644
--- a/autom4te.cache/requests
+++ b/autom4te.cache/requests
@@ -35,49 +35,49 @@
'configure.ac'
],
{
- 'AC_CONFIG_MACRO_DIR' => 1,
+ 'AU_DEFUN' => 1,
+ 'AM_PROG_CC_C_O' => 1,
+ '_m4_warn' => 1,
+ 'm4_include' => 1,
+ '_AM_AUTOCONF_VERSION' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
- 'm4_pattern_forbid' => 1,
- 'm4_pattern_allow' => 1,
- '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
- '_AM_DEPENDENCIES' => 1,
- 'AM_SET_LEADING_DOT' => 1,
- 'AM_MISSING_PROG' => 1,
- 'AM_INIT_AUTOMAKE' => 1,
- 'include' => 1,
- '_AM_IF_OPTION' => 1,
- 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
- 'AM_AUX_DIR_EXPAND' => 1,
+ 'AM_SANITY_CHECK' => 1,
+ 'AC_DEFUN_ONCE' => 1,
'AM_PROG_INSTALL_SH' => 1,
- '_m4_warn' => 1,
- '_AM_PROG_CC_C_O' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
- 'AM_SUBST_NOTMAKE' => 1,
- '_AM_SET_OPTIONS' => 1,
- 'AM_SILENT_RULES' => 1,
- 'AM_PROG_CC_C_O' => 1,
- 'AM_DEP_TRACK' => 1,
+ '_AC_AM_CONFIG_HEADER_HOOK' => 1,
+ 'AM_PATH_PYTHON' => 1,
+ '_AM_CONFIG_MACRO_DIRS' => 1,
+ 'AC_DEFUN' => 1,
'AM_RUN_LOG' => 1,
- 'AM_MAKE_INCLUDE' => 1,
- 'AM_SET_DEPDIR' => 1,
+ '_AM_PROG_TAR' => 1,
+ 'AM_SUBST_NOTMAKE' => 1,
+ 'AM_SET_LEADING_DOT' => 1,
+ 'm4_pattern_allow' => 1,
+ 'AM_MISSING_PROG' => 1,
'AM_PYTHON_CHECK_VERSION' => 1,
- 'AM_PROG_INSTALL_STRIP' => 1,
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
- '_AM_PROG_TAR' => 1,
- 'AC_DEFUN' => 1,
- 'm4_include' => 1,
- '_AC_AM_CONFIG_HEADER_HOOK' => 1,
- 'AU_DEFUN' => 1,
'_AM_MANGLE_OPTION' => 1,
- '_AM_SET_OPTION' => 1,
- 'AM_MISSING_HAS_RUN' => 1,
- 'AC_DEFUN_ONCE' => 1,
- '_AM_CONFIG_MACRO_DIRS' => 1,
+ '_AM_SET_OPTIONS' => 1,
+ 'm4_pattern_forbid' => 1,
+ 'AM_SILENT_RULES' => 1,
'AM_CONDITIONAL' => 1,
- 'AM_SANITY_CHECK' => 1,
+ 'AM_INIT_AUTOMAKE' => 1,
+ '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
+ 'AC_CONFIG_MACRO_DIR' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
+ 'AM_MISSING_HAS_RUN' => 1,
+ 'AM_MAKE_INCLUDE' => 1,
+ '_AM_SET_OPTION' => 1,
+ 'AM_AUX_DIR_EXPAND' => 1,
+ 'AM_PROG_INSTALL_STRIP' => 1,
+ 'AM_SET_DEPDIR' => 1,
+ 'include' => 1,
'AM_AUTOMAKE_VERSION' => 1,
- 'AM_PATH_PYTHON' => 1,
- '_AM_AUTOCONF_VERSION' => 1
+ '_AM_DEPENDENCIES' => 1,
+ '_AM_IF_OPTION' => 1,
+ '_AM_PROG_CC_C_O' => 1,
+ 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
+ 'AM_DEP_TRACK' => 1
}
], 'Autom4te::Request' ),
bless( [
@@ -92,66 +92,66 @@
'configure.ac'
],
{
- 'AM_PATH_GUILE' => 1,
- 'AH_OUTPUT' => 1,
- 'AM_NLS' => 1,
- 'AC_REQUIRE_AUX_FILE' => 1,
+ 'AM_PROG_CC_C_O' => 1,
+ 'sinclude' => 1,
+ 'LT_INIT' => 1,
+ 'm4_include' => 1,
+ '_m4_warn' => 1,
'AM_POT_TOOLS' => 1,
- 'AM_PROG_AR' => 1,
- 'AM_PROG_CXX_C_O' => 1,
- 'AC_SUBST_TRACE' => 1,
- 'AM_PROG_LIBTOOL' => 1,
- 'AC_LIBSOURCE' => 1,
+ 'AM_PROG_MKDIR_P' => 1,
+ 'AM_NLS' => 1,
+ 'AC_CANONICAL_HOST' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
+ 'AC_SUBST' => 1,
+ 'AM_PROG_F77_C_O' => 1,
'AC_FC_PP_SRCEXT' => 1,
- 'AM_CONDITIONAL' => 1,
- 'AM_AUTOMAKE_VERSION' => 1,
- 'AC_CANONICAL_BUILD' => 1,
- 'AM_EXTRA_RECURSIVE_TARGETS' => 1,
- 'AM_PROG_CC_C_O' => 1,
- 'AM_SILENT_RULES' => 1,
- 'AC_CANONICAL_SYSTEM' => 1,
- 'AM_PROG_MOC' => 1,
- 'AC_FC_SRCEXT' => 1,
- '_AM_COND_ELSE' => 1,
- 'AC_CONFIG_FILES' => 1,
- 'AC_FC_FREEFORM' => 1,
- 'm4_include' => 1,
- 'AC_CONFIG_AUX_DIR' => 1,
- 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
+ 'AH_OUTPUT' => 1,
'AM_GNU_GETTEXT' => 1,
- 'AC_CONFIG_SUBDIRS' => 1,
- 'AC_CONFIG_LINKS' => 1,
- 'include' => 1,
- 'AM_INIT_AUTOMAKE' => 1,
- 'AC_CONFIG_HEADERS' => 1,
- 'sinclude' => 1,
- 'AC_SUBST' => 1,
- 'AC_FC_PP_DEFINE' => 1,
'_LT_AC_TAGCONFIG' => 1,
- '_m4_warn' => 1,
- '_AM_COND_IF' => 1,
+ 'AC_FC_PP_DEFINE' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
- 'm4_sinclude' => 1,
- 'AM_ENABLE_MULTILIB' => 1,
- '_AM_SUBST_NOTMAKE' => 1,
- 'AM_PROG_MKDIR_P' => 1,
- 'AM_MAINTAINER_MODE' => 1,
- '_AM_MAKEFILE_INCLUDE' => 1,
- 'AM_PROG_FC_C_O' => 1,
'AC_CANONICAL_TARGET' => 1,
- 'AC_CONFIG_LIBOBJ_DIR' => 1,
- 'm4_pattern_forbid' => 1,
+ 'AM_XGETTEXT_OPTION' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
+ 'AC_FC_FREEFORM' => 1,
+ '_AM_COND_ELSE' => 1,
+ 'LT_SUPPORTED_TAG' => 1,
'AC_PROG_LIBTOOL' => 1,
- 'm4_pattern_allow' => 1,
- 'AM_XGETTEXT_OPTION' => 1,
- 'AM_PROG_F77_C_O' => 1,
+ 'AM_ENABLE_MULTILIB' => 1,
'AC_INIT' => 1,
- 'AC_CANONICAL_HOST' => 1,
- 'LT_INIT' => 1,
+ 'm4_pattern_allow' => 1,
+ 'AM_PROG_CXX_C_O' => 1,
+ 'm4_sinclude' => 1,
+ 'm4_pattern_forbid' => 1,
+ 'AM_PROG_AR' => 1,
+ '_AM_COND_IF' => 1,
+ 'AM_CONDITIONAL' => 1,
+ 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
+ 'AM_SILENT_RULES' => 1,
'_AM_COND_ENDIF' => 1,
- 'LT_SUPPORTED_TAG' => 1
+ 'AC_SUBST_TRACE' => 1,
+ 'AM_INIT_AUTOMAKE' => 1,
+ 'AC_CONFIG_HEADERS' => 1,
+ 'AM_PROG_MOC' => 1,
+ 'AC_CONFIG_SUBDIRS' => 1,
+ '_AM_SUBST_NOTMAKE' => 1,
+ 'AC_CANONICAL_SYSTEM' => 1,
+ 'AC_CANONICAL_BUILD' => 1,
+ 'AC_REQUIRE_AUX_FILE' => 1,
+ '_AM_MAKEFILE_INCLUDE' => 1,
+ 'AM_MAINTAINER_MODE' => 1,
+ 'AC_FC_SRCEXT' => 1,
+ 'AC_LIBSOURCE' => 1,
+ 'AM_PROG_FC_C_O' => 1,
+ 'include' => 1,
+ 'AM_AUTOMAKE_VERSION' => 1,
+ 'AC_CONFIG_FILES' => 1,
+ 'AC_CONFIG_LINKS' => 1,
+ 'AM_PROG_LIBTOOL' => 1,
+ 'AC_CONFIG_LIBOBJ_DIR' => 1,
+ 'AC_CONFIG_AUX_DIR' => 1,
+ 'AM_EXTRA_RECURSIVE_TARGETS' => 1,
+ 'AM_PATH_GUILE' => 1
}
], 'Autom4te::Request' )
);
diff --git a/maps/five.txt b/maps/five.txt
index 84ea49b..d6893a5 100644
--- a/maps/five.txt
+++ b/maps/five.txt
@@ -8,7 +8,7 @@ define s worldspawn
define o monster ogre
define c monster cyberdaemon
define h monster hellknight
-define a ammo 6 50
+define a ammo 6
define w weapon 6
define l light
diff --git a/maps/three.txt b/maps/three.txt
index 8d2978f..d1e4343 100644
--- a/maps/three.txt
+++ b/maps/three.txt
@@ -6,19 +6,18 @@ define s worldspawn
define o monster monster_demon_imp
define h monster monster_demon_hellknight
define S monster monster_demon_tick
-define i light
###############################
-# 1 i# 2 i #
+# 1 # 2 #
# # #
# s o . #
# . #
# ####### h #
-#i # i #
+# # #
# # #
##################..###########
-# 3 i #
+# 3 #
# S #
-# i #
+# #
###############################
diff --git a/python/developer-txt2map b/python/developer-txt2map
index 01dae08..c78e30c 100755
--- a/python/developer-txt2map
+++ b/python/developer-txt2map
@@ -1,6 +1,8 @@
#!/bin/bash
FLOOR=
+FLOOR=-f
+VISPORTALS=-p
rm *.pyc
echo -n "txt2pen: "
@@ -11,7 +13,7 @@ else
exit 1
fi
-if PYTHONPATH=student python pen2map.py ${FLOOR} -b -c tiny.ss -s -e -o tiny.map tiny.pen ; then
+if PYTHONPATH=student python pen2map.py ${VISPORTALS} ${FLOOR} -b -c tiny.ss -s -e -o tiny.map tiny.pen ; then
echo "pen2map: pass"
else
echo "pen2map: failed"
diff --git a/python/opt-txt2map b/python/opt-txt2map
index f8b2033..102e2c6 100755
--- a/python/opt-txt2map
+++ b/python/opt-txt2map
@@ -1,7 +1,9 @@
#!/bin/bash
-FLOOR=-f
FLOOR=
+FLOOR=-f
+PORTALS=
+PORTALS=-p
rm *.pyc
echo -n "txt2pen: "
@@ -12,7 +14,7 @@ else
exit 1
fi
-if PYTHONPATH=../../solutions python pen2map.py -r -O ${FLOOR} -b -s -e -o tiny.map tiny.pen ; then
+if PYTHONPATH=../../solutions python pen2map.py ${PORTALS} -O ${FLOOR} -V -b -s -e -o tiny.map tiny.pen ; then
echo "pen2map: pass"
else
echo "pen2map: failed"
diff --git a/python/pen2map.py b/python/pen2map.py
index da6fab5..44e6251 100644
--- a/python/pen2map.py
+++ b/python/pen2map.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Copyright (C) 2017
+# Copyright (C) 2017, 2018
# Free Software Foundation, Inc.
# This file is part of Chisel.
#
@@ -19,7 +19,7 @@
# Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
-# Author Gaius Mulley <gaius@gnu.org>
+# Author Gaius Mulley <gaius@southwales.ac.uk>
#
import getopt, sys, string
@@ -33,7 +33,7 @@ EBNF of the pen file format
FileUnit := RoomDesc { RoomDesc } [ RandomTreasure ] "END." =:
RoomDesc := 'ROOM' Integer
- { WallDesc | DoorDesc | TreasureDesc } 'END' =:
+ { WallDesc | DoorDesc | TreasureDesc | SoundDesc } 'END' =:
WallDesc := 'WALL' WallCoords { WallCoords } =:
@@ -58,6 +58,9 @@ TreasureDesc := 'TREASURE' 'AT' Integer Integer
RandomTreasure := 'RANDOMIZE' 'TREASURE' Integer
{ Integer }
=:
+soundDesc := 'SOUND' 'AT' Integer Integer filename
+ { 'VOLUME' Integer | "LOOPING" | "WAIT" int } =:
+
"""
inputFile = None
@@ -97,6 +100,8 @@ defaultOn = "MID"
curOn = defaultOn
defaultColour = [150, 150, 150]
autoBeams = False
+enableVisportals = False
+minFloor, maxFloor = 0, 0
defaults = { "portal":"textures/editor/visportal",
"open":"textures/editor/visportal",
@@ -136,8 +141,10 @@ lightHeight = 2.0 # 8 foot high
lightBlockHeight = 1.0 # 4 foot high
lightFloorHeight = 0.0625 # 3 inches
lightFloorHeight = 0.125 # 6 inches
+lightFloorHeight = 0.125 # 6 inches
lightCeilingHeight = minCeilingHeight - 1.5
floorStep = 0.25 # 1 foot
+noSteps = 4 # how many steps
def mycut (l, i):
@@ -294,6 +301,7 @@ class roomInfo:
self.floorLevel = None
self.inside = None
self.defaultColours = {}
+ self.sounds = []
def addWall (self, line):
global maxx, maxy
@@ -324,6 +332,8 @@ class roomInfo:
for d in self.doors:
n += d[1]
return n
+ def addSound (self, s, pos):
+ self.sounds += [[s, pos]]
def newRoom (n):
global rooms
@@ -452,11 +462,11 @@ def usage (code):
#
def handleOptions ():
- global debugging, verbose, outputName, toTxt, toMap, ssName, comments, statistics, gameType, genSteps, optimise, regressionRequired, autoBeams
+ global debugging, verbose, outputName, toTxt, toMap, ssName, comments, statistics, gameType, genSteps, optimise, regressionRequired, autoBeams, enableVisportals
outputName = None
try:
- optlist, l = getopt.getopt(sys.argv[1:], ':bc:defg:hmo:rstvVO')
+ optlist, l = getopt.getopt(sys.argv[1:], ':bc:defg:hmo:prstvVO')
for opt in optlist:
if opt[0] == '-b':
autoBeams = True
@@ -477,6 +487,8 @@ def handleOptions ():
usage (1)
elif opt[0] == '-h':
usage (0)
+ elif opt[0] == '-p':
+ enableVisportals = True
elif opt[0] == '-o':
outputName = opt[1]
elif opt[0] == '-v':
@@ -743,7 +755,7 @@ def status ():
def integer ():
global curInteger
i = peek ()
- if i.isdigit ():
+ if i.isdigit () or (i[0] == '-'):
curInteger = get ()
# print "found integer", curInteger, "next token is", peek ()
return True
@@ -1001,6 +1013,52 @@ def defaultDesc ():
errorLine ("expecting FLOOR, MID or CEILING after DEFAULT")
+class sound:
+ def __init__ (self, filename):
+ self.filename = filename
+ self.volume = 0.0
+ self.looping = 1
+ self.wait = 0.0
+ self.mindist = 3.0
+ self.maxdist = 25.0
+ def setVolume (self, volume):
+ self.volume = volume
+ def setLooping (self):
+ self.looping = True
+ def setWait (self, wait):
+ self.wait = wait
+
+
+#
+#
+#
+
+def soundDesc ():
+ expect ("SOUND")
+ expect ("AT")
+ if posDesc ():
+ soundPos = curPos
+ filename = get ()
+ s = sound (filename)
+ while expecting (['VOLUME', 'LOOPING', 'WAIT']):
+ if expecting (['VOLUME']):
+ expect ('VOLUME')
+ if integer ():
+ s.setVolume (curInteger)
+ else:
+ errorLine ('expecting an integer after the VOLUME keyword')
+ elif expecting (['LOOPING']):
+ expect ('LOOPING')
+ s.setLooping ()
+ elif expecting (['WAIT']):
+ expect ('WAIT')
+ if integer ():
+ s.setWait (curInteger)
+ else:
+ errorLine ('expecting an integer after the WAIT keyword')
+ curRoom.addSound (s, soundPos)
+
+
#
# roomDesc := "ROOM" integer { doorDesc | wallDesc | treasureDesc | ammoDesc | lightDesc | insideDesc | weaponDesc | monsterDesc | spawnDesc } =:
#
@@ -1014,7 +1072,7 @@ def roomDesc ():
curRoom = newRoom (curRoomNo)
if verbose:
print "roomDesc", curRoomNo
- while expecting (['DOOR', 'WALL', 'TREASURE', 'AMMO', 'WEAPON', 'LIGHT', 'INSIDE', 'MONSTER', 'SPAWN', 'DEFAULT']):
+ while expecting (['DOOR', 'WALL', 'TREASURE', 'AMMO', 'WEAPON', 'LIGHT', 'INSIDE', 'MONSTER', 'SPAWN', 'DEFAULT', 'SOUND']):
if expecting (['DOOR']):
doorDesc ()
elif expecting (['WALL']):
@@ -1037,6 +1095,8 @@ def roomDesc ():
spawnDesc ()
elif expecting (['DEFAULT']):
defaultDesc ()
+ elif expecting (['SOUND']):
+ soundDesc ()
expect ('END')
return True
else:
@@ -1753,11 +1813,13 @@ def flushBricks (o, bcount):
#
def doWall (r, e):
+ global minFloor, maxFloor
if isVertical (e):
a = min (e[0][1], e[1][1])
b = max (e[0][1], e[1][1])
for l in range (a, b+1):
- pos = [e[0][0], l, rooms[r].floorLevel]
+ # pos = [e[0][0], l, rooms[r].floorLevel]
+ pos = [e[0][0], l, minFloor-1]
end = [e[1][0]+1, l+1, minCeilingHeight]
size = subVec (end, pos)
newcuboid (pos, size, e[-2])
@@ -1765,7 +1827,8 @@ def doWall (r, e):
a = min (e[0][0], e[1][0])
b = max (e[0][0], e[1][0])
for l in range (a, b+1):
- pos = [l, e[0][1], rooms[r].floorLevel]
+ # pos = [l, e[0][1], rooms[r].floorLevel]
+ pos = [l, e[0][1], minFloor-1]
end = [l+1, e[1][1]+1, minCeilingHeight]
size = subVec (end, pos)
newcuboid (pos, size, e[-2])
@@ -1788,23 +1851,76 @@ def brushFooter (o):
return o
#
+# generateStepsVerticalWall - generate a sequence of steps on a vertical wall.
+#
+
+def generateStepsVerticalWall (r, e, l):
+ print "vertical steps in room", r, e
+ leftLevel = rooms[str (getFloor (e[0][0]-1, e[0][1]))].floorLevel
+ rightLevel = rooms[str (getFloor (e[0][0]+1, e[0][1]))].floorLevel
+ winc = 1.0/float (noSteps)
+ if leftLevel == rightLevel:
+ hinc = 0
+ else:
+ hinc = floorStep
+ widthOffset = 0
+ heightOffset = 0
+ for s in range (noSteps):
+ pos = [e[0][0]+widthOffset, l, minFloor-1]
+ print leftLevel, rightLevel, widthOffset, heightOffset
+ widthOffset += winc
+ heightOffset += hinc
+ if leftLevel < rightLevel:
+ end = [e[1][0]+widthOffset, l+1, leftLevel + heightOffset]
+ else:
+ end = [e[1][0]+widthOffset, l+1, leftLevel - heightOffset]
+ size = subVec (end, pos)
+ newcuboid (pos, size, 'wall')
+
+
+#
+# generateStepsHorizontalWall - generate a sequence of steps on a horizontal wall.
+#
+
+def generateStepsHorizontalWall (r, e, l):
+ print "horizontal steps in room", r, e
+ botLevel = rooms[str (getFloor (e[0][0], e[0][1]-1))].floorLevel
+ topLevel = rooms[str (getFloor (e[0][0], e[0][1]+1))].floorLevel
+ winc = 1.0/float (noSteps)
+ if topLevel == botLevel:
+ hinc = 0
+ else:
+ hinc = floorStep
+ widthOffset = 0
+ heightOffset = 0
+ for s in range (noSteps):
+ pos = [l, e[0][1]+widthOffset, minFloor-1]
+ widthOffset += winc
+ heightOffset += hinc
+ if botLevel < topLevel:
+ end = [l+1, e[1][1]+widthOffset, botLevel + heightOffset]
+ else:
+ end = [l+1, e[1][1]+widthOffset, botLevel - heightOffset]
+ size = subVec (end, pos)
+ newcuboid (pos, size, 'wall')
+
+
+#
# doOpen - create an open door.
#
def doOpen (r, e):
+ global minFloor, maxFloor
if debugging:
print "building floor and ceiling for doorway"
- if isVertical (e):
+ if (e[-1] == 'left') or (e[-1] == 'right'):
+ #
+ # vertical door (on the 2D map)
+ #
a = min (e[0][1], e[1][1])
b = max (e[0][1], e[1][1])
for l in range (a, b+1):
- h = rooms[r].floorLevel-1
- pos = [e[0][0], l, h]
- end = [e[1][0]+1, l+1, h+1]
- size = subVec (end, pos)
- if debugging:
- print "vertical floor block at", pos, end, size
- newcuboid (pos, size, 'wall') # floor
+ generateStepsVerticalWall (r, e, l)
h = minCeilingHeight
pos = [e[0][0], l, h]
end = [e[1][0]+1, l+1, h+1]
@@ -1812,17 +1928,20 @@ def doOpen (r, e):
if debugging:
print "vertical ceiling block at", pos, end, size
newcuboid (pos, size, 'wall') # ceiling
- elif isHorizontal (e):
+ if enableVisportals:
+ # visportal doorway
+ #
+ # (mcomp your code goes here)
+ #
+ pass
+ else:
+ #
+ # horizontal door (on the 2D map)
+ #
a = min (e[0][0], e[1][0])
b = max (e[0][0], e[1][0])
for l in range (a, b+1):
- h = rooms[r].floorLevel-1
- pos = [l, e[0][1], h]
- end = [l+1, e[1][1]+1, h+1]
- size = subVec (end, pos)
- if debugging:
- print "horizontal floor block at", pos, end, size
- newcuboid (pos, size, 'wall') # ceiling
+ generateStepsHorizontalWall (r, e, l)
h = minCeilingHeight
pos = [l, e[0][1], h]
end = [l+1, e[1][1]+1, h+1]
@@ -1830,6 +1949,12 @@ def doOpen (r, e):
if debugging:
print "horiz ceiling block at", pos, end, size
newcuboid (pos, size, 'wall') # ceiling
+ if enableVisportals:
+ # visportal doorway
+ #
+ # (mcomp your code goes here)
+ #
+ pass
brickFunc = {'leftwall':doWall, 'topwall':doWall, 'rightwall':doWall, 'bottomwall':doWall,
@@ -2175,18 +2300,20 @@ def generateCeiling (r, e):
for y in range (1, maxy):
if getFloor (x, y) == int (r):
pos = [x, y, rooms[r].floorLevel+minCeilingHeight]
- size = [1, 1, 1]
+ end = [x+1, y+1, minCeilingHeight+1]
+ size = subVec (end, pos)
newcuboid (pos, size, 'ceiling')
if autoBeams:
generateBeams (r, e)
def generateFloor (r, e):
+ global minFloor, maxFloor
for x in range (1, maxx):
for y in range (1, maxy):
if getFloor (x, y) == int (r):
- pos = [x, y, rooms[r].floorLevel-1]
- size = [1, 1, 1]
+ pos = [x, y, minFloor-1]
+ size = [1, 1, rooms[r].floorLevel-minFloor+1]
if debugging:
print "floor at", pos, size
newcuboid (pos, size, 'floor')
@@ -2427,7 +2554,7 @@ def generateFloorLight (r, l, walls):
newlight (pos, size, li)
return
# print "light is not touching a wall", l
- pos = [int (lp[0]), int (lp[1]), getFloorLevel (r)]
+ pos = [int (lp[0]), int (lp[1]), getFloorLevel (r) + lightFloorHeight]
size = [lightBlock, lightBlock, lightFloorHeight]
if debugging:
print pos, size
@@ -2515,16 +2642,50 @@ def generateAmmo (o, e):
for r in rooms.keys():
if debugging:
print rooms[r].ammo
- for t, a, p in rooms[r].ammo:
+ for ammo_kind, a, xy in rooms[r].ammo:
o.write ("// entity " + str (e) + '\n')
o.write ("{\n")
o.write (' "inv_item" "4"\n')
- o.write (' "classname" "' + t + '"\n')
- o.write (' "name" "' + t + '_' + str (n) + '"\n')
+ o.write (' "classname" "' + ammo_kind + '"\n')
+ o.write (' "name" "' + ammo_kind + '_' + str (n) + '"\n')
o.write (' "origin" "')
- pos = p + [getFloorLevel (r) + invSpawnHeight]
- v = pen2MidPos (pos)
+ xyz = xy + [getFloorLevel (r) + invSpawnHeight]
+ v = pen2MidPos (xyz)
+ o.write ('%f %f %f"\n' % (-v[0], -v[1], v[2]))
+ o.write ("}\n")
+ n += 1
+ e += 1
+ return o, e
+
+
+def generateSounds (o, e):
+ n = 1
+ for r in rooms.keys():
+ if debugging:
+ print rooms[r].sounds
+ for s, xy in rooms[r].sounds:
+ o.write ("// entity " + str (e) + '\n')
+ o.write ("{\n")
+ o.write (' "classname" "speaker"\n')
+ o.write (' "name" "speaker_%d"\n' % e)
+ o.write (' "origin" "')
+ xyz = xy + [getFloorLevel (r) + invSpawnHeight]
+ v = pen2MidPos (xyz)
o.write ('%f %f %f"\n' % (-v[0], -v[1], v[2]))
+ o.write (' "s_shader" "%s"\n' % s.filename)
+ o.write (' "s_mindistance" "%s"\n' % s.mindist)
+ o.write (' "s_maxdistance" "%s"\n' % s.maxdist)
+ o.write (' "s_volume" "%s"\n' % s.volume)
+ o.write (' "s_omni" "0"\n')
+ o.write (' "s_occlusion" "0"\n')
+ o.write (' "soundgroup" ""\n')
+ o.write (' "s_leadthrough" "0.100000"\n')
+ o.write (' "s_plain" "0"\n')
+ o.write (' "wait" "%s"\n' % s.wait)
+ o.write (' "random" "0.000000"\n')
+ o.write (' "s_looping" "1"\n')
+ o.write (' "s_unclamped" "0"\n')
+ o.write (' "s_justVolume" "1"\n')
o.write ("}\n")
n += 1
e += 1
@@ -2550,6 +2711,7 @@ def generateMap (o):
o, e = generateMonsters (o, e)
o, e = generateLights (o, e)
o, e = generateAmmo (o, e)
+ o, e = generateSounds (o, e)
if statistics:
print "Total rooms =", len (rooms.keys ())
print "Total cuboids =", len (cuboids.keys ())
@@ -2560,17 +2722,6 @@ def generateMap (o):
#
-# decFloorLevel - return the floor level of room, s, and subtract 1 ft.
-#
-
-def decFloorLevel (s):
- if s.floorLevel is None:
- return 0
- else:
- return s.floorLevel - floorStep
-
-
-#
# getSpawnRoom - return the room in which the player is spawned.
#
@@ -2603,18 +2754,19 @@ def getNeighbours (r):
# This is a breadth first algorithm.
#
-def lowerFloors (s, unvisited):
- if (unvisited != []) and (s in unvisited):
- unvisited.remove (s)
- src = rooms[s]
- children = getNeighbours (src)
- for c in children:
+def lowerFloors (s):
+ visited = [s]
+ queue = getNeighbours (rooms[s])
+ level = -(floorStep * noSteps)
+ while queue != []:
+ nextLevel = []
+ for c in queue:
r = rooms[c]
if r.floorLevel == None:
- r.floorLevel = decFloorLevel (src)
- for c in children:
- unvisited = lowerFloors (c, unvisited)
- return unvisited
+ r.floorLevel = level
+ nextLevel += getNeighbours (r)
+ queue = nextLevel
+ level -= (floorStep * noSteps)
#
@@ -2622,9 +2774,10 @@ def lowerFloors (s, unvisited):
#
def calcFloorLevel ():
+ global minFloor, maxFloor
s = getSpawnRoom ()
rooms[s].floorLevel = 0
- unvisited = lowerFloors (s, getListOfRooms ())
+ lowerFloors (s)
for r in rooms.keys ():
if verbose:
print "room", r, "has floor level",
@@ -2635,6 +2788,8 @@ def calcFloorLevel ():
else:
if verbose:
print rooms[r].floorLevel
+ minFloor = min (minFloor, rooms[r].floorLevel)
+ maxFloor = max (minFloor, rooms[r].floorLevel)
#
diff --git a/python/tiny.aas48 b/python/tiny.aas48
index 422ea5a..c0c2343 100644
--- a/python/tiny.aas48
+++ b/python/tiny.aas48
@@ -1,6 +1,6 @@
DewmAAS "1.07"
-9961472
+3080192
settings
{
@@ -25,1323 +25,1349 @@ settings
tt_waterJump = 100
tt_startWalkOffLedge = 100
}
-planes 86 {
+planes 302 {
0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 1 0 -396 )
- 39 ( -0 -1 -0 396 )
- 40 ( 1 -0 0 -504 )
- 41 ( -1 0 -0 504 )
- 42 ( -0 1 -0 -276 )
- 43 ( 0 -1 0 276 )
- 44 ( 0 1 0 -216 )
- 45 ( -0 -1 -0 216 )
- 46 ( 1 0 0 -552 )
- 47 ( -1 -0 -0 552 )
- 48 ( 0 1 0 -240 )
- 49 ( -0 -1 -0 240 )
- 50 ( 1 -0 -0 -528 )
- 51 ( -1 0 0 528 )
- 52 ( 1 0 0 -468 )
- 53 ( -1 -0 -0 468 )
- 54 ( 1 -0 0 -216 )
- 55 ( -1 0 -0 216 )
- 56 ( 1 0 0 -276 )
- 57 ( -1 -0 -0 276 )
- 58 ( 1 -0 0 -408 )
- 59 ( -1 0 -0 408 )
- 60 ( -0 -0 1 62 )
- 61 ( 0 0 -1 -62 )
- 62 ( -0 1 0 -252 )
- 63 ( 0 -1 -0 252 )
- 64 ( 1 0 0 -540 )
- 65 ( -1 -0 -0 540 )
- 66 ( 1 -0 -0 -600 )
- 67 ( -1 0 0 600 )
- 68 ( 1 -0 -0 -888 )
- 69 ( -1 0 0 888 )
- 70 ( 1 0 0 -840 )
- 71 ( -1 -0 -0 840 )
- 72 ( 1 0 0 -564 )
- 73 ( -1 -0 -0 564 )
- 74 ( 1 0 0 -804 )
- 75 ( -1 -0 -0 804 )
- 76 ( 1 -0 0 -744 )
- 77 ( -1 0 -0 744 )
- 78 ( 1 -0 0 -792 )
- 79 ( -1 0 -0 792 )
- 80 ( 1 0 0 -660 )
- 81 ( -1 -0 -0 660 )
- 82 ( 0 1 0 -168 )
- 83 ( -0 -1 -0 168 )
- 84 ( 1 -0 -0 -648 )
- 85 ( -1 0 0 648 )
+ 20 ( -0 1 -0 -132 )
+ 21 ( 0 -1 0 132 )
+ 22 ( 0 1 0 -456 )
+ 23 ( -0 -1 -0 456 )
+ 24 ( 0 1 0 -264 )
+ 25 ( -0 -1 -0 264 )
+ 26 ( -0 1 -0 -324 )
+ 27 (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