// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, (%rsp)
movq %rdi, %r15
movl 0x60(%rsp), %eax
movl %eax, 0xc(%rsp)
movl $0x14, %edi
movl $0x4b, %esi
movl $0x11, %edx
movl $0x1b, %ecx
callq 0x1130
movq %rax, %rbx
subq $0x8, %rsp
xorl %eax, %eax
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x20, %rsp
movl $0x1, %ebp
leaq 0x5db1(%rip), %r14      # 0xf2ff
movq %rbx, %rdi
movl $0x1, %esi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
incl %ebp
cmpl $0x20, %ebp
jne 0x954e
movl $0x29, %ebp
leaq 0x5d8a(%rip), %r14      # 0xf2ff
movq %rbx, %rdi
movl $0x1, %esi
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1070
incl %ebp
cmpl $0x4a, %ebp
jne 0x9575
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leaq 0x74b2(%rip), %rcx      # 0x10a58
movq %rbx, %rdi
movl $0x1, %esi
movl $0x21, %edx
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1080
cmpl $0x0, (%rsp)
js 0x97f8
movq (%rsp), %rax
incl %eax
movq %rax, (%rsp)
leaq 0x5d0e(%rip), %rbp      # 0xf2ff
xorl %r13d, %r13d
leal 0x6(%r13,%r13,2), %r14d
movl $0x1, %r12d
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1070
incl %r12d
cmpl $0x4a, %r12d
jne 0x95ff
movq %r13, %r14
shlq $0x5, %r14
cmpl $0x1, 0x1c(%r15,%r14)
jne 0x979b
addq %r15, %r14
movslq 0x10(%r14), %rax
cmpq $0x3, %rax
jg 0x9670
movq (%r14), %r8
movq 0x8(%r14), %r9
movl 0x14(%r14), %r10d
leaq 0x73bb(%rip), %rcx      # 0x10a08
movslq (%rcx,%rax,4), %r11
addq %rcx, %r11
leal 0x2(%r13,%r13,2), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x73f8(%rip), %rcx      # 0x10a60
xorl %eax, %eax
pushq %r11
pushq %r10
jmp 0x96e9
cmpl $0x6, %eax
je 0x97d1
cmpl $0x5, %eax
je 0x96b3
cmpl $0x4, %eax
jne 0x96f2
movq (%r14), %r8
movq 0x8(%r14), %r9
movslq 0x14(%r14), %r10
shlq $0x6, %r10
leal 0x2(%r13,%r13,2), %esi
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x73cf(%rip), %rcx      # 0x10a79
xorl %eax, %eax
movq 0x20(%rsp), %r11
jmp 0x96e5
movq (%r14), %r8
movq 0x8(%r14), %r9
movslq 0x14(%r14), %rax
leaq (%rax,%rax,2), %r10
shlq $0x4, %r10
leal 0x2(%r13,%r13,2), %esi
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x739b(%rip), %rcx      # 0x10a79
xorl %eax, %eax
movq 0x28(%rsp), %r11
pushq (%r11,%r10)
callq 0x1070
addq $0x10, %rsp
movl 0x18(%r14), %eax
cmpl $0x8, %eax
je 0x975d
cmpl $0x6, %eax
je 0x9733
cmpl $0x4, %eax
jne 0x979b
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leal 0x5(%r13,%r13,2), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x7377(%rip), %rcx      # 0x10aa3
movl 0x10(%rsp), %r8d
jmp 0x9785
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leal 0x5(%r13,%r13,2), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x734d(%rip), %rcx      # 0x10aa3
movl 0x14(%rsp), %r8d
jmp 0x9785
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x11c0
leal 0x5(%r13,%r13,2), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x7331(%rip), %rcx      # 0x10ab1
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1060
leal 0x6(%r13,%r13,2), %r14d
movl $0x1, %r12d
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1070
incl %r12d
cmpl $0x4a, %r12d
jne 0x97a6
incq %r13
cmpq (%rsp), %r13
jne 0x95f4
jmp 0x97f8
movq (%r14), %r8
movq 0x8(%r14), %r9
leal 0x2(%r13,%r13,2), %esi
movq %rbx, %rdi
movl $0x1, %edx
leaq 0x72a0(%rip), %rcx      # 0x10a8c
xorl %eax, %eax
callq 0x1070
jmp 0x96f2
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x11e0
subq $0x8, %rsp
movl $0x20, %r14d
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %rax
pushq %rax
pushq %rax
callq 0x1120
addq $0x18, %rsp
movq %rbx, %rdi
movl $0x20, %esi
movl $0x20, %edx
movl $0x20, %ecx
movl $0x20, %r8d
movl $0x20, %r9d
pushq %r14
pushq %r14
pushq %r14
callq 0x1120
addq $0x20, %rsp
movq %rbx, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1110