// File: lotuskip[P]yuxtapa/server/map.cpp
// Function: Map::apply_house(Coords const&)
void Map::apply_house(const Coords &c)
{
	short i, j;
	Tile* tp;
	for(i = 0; i < MAX_HS; ++i)
	{
		if(c.x+i >= mapsize-1 || c.y+i <= 0)
			break;
		for(j = 0; j < MAX_HS; ++j)
		{
			if(c.y+j >= mapsize-1 || c.y+j <= 0)
				break;
			tp = mod_tile(c.x + i, c.y + j);
			switch(house[j*MAX_HS+i])
			{
			case ':': case '.':
				*tp = T_FLOOR; break;
			case '#':
				*tp = T_WALL; break;
			case 'I':
				*tp = T_ILLUSION_WALL; break;
			case '+':
				*tp = T_DOOR;
				if(random()%2) // open instead of closed
				{
					tp->symbol = '\\';
					tp->flags |= TF_WALKTHRU|TF_SEETHRU;
				}
				break;
			case '|': case '-':
				*tp = T_WINDOW;
				tp->symbol = house[j*MAX_HS+i];
				break;
			// default: do nothing
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movw $0x0, -0x12(%rbp)
movswl -0x12(%rbp), %eax
cmpl $0xe, %eax
jge 0x2b644
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movswl -0x12(%rbp), %edx
addl %edx, %eax
movswl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2b4a9
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x12(%rbp), %ecx
addl %ecx, %eax
cmpl $0x0, %eax
jg 0x2b4ae
jmp 0x2b644
movw $0x0, -0x14(%rbp)
movswl -0x14(%rbp), %eax
cmpl $0xe, %eax
jge 0x2b631
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x14(%rbp), %edx
addl %edx, %eax
movswl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x2b4f0
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x14(%rbp), %ecx
addl %ecx, %eax
cmpl $0x0, %eax
jg 0x2b4f5
jmp 0x2b631
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movzwl (%rax), %ecx
movzwl -0x12(%rbp), %edx
addl %edx, %ecx
movzwl 0x2(%rax), %eax
movzwl -0x14(%rbp), %edx
addl %edx, %eax
movswl %cx, %esi
movswl %ax, %edx
callq 0x2e400
movq %rax, -0x20(%rbp)
movswl -0x14(%rbp), %eax
movl %eax, %ecx
addl %ecx, %ecx
shll $0x4, %eax
subl %ecx, %eax
movswl -0x12(%rbp), %ecx
addl %ecx, %eax
cltq
leaq 0x65735(%rip), %rcx     # 0x90c70
movsbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
subl $0x23, %eax
je 0x2b59d
jmp 0x2b549
movl -0x2c(%rbp), %eax
subl $0x2b, %eax
je 0x2b5b9
jmp 0x2b553
movl -0x2c(%rbp), %eax
subl $0x2d, %eax
je 0x2b5f1
jmp 0x2b561
movl -0x2c(%rbp), %eax
subl $0x2e, %eax
je 0x2b58c
jmp 0x2b56b
movl -0x2c(%rbp), %eax
subl $0x3a, %eax
je 0x2b58c
jmp 0x2b575
movl -0x2c(%rbp), %eax
subl $0x49, %eax
je 0x2b5ab
jmp 0x2b57f
movl -0x2c(%rbp), %eax
subl $0x7c, %eax
je 0x2b5f1
jmp 0x2b61e
movq -0x20(%rbp), %rax
movl 0x3682a(%rip), %ecx     # 0x61dc0
movl %ecx, (%rax)
jmp 0x2b61e
movq -0x20(%rbp), %rax
movl 0x3682d(%rip), %ecx     # 0x61dd4
movl %ecx, (%rax)
jmp 0x2b61e
movq -0x20(%rbp), %rax
movl 0x36827(%rip), %ecx     # 0x61ddc
movl %ecx, (%rax)
jmp 0x2b61e
movq -0x20(%rbp), %rax
movl 0x3681d(%rip), %ecx     # 0x61de0
movl %ecx, (%rax)
callq 0x5270
movl $0x2, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x2b5ef
movq -0x20(%rbp), %rax
movb $0x5c, 0x2(%rax)
movq -0x20(%rbp), %rax
movzwl (%rax), %ecx
orl $0x5, %ecx
movw %cx, (%rax)
jmp 0x2b61e
movq -0x20(%rbp), %rax
movl 0x367e9(%rip), %ecx     # 0x61de4
movl %ecx, (%rax)
movswl -0x14(%rbp), %eax
imull $0xe, %eax, %eax
movswl -0x12(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x6565c(%rip), %rax     # 0x90c70
movb (%rax,%rcx), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x2(%rax)
jmp 0x2b620
movw -0x14(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x14(%rbp)
jmp 0x2b4b4
jmp 0x2b633
movw -0x12(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x12(%rbp)
jmp 0x2b46e
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)