void CCacheWriter::CStoreBuffer::StoreString(const string& s) { size_t size = s.size(); CheckSpace(4+size); x_StoreUint4(ToUint4(size)); memcpy(m_Ptr, s.data(), size); m_Ptr += size; }
int main(INT iArgc, PSZ Argv[]) { APIRET rc; ULONG ulDiskSize, ulDiskFree; INT iArg; INT iPartType; PSZ pEnd; PSZ p; for (iArg = 1; iArg < iArgc; iArg++) { strupr(Argv[iArg]); if (Argv[iArg][0] == '/') { switch (Argv[iArg][1]) { case 'V': fDetailed = 1; if (Argv[iArg][2] == ':' && Argv[iArg][3] == '2') fDetailed = 2; if (Argv[iArg][2] == ':' && Argv[iArg][3] == '3') fDetailed = 3; if (Argv[iArg][2] == ':' && Argv[iArg][3] == '4') fDetailed = 4; break; case 'B': fShowBootSector = TRUE; break; case 'P': p = &Argv[iArg][2]; for (;;) { while (*p) { while (isspace(*p)) p++; if (!(*p)) { printf("ERROR: Expected partition types not found!\n"); exit(1); break; } iPartType = strtol(p, &pEnd, 16); if (iPartType > 255) { printf("ERROR: Partition type %X is not valid\n", iPartType); exit(1); } printf("Also including partition types %2.2X.\n", iPartType); rgfFakePart[iPartType] = TRUE; // if (iPartType & PARTITION_HIDDEN) // { // printf("Also including partition types %2.2X.\n", iPartType & ~PARTITION_HIDDEN); // rgfFakePart[iPartType & ~PARTITION_HIDDEN] = TRUE; // } p = pEnd; while (isspace(*p)) p++; if (*p != ',') break; p++; } if (iArg + 1 < iArgc && Argv[iArg+1][0] != '/') { iArg++; p = Argv[iArg]; } else break; } break; default : printf("Unknown option %s ignored.\n", Argv[iArg]); break; } } else printf("Invalid argument %s ignored.\n", Argv[iArg]); } rc = InitProg(); if (rc) return rc; if (usDriveCount > 0 && fDetailed > 2) { PDRIVEINFO pDrive = rgDrives; USHORT usDrive; for (usDrive = 0; usDrive < usDriveCount; usDrive++) { pDrive = &rgDrives[usDrive]; printf("\n=== Directory structure of FAT32 DRIVE #%d===\n", pDrive->DiskNum); rc = OpenDisk(pDrive->DiskNum, &pDrive->hDisk); DumpDirectory(pDrive, pDrive->bpb.RootDirStrtClus, "X:"); CheckSpace(pDrive); #ifdef HENK ulDiskSize = DiskSize('F'); ulDiskFree = DiskFree('F'); #endif printf("\n"); printf("Found:\n"); printf("Disk size = %13lu\n", pDrive->ulTotalClusters); printf("In use = %13ld\n", ulTotalClusters); printf("Free = %13ld\n", ulTotalFree); #ifdef HENK printf("Reported by DOS:\n"); printf("Disk size = %13lu\n", ulDiskSize / 4096); printf("In Use = %13lu\n", (ulDiskSize - ulDiskFree)/4096); printf("Free = %13lu\n", ulDiskFree / 4096); printf("Difference = %13ld\n", (ulDiskSize - ulDiskFree)/4096 - ulTotalClusters); #endif CloseDisk(pDrive->hDisk); pDrive->hDisk = 0; } } return 0; }
void MovePac(struct Player *P) { int nx,ny,goo=0,dx=0,dy=0,part; bool Check=false; P->mc++; if(WakaFlag) { WakaFlag=0; P->cur=P->old; } else { WakaFlag=1; P->old=P->cur; P->cur=SPR_PACNONE; //destw->draw(picts[SPR_PACNONE],P->zx,P->zy); destw->copyBlock(srcs,picts[SPR_PACNONE]->x,picts[SPR_PACNONE]->y,P->zx,P->zy,BITMAP_X,BITMAP_Y); } if(P->mc==P->speed) { if((P->bx==0)&&(P->by==5)) { DoTunnel(P,LEFT_TUNNEL); } else if((P->bx==18)&&(P->by==5)) { DoTunnel(P,RIGHT_TUNNEL); } P->mc=0; nx=P->zx; ny=P->zy; if(P->mcnt==CountMax) Check=true; if(P->mcnt<0) Check=true; if(Check) { P->mcnt=0; P->dir=P->nextdir; } switch(P->dir) { case DIR_UP: dy= -1; P->cur=SPR_PACUP; break; case DIR_DOWN: dy=1; P->cur=SPR_PACDOWN; break; case DIR_LEFT: dx= -1; P->cur=SPR_PACLEFT; break; case DIR_RIGHT: dx=1; P->cur=SPR_PACRIGHT; break; default: break; } dx=dx*AspectX; dy=dy*AspectY; //dy=DirY[P->dir]; dx=DirX[P->dir]; //P->cur=(*shapes)[P->dir]; if(Check) { P->lx=(nx+BITMAP_X/2)/BITMAP_X; P->ly=(ny+BITMAP_Y/2)/BITMAP_Y; part=ReadBoard(P->bx,P->by); if((part)==(int)'.') { WriteBoard(P->bx,P->by,(int)','); NumDots--; NumPoints+=1; UpdateScore(); } else if((part)==(int)'*') { WriteBoard(P->bx,P->by,(int)','); NumDots--; NumPoints+=10; UpdateScore(); DoMyBlue(); } /*P->lx=(nx+BITMAP_X/2)/BITMAP_X; P->ly=(ny+BITMAP_Y/2)/BITMAP_Y;*/ goo=CheckSpace(nx,ny,&dx,&dy); if(goo) { P->dir=DIR_STOP; P->nextdir=DIR_STOP; } } if(!goo) { if(FOOBAR_PACMOVE) DrawBoardPart(P->lx,P->ly,ReadBoard(P->lx,P->ly)); nx+=dx; ny+=dy; P->mcnt++; #ifdef CATCH_OUT if(ny<0) { ny=1; P->dir=DIR_DOWN; } if(ny>SCREEN_Y+BITMAP_X) { ny=SCREEN_Y-2; P->dir=DIR_UP; } if(nx<0) { nx=1; P->dir=DIR_RIGHT; } if(nx>SCREEN_X) { nx=SCREEN_X-2; P->dir=DIR_LEFT; } #endif if(WakaFlag) { //destw->draw(picts[P->cur],nx,ny); destw->copyBlock(srcs,picts[P->cur]->x,picts[P->cur]->y,nx,ny,BITMAP_X,BITMAP_Y); } else { //destw->draw(picts[SPR_PACNONE],nx,ny); destw->copyBlock(srcs,picts[SPR_PACNONE]->x,picts[SPR_PACNONE]->y,nx,ny,BITMAP_X,BITMAP_Y); } P->zx=nx; P->zy=ny; P->bx=(nx+BITMAP_X/2)/BITMAP_X; P->by=(ny+BITMAP_Y/2)/BITMAP_Y; } } }
void StoreUint4(Uint4 v) { CheckSpace(4); x_StoreUint4(v); }
void MoveGhost(struct Player *g) { int nx,ny,goo=0,dx=0,dy=0; bool Check=false; g->mc++; if(g->mc==g->speed) { g->mc=0; nx=g->zx; ny=g->zy; if(g->mcnt==CountMax) Check=true; if(g->mcnt<0) Check=true; if(Check) { g->mcnt=0; g->dir=g->nextdir; } if(g->lastint==G_SMART) { switch(g->dir) { case DIR_UP: dy= -1; g->cur=SPR_GUP; break; case DIR_DOWN: dy=1; g->cur=SPR_GDOWN; break; case DIR_LEFT: dx= -1; g->cur=SPR_GLEFT; break; case DIR_RIGHT: dx=1; g->cur=SPR_GRIGHT; break; default: break; } } if(g->lastint==G_SCARED) { switch(g->dir) { case DIR_UP: dy= -1; g->cur=SPR_BUP; break; case DIR_DOWN: dy=1; g->cur=SPR_BDOWN; break; case DIR_LEFT: dx= -1; g->cur=SPR_BLEFT; break; case DIR_RIGHT: dx=1; g->cur=SPR_BRIGHT; break; default: break; } } if(g->lastint==G_EYES) { switch(g->dir) { case DIR_UP: dy= -1; g->cur=SPR_EUP; break; case DIR_DOWN: dy=1; g->cur=SPR_EDOWN; break; case DIR_LEFT: dx= -1; g->cur=SPR_ELEFT; break; case DIR_RIGHT: dx=1; g->cur=SPR_ERIGHT; break; default: break; } } dx=dx*AspectX; dy=dy*AspectY; if(Check) { DrawBoardPart(g->lx,g->ly,ReadBoard(g->lx,g->ly)); g->lx=(nx+BITMAP_X/2)/BITMAP_X; g->ly=(ny+BITMAP_Y/2)/BITMAP_Y; goo=CheckSpace(nx,ny,&dx,&dy); if(goo) { GhostChoose(g); g->mcnt=CountMax; MoveGhost(g); } } if(!goo) { if(FOOBAR_PACMOVE) DrawBoardPart(g->lx,g->ly,ReadBoard(g->lx,g->ly)); nx+=dx; ny+=dy; g->mcnt++; #ifdef CATCH_OUT if(ny<0) { ny=1; g->dir=DIR_DOWN; } if(ny>SCREEN_Y) { ny=SCREEN_Y-2; g->dir=DIR_UP; } if(nx<0) { nx=1; g->dir=DIR_RIGHT; } if(nx>SCREEN_X) { nx=SCREEN_X-2; g->dir=DIR_LEFT; } #endif //destw->draw(picts[g->cur],nx,ny); destw->copyBlock(srcs,picts[g->cur]->x,picts[g->cur]->y,nx,ny,BITMAP_X,BITMAP_Y); g->zx=nx; g->zy=ny; g->bx=(nx+BITMAP_X/2)/BITMAP_X; g->by=(ny+BITMAP_Y/2)/BITMAP_Y; if(g->lastint==G_EYES) if((g->bx==HomeX)&&(g->by==HomeY)) { g->lastint=G_SMART; DoNormal(g); } } } }