Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //needed vars (array indices)
- //int carframe -- a 60 frame timer.
- //These are based on LINK's X, Y, and DIR; so we do not store them separately.
- //cardir, x, y,
- //needed constants
- //Link Misc[]
- const int LINK_MISC_ENGINEFLAGS
- const int LM_MINECAR = 0x10;
- void SetMinecarMode(bool enable)
- {
- if ( enable ) Link->Misc[LINK_MISC_ENGINEFLAGS] |= LM_MINECAR;
- else Link->Misc[LINK_MISC_ENGINEFLAGS] &= ~LM_MINECAR;
- }
- bool LinkInMinecar(){ return (Link->Misc[LINK_MISC_ENGINEFLAGS]&LM_MINECAR);}
- //flags for track, branch, dock --can use raft types for these,
- //and they should be on layer 1 so that they can
- //be permanantly changed
- const int FLAG_MINECAR_DOCK
- const int FLAG_MINECAR_PATH
- const int FLAG_MINECAR_BRANCH
- //tiles
- const int TILE_MINECAR_EMPTY_UP
- const int TILE_MINECAR_EMPTY_DOWN
- const int TILE_MINECAR_EMPTY_LEFT
- const int TILE_MINECAR_EMPTY_RIGHT
- const int TILE_MINECAR_LINK_UP
- const int TILE_MINECAR_LINK_DOWN
- const int TILE_MINECAR_LINK_LEFT
- const int TILE_MINECAR_LINK_RIGHT
- //sounds
- const int SFX_MINECAR_TRACK
- const int SFX_MINECAR_STOP
- //layers
- const int LAYER_MINECAR_FLAGS
- const int LAYER_MINECAR_DRAWS
- //combos for diretional changes
- const int CMB_MINECAR_CHANGEDIR_UP
- const int CMB_MINECAR_CHANGEDIR_DOWN
- const int CMB_MINECAR_CHANGEDIR_LEFT
- const int CMB_MINECAR_CHANGEDIR_RIGHT
- //function to read branching paths -- read the current combo position, and if it is a branch type
- //! check AdjacentCombo UDLR to see which branches are legal.
- int IsMineCarBranch(){}
- int IsMinecarUpBranch(){}
- int IsMinecarDownBranch(){}
- int IsMinecarLeftBranch(){}
- int IsMinecarRightBranch(){}
- //Sources
- // Add invisibility and invincibility sources from the minecar
- // to the global function that fetermines of Link is invinciblwe, or not drawn.
- //GLOBAL CONDITIONS
- //if there is a minecar flag on the screen
- //draw empty minecar tile to screen over its flag
- //if Link is over the minecar
- //if link presses a
- //put Link in minecar mode, setting a flag in Link->Misc[]
- //whenever that flag is true, we make Link invisible, and draw a minecar at
- //his position, based on his direction and coordinates, om the DRAW layer
- //change the car flag on layer 1 to car_inuse so that it doesn't respawn
- //decrement carframe counter unless it is 0
- //if it is 0, reset it
- //make link invisible --set the global source, **NOT** direct writes to Link->Invisible
- //make link invincible --set the global source, **NOT** direct writes to Link->CollDetection
- //draw tile of minecar holding Link to Link's x/y
- //draw other minecars on the screen based on screen flags that show a landed car at a dock
- //! We know which these are, because they are not at Link's position.
- //! Link riding a minecar clears the screen flag on layer 1 that causes an empty
- //! car to be drawn; so these are only drawn to docked cars and we draw Link inside
- //! a monecar when LinkInMinecar() evaluates true.
- //move minecar along track
- //! We do this by moving Link, rather than the car. The car is always drawn to Links position
- // based on his direction.
- //if there is an intersection
- //if Link is holding a directional button
- //change the track
- //if we are in minecar mode, and moving
- //determine car direction
- //! Read for combos that change the direction here
- //update tile based on dir
- //follow track based on flags
- //if we are changing tracks, do that now
- //otherwise, follow the track until we reach an end pad flag
- //based on dir and carframe timer for movement
- //play the track noise every n frames based on carframe
- //minecar stops moving
- //minecar mode ends
- //if the car is over a landing pad, hop Link out of the car
- //UNSET link invisible --unset the global source, **NOT** direct writes to Link->Invisible
- //UNSET link invincible --unset the global source, **NOT** direct writes to Link->CollDetection
- //make a minecar flag on layer 1 of the screen where it stops
- //so that it remains there until we reset it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement