// File: /workspace/github_c_makefile_star2_O2/S01den[P]Lost_CavernRL/menu.c
// Function: questsMenu
void questsMenu(Quest actQuest[], int nbrQuestAct, Weapons listWeapons[], Armor listArmor[], int nbrTurretKilled, int nbrInfectedKilled, int nbrDroidKilled)
{
	int i = 0;
	int j = 0;
	char *typeRewards[] = {"VAX","LIFE POINTS","COMPONENTS","EXOTIC BLOOD"};

	WINDOW *win;
	win = newwin(20,75,LONGUEUR/2-2,LARGEUR/4-5);
	box(win,0,0);
	for(i = 1; i < 75/2-5; i++)
		mvwprintw(win,1,i,"-");
	for(i = 75/2+4; i < 74; i++)
		mvwprintw(win,1,i,"-");

	wattron(win, A_BOLD);
	mvwprintw(win,1,75/2-4,"QUESTS:");
	wattroff(win, A_BOLD);
	keypad(win, TRUE);

	for(i = 0; i < nbrQuestAct+1; i++)
	{
		for(j = 1; j < 74; j++)
			mvwprintw(win,i*3+6,j,"-");
		if(actQuest[i].isSet == 1)
		{
			if(actQuest[i].typeReward <= 3)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n  Reward: %d (%s)",actQuest[i].name,actQuest[i].description,actQuest[i].reward,typeRewards[actQuest[i].typeReward]);
			}
			else if(actQuest[i].typeReward == 4)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: %s",actQuest[i].name,actQuest[i].description,listWeapons[actQuest[i].reward].name);
			}
			else if(actQuest[i].typeReward == 5)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: %s",actQuest[i].name,actQuest[i].description,listArmor[actQuest[i].reward].name);
			}
			else if(actQuest[i].typeReward == 6)
			{
				mvwprintw(win,i*3+2,1,"%s:\n%s\n Reward: a drug",actQuest[i].name,actQuest[i].description);
			}
			if(actQuest[i].indice == 4)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/5 Killed)",nbrTurretKilled);
				wattroff(win,A_BOLD);
			}
			else if(actQuest[i].indice == 6)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/5 Killed)",nbrInfectedKilled);
				wattroff(win,A_BOLD);
			}
			else if(actQuest[i].indice == 8)
			{
				wattron(win,A_BOLD);
				mvwprintw(win,i*3+5,1,"(%d/10 Killed)",nbrDroidKilled);
				wattroff(win,A_BOLD);
			}
		}
		for(j = 1; j < 74; j++)
			mvwprintw(win,i*3+6,j,"-");

	}

	wrefresh(win);

	wgetch(win);

	box(win, ' ', ' ');
	wborder(win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
	wclear(win);
	wrefresh(win);
	delwin(win);	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x24(%rsp)
movl %r8d, 0x20(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movl %esi, %ebp
movq %rdi, 0x28(%rsp)
movl 0x80(%rsp), %eax
movl %eax, 0x1c(%rsp)
pushq $0x14
popq %rdi
pushq $0x4b
popq %rsi
pushq $0x11
popq %rdx
pushq $0x1b
popq %rcx
callq 0x1130
movq %rax, %rbx
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1120
pushq $0x1
popq %r14
leaq 0x501e(%rip), %r15      # 0xd2ff
movl %r14d, %r12d
cmpl $0x20, %r12d
je 0x8302
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1070
incl %r12d
jmp 0x82e4
pushq $0x29
popq %r14
leaq 0x4ff2(%rip), %r15      # 0xd2ff
pushq $0x1
popq %r12
movq %rbx, %rdi
cmpl $0x4a, %r14d
je 0x832f
movl %r12d, %esi
movl %r14d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1070
incl %r14d
jmp 0x8311
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leaq 0x67b6(%rip), %rcx      # 0xeaf8
pushq $0x21
popq %rdx
movq %rbx, %rdi
movl %r12d, %esi
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1080
movslq %ebp, %rax
movq %rax, 0x40(%rsp)
leaq 0x4f84(%rip), %r15      # 0xd2ff
xorl %r13d, %r13d
cmpq 0x40(%rsp), %r13
jg 0x856c
leaq (,%r13,2), %r14
addq %r13, %r14
leaq 0x6(,%r13,2), %rbp
addq %r13, %rbp
cmpl $0x4a, %r12d
je 0x83bc
movq %rbx, %rdi
movl %ebp, %esi
movl %r12d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1070
incl %r12d
jmp 0x839f
movq %r13, %r12
shlq $0x5, %r12
movq 0x28(%rsp), %rax
cmpl $0x1, 0x1c(%rax,%r12)
jne 0x8540
addq 0x28(%rsp), %r12
movslq 0x10(%r12), %rax
cmpq $0x3, %rax
jg 0x841b
movq (%r12), %r8
movq 0x8(%r12), %r9
movl 0x14(%r12), %ecx
leaq 0x66b3(%rip), %rdx      # 0xeaac
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
leal 0x2(%r14), %esi
movq %rax, 0x8(%rsp)
movl %ecx, (%rsp)
movq %rbx, %rdi
pushq $0x1
popq %rdx
leaq 0x66e7(%rip), %rcx      # 0xeb00
jmp 0x848f
cmpl $0x6, %eax
je 0x8475
cmpl $0x5, %eax
je 0x8443
cmpl $0x4, %eax
jne 0x8496
movq (%r12), %r8
movq 0x8(%r12), %r9
movslq 0x14(%r12), %rax
shlq $0x6, %rax
movq 0x30(%rsp), %rcx
jmp 0x845a
movq (%r12), %r8
movq 0x8(%r12), %r9
movslq 0x14(%r12), %rax
imulq $0x30, %rax, %rax
movq 0x38(%rsp), %rcx
movq (%rcx,%rax), %rax
leal 0x2(%r14), %esi
movq %rax, (%rsp)
movq %rbx, %rdi
pushq $0x1
popq %rdx
leaq 0x66a6(%rip), %rcx      # 0xeb19
jmp 0x848f
movq (%r12), %r8
movq 0x8(%r12), %r9
leal 0x2(%r14), %esi
movq %rbx, %rdi
pushq $0x1
popq %rdx
leaq 0x669d(%rip), %rcx      # 0xeb2c
xorl %eax, %eax
callq 0x1070
movl 0x18(%r12), %eax
cmpl $0x8, %eax
je 0x8502
cmpl $0x6, %eax
je 0x84d8
cmpl $0x4, %eax
jne 0x8540
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r14d
movq %rbx, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
leaq 0x6672(%rip), %rcx      # 0xeb43
movl 0x20(%rsp), %r8d
jmp 0x852a
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r14d
movq %rbx, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
leaq 0x6648(%rip), %rcx      # 0xeb43
movl 0x24(%rsp), %r8d
jmp 0x852a
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
addl $0x5, %r14d
movq %rbx, %rdi
movl %r14d, %esi
pushq $0x1
popq %rdx
leaq 0x662c(%rip), %rcx      # 0xeb51
movl 0x1c(%rsp), %r8d
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
pushq $0x1
popq %r12
movl %r12d, %r14d
cmpl $0x4a, %r14d
je 0x8564
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1070
incl %r14d
jmp 0x8547
incq %r13
jmp 0x837e
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x11e0
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
pushq $0x20
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
movl %ebp, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x1120
movl %ebp, 0x10(%rsp)
movl %ebp, 0x8(%rsp)
movl %ebp, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
movl %ebp, %ecx
movl %ebp, %r8d
movl %ebp, %r9d
callq 0x1120
movq %rbx, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1110