// File: /workspace/github_c_makefile_star2_O1/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:
movabsq $0x50414d2e3154454e, %rcx # imm = 0x50414D2E3154454E
leaq 0xccdd0(%rip), %rax     # 0xe2810
movq (%rax), %rdx
xorq %rcx, %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15ac3
leaq 0x1000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15acf
leaq 0x2000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15adb
leaq 0x3000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15ae7
leaq 0x5000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15af3
leaq 0x6000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
je 0x15aff
leaq 0x4000000(%rcx), %rdx
xorq (%rax), %rdx
movzbl 0x8(%rax), %esi
orq %rdx, %rsi
jne 0x15b10
jmp 0x15b09
movabsq $0x50414d2e3254454e, %rcx # imm = 0x50414D2E3254454E
jmp 0x15b09
movabsq $0x50414d2e3354454e, %rcx # imm = 0x50414D2E3354454E
jmp 0x15b09
movabsq $0x50414d2e3454454e, %rcx # imm = 0x50414D2E3454454E
jmp 0x15b09
movabsq $0x50414d2e3654454e, %rcx # imm = 0x50414D2E3654454E
jmp 0x15b09
movabsq $0x50414d2e3754454e, %rcx # imm = 0x50414D2E3754454E
jmp 0x15b09
movabsq $0x50414d2e3554454e, %rcx # imm = 0x50414D2E3554454E
movq %rcx, (%rax)
movb $0x0, 0x8(%rax)
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
callq 0x145ca
leaq 0xccce6(%rip), %rdi     # 0xe2810
callq 0x19a20
xorl %eax, %eax
callq 0xa1e5
leaq 0x78cfd3(%rip), %rax    # 0x7a2b10
movl (%rax), %ebx
testl %ebx, %ebx
js 0x15b5c
leaq 0x78cfd6(%rip), %r14    # 0x7a2b20
movswl %bx, %edi
callq 0x1b0cd
movl %ebx, %eax
movl (%r14,%rax,4), %ebx
testl %ebx, %ebx
jns 0x15b4a
leaq 0x78cfad(%rip), %rax    # 0x7a2b10
movl (%rax), %eax
testl %eax, %eax
js 0x15b81
leaq 0x78cfb0(%rip), %rcx    # 0x7a2b20
movl %eax, %eax
movl $0x0, 0x10(%rsp,%rax,4)
movl (%rcx,%rax,4), %eax
testl %eax, %eax
jns 0x15b70
leaq 0x5ce860(%rip), %rax    # 0x5e43e8
movl $0x11, (%rax)
leaq 0x31656b(%rip), %rax    # 0x32c100
movb $0x0, 0x1(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
leaq 0x78cf4d(%rip), %rax    # 0x7a2b04
movslq (%rax), %rax
leaq 0x78cf4f(%rip), %rcx    # 0x7a2b10
cmpl (%rcx), %eax
jne 0x15c7e
movl $0x1, 0x10(%rsp,%rax,4)
leaq 0xc(%rsp), %r14
leaq 0x78cf43(%rip), %r12    # 0x7a2b20
leaq 0x78cf28(%rip), %r13    # 0x7a2b0c
leaq 0x76d34(%rip), %r15     # 0x8c91f
leaq 0xcb86c(%rip), %rbx     # 0xe145e
movq %r14, %rdi
leaq 0xcb9f4(%rip), %rsi     # 0xe15f0
callq 0x5b437
testl %eax, %eax
jle 0x15c12
movslq 0xc(%rsp), %rax
movl $0x1, 0x10(%rsp,%rax,4)
leaq 0x78cef7(%rip), %rax    # 0x7a2b10
movl (%rax), %eax
xorl %ebp, %ebp
testl %eax, %eax
js 0x15c31
movl %eax, %eax
cmpl $0x1, 0x10(%rsp,%rax,4)
sbbl $-0x1, %ebp
movl (%r12,%rax,4), %eax
jmp 0x15c1d
movl (%r13), %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x14b61
movswl (%rbx), %edi
xorl %esi, %esi
callq 0xb563
leaq 0x3164ae(%rip), %rax    # 0x32c100
movb 0x1(%rax), %al
cmpl (%r13), %ebp
jge 0x15c5f
testb %al, %al
je 0x15bf2
testb %al, %al
je 0x15c8c
leaq 0x316496(%rip), %rax    # 0x32c100
movb $0x0, 0x1(%rax)
leaq 0x76cc3(%rip), %rdi     # 0x8c938
xorl %eax, %eax
callq 0x2d800
jmp 0x15c8c
leaq 0x76cda(%rip), %rdi     # 0x8c95f
xorl %eax, %eax
callq 0x14b61
leaq 0xcb951(%rip), %rax     # 0xe15e4
cmpl $0x0, (%rax)
je 0x15cb8
leaq 0xcb7e1(%rip), %rax     # 0xe1480
movq (%rax), %rcx
leaq 0x76ca9(%rip), %rdi     # 0x8c952
movl $0xc, %esi
movl $0x1, %edx
callq 0x8ff0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq