577
edits
(started the draft of object anatomy) |
No edit summary |
||
Line 4: | Line 4: | ||
==Anatomy of an Object Code== | ==Anatomy of an Object Code== | ||
===Initialization=== | ===Initialization=== | ||
To start the object initialization, the object is called via a Macro preset | To start the object initialization, the object is called via a Macro preset from the level script, which will prompt it initialization with the attached BehaviorScript. The BehaviorScript is then fetched in [https://github.com/n64decomp/sm64/blob/master/data/behavior_data.c data/behavior_data.c] to start initializaing the object.<br> | ||
''Note : The following order is not consistent over the whole code. The collision data for example is loaded at different point depending on the BehaviorScript in question. | ''Note : The following order is not consistent over the whole code. The collision data for example is loaded at different point depending on the BehaviorScript in question. | ||
===Set Object List=== | ===Set Object List=== | ||
Line 19: | Line 19: | ||
===Set Object Specific Values=== | ===Set Object Specific Values=== | ||
Set object specific values (Home, physic, drop to floor) - > [https://github.com/n64decomp/sm64/blob/master/src/engine/behavior_script.c src/engine/behavior_script.c] <br> | Set object specific values (Home, physic, drop to floor) - > [https://github.com/n64decomp/sm64/blob/master/src/engine/behavior_script.c src/engine/behavior_script.c] <br> | ||
For all object, multiple extra operation can and will be done, of which an exhaustive list can be found in [https://github.com/n64decomp/sm64/blob/master/src/engine/behavior_script.c src/engine/behavior_script.c]. The operation done for the Goomba BehaviorScript are: | |||
* Set the object's physics | |||
* Set the object's home | |||
* Drop the object to the floor | |||
===Call the Object-specific gameloop behavior=== | |||
There are two typically two types of behavior functions located in the behavior file of an object, which are located in [https://github.com/n64decomp/sm64/tree/master/src/game/behaviors src/game/behaviors]. The "initialization" function, which is typically run once when loading the objects. The "loop" function, on the other hand, is the behavior that will run on every processing frames. The main way to distinguish between them is that the latter is surrounded by "BEGIN_LOOP()" and "END_LOOP()" and always comes at the end of the BehaviorScript. | |||
edits