// - Look in locgen.df for the theme helper words I used

locations-start

: zombtest for 1 zombs drift next ;

	locations-reset

	location
		tags: bedroom house
		max-rooms: 7
		entry-tags: entry

		: set-theme

			rnd5050 if floor-carpet else floor-wood then

			0 3 rnd loc-wtheme!
			0 4 rnd loc-dtheme!
			0 5 rnd to theme-num 

		;

		: nad 0 auto-doors! ; 
		: ndx 0 %auto-door-escape ;
		
		script: set-theme 
		pre-script: set-theme 
		post-script: 0 2 rnd zombs

		room-choice: entry
			room-weight: 10
			room-count: 1
			room-script: ndx
			room-post-script: dhall
			filter-only

		room-choice: bathroom
			room-weight: 10
			room-count: 1
			room-script: nad floor-bath

		room-choice: bedroom
			room-weight: 50
			room-count: 3
			room-script: nad
			room-post-script: beddoor

		room-choice: closet
			room-weight: 10
			room-count: 1
			room-script: nad

		room-choice: hall
			room-weight: 10
			room-count: 1
			room-script: ndx
			room-post-script: dbathroom
				
								
		location tags: tiny house
		max-rooms: 5
		entry-tags: entry
		script: set-theme 
		pre-script: set-theme
		post-script: 0 2 rnd zombs

		room-choice: entry
			room-weight: 1
			room-count: 1
			room-script: ndx
			room-post-script: dhall
			filter-only

		room-choice: bathroom
			room-weight: 40
			room-count: 1
			room-script: nad floor-bath

		room-choice: bedroom
			room-weight: 50
			room-count: 1
			room-script: nad
			room-post-script: beddoor

		room-choice: closet
			room-weight: 10
			room-count: 1
			room-script: nad

		room-choice: kitchen
			room-weight: 20
			room-count: 1
			room-script: nad floor-kitchen

		room-choice: living
			room-weight: 20
			room-count: 1
	
	location
		tags: small house
		max-rooms: 8
		entry-tags: entry
		script: set-theme 
		pre-script: set-theme
		post-script: 0 2 rnd zombs

		room-choice: entry
			room-weight: 1
			room-count: 1
			room-script: ndx
			room-post-script: dhall
			filter-only

		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath

		room-choice: bedroom
			room-weight: 50
			room-count: 2
			room-script: nad
			room-post-script: beddoor

		room-choice: closet
			room-weight: 1
			room-count: 1
			room-script: nad

		room-choice: kitchen
			room-weight: 20
			room-count: 1
			room-script: nad floor-kitchen

		room-choice: living
			room-weight: 100
			room-count: 1

		room-choice: hall
			room-weight: 1
			room-count: 1
			room-script: ndx
			room-post-script: dbathroom
			
	location
		tags: death house
		max-rooms: 9
		entry-tags: entry
		
		script: set-theme 
		pre-script: set-theme
		post-script: 0 2 rnd zombs
		
		room-choice: entry
			room-script: ndx 
			room-post-script: dhall
			room-weight: 1
			room-count: 1
			filter-only
			
		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath

		room-choice: bedroom
			room-weight: 50
			room-count: 2
			room-script: nad

		room-choice: kitchen
			room-weight: 20
			room-count: 1
			room-script: nad floor-kitchen

		room-choice: living
			room-weight: 100
			room-count: 1

		room-choice: hall
			room-weight: 1
			room-count: 1
			room-script: ndx
			room-post-script: dbathroom
			
		room-choice: treasure
			room-script: nad
			room-weight: 1
			room-count: 1
			
		room-choice: closet
			room-weight: 20
			room-count: 2
			room-script: nad 
			room-post-script: 0 1 rnd zombs
			
		room-choice: death
			room-weight: 500
			room-count: 1
			room-script: nad 
			room-post-script: 30 %chance if random-door "treasure" with-door then
			
	location
		tags: treasureland
		max-rooms: 4
		entry-tags: entry
		
		script: set-theme 
		pre-script: set-theme
		post-script: 0 2 rnd zombs
		
		room-choice: entry
			room-script: ndx
			room-weight: 1
			room-count: 1
			filter-only
			
		room-choice: treasure
			room-script: nad
			room-weight: 1
			room-count: 3
		
	location
		tags: apartments
		max-rooms: 14
		entry-tags: aptlobby
		script: set-theme 
		pre-script: set-theme 
		post-script: 0 2 rnd zombs
"
		room-choice: aptlobby
			room-script: ndx
			room-post-script: dhall
			room-weight: 1
			room-count: 1
			filter-only
			
		room-choice: hall
			room-weight: 360
			room-count: 1
			room-script: ndx
		
		room-choice: bedroom
			room-weight: 200
			room-count: 5
			room-script: nad
			room-post-script: dbathroom

		room-choice: closet
			room-weight: 1
			room-count: 1
			room-script: nad

		room-choice: kitchen
			room-weight: 70
			room-count: 1
			room-script: nad floor-kitchen			
	
		room-choice: bathroom
			room-weight: 1
			room-count: 5
			room-script: nad floor-bath			
"
		constant apartment-base
		apartment-base evaluate
		
	location
		tags: big-apartments-E
		max-rooms: 16
		entry-tags: aptlobby
		
		script: set-theme 
		pre-script: set-theme 
		post-script: 10diff %zombs
	
		apartment-base evaluate

		room-choice: bedroom
			room-weight: 100
			room-count: 1
			room-script: nad
			room-post-script: dbathroom looseloot
			
		room-choice: bathroom
			room-weight: 1
			room-count: 1
			room-script: nad floor-bath	
	
	location
		tags: big-apartments-H
		max-rooms: 23
		entry-tags: aptlobby
		
		script: set-theme 
		pre-script: set-theme 
		post-script: 10diff %zombs
	
		room-choice: hall
			room-weight: 480
			room-count: 1
			room-script: ndx
			
		room-choice: living
			room-weight: 350
			room-count: 1
	
		apartment-base evaluate
			
		room-choice: bedroom
			room-weight: 100
			room-count: 2
			room-script: nad
			room-post-script: dbathroom looseloot
			
		room-choice: bedroom
			room-weight: 100
			room-count: 1
			room-script: nad
			room-post-script: dbathroom bigloot
			
		room-choice: closet
			room-weight: 1
			room-count: 1
			room-script: nad			
	
		room-choice: bathroom
			room-weight: 1
			room-count: 3
			room-script: nad floor-bath	
		
			
	location
		tags: big-apartments-M
		max-rooms: 19
		entry-tags: aptlobby
		
		script: set-theme 
		pre-script: set-theme 
		post-script: 10diff %zombs
			
		room-choice: hall
			room-weight: 460
			room-count: 1
			room-script: ndx
			
		apartment-base evaluate

		room-choice: bedroom
			room-weight: 100
			room-count: 2
			room-script: nad
			room-post-script: dbathroom looseloot
				
		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath	
		
			
location
		tags: open1 house
		max-rooms: 8
		entry-tags: open1
		script: set-theme 
		pre-script: set-theme
		post-script: 10diff %zombs
"
		room-choice: open1
			room-weight: 1
			room-count: 1
			room-script: ndx
			room-post-script: dhall
			filter-only

		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath

		room-choice: bedroom
			room-weight: 50
			room-count: 3
			room-script: nad
			room-post-script: beddoor

		room-choice: kitchen
			room-weight: 70
			room-count: 1
			room-script: nad floor-kitchen

		room-choice: hall
			room-weight: 50
			room-count: 1
			room-script: ndx
			room-post-script: dbathroom
"
		constant open1-house
		open1-house evaluate
			
location
		tags: big-open1-M
		max-rooms: 13
		entry-tags: open1
		script: set-theme 
		pre-script: set-theme
		post-script: 10diff %zombs

		room-choice: hall
			room-weight: 50
			room-count: 1
			room-script: ndx
			room-post-script: dhall
		
		open1-house evaluate

		room-choice: bedroom
			room-weight: 50
			room-count: 2
			room-script: nad
			room-post-script: beddoor looseloot
			
		room-choice: bedroom
			room-weight: 50
			room-count: 1
			room-script: nad
			room-post-script: beddoor
			
location
		tags: big-open1-H
		max-rooms: 20
		entry-tags: open1
		script: set-theme 
		pre-script: set-theme
		post-script: 10diff %zombs

		room-choice: hall
			room-weight: 80
			room-count: 2
			room-script: ndx
			room-post-script: dhall
		
		room-choice: living
			room-weight: 50
			room-count: 1
			room-post-script: bigloot
		
		open1-house evaluate

		room-choice: bedroom
			room-weight: 50
			room-count: 3
			room-script: nad
			room-post-script: beddoor
		
		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath
		
		room-choice: bedroom
			room-weight: 50
			room-count: 2
			room-script: nad
			room-post-script: beddoor looseloot
			
location
		tags: cabin-E
		max-rooms: 2
		entry-tags: cabin
		
		: set-theme-cabin

			floor-wood
			wall-wood
			0 4 rnd loc-dtheme!
			0 5 rnd to theme-num 

		;
		
		script: set-theme-cabin
		pre-script: set-theme-cabin
		post-script: 6 %zombs

		room-choice: randcabin
			room-weight: 80
			room-count: 1
			room-script: ndx
			room-post-script: looseloot
			
		room-choice: bathroom
			room-weight: 1
			room-count: 1
			room-script: nad
			
location
		tags: cabin-hermit
		max-rooms: 2
		entry-tags: entry
		script: set-theme-cabin 
		pre-script: set-theme
		post-script: 0 %zombs

		room-choice: entry
			room-script: ndx 
			room-post-script: 
			room-weight: 1
			room-count: 1
			filter-only
		
		room-choice: randcabin
			room-weight: 80
			room-count: 1
			room-script: nad
			room-post-script: hermit looseloot
			
location
		tags: cabin-bear
		max-rooms: 1
		entry-tags: bearcabin
		script: set-theme 
		pre-script: set-theme-cabin
		post-script: 5 %zombs
		
		room-choice: bearcabin
			room-weight: 80
			room-count: 1
			room-script: ndx
			room-post-script: nicercommon-gun
			filter-only

location
		tags: yallmart
		max-rooms: 4
		entry-tags: yallmart

	: yall-theme floor-mart wall-mart door-mart ;
	: carts-scatter for shoppingcart scatter next ;
	: carts-here for shoppingcart drift next ;
		
		script: yall-theme 

		post-script: 10diff %zombs

// TODO: m/f bathrooms, garden center, employee break room, storage room?

		room-choice: yallmart
			room-weight: 10
			room-count: 4
			room-script: ndx
			room-post-script: LLkitchen LLkitchen LLmisc
			filter-only

		room-choice: bathroom
			room-weight: 1
			room-count: 2
			room-script: nad floor-bath		

		room-choice: treasure
			room-script: nad
			room-weight: 1
			room-count: 1
			room-post-script: LLkitchen			

location
		tags: trashed
		max-rooms: 2
		entry-tags: trashed
		
		room-choice: trashed
			room-weight: 10
			room-count: 2
			room-script: nad
			filter-only
			
location
		tags: bar
		max-rooms: 1
		entry-tags: bar
		script: set-theme-cabin 

	: barcounter
		spawn special_objects48_base_id 0x 3 + lt .spriteid!
		rndflip bbox immovable as-wood dropswood
	;

	: bararcade
		spawn special_objects32_base_id 0x 27 + lt .spriteid!
		bbox as-wood
	;

	: barstool
		spawn special_objects32_base_id 0x 1f + lt .spriteid!
		bbox as-wood
	;	

	: bottle-scatter 6 for bottle drop scatter next ;
	: barloot
		bottle-scatter
		new-drunk-npc
		skelscat
		30 %chance if skelscat then
		1 4 rnd case
			1 of dolt 12 sbullet endof
			2 of shotgun 8 sshot endof
			3 of 3 for pipescat next 50 LOOT_GAS spawnscat endof
			4 of pistol 30 sbullet endof
		endcase
	;

	
		room-choice: bar
			room-weight: 10
			room-count: 1
			room-script: nad 
			room-post-script: barloot
			filter-only

location
		tags: shop
		max-rooms: 1
		entry-tags: shop
		script: yall-theme 

	: shoploot
		3 6 rnd for skelscat next
		3 carts-scatter
		3 for LLammobox next
		90 %chance if pistol scatter 10 15 rnd sbullet then
		25 %chance if shotgun scatter pistol scatter then
		50 %chance if LLammobox then
		10 %chance if LLammobox then
		30 %chance if 1 4 rnd case
			1 of dolt 12 sbullet endof
			2 of shotgun 8 sshot endof
			3 of rifle 15 srifle endof
			4 of niceranged scatter endof
		endcase	then
	;

		room-choice: shop
			room-weight: 10
			room-count: 1
			room-script: nad 
			room-post-script: 10diff %zombs shoploot
			filter-only
			
locations-end

