video(which folder, clip0, clip1, attributes, progressBar, priority)

From pinHeck Wiki
Jump to: navigation, search

Note: The 'progressBar' parameter is obsolete and should be left as a 0.

Example:

video('S', 'R', 'P', 0, 0, 255);

Plays file SRP.vid from folder DMD/_DS at top priority and does not allow numbers or graphics.

video('S', 'R', 'P', loopVideo, 0, 255);

Plays file SRP.vid from folder DMD/_DS at top priority and loops the video until told to do otherwise. Does not allow graphics.

video('S', 'R', 'P', loopVideo | allowSmall, 0, 255);

Plays file SRP.vid from folder DMD/_DS at top priority and loops the video. It also allows small numbers to be displayed.


A video, as defined by the pinHeck system, is a series of bitmaps stored as a single ".vid" file in the DMD folder of the SD card. For more information on creating video files, check the DMDTool page.

By default, the pinHeck system will display the score/ball or the attract mode. If you call video(x,x,x,x,x,x) it will immediately play that video and return to the default display when the video ends (unless video is set to loop)

The most important part of the Video command is the "attributes" parameter. This is an 8-bit value where each bit sets an attribute to that particular video clip. The attribute bits are:

-Defined Name - Which Bit - - Description -

loopVideo B10000000 //Should video start over after it ends?

preventRestart B01000000 //If video called is already playing, don't restart it (just let it keep playing)

noEntryFlush B00100000 //Do not flush graphics on video start (for instance, to have a number appear on an enqueued video)

noExitFlush B00010000 //Do not flush graphics on video end

allowBar B00000100 //Can show Progess Bar during a video?

allowLarge B00000010 //Can show large numbers on the video?

allowSmall B00000001 //Can show small numbers on the video?

allowAll B00000011 //Allow both large and small numbers on the video

manualStep B00001000 //Video frames must be advanced manually


The bit values are defined in the pins.h file for ease of use. They can be combined via the OR operator | for example, to loop a video and also allow large numbers:

video('S', 'R', 'P', loopVideo | allowSmall, 0, 255);

This sets both those bits in the video attribute. You could also use the decimal value of 1 for 'allowSmall' but using the predefined constants is easier for us humans.

loopVideo

Set the loopVideo bit to make the video loop continuously until video is stopped manually or another video clip is called. The priority is only valid for the first play through, once it loops priority is set to 0. This helps ensure old videos don't get "stuck on"


preventRestart

Prevents a video from restarting itself. Example: In AMH hitting the pops showing a woman waving her hand and a scrolling background. This is a 5 second animation. Every pop hit calls this animation at the same priority, which means it would normally keep starting over and the hand waving would look jerky.

By setting the preventRestart bit if a new video call tries to start the same video that's already playing, the new video call will be ignored.


noEntryFlush

When a video ends it also terminates any numbers / graphics drawn on it. Most of the time this is convenient, but there are some occasions where you will want to control this manaually.

Let's say you want to display this:

BIGFOOT MODE COMPLETE! (3 second video)

then a video saying

BIGFOOT MODE SCORE: (5 second video) (the score)

Your game kernel doesn't want to sit there timing this out, let the video processor do it! This is where the flush bits come in. Let's say we code this:

video('P', '9', 'Z', 0, 0, 255); //Show MODE WIN dialog, DON'T allow numbers!

numbers(0, numberFlash | 1, 255, 11, modeTotal); //Create number display of how many points we earned using graphic #0

videoQ('P', '9', 'V', allowAll, 0, 255); //Show MODE TOTAL dialog along with the score.


The first video will play, and the second queued video after that, but the numbers won't be there. Why? It's because when a video starts (and ends) it flushes the number/graphics display. To prevent this, do the following:

video('P', '9', 'Z', noExitFlush, 0, 255); //Show MODE WIN dialog, set bit to NOT flush numbers when video ends. So this video won't show a number, but it won't flush it either.

numbers(0, numberFlash | 1, 255, 11, modeTotal); //Set graphic #0 as how many points we scored. It won't show up on the first video since it doesn't allow numbers.

videoQ('P', '9', 'V', noEntryFlush | B00000011, 0, 255); //Show MODE TOTAL and DON'T flush numbers as video starts. The graphic #0 we set up will still be there and be properly displayed.

noExitFlush

Prevent graphics from being flushed when a video ends. Usually used along with noEntryFlush and enqueued videos, see above.


allowBar

Bit that says whether or not a progress bar / health bar can be displayed during a video. Only set this on videos you intend to draw a progress bar over. That way, if a progress bar video gets interrupted by another video, the progress bar won't mistakenly be drawn on the new video.

Example code for the Pop Bumpers advancing a progress bar:

video('B', 'A', 'A', allowBar | allowSmall | preventRestart, 0, 250); //Starts a video that allows a progress bar, small numbers and can't restart itself showProgressBar(4, 3, 12, 26, barProgress[player] * 4, 4); //Draws a progress bar on the current video

Check showProgressBar() for more information.


allowLarge

Video can display large numbers (usually for bonuses, mode totals, etc)


allowSmall

Video can display small numbers, usually for countdown timers in the corner, or "Get X More For Something". I almost always have "allowSmall" enabled on every video.


allowAll

Allows both sizes of numbers.


manualStep

Video frames must be advanced manually via the videoControl(x) command.