Exemple #1
0
//------------------------------------------------------------------------------------------------
// load list of bitmaps from APAK
//------------------------------------------------------------------------------------------------
BOOL ddx2LoadList(char *pFileName, APAK_HANDLE *pBmpArchive, char *p_bmp_dir)
{  
  int				c;
  char			text[256];
  FILE			*file = 0;
  DWORD			Eplased = 0;
  DWORD			Start, Stop;
  
  achdir(pBmpArchive, p_bmp_dir);
  
  kprintf(1,(unsigned char *) "Kofola: - Load bitmap pro herni menu");
  file = aopen(pBmpArchive, pFileName,"rb");
  if(!file) {
    kprintf(1,(unsigned char *) "File not found : %s",pFileName);
    konec(TRUE);
  }

  c = 0;
  Start = timeGetTime();
  while(!aeof(file)) {
    agets(text,256,file);
    if(!aeof(file)) {
      text[strlen(text)-1] = '\0';
      ddx2LoadBitmapPos(c,text,pBmpArchive);
    }
    c++;
  }
  
  aclose(file);
  
  Stop = timeGetTime();
  kprintf(1, (unsigned char *) "--------------Total load time %.1f s -----------------", Eplased / 1000.0f);
  
  return(TRUE);
}
Exemple #2
0
//------------------------------------------------------------------------------------------------
// load bitmap from DISK na pozici
//------------------------------------------------------------------------------------------------
SurfaceHandle ddx2LoadBitmapPosDisk(SurfaceHandle handle, char *pFileName)
{
  if(handle != K_CHYBA) {
    ddx2ReleaseBitmap(handle);      
    if((slist.p_slist[handle].p_bmp = bmp_nahraj(pFileName,TRUE))) {
      return(handle);
    }    
  }
  
  kprintf(TRUE,"FILE %s LINE %d Chyba loadu bmp %s..."__FILE__,__LINE__,pFileName);
  konec(TRUE);
  
  return(K_CHYBA);
}
Exemple #3
0
void Vlakno3(void * param) {
  int port = (int) param;
  holog.log(I3, "Ovladaci Vlakno3 spusteno na portu %i\n", port);

  ladiciSocket = new HoServerSocket(port, 500);
  if (!ladiciSocket->listenBind()) {
    holog.log(F2, "Nelze listenBind\n");
    exit(1);
  }
  bool kon = false;
  while (!kon) {
    HoSocket *client = ladiciSocket->accept();
    if (!client) {
      holog.log(F2, "Nelze pøijmout soket\n");
      exit(1);
    }
    char co;
    holog.log(I1, "pred recv\n");
    int kolik = client->recv((void *) &co, 1);
    if (kolik == 1) {
      switch (co) {
        case 'v':
          semaforKlienti.down();
          semaforStolky.down();
          klienti.debugPrint(stdout);
          stolky.print(stdout);
          semaforStolky.up();
          semaforKlienti.up();
          break;
        case 'k':
          holog.log(I4, "Prej mam koncit\n");
          konec();
          kon = true;
          break;
        default:
          goto els;
      }
    } else {
       els:
       holog.log(W2, "Chyba ovladace\n");
    }
    delete client;
  }
  delete ladiciSocket;
}
Exemple #4
0
//------------------------------------------------------------------------------------------------
// Create Surface
//------------------------------------------------------------------------------------------------
SurfaceHandle ddx2CreateSurface(int x, int y, int idx)
{
  if(idx > -1 && idx < slist.surf_max) {
    ddx2ReleaseBitmap(idx);
    
    slist.p_slist[idx].p_bmp = bmp_vyrob(x,y);

    if(!(slist.p_slist[idx].p_bmp)) {
      kprintf(TRUE,"FILE %s LINE %d vyrob bmp..."__FILE__,__LINE__);
      konec(TRUE);  
    }

    if(slist.p_slist[idx].p_bmp)
      ddx2CleareSurface(idx);
    return(slist.p_slist[idx].p_bmp ? idx : K_CHYBA);
  } else {
    return(K_CHYBA);
  }
}