// *********************************************************************************** // Program written by B. Swan - BURROWINGGERBIL@HOTMAIL.COM // *********************************************************************************** // *********************************************************************************** // Change the graphics on animating blocks // *********************************************************************************** void AnimateScenery() { u_short tTemp; for (tTemp = 1; tTemp<4; tTemp++) { LevelBlocks[tTemp].v = 15 - (LevelXReal) % 8 * 2; } for (tTemp = 0; tTemp<16; tTemp++) { LevelBlocks[tTemp + 100].u = ((tTemp % 4) * 16) + (short) (SIN[((Counter * 12) % 360)] * 7 + 7); } } // *********************************************************************************** // Collision detection routine // *********************************************************************************** u_short Hit(short x1, short y1, short w1, short h1, short x2, short y2, short w2, short h2) { if ((x2 > x1 - w2) && (x2 < x1 + w1) && (y2 > y1 - h2) && (y2 < y1 + h1)) { return 1; } else { return 0; } } // *********************************************************************************** // Play a given sample // *********************************************************************************** void PlaySound(u_short tS, u_short tVol, u_short tX) { short tTemp1, tTemp2; // Set stereo volume GetVolume(tVol, tX, &tTemp1, &tTemp2); tTemp1 = SsUtKeyOn(VBRet, tS, 0, 48, 0, tTemp1, tTemp2); } // *********************************************************************************** // Play back sample // *********************************************************************************** short PlayBackSound() { short tTemp1; tTemp1 = SsUtKeyOn(VBRet, 6, 0, 48, 0, 63, 63); return tTemp1; } // *********************************************************************************** // Calculate and return stereo volumes // *********************************************************************************** void GetVolume(u_short tVol, u_short tX, short *tLeft, short *tRight) { short tTemp1, tTemp2; tX = MIN(MAX(tX, 0), 319); tTemp1 = (319 - tX) * tVol / 320; tTemp2 = tX * tVol / 320; *tLeft = tTemp1; *tRight = tTemp2; }