// File: /workspace/github_c_makefile_star2_O2/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
leaq 0xc71ac(%rip), %rbx     # 0xdb810
leaq 0x6d2f9(%rip), %rsi     # 0x81964
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x14744
leaq 0xc718b(%rip), %rbx     # 0xdb810
leaq 0x6d2e1(%rip), %rsi     # 0x8196d
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x14750
leaq 0xc716a(%rip), %rbx     # 0xdb810
leaq 0x6d2c9(%rip), %rsi     # 0x81976
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x1475c
leaq 0xc7149(%rip), %rbx     # 0xdb810
leaq 0x6d2b1(%rip), %rsi     # 0x8197f
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x14768
leaq 0xc7128(%rip), %rbx     # 0xdb810
leaq 0x6d299(%rip), %rsi     # 0x81988
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x14774
leaq 0xc710b(%rip), %rbx     # 0xdb810
leaq 0x6d285(%rip), %rsi     # 0x81991
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
je 0x14780
leaq 0xc70ee(%rip), %rbx     # 0xdb810
leaq 0x6d271(%rip), %rsi     # 0x8199a
pushq $0x9
popq %rdx
movq %rbx, %rdi
callq 0x89f0
testl %eax, %eax
jne 0x14791
movabsq $0x50414d2e3154454e, %rax # imm = 0x50414D2E3154454E
jmp 0x1478a
movabsq $0x50414d2e3254454e, %rax # imm = 0x50414D2E3254454E
jmp 0x1478a
movabsq $0x50414d2e3354454e, %rax # imm = 0x50414D2E3354454E
jmp 0x1478a
movabsq $0x50414d2e3454454e, %rax # imm = 0x50414D2E3454454E
jmp 0x1478a
movabsq $0x50414d2e3654454e, %rax # imm = 0x50414D2E3654454E
jmp 0x1478a
movabsq $0x50414d2e3754454e, %rax # imm = 0x50414D2E3754454E
jmp 0x1478a
movabsq $0x50414d2e3554454e, %rax # imm = 0x50414D2E3554454E
movq %rax, (%rbx)
movb $0x0, 0x8(%rbx)
callq 0x1322e
leaq 0xc7073(%rip), %rdi     # 0xdb810
callq 0x18550
xorl %eax, %eax
callq 0x95ed
leaq 0x787380(%rip), %rbx    # 0x79bb30
leaq 0x787389(%rip), %r12    # 0x79bb40
movslq (%rbx), %rbx
testq %rbx, %rbx
js 0x147d0
movswl %bx, %edi
callq 0x19ac0
shlq $0x2, %rbx
addq %r12, %rbx
jmp 0x147b7
leaq 0x787359(%rip), %rax    # 0x79bb30
movslq (%rax), %rax
testq %rax, %rax
js 0x147ed
andl $0x0, 0x10(%rsp,%rax,4)
shlq $0x2, %rax
addq %r12, %rax
jmp 0x147d7
leaq 0x5c8c14(%rip), %rax    # 0x5dd408
movl $0x11, (%rax)
leaq 0x31091f(%rip), %rax    # 0x325120
movb $0x0, 0x1(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
leaq 0x787301(%rip), %rax    # 0x79bb24
movslq (%rax), %rax
leaq 0x787303(%rip), %r13    # 0x79bb30
cmpl (%r13), %eax
jne 0x1490a
movl $0x1, 0x10(%rsp,%rax,4)
leaq 0x7872e6(%rip), %rbx    # 0x79bb2c
leaq 0x6d156(%rip), %r15     # 0x819a3
leaq 0xc5c0a(%rip), %r14     # 0xda45e
leaq 0xc(%rsp), %rdi
leaq 0xc5d90(%rip), %rsi     # 0xda5f0
callq 0x5486a
testl %eax, %eax
jle 0x14876
movslq 0xc(%rsp), %rax
movl $0x1, 0x10(%rsp,%rax,4)
xorl %ebp, %ebp
movq %r13, %rax
movslq (%rax), %rax
testq %rax, %rax
js 0x14898
cmpl $0x1, 0x10(%rsp,%rax,4)
leaq (,%rax,4), %rax
sbbl $-0x1, %ebp
addq %r12, %rax
jmp 0x1487b
movl (%rbx), %edx
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1373a
movswl (%r14), %edi
xorl %esi, %esi
callq 0xa81a
leaq 0x310868(%rip), %rax    # 0x325120
movb 0x1(%rax), %al
cmpl (%rbx), %ebp
jge 0x148c3
testb %al, %al
je 0x14854
testb %al, %al
je 0x148e0
leaq 0x310852(%rip), %rax    # 0x325120
movb $0x0, 0x1(%rax)
leaq 0x6d0e3(%rip), %rdi     # 0x819bc
xorl %eax, %eax
callq 0x2acb8
leaq 0xc5cfd(%rip), %rax     # 0xda5e4
cmpl $0x0, (%rax)
je 0x1494e
leaq 0xc5b8d(%rip), %rax     # 0xda480
movq (%rax), %rcx
leaq 0x6d0d9(%rip), %rdi     # 0x819d6
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x8ff0
jmp 0x1494e
leaq 0x6d0d2(%rip), %rdi     # 0x819e3
xorl %eax, %eax
callq 0x1373a
leaq 0xc5cc5(%rip), %rax     # 0xda5e4
cmpl $0x0, (%rax)
je 0x1494e
leaq 0xc5b55(%rip), %rax     # 0xda480
movq (%rax), %rcx
leaq 0x6d0a1(%rip), %rdi     # 0x819d6
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
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