You know how Recca has these swaying background effects? I was thinking of creating a code that easily lets you create those effects. Because I want to have it in general use for everyone, it'd be good to have more than one people to create (and later optimize) the code. This will be for MMC3 mapper, but can be later modified to be used with other mappers with scanline IRQ.
My current plan is to use only one IRQ routine and NMI to set up the IRQ request if a flag is set for that. The IRQ routine checks bunch of variables like:
Using these variables the IRQ routine knows how to handle the swaying. One other function would be that you can choose what to do when you reach the end of the swaying table. Possible options would be either loop, stop or load new swaying table. This would allow start and end swaying to make the transition between non-swaying and swaying background look smoother.
Here is a pseudo code of the current plan:
Any additional ideas and things to consider would be appreciated. Currently the other splits will "trace" the previous split's position, but I still need to figure out how to do that.
My current plan is to use only one IRQ routine and NMI to set up the IRQ request if a flag is set for that. The IRQ routine checks bunch of variables like:
- - first split scanline
- split increment
- amount of splits to create
- offset in the swaying table
- address where the swaying table is located
- swaying table length
- swaying mode
Using these variables the IRQ routine knows how to handle the swaying. One other function would be that you can choose what to do when you reach the end of the swaying table. Possible options would be either loop, stop or load new swaying table. This would allow start and end swaying to make the transition between non-swaying and swaying background look smoother.
Here is a pseudo code of the current plan:
Code:
; in game code
Setup variables and enable swaying
; in NMI
Reload IRQ with the $C000, $C001, $E000 and $E001 if swaying is enables
; in IRQ
Acknowledge IRQ
Read swaying table offset and move scroll after split to that position
Decrement split count
If split count == 0 -> RTI
Compare swaying table offset with table length
If equal -> check swaying mode for next action
If not equal set up next IRQ and exit
Setup variables and enable swaying
; in NMI
Reload IRQ with the $C000, $C001, $E000 and $E001 if swaying is enables
; in IRQ
Acknowledge IRQ
Read swaying table offset and move scroll after split to that position
Decrement split count
If split count == 0 -> RTI
Compare swaying table offset with table length
If equal -> check swaying mode for next action
If not equal set up next IRQ and exit
Any additional ideas and things to consider would be appreciated. Currently the other splits will "trace" the previous split's position, but I still need to figure out how to do that.