Difference between revisions of "videoPage(whichPage, which folder, clip0, clip1, priority, vectorPage, vidCommand)"

From pinHeck Wiki
Jump to: navigation, search
Line 11: Line 11:
 
Select the folder and file to load.
 
Select the folder and file to load.
  
Example: videoPage(7, 'S', 'R', 'P', 255, 7, loadInt) loads DMD/_DS/SRP.vid
+
Example:
 +
videoPage(7, 'S', 'R', 'P', 255, 7, loadInt) loads DMD/_DS/SRP.vid
  
  
 
'''priority'''
 
'''priority'''
  
The interrupt priority of the page. Mostly used when using the one-shot "loadInt" vidCommand (see below)
+
The priority of the page. Any interrupting video (using the loadInt command) must have the same or higher priority level else it will not be shown. Set important mode/rule video priorities high, and less important things like slings and pops videos lower.
  
  
 
'''vectorPage'''
 
'''vectorPage'''
  
When the video ends, this is the page (0-7) the system will jump to. It can jump back to itself, or to other pages to create display loops.
+
This is the page (0-7) the system will jump to when the video ends. It can jump back to itself, or to other pages to create display loops. If two layers of video of different lengths are running, jump occurs when the shortest video ends. If video is running backwards, system jumps when the beginning of the file is reached.
  
Example: videoPage(0, 'S', 'R', 'P', 255, 0, loadNew) starts immediately and loops back to itself (repeats)
+
Example:
 +
videoPage(0, 'S', 'R', 'P', 255, 0, loadNew);
  
 +
Starts immediately and loops back to itself (repeats).
  
 +
Example:
 +
videoPage(1, 'S', 'R', 'A', 255, 2, loadNormal);
 +
videoPage(2, 'S', 'R', 'B', 255, 0, loadNormal);
 +
videoPage(0, 'S', 'R', 'C', 255, 1, loadNew);
  
'''Example:'''
+
Loads SRA into page 1, SRB into page 2, and SRC into page 0, with a command to start playing page 0.
 +
After Page 0 plays it vectors into page 1, which vectors into Page 2, which vectors back to page 0 completing the loop.
  
'''video(0, 'S', 'R', 'P', 255, 0, loadNew);'''
+
When setting up loops like this load in the first page last and include the loadNew command to start playback on that video.
  
Loads file SRP.vid from folder DMD/_DS at priority 255 (top) vectors back to page 0 when done (repeats) and
 
  
Plays file SRP.vid from folder DMD/_DS at top priority and does not allow numbers or graphics.
+
'''vidCommand'''
  
'''video('S', 'R', 'P', loopVideo, 0, 255);'''
+
Tells the system what to do with this page we just loaded into memory.
  
Plays file SRP.vid from folder DMD/_DS at top priority and loops the video until told to do otherwise. Does not allow graphics.
+
loadNormal  - Sets up a video page but doesn't run it yet. Use this to set up a video loop (perhaps 1-2 videos) and then use LoadNew for the final video to set it up and start the loop.
 +
loadNew     - Sets up video page and immediately loads it. Use this when you want to start a new loop.
 +
loadInt     - Use this command to interrupt a loop with a single video. Only runs if priority is higher or equal to priority of the video already playing. When this video ends, system returns back to the loop. You don't need to specify a vectorPage in this case.
 +
loadQueue  - If you need a few videos to go one after another, but you're not sure how many, use this command. (Not yet implemented)
  
'''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.
+
Example:
  
 +
videoPage(7, 'S', 'R', 'X', 200, 0, loadInt);
  
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.
+
If current video is priority 200 or lower, system runs file SRX on page 7, then returns back to previously playing loop. If an interrupt video is called while an interrupt video of the same filename/page is playing (such as successive pop bumper hits) the new calls will be ignored until the video finishes and goes back to the main loop.
 
+
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.
+

Revision as of 03:05, 18 October 2016

Loads a video page in memory with specified file and parameters.


whichPage

Which video page in memory the file should be loaded to, from 0-7.


folder, clip0, clip1

Select the folder and file to load.

Example: videoPage(7, 'S', 'R', 'P', 255, 7, loadInt) loads DMD/_DS/SRP.vid


priority

The priority of the page. Any interrupting video (using the loadInt command) must have the same or higher priority level else it will not be shown. Set important mode/rule video priorities high, and less important things like slings and pops videos lower.


vectorPage

This is the page (0-7) the system will jump to when the video ends. It can jump back to itself, or to other pages to create display loops. If two layers of video of different lengths are running, jump occurs when the shortest video ends. If video is running backwards, system jumps when the beginning of the file is reached.

Example: videoPage(0, 'S', 'R', 'P', 255, 0, loadNew);

Starts immediately and loops back to itself (repeats).

Example: videoPage(1, 'S', 'R', 'A', 255, 2, loadNormal); videoPage(2, 'S', 'R', 'B', 255, 0, loadNormal); videoPage(0, 'S', 'R', 'C', 255, 1, loadNew);

Loads SRA into page 1, SRB into page 2, and SRC into page 0, with a command to start playing page 0. After Page 0 plays it vectors into page 1, which vectors into Page 2, which vectors back to page 0 completing the loop.

When setting up loops like this load in the first page last and include the loadNew command to start playback on that video.


vidCommand

Tells the system what to do with this page we just loaded into memory.

loadNormal - Sets up a video page but doesn't run it yet. Use this to set up a video loop (perhaps 1-2 videos) and then use LoadNew for the final video to set it up and start the loop. loadNew - Sets up video page and immediately loads it. Use this when you want to start a new loop. loadInt - Use this command to interrupt a loop with a single video. Only runs if priority is higher or equal to priority of the video already playing. When this video ends, system returns back to the loop. You don't need to specify a vectorPage in this case. loadQueue - If you need a few videos to go one after another, but you're not sure how many, use this command. (Not yet implemented)


Example:

videoPage(7, 'S', 'R', 'X', 200, 0, loadInt);

If current video is priority 200 or lower, system runs file SRX on page 7, then returns back to previously playing loop. If an interrupt video is called while an interrupt video of the same filename/page is playing (such as successive pop bumper hits) the new calls will be ignored until the video finishes and goes back to the main loop.