// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekmsc.c
// Function: nextnetlevel
void
nextnetlevel()
{
     int  i,len,other,readyplayers,playerreadyflag[MAXPLAYERS];

     if( strcmp(boardfilename,"NET1.MAP") == 0) {
          strcpy(boardfilename,"NET2.MAP");
     }
     else if( strcmp(boardfilename,"NET2.MAP") == 0) {
          strcpy(boardfilename,"NET3.MAP");
     }
     else if( strcmp(boardfilename,"NET3.MAP") == 0) {
          strcpy(boardfilename,"NET4.MAP");
     }
     else if( strcmp(boardfilename,"NET4.MAP") == 0) {
          strcpy(boardfilename,"NET6.MAP");
     }
     else if( strcmp(boardfilename,"NET6.MAP") == 0) {
          strcpy(boardfilename,"NET7.MAP");
     }
     else if( strcmp(boardfilename,"NET7.MAP") == 0) {
          strcpy(boardfilename,"NET5.MAP");
     }
     else if( strcmp(boardfilename,"NET5.MAP") == 0) {
          strcpy(boardfilename,"NET1.MAP");
     }
     initpaletteshifts();
     prepareboard(boardfilename);
     precache();
     for( i=connecthead ; i >= 0 ; i=connectpoint2[i] ) {
          initplayersprite((short)i);
     }
//** Les START - 10/02/95
     for (i=connecthead ; i >= 0 ; i=connectpoint2[i]) {
          playerreadyflag[i]=0;
     }
#if 0
     for (i=connecthead ; i >= 0 ; i=connectpoint2[i]) {
          syncvel[i]=fsyncvel[i]=osyncvel[i]=0;
          syncsvel[i]=fsyncsvel[i]=osyncsvel[i]=0;
          syncangvel[i]=fsyncangvel[i]=osyncangvel[i]=0;
          syncbits[i]=fsyncbits[i]=osyncbits[i]=0;
          for (j=0 ; j < MOVEFIFOSIZ ; j++) {
               baksyncvel[j][i]=0;
               baksyncsvel[j][i]=0;
               baksyncangvel[j][i]=0;
               baksyncbits[j][i]=0;
          }
     }
     movefifoplc=movefifoend=0;
     syncvalplc=othersyncvalplc=0;
     syncvalend=othersyncvalend=0;
     syncvalcnt=othersyncvalcnt=0L;
     olocvel=olocvel2=0;
     olocsvel=olocsvel2=0;
     olocangvel=olocangvel2=0;
     olocbits=olocbits2=0;
#endif
     randomseed=17L;
     keystatus[0x01]=0;
     memset(playerreadyflag,0,sizeof(int)*MAXPLAYERS);
     readyplayers=0;
     if (myconnectindex == connecthead) {
          playerreadyflag[myconnectindex]=1;
          do {
               if ((len=getpacket(&other,tempbuf)) > 0) {
                    playerreadyflag[other]=1;
               }
               readyplayers=0;
               for (i=connecthead ; i >= 0 ; i=connectpoint2[i]) {
                    if (playerreadyflag[i]) {
                         readyplayers++;
                    }
               }
               showmessage("%d OF %d PLAYERS READY..",readyplayers,numplayers);
               drawscreen(screenpeek,0L);
          } while (readyplayers < numplayers && keystatus[0x01] == 0);
          if (keystatus[0x01]) {
               keystatus[0x01]=0;
               crashgame("Multiplayer game aborted!");
          }
          if (dbgflag) {
               fprintf(dbgfp,"\nNEW LEVEL\n\n");
          }
     }
     else {
          showmessage("ONE MOMENT...");
          if (dbgflag) {
               fprintf(dbgfp,"\nNEW LEVEL\n\n");
          }
     }
//** Les END   - 10/02/95
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movabsq $0x50414d2e3154454e, %rcx # imm = 0x50414D2E3154454E
leaq 0xcfd31(%rip), %rax     # 0xe5810
movq (%rax), %rdx
xorq %rcx, %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b62
leaq 0x1000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b6e
leaq 0x2000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b7a
leaq 0x3000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b86
leaq 0x5000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b92
leaq 0x6000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15b9e
leaq 0x4000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
jne 0x15baf
jmp 0x15ba8
movabsq $0x50414d2e3254454e, %rcx # imm = 0x50414D2E3254454E
jmp 0x15ba8
movabsq $0x50414d2e3354454e, %rcx # imm = 0x50414D2E3354454E
jmp 0x15ba8
movabsq $0x50414d2e3454454e, %rcx # imm = 0x50414D2E3454454E
jmp 0x15ba8
movabsq $0x50414d2e3654454e, %rcx # imm = 0x50414D2E3654454E
jmp 0x15ba8
movabsq $0x50414d2e3754454e, %rcx # imm = 0x50414D2E3754454E
jmp 0x15ba8
movabsq $0x50414d2e3554454e, %rcx # imm = 0x50414D2E3554454E
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
callq 0x1464a
leaq 0xcfc55(%rip), %rdi     # 0xe5810
callq 0x19b14
xorl %eax, %eax
callq 0xa205
leaq 0x78ff62(%rip), %rax    # 0x7a5b30
movl (%rax), %ebx
testl %ebx, %ebx
js 0x15c0e
leaq 0x78ff65(%rip), %r14    # 0x7a5b40
movswl %bx, %edi
callq 0x1b1e5
movl %ebx, %eax
movl (%r14,%rax,4), %ebx
testl %ebx, %ebx
jns 0x15bdb
leaq 0x78ff3c(%rip), %rax    # 0x7a5b30
movl (%rax), %ebx
testl %ebx, %ebx
js 0x15c0e
movl %ebx, %eax
movl %eax, %eax
movl $0x0, 0x10(%rsp,%rax,4)
movl (%r14,%rax,4), %eax
testl %eax, %eax
jns 0x15bfc
leaq 0x5d17f3(%rip), %rax    # 0x5e7408
movl $0x11, (%rax)
leaq 0x3194fe(%rip), %rax    # 0x32f120
movb $0x0, 0x1(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
leaq 0x78fee0(%rip), %rax    # 0x7a5b24
cmpl %ebx, (%rax)
jne 0x15d30
movslq %ebx, %rax
movl $0x1, 0x10(%rsp,%rax,4)
leaq 0xc(%rsp), %r14
leaq 0x78fedd(%rip), %r12    # 0x7a5b40
leaq 0x78fec2(%rip), %r13    # 0x7a5b2c
leaq 0x79d32(%rip), %r15     # 0x8f9a3
leaq 0xce7e6(%rip), %rbx     # 0xe445e
movq %r14, %rdi
leaq 0xce96e(%rip), %rsi     # 0xe45f0
callq 0x5e6cb
testl %eax, %eax
jle 0x15c98
movslq 0xc(%rsp), %rax
movl $0x1, 0x10(%rsp,%rax,4)
leaq 0x78fe91(%rip), %rax    # 0x7a5b30
movl (%rax), %eax
xorl %ebp, %ebp
testl %eax, %eax
js 0x15cb7
movl %eax, %eax
cmpl $0x1, 0x10(%rsp,%rax,4)
sbbl $-0x1, %ebp
movl (%r12,%rax,4), %eax
jmp 0x15ca3
movl (%r13), %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x14be7
movswl (%rbx), %edi
xorl %esi, %esi
callq 0xb541
leaq 0x319448(%rip), %rax    # 0x32f120
movb 0x1(%rax), %al
cmpl (%r13), %ebp
jge 0x15ce5
testb %al, %al
je 0x15c78
testb %al, %al
je 0x15d02
leaq 0x319430(%rip), %rax    # 0x32f120
movb $0x0, 0x1(%rax)
leaq 0x79cc1(%rip), %rdi     # 0x8f9bc
xorl %eax, %eax
callq 0x2eb88
leaq 0xce8db(%rip), %rax     # 0xe45e4
cmpl $0x0, (%rax)
je 0x15d78
leaq 0xce76b(%rip), %rax     # 0xe4480
movq (%rax), %rcx
leaq 0x79cb7(%rip), %rdi     # 0x8f9d6
movl $0xc, %esi
movl $0x1, %edx
callq 0x8ff0
jmp 0x15d78
leaq 0x79cac(%rip), %rdi     # 0x8f9e3
xorl %eax, %eax
callq 0x14be7
leaq 0xce89f(%rip), %rax     # 0xe45e4
cmpl $0x0, (%rax)
je 0x15d78
leaq 0xce72f(%rip), %rax     # 0xe4480
movq (%rax), %rcx
leaq 0x79c7b(%rip), %rdi     # 0x8f9d6
movl $0xc, %esi
movl $0x1, %edx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8ff0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq