1;;----------------------------------------------------------------------------
2;; Constants
3;;----------------------------------------------------------------------------
4
5;; This file loads 58 files
6
7
8;; Slots
9(define slot-nil              0)
10(define slot-amulet           1)
11(define slot-ring             2)
12(define slot-gazer-helm       4)
13(define slot-weapon           8)
14(define slot-shield           8)
15(define slot-weapon-or-shield 8)
16(define slot-armor            16)
17(define slot-boot             32)
18(define slot-helm             64)
19
20;; Speeds  ;; TODO: move most of these into kern-intvars ?
21
22(define speed-human             50)  ;; typical AP/round for humans
23
24(define base-move-ap		50)  ;; this may not bear a neat relationship to speed-human
25(define default-weapon-rap      50)  ;; this may not bear a neat relationship to speed-human
26(define default-armour-apmod    2)  ;; this may not bear a neat relationship to speed-human
27
28(define base-skill-ap			base-move-ap)  ;; this may not bear a neat relationship to speed-human
29(define base-spell-ap			base-move-ap)  ;; this may not bear a neat relationship to speed-human
30
31;; AP costs of various actions which the kernal needs to know about:
32(kern-set-kern-intvar "AP_TOTAL:normal_human"    speed-human)
33
34(kern-set-kern-intvar "AP_COST:default"           speed-human)
35(kern-set-kern-intvar "AP_COST:search"            (* 3 speed-human))
36(kern-set-kern-intvar "AP_COST:get_item"          (* 0.34 speed-human))
37(kern-set-kern-intvar "AP_COST:drop_item"         (* 0.34 speed-human))
38(kern-set-kern-intvar "AP_COST:open_mechanism"    speed-human)
39(kern-set-kern-intvar "AP_COST:open_container"    speed-human)
40(kern-set-kern-intvar "AP_COST:handle_mechanism"  speed-human)
41(kern-set-kern-intvar "AP_COST:use_item"          speed-human)  ;; may be unused, per comment in cmd.c cmdUse()
42
43;; Normal mixing: 18 + (num_mixed * 12) + (spell_level * 12) AP
44(kern-set-kern-intvar "AP_COST:mix_reagents_base"         (* 3 speed-human))
45(kern-set-kern-intvar "AP_COST:mix_reagents_per_mix"      (* 2 speed-human))
46(kern-set-kern-intvar "AP_COST:mix_reagents_per_level"    (* 2 speed-human))
47;; Attempt at non-existent spell: 3d18+6 AP
48(kern-set-kern-intvar "AP_COST:mix_reagents_nospell_num"   3)
49(kern-set-kern-intvar "AP_COST:mix_reagents_nospell_dice" (* 3 speed-human))
50(kern-set-kern-intvar "AP_COST:mix_reagents_nospell_plus"  speed-human)
51;; Missing or additional ingredients: (2 * spell_level)d18+18 AP
52(kern-set-kern-intvar "AP_COST:mix_reagents_badmix_num"    2)  ;; times spell Level
53(kern-set-kern-intvar "AP_COST:mix_reagents_badmix_dice"  (* 3 speed-human))
54(kern-set-kern-intvar "AP_COST:mix_reagents_badmix_plus"  (* 3 speed-human))
55
56;; These values are used by ctrl.c ctrl_attack_target()
57;; to adjust weapon AP costs in the event of dual wielding.
58;; The dual weapon rules can thus be tweaked here...
59(kern-set-kern-intvar "AP_MULT12:second_wpn_attack"       6)  ;; AP cost * 6/12 for 2nd weapon attack if dual wpns used
60(kern-set-kern-intvar "AP_MULT12:third_plus_wpn_attack"   6)  ;; AP cost * 6/12 for 3rd+ weapon attacks, if 3+ weapons used
61(kern-set-kern-intvar "AP_THRESHOLD:multi_attack_overage" 0)  ;; attack sequence can continue if AP overage is not > 0
62
63(kern-set-kern-intvar "submerged_def_bonus" 10) ;; defense bonus for submerged critters
64
65;; ship speeds are better handled using mmodes/pclasses-
66;; it should only affect actual movement
67(define speed-ship            speed-human)
68
69;; Action Point costs for various basic actions:
70;; are these used anywhere?
71;;(define ap-for-1H-melee-attack   9)
72;;(define ap-for-2H-melee-attack  12)
73
74;;(define ap-for-1H-thrown-attack 12)
75;;(define ap-for-2H-thrown-attack 18)
76
77;;(define ap-for-shooting-attack  12)
78
79;;(define ap-for-combat-spell      9)
80;;(define ap-to-use-scroll        12)
81
82
83;; Difficulty Classes
84(define dc-escape-ensnare  26)
85(define dc-escape-paralyze 16)
86
87;; Pmasks (keep them around until mechs are converted to use passability
88;; classes (see below))
89(define pmask-none   0)
90(define pmask-solid  1)
91(define pmask-land   2)
92(define pmask-water  4)
93(define pmask-shoals 8)
94(define pmask-bridge (+ pmask-land pmask-water pmask-shoals))
95(define pmask-all    (+ pmask-solid pmask-land pmask-water pmask-shoals))
96
97;; Passability Difficulty Levels
98;;   (Note: 255 is well-known to the kernel to mean
99;;   "impassible" in the case of movement costs)
100(define fast        (* 0.66 base-move-ap))  ;; 0.66 (2/3)
101(define s-fast      (* 0.8 base-move-ap))  ;; 'slightly fast' 0.8
102(define norm        base-move-ap)  ;; 1.0
103(define s-hard      (* 1.5 base-move-ap))  ;; 1.5
104(define hard       (* 2 base-move-ap))  ;; 2.0
105(define v-hard     (* 3 base-move-ap))  ;; 3.0
106
107(define no-drop    100)  ;; special, used for dropability (not related to speed-human)
108(define cant      255)  ;; special
109
110;(define norm       50)  ;; 1.0
111;(define s-hard     75)  ;; 1.5
112;(define hard      100)  ;; 2.0
113;(define v-hard    150)  ;; 3.0
114;(define fast       30)  ;; 0.6
115;(define s-fast     40)  ;; 0.4
116;(define no-drop   100)  ;; 2.0
117;(define cant      255)  ;;
118
119
120;; Passability classes
121(define pclass-none          0)
122(define pclass-grass         1)
123(define pclass-deep          2)
124(define pclass-shoals        3)
125(define pclass-mountains     4) ;; no ceiling
126(define pclass-wall          5) ;; has a ceiling
127(define pclass-trees         6)
128(define pclass-forest        7)
129(define pclass-hills         8)
130(define pclass-repel         9) ;; energy shield blocks all
131(define pclass-space         10)
132(define pclass-bridge        pclass-grass)
133(define pclass-road          pclass-grass)
134(define pclass-boulder       11) ;; no ceiling, smaller than mountain
135(define pclass-waterboulder  12) ;; worst case of boulder and water
136(define pclass-sludge        13)
137(define pclass-shallows      14)
138(define pclass-bars          15) ;; portcullis
139(define pclass-window        16) ;; separating from bars for shoot-but-not-crawl-through passability
140(define pclass-vmountains    17)
141(define pclass-canfloat      18) ;; avoids drowning
142(define pclass-canfly        19) ;; avoids ground based issues
143
144;; Movement modes
145(define mmodes
146  (list
147   (list 'mmode-walk      "walking"     0)
148   (list 'mmode-hover     "hovering"    1)
149   (list 'mmode-ship      "sailing"     2)
150   (list 'mmode-phase     "phasing"     3)
151   (list 'mmode-fly       "flying"      4)
152   (list 'mmode-skiff     "rowing"      5)
153   (list 'mmode-fish      "swimming"    6)
154   (list 'mmode-crawl     "crawling"    7) ;; spiders, can cross boulders
155   (list 'mmode-voidship  "sailing"     8)
156   (list 'mmode-ranger    "stalking"    9)
157   (list 'mmode-none      "stationary" 10)
158   (list 'mmode-wriggle   "wriggle"    11) ;; rogue special move
159   (list 'mmode-missile   "missile"    12)
160   (list 'mmode-fastfly   "flying"     13)
161   (list 'mmode-fastrun   "running"    14)
162   (list 'mmode-fastcrawl "crawling"   15)
163   (list 'mmode-smallobj  "smallobj"   16) ;; for determining dropability of small objects
164   (list 'mmode-largeobj  "largeobj"   17) ;; for determining dropability of big objects- basically, stuff that wont fit through bars/windows
165   (list 'mmode-field     "field"      18) ;; for determining dropability of fields
166   (list 'mmode-return    "return"     19) ;; return path for magic axe (for now assume it always returns)
167   (list 'mmode-cannon    "cannon"     20) ;; enhanced missile passibility for cannon shells
168   (list 'mmode-large     "striding"   21) ;; big critters
169))
170(map (lambda (mmode) (apply kern-mk-mmode mmode)) mmodes)
171
172(define mmode-jump mmode-fly)
173
174;; Movement cost table (optimized for cut to/paste from spreadsheet!)
175(kern-mk-ptable
176	;;	walk	hover	ship	phase	fly	skiff	fish	crawl	vship	rangr	none	wrigl	missl	f_fly	f_run	f_crawl	sml_obj	lrg_obj	fields	return	cannon	striding
177	(list	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	)	;; none
178	(list	norm	norm	cant	norm	norm	cant	cant	norm	cant	norm	cant	norm	0	fast	fast	fast	norm	norm	norm	0	0	norm	)	;; grass/paving
179	(list	cant	cant	s-fast	cant	norm	v-hard	norm	cant	cant	cant	cant	cant	0	fast	cant	cant	cant	cant	no-drop	0	0	cant	)	;; deep
180	(list	cant	s-hard	cant	cant	norm	norm	norm	cant	cant	cant	cant	cant	0	fast	cant	cant	cant	cant	no-drop	0	0	s-hard	)	;; shoals
181	(list	cant	cant	cant	cant	s-hard	cant	cant	cant	cant	cant	cant	cant	95	s-fast	cant	cant	no-drop	no-drop	cant	0	90	cant	)	;; mountains
182	(list	cant	cant	cant	s-hard	cant	cant	cant	cant	cant	cant	cant	cant	100	cant	cant	cant	cant	cant	cant	0	100	cant	)	;; wall (w/ ceiling)
183	(list	hard	hard	cant	norm	norm	cant	cant	hard	cant	norm	cant	hard	10	fast	norm	norm	norm	norm	norm	0	7	hard	)	;; trees
184	(list	v-hard	v-hard	cant	norm	norm	cant	cant	v-hard	cant	s-hard	cant	v-hard	30	fast	hard	hard	norm	norm	norm	0	20	v-hard	)	;; forest
185	(list	v-hard	hard	cant	norm	norm	cant	cant	v-hard	cant	s-hard	cant	v-hard	7	fast	hard	hard	norm	norm	norm	0	5	hard	)	;; hills/bog
186	(list	cant	cant	cant	cant	cant	cant	cant	cant	cant	cant	cant	cant	100	cant	cant	cant	no-drop	no-drop	norm	0	100	cant	)	;; energy fields
187	(list	cant	cant	cant	cant	norm	cant	cant	cant	norm	cant	cant	cant	0	fast	cant	cant	cant	cant	no-drop	0	0	cant	)	;; space
188	(list	cant	norm	cant	norm	norm	cant	cant	hard	cant	cant	cant	hard	10	fast	cant	norm	norm	norm	norm	0	4	norm	)	;; boulder
189	(list	cant	hard	cant	cant	norm	cant	cant	hard	cant	cant	cant	hard	10	fast	cant	norm	norm	norm	no-drop	0	4	hard	)	;; waterboulder
190	(list	cant	norm	hard	cant	norm	v-hard	v-hard	cant	cant	cant	cant	cant	0	fast	cant	cant	cant	cant	no-drop	0	0	norm	)	;; sludge
191	(list	s-hard	norm	cant	norm	norm	norm	norm	s-hard	cant	norm	cant	cant	0	fast	norm	norm	cant	cant	no-drop	0	0	norm	)	;; shallow sludge
192	(list	cant	cant	cant	s-hard	cant	cant	cant	cant	cant	cant	cant	v-hard	7	cant	cant	cant	norm	no-drop	norm	0	7	cant	)	;; bars (eg portcullis)
193	(list	cant	cant	cant	s-hard	cant	cant	cant	cant	cant	cant	cant	cant	30	cant	cant	cant	no-drop	no-drop	no-drop	0	25	cant	)	;; window
194	(list	cant	cant	cant	cant	s-hard	cant	cant	cant	cant	cant	cant	cant	30	s-fast	cant	cant	no-drop	no-drop	no-drop	0	10	cant	)	;; passlos mountains
195	(list	cant	v-hard	s-fast	cant	norm	cant	norm	cant	cant	cant	cant	cant	norm	norm	cant	cant	cant	cant	norm	norm	norm	v-hard	)	;; float
196	(list	cant	hard	cant	cant	norm	hard	cant	cant	norm	cant	cant	cant	norm	norm	cant	cant	cant	cant	norm	norm	norm	cant	)	;; fly
197)
198;; Note that pclass 'missl' is using the value as a percentage chance
199;; for a missile to be blocked by obscuring terrain, not as an AP cost
200
201
202;; Factions. The diplomacy table (which defines the relationship between
203;; factions) must be defined in the session file, because it changes over time.
204(define faction-none          0)
205(define faction-player        1)
206(define faction-men           2)
207(define faction-cave-goblin   3)
208(define faction-accursed      4)
209(define faction-monster       5)
210(define faction-troll         6)
211(define faction-spider        7)
212(define faction-outlaw        8)
213(define faction-gint          9)
214(define faction-demon         10)
215(define faction-forest-goblin 11)
216(define faction-green-tower   faction-men)
217(define faction-oparine       faction-men)
218(define faction-trigrave      faction-men)
219(define faction-nixie         faction-monster)
220(define faction-prisoner      12)
221(define faction-glasdrin      13)
222(define faction-num           14)
223
224;; Layers (must match object.h)
225(define layer-none       0)
226(define layer-tfeat      1)
227(define layer-mechanism  2)
228(define layer-portal     3)
229(define layer-vehicle    4)
230(define layer-bed        5)
231(define layer-container  6)
232(define layer-item       7)
233(define layer-field      8)
234(define layer-being      9)
235(define layer-projectile 10)
236(define layer-crosshair  11)
237
238;; Contexts
239(define context-world 1)
240(define context-town  2)
241(define context-any      (+ context-town context-world))
242
243;; Damage/Immunity types (ordinal, not bitmasks)
244(define damage-none   0)
245(define damage-fire   1)
246(define damage-poison 2)
247(define damage-sleep  3)
248
249;; Damage amounts
250(define lava-damage 10)
251
252;; Directions (as returned by kern-ui-get-direction)
253(define northwest 0)
254(define north     1)
255(define northeast 2)
256(define west      3)
257(define here      4)
258(define east      5)
259(define southwest 6)
260(define south     7)
261(define southeast 8)
262(define up        9)
263(define down      10)
264
265;; Scroll directions (for UI keyhandling, must match kernel's StatusScrollDir)
266(define scroll-up       0)
267(define scroll-down     1)
268(define scroll-right    2)
269(define scroll-left     3)
270(define scroll-pageup   4)
271(define scroll-pagedown 5)
272(define scroll-top      6)
273(define scroll-bottom   7)
274
275(define opposite-dir (vector southeast south southwest
276                             east here west
277                             northeast north northwest
278                             down up))
279
280;; Player character bonuses
281(define pc-hp-off  25)
282(define pc-hp-gain 5)
283(define pc-mp-off  1)
284(define pc-mp-gain 1)
285
286;; NPC activities
287(define (isdrunk? knpc)
288  (string=? "drunk" (kern-obj-get-activity knpc)))
289(define (isworking? knpc)
290  (string=? "working" (kern-obj-get-activity knpc)))
291
292;; Prices
293(define base-scroll-cost 20) ;; gold pieces per level of scroll's spell
294(define reagent-price-mult 1) ;; global reagent price multiplier
295
296;; rather than trying to calculate appropriate hp/mp for
297;; characters, stick in a big number and let Character::new
298;; trim it as needed
299(define max-health 999999999)
300
301;; Some of the following are order-dependent
302(load "loc.scm")
303(load "kobj.scm")
304(load "ifc.scm")
305
306;; sprite sets
307;;
308;; 'ss_sprite_set_name tile_pix_w tile_pix_h tiles_h tiles_w x_offset y_offset "path/filename"
309;;
310;;                  'ss_sprite_set_name
311;;                  |                    tile_pixels_wide tile_pixels_high
312;;                  |                    |       sheet_tiles_high sheet_tiles_wide
313;;                  |                    |       |       sheet_pixels_x_offset sheet_pixels_y_offset
314;;                  |                    |       |       |     "path/filename"
315;;                  |                    |       |       |     |
316;;                  v                    v       v       v     v
317;;----------------------------------------------------------------------------
318(kern-mk-sprite-set 'ss_u4_shapes        32 32   16 16   0 0  "shapes.png")
319(kern-mk-sprite-set 'ss_u4_charset       8  16    8 16   0 0  "charset.png")
320(kern-mk-sprite-set 'ss_frame            16 16    4  4   0 0  "frame.png")
321; (kern-mk-sprite-set 'ss_rune             32 32    4  8   0 0  "rune.png")
322(kern-mk-sprite-set 'ss_addon            32 32   16  8   0 0  "addons.png")
323(kern-mk-sprite-set 'ss_moons            16 16    4  8   0 0  "moons.png")
324; (kern-mk-sprite-set 'ss_signs            32 32    1  8   0 0  "signs.png")
325; (kern-mk-sprite-set 'ss_runestones       32 32    4  8   0 0  "runestones.png")
326; (kern-mk-sprite-set 'ss_newmonst         32 32   16  8   0 0  "newmonst.png")
327; (kern-mk-sprite-set 'ss_newfolks         32 32   16  8   0 0  "newfolks.png")
328; (kern-mk-sprite-set 'ss_buildings        32 32    1  2   0 0  "tower.png")
329; (kern-mk-sprite-set 'ss_overlays         32 32   13  8   0 0  "newterrain.png")
330; (kern-mk-sprite-set 'ss_effects          8  16    3  16  0 0  "effects.png")
331; (kern-mk-sprite-set 'ss_bigobjects       40 40    8  8   0 0  "bigobjects.png")
332; (kern-mk-sprite-set 'ss_humanoids        32 32   16  8   0 0  "humanoids.png")
333; (kern-mk-sprite-set 'ss_people           32 32   16  8   0 0  "hirespeople.png")
334; (kern-mk-sprite-set 'ss_monsters         32 32   16  8   0 0  "monsters.png")
335; (kern-mk-sprite-set 'ss_ship             32 32    8  8   0 0  "ship.png")
336; (kern-mk-sprite-set 'ss_sfx              32 32    8  8   0 0  "sfx.png")
337; (kern-mk-sprite-set 'ss_creatures        32 32   16  8   0 0  "creatures.png")
338; (kern-mk-sprite-set 'ss_tools            32 32    8  8   0 0  "tools.png")
339
340;; New paper-doll sprite sets
341; (kern-mk-sprite-set 'ss_bodies     32 32 4 4 0 0 "bodies.png")
342; (kern-mk-sprite-set 'ss_adornments 32 32 4 4 0 0 "adornments.png")
343; (kern-mk-sprite-set 'ss_clothes    32 32 5 4 0 0 "clothes.png")
344
345
346;; sprites
347(kern-mk-sprite 's_sun                      ss_moons 1 24 #f 0 )
348(kern-mk-sprite 's_grass         ss_u4_shapes 1  4 #f 0 )
349(kern-mk-sprite 's_wanderer         ss_u4_shapes 4 224 #f 0 )
350(kern-mk-sprite 's_crosshair            ss_addon 1  0 #f   0 )
351; (kern-mk-sprite 's_bog           ss_u4_shapes 1  3 #f 0 )
352; (kern-mk-sprite 's_town          ss_u4_shapes 1 10 #f 0 )
353(kern-mk-sprite 's_keep          ss_u4_shapes 1 11 #f 0 )
354; (kern-mk-sprite 's_hamlet        ss_u4_shapes 1 12 #f 0 )
355; (kern-mk-sprite 's_leftwing      ss_u4_shapes 1 13 #f 0 )
356; (kern-mk-sprite 's_castle        ss_u4_shapes 1 14 #f 0 )
357; (kern-mk-sprite 's_rightwing     ss_u4_shapes 1 15 #f 0 )
358; (kern-mk-sprite 's_cobblestone   ss_u4_shapes 1 22 #f 0 )
359; (kern-mk-sprite 's_ew_bridge     ss_u4_shapes 1 23 #f 0 )
360; (kern-mk-sprite 's_ballon        ss_u4_shapes 1 24 #f 0 )
361; (kern-mk-sprite 's_bridge_top    ss_u4_shapes 1 25 #f 0 )
362; (kern-mk-sprite 's_bridge_bottom ss_u4_shapes 1 26 #f 0 )
363; (kern-mk-sprite 's_ladder_up     ss_u4_shapes 1 27 #f 0 )
364; (kern-mk-sprite 's_ladder_down   ss_u4_shapes 1 28 #f 0 )
365; (kern-mk-sprite 's_ruin          ss_u4_shapes 1 29 #f 0 )
366; (kern-mk-sprite 's_shrine        ss_u4_shapes 1 30 #f 0 )
367; (kern-mk-sprite 's_pillar      ss_u4_shapes 1 48 #f 0 )
368; (kern-mk-sprite 's_wall_b      ss_u4_shapes 1 49 #f 0 )
369; (kern-mk-sprite 's_wall_a      ss_u4_shapes 1 50 #f 0 )
370; (kern-mk-sprite 's_wall_c      ss_u4_shapes 1 51 #f 0 )
371; (kern-mk-sprite 's_wall_d      ss_u4_shapes 1 52 #f 0 )
372; (kern-mk-sprite 's_mast        ss_u4_shapes 1 53 #f 0 )
373; (kern-mk-sprite 's_ships_wheel ss_u4_shapes 1 54 #f 0 )
374; (kern-mk-sprite 's_boulder     ss_u4_shapes 1 55 #f 0 )
375(kern-mk-sprite 's_asleep      ss_u4_shapes 1 56 #f 0 )
376; (kern-mk-sprite 's_wall_rock   ss_u4_shapes 1 57 #f 0 )
377; (kern-mk-sprite 's_door_locked ss_u4_shapes 1 58 #f 0 )
378; (kern-mk-sprite 's_door        ss_u4_shapes 1 59 #f 0 )
379; (kern-mk-sprite 's_chest       ss_u4_shapes 1 60 #f 0 )
380; (kern-mk-sprite 's_ankh        ss_u4_shapes 1 61 #f 0 )
381; (kern-mk-sprite 's_flagstone   ss_u4_shapes 1 62 #f 0 )
382; (kern-mk-sprite 's_deck        ss_u4_shapes 1 63 #f 0 )
383
384; (kern-mk-sprite 's_moongate_quarter        ss_u4_shapes 1 64 #f 0 )
385; (kern-mk-sprite 's_moongate_half           ss_u4_shapes 1 65 #f 0 )
386; (kern-mk-sprite 's_moongate_three_quarters ss_u4_shapes 1 66 #f 0 )
387; (kern-mk-sprite 's_moongate_full           ss_u4_shapes 1 67 #f 0 )
388
389; (kern-mk-sprite 's_field_poison ss_u4_shapes 1 68 #t 0 )
390; (kern-mk-sprite 's_field_energy ss_u4_shapes 1 69 #t 0 )
391; (kern-mk-sprite 's_field_fire   ss_u4_shapes 1 70 #t 0 )
392; (kern-mk-sprite 's_field_sleep  ss_u4_shapes 1 71 #t 0 )
393; (kern-mk-sprite 's_wall         ss_u4_shapes 1 72 #f 0 )
394; (kern-mk-sprite 's_secret_door  ss_u4_shapes 1 73 #f 0 )
395; (kern-mk-sprite 's_altar_obj        ss_u4_shapes 1 74 #f 0 )
396; (kern-mk-sprite 's_lava         ss_u4_shapes 1 76 #t 0 )
397; (kern-mk-sprite 's_projectile   ss_u4_shapes 1 77 #f 0 )
398; (kern-mk-sprite 's_magic        ss_u4_shapes 1 78 #f 0 )
399(kern-mk-sprite 's_hit          ss_u4_shapes 1 79 #f 0 )
400; (kern-mk-sprite 's_guard        ss_u4_shapes 2 80 #f 0 )
401; (kern-mk-sprite 's_townsman     ss_u4_shapes 2 82 #f 0 )
402; (kern-mk-sprite 's_bard         ss_u4_shapes 2 84 #f 0 )
403; (kern-mk-sprite 's_jester       ss_u4_shapes 2 86 #f 0 )
404; (kern-mk-sprite 's_beggar       ss_u4_shapes 2 88 #f 0 )
405; (kern-mk-sprite 's_child        ss_u4_shapes 2 90 #f 0 )
406; (kern-mk-sprite 's_bull         ss_u4_shapes 2 92 #f 0 )
407; (kern-mk-sprite 's_lord         ss_u4_shapes 2 94 #f 0 )
408
409; (kern-mk-sprite 's_A ss_u4_shapes 1  96 #f 0 )
410; (kern-mk-sprite 's_B ss_u4_shapes 1  97 #f 0 )
411; (kern-mk-sprite 's_C ss_u4_shapes 1  98 #f 0 )
412; (kern-mk-sprite 's_D ss_u4_shapes 1  99 #f 0 )
413; (kern-mk-sprite 's_E ss_u4_shapes 1 100 #f 0 )
414; (kern-mk-sprite 's_F ss_u4_shapes 1 101 #f 0 )
415; (kern-mk-sprite 's_G ss_u4_shapes 1 102 #f 0 )
416; (kern-mk-sprite 's_H ss_u4_shapes 1 103 #f 0 )
417; (kern-mk-sprite 's_I ss_u4_shapes 1 104 #f 0 )
418; (kern-mk-sprite 's_J ss_u4_shapes 1 105 #f 0 )
419; (kern-mk-sprite 's_K ss_u4_shapes 1 106 #f 0 )
420; (kern-mk-sprite 's_L ss_u4_shapes 1 107 #f 0 )
421; (kern-mk-sprite 's_M ss_u4_shapes 1 108 #f 0 )
422; (kern-mk-sprite 's_N ss_u4_shapes 1 109 #f 0 )
423; (kern-mk-sprite 's_O ss_u4_shapes 1 110 #f 0 )
424; (kern-mk-sprite 's_P ss_u4_shapes 1 111 #f 0 )
425; (kern-mk-sprite 's_Q ss_u4_shapes 1 112 #f 0 )
426; (kern-mk-sprite 's_R ss_u4_shapes 1 113 #f 0 )
427; (kern-mk-sprite 's_S ss_u4_shapes 1 114 #f 0 )
428; (kern-mk-sprite 's_T ss_u4_shapes 1 115 #f 0 )
429; (kern-mk-sprite 's_U ss_u4_shapes 1 116 #f 0 )
430; (kern-mk-sprite 's_V ss_u4_shapes 1 117 #f 0 )
431; (kern-mk-sprite 's_W ss_u4_shapes 1 118 #f 0 )
432; (kern-mk-sprite 's_X ss_u4_shapes 1 119 #f 0 )
433; (kern-mk-sprite 's_Y ss_u4_shapes 1 120 #f 0 )
434; (kern-mk-sprite 's_Z ss_u4_shapes 1 121 #f 0 )
435
436; (kern-mk-sprite 's_counter_2x1_c ss_u4_shapes 1 122 #f 0 )
437; (kern-mk-sprite 's_counter_2x1_e ss_u4_shapes 1 123 #f 0 )
438; (kern-mk-sprite 's_counter_2x1_w ss_u4_shapes 1 124 #f 0 )
439; (kern-mk-sprite 's_counter_1x1   ss_u4_shapes 1 125 #f 0 )
440
441; (kern-mk-sprite 's_blank          ss_u4_shapes 1 126 #f 0 )
442(kern-mk-sprite 's_null           ss_u4_shapes 1 126 #f 0 )
443; (kern-mk-sprite 's_wall_stone     ss_u4_shapes 1 127 #f 0 )
444
445; (kern-mk-sprite 's_pirate_left    ss_u4_shapes 1 128 #f 0 )
446; (kern-mk-sprite 's_pirate_front   ss_u4_shapes 1 129 #f 0 )
447; (kern-mk-sprite 's_pirate_right   ss_u4_shapes 1 130 #f 0 )
448; (kern-mk-sprite 's_pirate_back    ss_u4_shapes 1 131 #f 0 )
449
450; (kern-mk-sprite 's_nixie          ss_u4_shapes 2 132 #f 0 )
451; (kern-mk-sprite 's_kraken         ss_u4_shapes 2 134 #f 0 )
452; (kern-mk-sprite 's_sea_serpent    ss_u4_shapes 2 136 #f 0 )
453; (kern-mk-sprite 's_sea_horse      ss_u4_shapes 2 138 #f 0 )
454; (kern-mk-sprite 's_whirlpool      ss_u4_shapes 2 140 #f 0 )
455; (kern-mk-sprite 's_tornado        ss_u4_shapes 2 142 #f 0 )
456
457; (kern-mk-sprite 's_rat            ss_u4_shapes 4 144 #f 0 )
458; (kern-mk-sprite 's_bat            ss_u4_shapes 4 148 #f 0 )
459; (kern-mk-sprite 's_spider         ss_u4_shapes 4 152 #f 0 )
460; (kern-mk-sprite 's_ghost          ss_u4_shapes 4 156 #f 0 )
461; (kern-mk-sprite 's_slime          ss_u4_shapes 4 160 #f 0 )
462; (kern-mk-sprite 's_slime_asleep   ss_u4_shapes 1 160 #f 0 )
463; (kern-mk-sprite 's_troll          ss_u4_shapes 4 164 #f 0 )
464; (kern-mk-sprite 's_gremlin        ss_u4_shapes 4 168 #f 0 )
465; (kern-mk-sprite 's_mimic          ss_u4_shapes 4 172 #f 0 )
466; (kern-mk-sprite 's_reaper         ss_u4_shapes 4 176 #f 0 )
467; (kern-mk-sprite 's_insects        ss_u4_shapes 4 180 #f 0 )
468; (kern-mk-sprite 's_gazer          ss_u4_shapes 4 184 #f 0 )
469; (kern-mk-sprite 's_deathknight         ss_u4_shapes 4 188 #f 0 )
470; (kern-mk-sprite 's_orc            ss_u4_shapes 4 192 #f 0 )
471; (kern-mk-sprite 's_skeleton       ss_u4_shapes 4 196 #f 0 )
472; (kern-mk-sprite 's_brigand        ss_u4_shapes 4 200 #f 0 )
473; (kern-mk-sprite 's_snake          ss_u4_shapes 4 204 #f 0 )
474; (kern-mk-sprite 's_ettin          ss_u4_shapes 4 208 #f 0 )
475; (kern-mk-sprite 's_headless       ss_u4_shapes 4 212 #f 0 )
476; (kern-mk-sprite 's_cyclops        ss_u4_shapes 4 216 #f 0 )
477; (kern-mk-sprite 's_wisp           ss_u4_shapes 4 220 #f 0 )
478; (kern-mk-sprite 's_lich           ss_u4_shapes 4 228 #f 0 )
479; (kern-mk-sprite 's_drake          ss_u4_shapes 4 232 #f 0 )
480; (kern-mk-sprite 's_zorn           ss_u4_shapes 4 236 #f 0 )
481; (kern-mk-sprite 's_demon          ss_u4_shapes 4 240 #f 0 )
482; (kern-mk-sprite 's_hydra          ss_u4_shapes 4 244 #f 0 )
483; (kern-mk-sprite 's_dragon         ss_u4_shapes 4 248 #f 0 )
484; (kern-mk-sprite 's_balron         ss_u4_shapes 4 252 #f 0 )
485
486(kern-mk-sprite 's_frame_ulc   ss_frame 1  0 #f 0 )
487(kern-mk-sprite 's_frame_td    ss_frame 1  1 #f 0 )
488(kern-mk-sprite 's_frame_urc   ss_frame 1  2 #f 0 )
489(kern-mk-sprite 's_frame_endu  ss_frame 1  3 #f 0 )  ; top of vertical bar, currently unused
490(kern-mk-sprite 's_frame_tr    ss_frame 1  4 #f 0 )
491(kern-mk-sprite 's_frame_plus  ss_frame 1  5 #f 0 )  ; center crosspiece, currently unused
492(kern-mk-sprite 's_frame_tl    ss_frame 1  6 #f 0 )
493(kern-mk-sprite 's_frame_vert  ss_frame 1  7 #f 0 )
494(kern-mk-sprite 's_frame_llc   ss_frame 1  8 #f 0 )
495(kern-mk-sprite 's_frame_tu    ss_frame 1  9 #f 0 )
496(kern-mk-sprite 's_frame_lrc   ss_frame 1 10 #f 0 )
497(kern-mk-sprite 's_frame_endb  ss_frame 1 11 #f 0 )  ; bottom of vertical bar, currently unused
498(kern-mk-sprite 's_frame_endl  ss_frame 1 12 #f 0 )
499(kern-mk-sprite 's_frame_horz  ss_frame 1 13 #f 0 )
500(kern-mk-sprite 's_frame_endr  ss_frame 1 14 #f 0 )
501(kern-mk-sprite 's_frame_dot   ss_frame 1 15 #f 0 )  ; disconnected disk, currently unused
502
503; (kern-mk-sprite 'ls_ankh          ss_u4_charset 1  0 #f 0 )
504; (kern-mk-sprite 'ls_shield        ss_u4_charset 1  1 #f 0 )
505; (kern-mk-sprite 'ls_holey_wall    ss_u4_charset 1  2 #f 0 )
506; (kern-mk-sprite 'ls_wall          ss_u4_charset 1  3 #f 0 )
507; (kern-mk-sprite 'ls_updown_arrow  ss_u4_charset 1  4 #f 0 )
508; (kern-mk-sprite 'ls_down_arrow    ss_u4_charset 1  5 #f 0 )
509; (kern-mk-sprite 'ls_up_arrow      ss_u4_charset 1  6 #f 0 )
510; (kern-mk-sprite 'ls_holey_ankh    ss_u4_charset 1  7 #f 0 )
511; (kern-mk-sprite 'ls_white_ball    ss_u4_charset 1  8 #f 0 )
512; (kern-mk-sprite 'ls_copyright     ss_u4_charset 1  9 #f 0 )
513; (kern-mk-sprite 'ls_trademark     ss_u4_charset 1 10 #f 0 )
514; (kern-mk-sprite 'ls_male          ss_u4_charset 1 11 #f 0 )
515; (kern-mk-sprite 'ls_female        ss_u4_charset 1 12 #f 0 )
516; (kern-mk-sprite 'ls_hbar          ss_u4_charset 1 13 #f 0 )
517; (kern-mk-sprite 'ls_vbar          ss_u4_charset 1 13 #f 0 )
518; (kern-mk-sprite 'ls_square        ss_u4_charset 1 14 #f 0 )
519; (kern-mk-sprite 'ls_blue_ball     ss_u4_charset 1 15 #f 0 )
520; (kern-mk-sprite 'ls_hbar_right    ss_u4_charset 1 16 #f 0 )
521; (kern-mk-sprite 'ls_hbar_left     ss_u4_charset 1 17 #f 0 )
522; (kern-mk-sprite 'ls_vbar_top      ss_u4_charset 1 16 #f 0 )
523; (kern-mk-sprite 'ls_vbar_bottom   ss_u4_charset 1 17 #f 0 )
524; (kern-mk-sprite 'ls_blank_one     ss_u4_charset 1 18 #f 0 )
525; (kern-mk-sprite 'ls_dot_dot_dot   ss_u4_charset 1 19 #f 0 )
526(kern-mk-sprite 'ls_whirlpool     ss_u4_charset 4 28 #f 0 )
527; (kern-mk-sprite 'ls_blank_three   ss_u4_charset 1 32 #f 0 )
528
529
530;; sounds
531(load "sounds.scm")
532
533;(load "effects.scm")
534
535;; terrain
536(define opq 12) ;; opaque
537(define hvy 5)  ;; heavy
538(define dns 3)  ;; dense
539(define lgt 2)  ;; light (density)
540(define trn 0)  ;; transparent
541(kern-mk-terrain 't_grass "grass" pclass-grass s_grass trn 0 nil)
542
543;; palette
544(kern-mk-palette 'pal_expanded
545  (list
546    (list  ".."   t_grass)              ;; "grass"
547  )
548) ;; palette pal_expanded
549
550
551
552
553;(load "fields.scm")
554;;(load "combat-maps.scm")
555
556;; Object types
557(load "objs.scm")
558;(load "traps.scm")
559;(load "pitfalls.scm")
560;(load "landslide.scm")
561;(load "containers.scm")
562;(load "reagents.scm")
563;(load "food.scm")
564
565;; arms
566(define (weap-ap mult)
567	(floor (* mult default-weapon-rap)))
568
569(define (armour-ap mult)
570	(floor (* mult default-armour-apmod)))
571
572(define obj-ifc-cap (ifc-cap obj-ifc))
573
574(define (mk-melee-arms-type tag name sprite to-hit-bonus damage deflect AP_cost AP_mod slots
575                            num-hands range weight
576                            stratt_mod dexatt_mod
577                            damage_mod avoid_mod)
578  (kern-mk-arms-type tag name sprite to-hit-bonus damage "0" deflect slots
579                     num-hands range AP_cost AP_mod nil nil #f #f weight nil
580					 obj-ifc-cap obj-ifc stratt_mod dexatt_mod damage_mod avoid_mod mmode-smallobj))
581
582(mk-melee-arms-type  't_hands          "bare hands"     nil              "1d2"    "1d2"    "1d2"    (weap-ap 0.67) 0 slot-nil      1      1     0        50      20       10      1.0  )
583
584;(load "powers.scm")
585;(load "ability.scm")
586;(load "cast-ui.scm")
587;(load "spells.scm")
588;(load "items.scm")
589;(load "vehicles.scm")
590;(load "beds.scm")
591;(load "money.scm")
592;(load "skills.scm")
593
594;; occs
595(define (mk-occ tag name hit def dam arm xp skset)
596  (kern-mk-occ tag name 1.0 0 0 0 0 hit def dam arm xp skset)
597  (kern-occ-set-gob (eval tag) (list nil nil nil nil nil nil nil nil)))
598
599;;            /           /         / t  / f / e /   /
600;;           /           /         / i  / e / g / r /
601;;          /           / e       / h  / d / a / o /
602;;         / g         / m       / -  / - / m / m /
603;;        / a         / a       / o  / o / a / r / p
604;;       / t         / n       / t  / t / d / a / x
605(mk-occ 'oc_wanderer "wanderer"  5   5   5   5   8 nil)
606
607
608;(load "ai.scm")
609
610;; species
611(define humanoid
612  (list
613   slot-armor
614   slot-boot
615   slot-helm
616   slot-amulet
617   slot-ring
618   slot-ring
619   slot-weapon-or-shield
620   slot-weapon-or-shield
621   ))
622
623(define (rel-spd speed)
624	(/ (* speed-human speed) 100))
625
626;; mk-species -- register a species type with the kernel
627(define (mk-species tag name str int dex spd con mag vr mmode weap morph xp sspr armordice mvsnd)
628  (kern-mk-species tag name str int dex (rel-spd spd) vr mmode
629                   con
630                   (max (round (/ con 10)) 1)
631                   mag
632                   (max (round (/ mag 2)) 1)
633                   sspr
634                   weap #t sound-damage
635                   mvsnd
636                   xp
637                   #f ;; stationary?
638                   armordice
639                   morph nil))
640(mk-species 'sp_human "human" 10 10 10 100 10 2 13 mmode-walk t_hands humanoid  2 s_asleep nil sound-walking)
641
642
643(load "conv.scm") ;; basic conversation
644;(load "yellow-slime.scm")
645;(load "troll.scm")
646;(load "spider.scm")
647;(load "npc-types.scm")
648;(load "mimic.scm")
649;(load "parties.scm")
650;(load "jewelry.scm")
651;(load "gate-guard.scm")
652
653;; Mechanism-like things
654;(load "bim.scm")
655;(load "step.scm")
656;(load "monster-generator.scm")
657;;(load "wilderness-manager.scm")
658; (load "terrain-to-ptype.scm")
659; (load "edge-spawn.scm")
660; (load "door.scm")
661; (load "portcullis.scm")
662; (load "hidden.scm")
663; (load "lever.scm")
664; (load "timer.scm")
665; (load "tblit.scm")
666; (load "portals.scm")
667; (load "moongate.scm")
668; (load "bridge.scm")
669; (load "drawbridge.scm")
670; (load "weather-vane.scm")
671;(load "wind-bridge.scm")
672
673;; Astronomy
674;(load "moon.scm")
675
676;; Quest system
677(load "tbl.scm")
678(load "ztats-quest-ui.scm")
679(load "quest-sys.scm")
680(load "quest-talk-to.scm")
681
682;; Miscellaneous crap
683(mk-obj-type 't_crosshair "crosshair" s_crosshair layer-crosshair nil)
684(kern-set-crosshair t_crosshair)
685(kern-set-frame s_frame_ulc
686                s_frame_urc
687                s_frame_llc
688                s_frame_lrc
689                s_frame_td
690                s_frame_tu
691                s_frame_tl
692                s_frame_tr
693                s_null
694                s_frame_horz
695                s_frame_vert
696                s_frame_endl
697                s_frame_endr)
698(kern-set-ascii ss_u4_charset 32)
699(kern-set-cursor ls_whirlpool)
700(kern-set-damage-sprite s_hit)
701(kern-add-hook 'combat_change_hook 'music-on-combat-change)
702(kern-add-hook 'session_start_hook 'music-on-combat-change)
703
704;; Setup the global effect sprites
705; (kern-set-quicken-sprite s_quicken)
706; (kern-set-time-stop-sprite s_time_stop)
707; (kern-set-magic-negated-sprite s_magic_negated)
708; (kern-set-reveal-sprite s_reveal)
709; (kern-set-xray-vision-sprite s_xray_vision)
710
711(kern-init-random)
712
713;;----------------------------------------------------------------------------
714;; this needs to be in a kern-loaded file so it's redefined on reload
715(define gregors-conv
716 (ifc nil
717      (method 'default (lambda (knpc kpc) (say knpc "Can't help you there.")))
718      (method 'hail (lambda (knpc kpc) (say knpc "Hullo.")))
719      (method 'heal (lambda (knpc kpc) (say knpc "[cough] Well enough, my granddaughter helps take care of me.")))
720      (method 'bye (lambda (knpc kpc) (say knpc "So long.")))
721      (method 'job (lambda (knpc kpc) (say knpc "I'm a charcoal burner. I also care for this ^c+rshrine^c-.")))
722      (method 'join (lambda (knpc kpc) (say knpc "Nope. Already got a job.")))
723      (method 'name (lambda (knpc kpc) (say knpc "Gregor's my name.")))
724      ))
725
726