jataka5000
New member
Hello!
I want to change which subroutine is used on the fly.
I have successfully created a "flag" variable that can be either #$01 or #$00, and I can make a small change in the way that a subroutine works. However, if I want to change a subroutine in several places, the game does not compile -- either I get a "branch out of range" error or "Routines\BASE_4_5\System\Vectors.asm(1): Value out of range." I suspect that I am breaking it because it doesn't want as many or as complex amount of branches as I have put in.
As an alternative, I'd like to have my flag variable allow one of two doHandlePhysics scripts to be called on the fly, depending on the state of the variable. Problem is I don't know where the doHandlePhysics routine is called each time as the code will loop through calling all the subroutines etc...
Note that this skill could be generalized to a variety of situations -- e.g. having a one-way scroller change to a two-way scroller, etc.
I picture modifying the code in a way like this:
Thank you for any insights on how I can accomplish executing more than one doHandlePhysics scripts!
-j5k
I want to change which subroutine is used on the fly.
I have successfully created a "flag" variable that can be either #$01 or #$00, and I can make a small change in the way that a subroutine works. However, if I want to change a subroutine in several places, the game does not compile -- either I get a "branch out of range" error or "Routines\BASE_4_5\System\Vectors.asm(1): Value out of range." I suspect that I am breaking it because it doesn't want as many or as complex amount of branches as I have put in.
As an alternative, I'd like to have my flag variable allow one of two doHandlePhysics scripts to be called on the fly, depending on the state of the variable. Problem is I don't know where the doHandlePhysics routine is called each time as the code will loop through calling all the subroutines etc...
Note that this skill could be generalized to a variety of situations -- e.g. having a one-way scroller change to a two-way scroller, etc.
I picture modifying the code in a way like this:
Code:
LDA myFlag
BNE doSecondSubroutine
[call for first subroutine, doHandlePhysics1]
JMP CarryOnWithProgram
doSecondSubroutine:
[call for second subroutine , doHandlePhysics2]
CarryOnWithProgram:
...
[rest of subroutine calls here]
...
Thank you for any insights on how I can accomplish executing more than one doHandlePhysics scripts!
-j5k