/* ================ = = ShapeTest = ================ */ void ShapeTest (void) { //TODO #if NOTYET extern word NumDigi; extern word *DigiList; extern int postx; extern int postwidth; extern byte *postsource; static char buf[10]; boolean done; ScanCode scan; int i,j,k,x; longword l; byte *addr; soundnames sound; // PageListStruct far *page; CenterWindow(20,16); VW_UpdateScreen(); for (i = 0,done = false; !done;) { US_ClearWindow(); sound = (soundnames) -1; // page = &PMPages[i]; US_Print(" Page #"); US_PrintUnsigned(i); if (i < PMSpriteStart) US_Print(" (Wall)"); else if (i < PMSoundStart) US_Print(" (Sprite)"); else if (i == ChunksInFile - 1) US_Print(" (Sound Info)"); else US_Print(" (Sound)"); /* US_Print("\n XMS: "); if (page->xmsPage != -1) US_PrintUnsigned(page->xmsPage); else US_Print("No"); US_Print("\n Main: "); if (page->mainPage != -1) US_PrintUnsigned(page->mainPage); else if (page->emsPage != -1) { US_Print("EMS "); US_PrintUnsigned(page->emsPage); } else US_Print("No"); US_Print("\n Last hit: "); US_PrintUnsigned(page->lastHit);*/ US_Print("\n Address: "); addr = (byte *) PM_GetPage(i); sprintf(buf,"0x%08X",(int32_t) addr); US_Print(buf); if (addr) { if (i < PMSpriteStart) { // // draw the wall // vbuf += 32*SCREENWIDTH; postx = 128; postwidth = 1; postsource = addr; for (x=0;x<64;x++,postx++,postsource+=64) { wallheight[postx] = 256; ScalePost (); } vbuf -= 32*SCREENWIDTH; } else if (i < PMSoundStart) { // // draw the sprite // vbuf += 32*SCREENWIDTH; SimpleScaleShape (160, i-PMSpriteStart, 64); vbuf -= 32*SCREENWIDTH; } else if (i == ChunksInFile - 1) { US_Print("\n\n Number of sounds: "); US_PrintUnsigned(NumDigi); for (l = j = k = 0;j < NumDigi;j++) { l += DigiList[(j * 2) + 1]; k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; } US_Print("\n Total bytes: "); US_PrintUnsigned(l); US_Print("\n Total pages: "); US_PrintUnsigned(k); } else { byte *dp = addr; for (j = 0;j < NumDigi;j++) { k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; if ((i >= PMSoundStart + DigiList[j * 2]) && (i < PMSoundStart + DigiList[j * 2] + k)) break; } if (j < NumDigi) { sound = (soundnames) j; US_Print("\n Sound #"); US_PrintUnsigned(j); US_Print("\n Segment #"); US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]); } for (j = 0;j < PageLengths[i];j += 32) { byte v = dp[j]; int v2 = (unsigned)v; v2 -= 128; v2 /= 4; if (v2 < 0) VWB_Vlin(WindowY + WindowH - 32 + v2, WindowY + WindowH - 32, WindowX + 8 + (j / 32),BLACK); else VWB_Vlin(WindowY + WindowH - 32, WindowY + WindowH - 32 + v2, WindowX + 8 + (j / 32),BLACK); } } } VW_UpdateScreen(); IN_Ack(); scan = LastScan; IN_ClearKey(scan); switch (scan) { case sc_LeftArrow: if (i) i--; break; case sc_RightArrow: if (++i >= ChunksInFile) i--; break; case sc_W: // Walls i = 0; break; case sc_S: // Sprites i = PMSpriteStart; break; case sc_D: // Digitized i = PMSoundStart; break; case sc_I: // Digitized info i = ChunksInFile - 1; break; /* case sc_L: // Load all pages for (j = 0;j < ChunksInFile;j++) PM_GetPage(j); break;*/ case sc_P: if (sound != -1) SD_PlayDigitized(sound,8,8); break; case sc_Escape: done = true; break; /* case sc_Enter: PM_GetPage(i); break;*/ } } SD_StopDigitized(); #endif }
/////////////////////////////////////////////////////////////////////////// // // SD_PlaySound() - plays the specified sound on the appropriate hardware // Returns the channel of the sound if it played, else 0. // /////////////////////////////////////////////////////////////////////////// int SD_PlaySound(const char* sound, SoundChannel chan) { bool ispos; int lp,rp; lp = LeftPosition; rp = RightPosition; LeftPosition = 0; RightPosition = 0; ispos = nextsoundpos; nextsoundpos = false; const SoundData &sindex = SoundInfo[sound]; if ((SoundMode != sdm_Off) && sindex.IsNull()) return 0; if ((DigiMode != sds_Off) && sindex.HasType(SoundData::DIGITAL)) { if ((DigiMode == sds_PC) && (SoundMode == sdm_PC)) { #ifdef NOTYET if (s->priority < SoundPriority) return 0; SDL_PCStopSound(); SD_PlayDigitized(sindex,lp,rp); SoundPositioned = ispos; SoundPriority = s->priority; #else return 0; #endif } else { #ifdef NOTYET if (s->priority < DigiPriority) return(false); #endif int channel = SD_PlayDigitized(sindex, lp, rp, chan); SoundPositioned = ispos; DigiPriority = sindex.GetPriority(); SoundPlaying = sound; return channel; } return(true); } if (SoundMode == sdm_Off) return 0; // if (!s->length) // Quit("SD_PlaySound() - Zero length sound"); if (sindex.GetPriority() < SoundPriority) return 0; bool didPlaySound = false; switch (SoundMode) { default: didPlaySound = true; break; case sdm_PC: if(sindex.HasType(SoundData::PCSPEAKER)) { SDL_PCPlaySound((PCSound *)sindex.GetData(SoundData::PCSPEAKER)); didPlaySound = true; } break; case sdm_AdLib: if(sindex.HasType(SoundData::ADLIB)) { SDL_ALPlaySound((AdLibSound *)sindex.GetData(SoundData::ADLIB)); didPlaySound = true; } break; } if (didPlaySound) { SoundPriority = sindex.GetPriority(); SoundPlaying = sound; } return 0; }
/////////////////////////////////////////////////////////////////////////// // // SD_PlaySound() - plays the specified sound on the appropriate hardware // /////////////////////////////////////////////////////////////////////////// boolean SD_PlaySound(soundnames sound) { SoundCommon *s; int lp = LeftPosition; int rp = RightPosition; LeftPosition = 0; RightPosition = 0; boolean ispos = nextsoundpos; nextsoundpos = false; if (sound == -1 || (DigiMode == SDS_OFF && SoundMode == SDM_OFF)) return 0; s = (SoundCommon *) SoundTable[sound]; if ((SoundMode != SDM_OFF) && !s) Quit("SD_PlaySound() - Uncached sound"); if ((DigiMode != SDS_OFF) && (DigiMap[sound] != -1)) { if ((DigiMode == SDS_PC) && (SoundMode == SDM_PC)) { return 0; } else { int channel = SD_PlayDigitized(DigiMap[sound], lp, rp); SoundPositioned = ispos; DigiNumber = sound; DigiPriority = s->priority; return channel + 1; } return(true); } if (SoundMode == SDM_OFF) return 0; if (!s->length) Quit("SD_PlaySound() - Zero length sound"); if (s->priority < SoundPriority) return 0; switch (SoundMode) { case SDM_PC: #if 0 SD_PCPlaySound((PCSound *)s); #endif break; case SDM_ADLIB: SD_ALPlaySound((AdLibSound *)s); break; } SoundNumber = sound; SoundPriority = s->priority; return 0; }