mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Lay some groundwork for more documentation, fix compilation error, put backgrounds into enum
This commit is contained in:
		
							parent
							
								
									5d5147cb0e
								
							
						
					
					
						commit
						bf85d9f9d5
					
				
					 22 changed files with 121 additions and 78 deletions
				
			
		|  | @ -2721,38 +2721,30 @@ G_TEXRECTFLIP = 0xe5 | ||||||
| --- @type integer | --- @type integer | ||||||
| G_TEXRECT = 0xe4 | G_TEXRECT = 0xe4 | ||||||
| 
 | 
 | ||||||
| --- @type integer | BACKGROUND_OCEAN_SKY       =  0 --- @type SkyBackgroundParams | ||||||
| BACKGROUND_OCEAN_SKY = 0 | BACKGROUND_FLAMING_SKY     =  1 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_UNDERWATER_CITY =  2 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_BELOW_CLOUDS    =  3 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_SNOW_MOUNTAINS  =  4 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_DESERT          =  5 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_HAUNTED         =  6 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_GREEN_SKY       =  7 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_ABOVE_CLOUDS    =  8 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_PURPLE_SKY      =  9 --- @type SkyBackgroundParams | ||||||
|  | BACKGROUND_CUSTOM          = 10 --- @type SkyBackgroundParams | ||||||
| 
 | 
 | ||||||
| --- @type integer | --- @alias SkyBackgroundParams | ||||||
| BACKGROUND_FLAMING_SKY = 1 | --- | `BACKGROUND_OCEAN_SKY` | ||||||
| 
 | --- | `BACKGROUND_FLAMING_SKY` | ||||||
| --- @type integer | --- | `BACKGROUND_UNDERWATER_CITY` | ||||||
| BACKGROUND_UNDERWATER_CITY = 2 | --- | `BACKGROUND_BELOW_CLOUDS` | ||||||
| 
 | --- | `BACKGROUND_SNOW_MOUNTAINS` | ||||||
| --- @type integer | --- | `BACKGROUND_DESERT` | ||||||
| BACKGROUND_BELOW_CLOUDS = 3 | --- | `BACKGROUND_HAUNTED` | ||||||
| 
 | --- | `BACKGROUND_GREEN_SKY` | ||||||
| --- @type integer | --- | `BACKGROUND_ABOVE_CLOUDS` | ||||||
| BACKGROUND_SNOW_MOUNTAINS = 4 | --- | `BACKGROUND_PURPLE_SKY` | ||||||
| 
 | --- | `BACKGROUND_CUSTOM` | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_DESERT = 5 |  | ||||||
| 
 |  | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_HAUNTED = 6 |  | ||||||
| 
 |  | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_GREEN_SKY = 7 |  | ||||||
| 
 |  | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_ABOVE_CLOUDS = 8 |  | ||||||
| 
 |  | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_PURPLE_SKY = 9 |  | ||||||
| 
 |  | ||||||
| --- @type integer |  | ||||||
| BACKGROUND_CUSTOM = 10 |  | ||||||
| 
 | 
 | ||||||
| --- @type integer | --- @type integer | ||||||
| GRAPH_RENDER_ACTIVE = (1 << 0) | GRAPH_RENDER_ACTIVE = (1 << 0) | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| -- AUTOGENERATED FOR CODE EDITORS -- | -- AUTOGENERATED FOR CODE EDITORS -- | ||||||
| 
 | 
 | ||||||
| --- @param o Object | --- @param o Object | ||||||
| --- @return MarioSpawnType | --- @return integer | ||||||
| --- Derives a `MARIO_SPAWN_*` constant from `o` | --- Derives a `MARIO_SPAWN_*` constant from `o` | ||||||
| function get_mario_spawn_type(o) | function get_mario_spawn_type(o) | ||||||
|     -- ... |     -- ... | ||||||
|  | @ -5945,6 +5945,7 @@ end | ||||||
| --- @param airAction integer | --- @param airAction integer | ||||||
| --- @param animation integer | --- @param animation integer | ||||||
| --- @return integer | --- @return integer | ||||||
|  | --- Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. If the sliding slows enough, Mario transitions to a specified stopping action | ||||||
| function common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation) | function common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
|  | @ -5985,6 +5986,7 @@ end | ||||||
| --- @param endAction integer | --- @param endAction integer | ||||||
| --- @param airAction integer | --- @param airAction integer | ||||||
| --- @return integer | --- @return integer | ||||||
|  | --- Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground | ||||||
| function quicksand_jump_land_action(m, animation1, animation2, endAction, airAction) | function quicksand_jump_land_action(m, animation1, animation2, endAction, airAction) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
|  | @ -6006,24 +6008,28 @@ end | ||||||
| --- @param m MarioState | --- @param m MarioState | ||||||
| --- @param animation integer | --- @param animation integer | ||||||
| --- @param endAction integer | --- @param endAction integer | ||||||
|  | --- Performs a stationary step, sets `m`'s animation and sets action to `endAction` once the animation finishes | ||||||
| function animated_stationary_ground_step(m, animation, endAction) | function animated_stationary_ground_step(m, animation, endAction) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --- @param m MarioState | --- @param m MarioState | ||||||
| --- @return integer | --- @return integer | ||||||
|  | --- Updates Mario's punching state | ||||||
| function mario_update_punch_sequence(m) | function mario_update_punch_sequence(m) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --- @param m MarioState | --- @param m MarioState | ||||||
| --- @return integer | --- @return integer | ||||||
|  | --- Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action if Mario is dead | ||||||
| function check_common_object_cancels(m) | function check_common_object_cancels(m) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --- @param m MarioState | --- @param m MarioState | ||||||
| --- @return integer | --- @return integer | ||||||
|  | --- Executes Mario's current object action by first checking common object cancels, then updating quicksand state. Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc | ||||||
| function mario_execute_object_action(m) | function mario_execute_object_action(m) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
|  | @ -9757,7 +9763,7 @@ function set_fog_intensity(intensity) | ||||||
|     -- ... |     -- ... | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| --- @return integer | --- @return SkyBackgroundParams | ||||||
| --- Gets the current skybox | --- Gets the current skybox | ||||||
| function get_skybox() | function get_skybox() | ||||||
|     -- ... |     -- ... | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ | ||||||
| - [first_person_cam.h](#first_person_camh) | - [first_person_cam.h](#first_person_camh) | ||||||
| - [gbi.h](#gbih) | - [gbi.h](#gbih) | ||||||
| - [geo_commands.h](#geo_commandsh) | - [geo_commands.h](#geo_commandsh) | ||||||
|  |     - [enum SkyBackgroundParams](#enum-SkyBackgroundParams) | ||||||
| - [graph_node.h](#graph_nodeh) | - [graph_node.h](#graph_nodeh) | ||||||
| - [interaction.c](#interactionc) | - [interaction.c](#interactionc) | ||||||
| - [interaction.h](#interactionh) | - [interaction.h](#interactionh) | ||||||
|  | @ -1286,17 +1287,21 @@ | ||||||
| <br /> | <br /> | ||||||
| 
 | 
 | ||||||
| ## [geo_commands.h](#geo_commands.h) | ## [geo_commands.h](#geo_commands.h) | ||||||
| - BACKGROUND_OCEAN_SKY | 
 | ||||||
| - BACKGROUND_FLAMING_SKY | ### [enum SkyBackgroundParams](#SkyBackgroundParams) | ||||||
| - BACKGROUND_UNDERWATER_CITY | | Identifier | Value | | ||||||
| - BACKGROUND_BELOW_CLOUDS | | :--------- | :---- | | ||||||
| - BACKGROUND_SNOW_MOUNTAINS | | BACKGROUND_OCEAN_SKY | 0 | | ||||||
| - BACKGROUND_DESERT | | BACKGROUND_FLAMING_SKY | 1 | | ||||||
| - BACKGROUND_HAUNTED | | BACKGROUND_UNDERWATER_CITY | 2 | | ||||||
| - BACKGROUND_GREEN_SKY | | BACKGROUND_BELOW_CLOUDS | 3 | | ||||||
| - BACKGROUND_ABOVE_CLOUDS | | BACKGROUND_SNOW_MOUNTAINS | 4 | | ||||||
| - BACKGROUND_PURPLE_SKY | | BACKGROUND_DESERT | 5 | | ||||||
| - BACKGROUND_CUSTOM | | BACKGROUND_HAUNTED | 6 | | ||||||
|  | | BACKGROUND_GREEN_SKY | 7 | | ||||||
|  | | BACKGROUND_ABOVE_CLOUDS | 8 | | ||||||
|  | | BACKGROUND_PURPLE_SKY | 9 | | ||||||
|  | | BACKGROUND_CUSTOM | 10 | | ||||||
| 
 | 
 | ||||||
| [:arrow_up_small:](#) | [:arrow_up_small:](#) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3052,6 +3052,9 @@ Applies shared logic for sliding-related actions while playing sliding sounds, m | ||||||
| 
 | 
 | ||||||
| ## [common_slide_action_with_jump](#common_slide_action_with_jump) | ## [common_slide_action_with_jump](#common_slide_action_with_jump) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. If the sliding slows enough, Mario transitions to a specified stopping action | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation)` | `local integerValue = common_slide_action_with_jump(m, stopAction, jumpAction, airAction, animation)` | ||||||
| 
 | 
 | ||||||
|  | @ -3154,6 +3157,9 @@ Applies movement upon landing from a jump or fall. Adjusts velocity based on slo | ||||||
| 
 | 
 | ||||||
| ## [quicksand_jump_land_action](#quicksand_jump_land_action) | ## [quicksand_jump_land_action](#quicksand_jump_land_action) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = quicksand_jump_land_action(m, animation1, animation2, endAction, airAction)` | `local integerValue = quicksand_jump_land_action(m, animation1, animation2, endAction, airAction)` | ||||||
| 
 | 
 | ||||||
|  | @ -3230,6 +3236,9 @@ Executes Mario's current moving actions by: checking common cancellations (e.g., | ||||||
| 
 | 
 | ||||||
| ## [animated_stationary_ground_step](#animated_stationary_ground_step) | ## [animated_stationary_ground_step](#animated_stationary_ground_step) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Performs a stationary step, sets `m`'s animation and sets action to `endAction` once the animation finishes | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `animated_stationary_ground_step(m, animation, endAction)` | `animated_stationary_ground_step(m, animation, endAction)` | ||||||
| 
 | 
 | ||||||
|  | @ -3252,6 +3261,9 @@ Executes Mario's current moving actions by: checking common cancellations (e.g., | ||||||
| 
 | 
 | ||||||
| ## [mario_update_punch_sequence](#mario_update_punch_sequence) | ## [mario_update_punch_sequence](#mario_update_punch_sequence) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Updates Mario's punching state | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = mario_update_punch_sequence(m)` | `local integerValue = mario_update_punch_sequence(m)` | ||||||
| 
 | 
 | ||||||
|  | @ -3272,6 +3284,9 @@ Executes Mario's current moving actions by: checking common cancellations (e.g., | ||||||
| 
 | 
 | ||||||
| ## [check_common_object_cancels](#check_common_object_cancels) | ## [check_common_object_cancels](#check_common_object_cancels) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action if Mario is dead | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = check_common_object_cancels(m)` | `local integerValue = check_common_object_cancels(m)` | ||||||
| 
 | 
 | ||||||
|  | @ -3292,6 +3307,9 @@ Executes Mario's current moving actions by: checking common cancellations (e.g., | ||||||
| 
 | 
 | ||||||
| ## [mario_execute_object_action](#mario_execute_object_action) | ## [mario_execute_object_action](#mario_execute_object_action) | ||||||
| 
 | 
 | ||||||
|  | ### Description | ||||||
|  | Executes Mario's current object action by first checking common object cancels, then updating quicksand state. Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc | ||||||
|  | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = mario_execute_object_action(m)` | `local integerValue = mario_execute_object_action(m)` | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1709,16 +1709,16 @@ Sets the intensity of the fog (this value scales very quickly, 1.0 to 1.1 is a d | ||||||
| Gets the current skybox | Gets the current skybox | ||||||
| 
 | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local integerValue = get_skybox()` | `local enumValue = get_skybox()` | ||||||
| 
 | 
 | ||||||
| ### Parameters | ### Parameters | ||||||
| - None | - None | ||||||
| 
 | 
 | ||||||
| ### Returns | ### Returns | ||||||
| - `integer` | [enum SkyBackgroundParams](constants.md#enum-SkyBackgroundParams) | ||||||
| 
 | 
 | ||||||
| ### C Prototype | ### C Prototype | ||||||
| `s8 get_skybox(void);` | `enum SkyBackgroundParams get_skybox(void);` | ||||||
| 
 | 
 | ||||||
| [:arrow_up_small:](#) | [:arrow_up_small:](#) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2634,7 +2634,7 @@ N/A | ||||||
| Derives a `MARIO_SPAWN_*` constant from `o` | Derives a `MARIO_SPAWN_*` constant from `o` | ||||||
| 
 | 
 | ||||||
| ### Lua Example | ### Lua Example | ||||||
| `local enumValue = get_mario_spawn_type(o)` | `local integerValue = get_mario_spawn_type(o)` | ||||||
| 
 | 
 | ||||||
| ### Parameters | ### Parameters | ||||||
| | Field | Type | | | Field | Type | | ||||||
|  | @ -2642,10 +2642,10 @@ Derives a `MARIO_SPAWN_*` constant from `o` | ||||||
| | o | [Object](structs.md#Object) | | | o | [Object](structs.md#Object) | | ||||||
| 
 | 
 | ||||||
| ### Returns | ### Returns | ||||||
| [enum MarioSpawnType](constants.md#enum-MarioSpawnType) | - `integer` | ||||||
| 
 | 
 | ||||||
| ### C Prototype | ### C Prototype | ||||||
| `enum MarioSpawnType get_mario_spawn_type(struct Object *o);` | `u32 get_mario_spawn_type(struct Object *o);` | ||||||
| 
 | 
 | ||||||
| [:arrow_up_small:](#) | [:arrow_up_small:](#) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,17 +11,19 @@ | ||||||
| #include "game/mario_actions_cutscene.h" | #include "game/mario_actions_cutscene.h" | ||||||
| 
 | 
 | ||||||
| // sky background params
 | // sky background params
 | ||||||
| #define BACKGROUND_OCEAN_SKY        0 | enum SkyBackgroundParams { | ||||||
| #define BACKGROUND_FLAMING_SKY      1 |     BACKGROUND_OCEAN_SKY, | ||||||
| #define BACKGROUND_UNDERWATER_CITY  2 |     BACKGROUND_FLAMING_SKY, | ||||||
| #define BACKGROUND_BELOW_CLOUDS     3 |     BACKGROUND_UNDERWATER_CITY, | ||||||
| #define BACKGROUND_SNOW_MOUNTAINS   4 |     BACKGROUND_BELOW_CLOUDS, | ||||||
| #define BACKGROUND_DESERT           5 |     BACKGROUND_SNOW_MOUNTAINS, | ||||||
| #define BACKGROUND_HAUNTED          6 |     BACKGROUND_DESERT, | ||||||
| #define BACKGROUND_GREEN_SKY        7 |     BACKGROUND_HAUNTED, | ||||||
| #define BACKGROUND_ABOVE_CLOUDS     8 |     BACKGROUND_GREEN_SKY, | ||||||
| #define BACKGROUND_PURPLE_SKY       9 |     BACKGROUND_ABOVE_CLOUDS, | ||||||
| #define BACKGROUND_CUSTOM           10 |     BACKGROUND_PURPLE_SKY, | ||||||
|  |     BACKGROUND_CUSTOM | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| // geo layout macros
 | // geo layout macros
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| const GeoLayout rr_geo_000770[] = { | const GeoLayout rr_geo_000770[] = { | ||||||
|    GEO_CULLING_RADIUS(1500), |    GEO_CULLING_RADIUS(1500), | ||||||
|    GEO_OPEN_NODE(), |    GEO_OPEN_NODE(), | ||||||
|       GEO_DISPLAY_LIST(LAYER_TRANSPARENT, rr_seg7_dl_0700E830), |       GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, rr_seg7_dl_0700E830), | ||||||
|    GEO_CLOSE_NODE(), |    GEO_CLOSE_NODE(), | ||||||
|    GEO_END(), |    GEO_END(), | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| const GeoLayout rr_geo_0007E8[] = { | const GeoLayout rr_geo_0007E8[] = { | ||||||
|    GEO_CULLING_RADIUS(2500), |    GEO_CULLING_RADIUS(2500), | ||||||
|    GEO_OPEN_NODE(), |    GEO_OPEN_NODE(), | ||||||
|       GEO_DISPLAY_LIST(LAYER_TRANSPARENT, rr_seg7_dl_07015C68), |       GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, rr_seg7_dl_07015C68), | ||||||
|    GEO_CLOSE_NODE(), |    GEO_CLOSE_NODE(), | ||||||
|    GEO_END(), |    GEO_END(), | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| const GeoLayout rr_geo_000800[] = { | const GeoLayout rr_geo_000800[] = { | ||||||
|    GEO_CULLING_RADIUS(4500), |    GEO_CULLING_RADIUS(4500), | ||||||
|    GEO_OPEN_NODE(), |    GEO_OPEN_NODE(), | ||||||
|       GEO_DISPLAY_LIST(LAYER_TRANSPARENT, rr_seg7_dl_07017530), |       GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, rr_seg7_dl_07017530), | ||||||
|    GEO_CLOSE_NODE(), |    GEO_CLOSE_NODE(), | ||||||
|    GEO_END(), |    GEO_END(), | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| const GeoLayout rr_geo_000818[] = { | const GeoLayout rr_geo_000818[] = { | ||||||
|    GEO_CULLING_RADIUS(5000), |    GEO_CULLING_RADIUS(5000), | ||||||
|    GEO_OPEN_NODE(), |    GEO_OPEN_NODE(), | ||||||
|       GEO_DISPLAY_LIST(LAYER_TRANSPARENT, rr_seg7_dl_07018B58), |       GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, rr_seg7_dl_07018B58), | ||||||
|    GEO_CLOSE_NODE(), |    GEO_CLOSE_NODE(), | ||||||
|    GEO_END(), |    GEO_END(), | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ const GeoLayout thi_geo_000608[] = { | ||||||
|                GEO_DISPLAY_LIST(LAYER_OPAQUE, thi_seg7_dl_07005260), |                GEO_DISPLAY_LIST(LAYER_OPAQUE, thi_seg7_dl_07005260), | ||||||
|                GEO_DISPLAY_LIST(LAYER_OPAQUE, thi_seg7_dl_07006968), |                GEO_DISPLAY_LIST(LAYER_OPAQUE, thi_seg7_dl_07006968), | ||||||
|                GEO_DISPLAY_LIST(LAYER_ALPHA, thi_seg7_dl_07007008), |                GEO_DISPLAY_LIST(LAYER_ALPHA, thi_seg7_dl_07007008), | ||||||
|                GEO_DISPLAY_LIST(LAYER_TRANSPARENT, thi_seg7_dl_070072E8), |                GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, thi_seg7_dl_070072E8), | ||||||
|                GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, thi_seg7_dl_070073C0), |                GEO_DISPLAY_LIST(LAYER_TRANSPARENT_DECAL, thi_seg7_dl_070073C0), | ||||||
|                GEO_ASM(   0, geo_movtex_pause_control), |                GEO_ASM(   0, geo_movtex_pause_control), | ||||||
|                GEO_ASM(0x1301, geo_movtex_draw_water_regions), |                GEO_ASM(0x1301, geo_movtex_draw_water_regions), | ||||||
|  |  | ||||||
|  | @ -147,7 +147,7 @@ void print_intro_text(void) { | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| enum MarioSpawnType get_mario_spawn_type(struct Object *o) { | u32 get_mario_spawn_type(struct Object *o) { | ||||||
|     if (o == NULL || o->behavior == NULL) { return MARIO_SPAWN_NONE; } |     if (o == NULL || o->behavior == NULL) { return MARIO_SPAWN_NONE; } | ||||||
| 
 | 
 | ||||||
|     const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior); |     const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior); | ||||||
|  |  | ||||||
|  | @ -158,7 +158,7 @@ extern u8 gSpawnedStarHiddenCount; | ||||||
| void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e); | void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e); | ||||||
| void print_intro_text(void); | void print_intro_text(void); | ||||||
| /* |description|Derives a `MARIO_SPAWN_*` constant from `o`|descriptionEnd| */ | /* |description|Derives a `MARIO_SPAWN_*` constant from `o`|descriptionEnd| */ | ||||||
| enum MarioSpawnType get_mario_spawn_type(struct Object *o); | u32 get_mario_spawn_type(struct Object *o); | ||||||
| 
 | 
 | ||||||
| /* |description|
 | /* |description|
 | ||||||
| Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area. | Finds a warp node in the current area by its ID. The warp node must exist in the list of warp nodes for the current area. | ||||||
|  |  | ||||||
|  | @ -419,7 +419,7 @@ void init_mario_after_warp(void) { | ||||||
|     if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_any_warp_node(); } |     if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_any_warp_node(); } | ||||||
|     if (spawnNode == NULL || spawnNode->object == NULL) { return; } |     if (spawnNode == NULL || spawnNode->object == NULL) { return; } | ||||||
| 
 | 
 | ||||||
|     enum MarioSpawnType marioSpawnType = get_mario_spawn_type(spawnNode->object); |     u32 marioSpawnType = get_mario_spawn_type(spawnNode->object); | ||||||
| 
 | 
 | ||||||
|     if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) { |     if (gMarioState && gMarioState->action != ACT_UNINITIALIZED) { | ||||||
|         for (s32 i = 0; i < MAX_PLAYERS; i++) { |         for (s32 i = 0; i < MAX_PLAYERS; i++) { | ||||||
|  |  | ||||||
|  | @ -1574,8 +1574,7 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32 | ||||||
| Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. | Builds on `common_slide_action` by also allowing Mario to jump out of a slide if A is pressed after a short delay. | ||||||
| If the sliding slows enough, Mario transitions to a specified stopping action | If the sliding slows enough, Mario transitions to a specified stopping action | ||||||
| |descriptionEnd| */ | |descriptionEnd| */ | ||||||
| s32 common_slide_action_with_jump(struct MarioState *m, u32 stopAction, u32 jumpAction, u32 airAction, | s32 common_slide_action_with_jump(struct MarioState *m, u32 stopAction, u32 jumpAction, u32 airAction, s32 animation) { | ||||||
|                                   s32 animation) { |  | ||||||
|     if (!m) { return FALSE; } |     if (!m) { return FALSE; } | ||||||
|     if (m->actionTimer == 5) { |     if (m->actionTimer == 5) { | ||||||
|         if (m->input & INPUT_A_PRESSED) { |         if (m->input & INPUT_A_PRESSED) { | ||||||
|  | @ -2124,10 +2123,10 @@ s32 act_backflip_land(struct MarioState *m) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* |description|
 | /* |description|
 | ||||||
| Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground | Handles a special landing in quicksand after a jump. Over several frames, Mario emerges from the quicksand. | ||||||
|  | First part of the animation reduces his quicksand depth. Ends with a normal landing action or transitions back to air if he leaves the ground | ||||||
| |descriptionEnd| */ | |descriptionEnd| */ | ||||||
| s32 quicksand_jump_land_action(struct MarioState *m, s32 animation1, s32 animation2, u32 endAction, | s32 quicksand_jump_land_action(struct MarioState *m, s32 animation1, s32 animation2, u32 endAction, u32 airAction) { | ||||||
|                                u32 airAction) { |  | ||||||
|     if (!m) { return FALSE; } |     if (!m) { return FALSE; } | ||||||
|     if (m->actionTimer++ < 6) { |     if (m->actionTimer++ < 6) { | ||||||
|         m->quicksandDepth -= (7 - m->actionTimer) * 0.8f; |         m->quicksandDepth -= (7 - m->actionTimer) * 0.8f; | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ | ||||||
|  */ |  */ | ||||||
| s8 sPunchingForwardVelocities[8] = { 0, 1, 1, 2, 3, 5, 7, 10 }; | s8 sPunchingForwardVelocities[8] = { 0, 1, 1, 2, 3, 5, 7, 10 }; | ||||||
| 
 | 
 | ||||||
|  | /* |description|Performs a stationary step, sets `m`'s animation and sets action to `endAction` once the animation finishes|descriptionEnd| */ | ||||||
| void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction) { | void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction) { | ||||||
|     stationary_ground_step(m); |     stationary_ground_step(m); | ||||||
|     set_character_animation(m, animation); |     set_character_animation(m, animation); | ||||||
|  | @ -30,6 +31,7 @@ void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 en | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description|Updates Mario's punching state|descriptionEnd| */ | ||||||
| s32 mario_update_punch_sequence(struct MarioState *m) { | s32 mario_update_punch_sequence(struct MarioState *m) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     u32 endAction, crouchEndAction; |     u32 endAction, crouchEndAction; | ||||||
|  | @ -474,11 +476,16 @@ s32 act_releasing_bowser(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description|
 | ||||||
|  | Checks for and handles common conditions that would cancel Mario's current object action. This includes transitioning | ||||||
|  | to a water plunge if below the water level, becoming squished if appropriate, or switching to standing death action | ||||||
|  | if Mario is dead | ||||||
|  | |descriptionEnd| */ | ||||||
| s32 check_common_object_cancels(struct MarioState *m) { | s32 check_common_object_cancels(struct MarioState *m) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     if (m->playerIndex != 0) { return FALSE; } |     if (m->playerIndex != 0) { return FALSE; } | ||||||
| 
 | 
 | ||||||
|     if (m->pos[1] <  m->waterLevel - 100) { |     if (m->pos[1] < m->waterLevel - 100) { | ||||||
|         bool allow = true; |         bool allow = true; | ||||||
|         smlua_call_event_hooks_mario_param_and_bool_ret_bool(HOOK_ALLOW_FORCE_WATER_ACTION, m, false, &allow); |         smlua_call_event_hooks_mario_param_and_bool_ret_bool(HOOK_ALLOW_FORCE_WATER_ACTION, m, false, &allow); | ||||||
|         if (allow) { |         if (allow) { | ||||||
|  | @ -497,6 +504,10 @@ s32 check_common_object_cancels(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description|
 | ||||||
|  | Executes Mario's current object action by first checking common object cancels, then updating quicksand state. | ||||||
|  | Dispatches to the appropriate action function, such as punching, throwing, picking up Bowser, etc | ||||||
|  | |descriptionEnd| */ | ||||||
| s32 mario_execute_object_action(struct MarioState *m) { | s32 mario_execute_object_action(struct MarioState *m) { | ||||||
|     if (!m) { return FALSE; } |     if (!m) { return FALSE; } | ||||||
|     s32 cancel; |     s32 cancel; | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ | ||||||
| #include "pc/lua/smlua.h" | #include "pc/lua/smlua.h" | ||||||
| #include "hardcoded.h" | #include "hardcoded.h" | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 check_common_idle_cancels(struct MarioState *m) { | s32 check_common_idle_cancels(struct MarioState *m) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     mario_drop_held_object(m); |     mario_drop_held_object(m); | ||||||
|  | @ -65,6 +66,7 @@ s32 check_common_idle_cancels(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 check_common_hold_idle_cancels(struct MarioState *m) { | s32 check_common_hold_idle_cancels(struct MarioState *m) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     if (m->floor && m->floor->normal.y < 0.29237169f) { |     if (m->floor && m->floor->normal.y < 0.29237169f) { | ||||||
|  | @ -186,6 +188,7 @@ s32 act_idle(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound) { | void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound) { | ||||||
|     if (!m) { return; } |     if (!m) { return; } | ||||||
|     if (!m->marioObj) { return; } |     if (!m->marioObj) { return; } | ||||||
|  | @ -653,6 +656,7 @@ s32 act_hold_panting_unused(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| void stopping_step(struct MarioState *m, s32 animID, u32 action) { | void stopping_step(struct MarioState *m, s32 animID, u32 action) { | ||||||
|     stationary_ground_step(m); |     stationary_ground_step(m); | ||||||
|     set_character_animation(m, animID); |     set_character_animation(m, animID); | ||||||
|  | @ -876,6 +880,7 @@ s32 act_shockwave_bounce(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 landing_step(struct MarioState *m, s32 arg1, u32 action) { | s32 landing_step(struct MarioState *m, s32 arg1, u32 action) { | ||||||
|     stationary_ground_step(m); |     stationary_ground_step(m); | ||||||
|     set_character_animation(m, arg1); |     set_character_animation(m, arg1); | ||||||
|  | @ -885,6 +890,7 @@ s32 landing_step(struct MarioState *m, s32 arg1, u32 action) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 check_common_landing_cancels(struct MarioState *m, u32 action) { | s32 check_common_landing_cancels(struct MarioState *m, u32 action) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     if (m->input & INPUT_UNKNOWN_10) { |     if (m->input & INPUT_UNKNOWN_10) { | ||||||
|  | @ -1148,6 +1154,7 @@ s32 act_first_person(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 check_common_stationary_cancels(struct MarioState *m) { | s32 check_common_stationary_cancels(struct MarioState *m) { | ||||||
|     if (!m) { return 0; } |     if (!m) { return 0; } | ||||||
|     if (m->playerIndex != 0) { return FALSE; } |     if (m->playerIndex != 0) { return FALSE; } | ||||||
|  | @ -1179,6 +1186,7 @@ s32 check_common_stationary_cancels(struct MarioState *m) { | ||||||
|     return FALSE; |     return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* |description||descriptionEnd| */ | ||||||
| s32 mario_execute_stationary_action(struct MarioState *m) { | s32 mario_execute_stationary_action(struct MarioState *m) { | ||||||
|     if (!m) { return FALSE; } |     if (!m) { return FALSE; } | ||||||
|     s32 cancel; |     s32 cancel; | ||||||
|  |  | ||||||
|  | @ -703,6 +703,7 @@ struct PcDebug gPcDebug = { | ||||||
|         0x9A2269E87B26BE68, |         0x9A2269E87B26BE68, | ||||||
|         0x0E76DE227D813019, |         0x0E76DE227D813019, | ||||||
|         0x12ABA8362D430002, |         0x12ABA8362D430002, | ||||||
|  |         0x0BF8F9C076430007, | ||||||
|     }, |     }, | ||||||
|     .id = DEFAULT_ID, |     .id = DEFAULT_ID, | ||||||
|     .bhvOffset = /* 0x12 */ 0, |     .bhvOffset = /* 0x12 */ 0, | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| #define MIXER 0x3DCE3B097C30006 | #define MIXER 0x3DCE3B097C30006 | ||||||
| 
 | 
 | ||||||
| struct PcDebug { | struct PcDebug { | ||||||
|     u64 tags[16]; |     u64 tags[17]; | ||||||
|     u64 id; |     u64 id; | ||||||
|     u64 bhvOffset; |     u64 bhvOffset; | ||||||
|     s64 debugId; |     s64 debugId; | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ void set_fog_intensity(f32 intensity) { | ||||||
| 
 | 
 | ||||||
| ///
 | ///
 | ||||||
| 
 | 
 | ||||||
| s8 get_skybox(void) { | enum SkyBackgroundParams get_skybox(void) { | ||||||
|     if (gOverrideBackground != -1) { return gOverrideBackground; } |     if (gOverrideBackground != -1) { return gOverrideBackground; } | ||||||
|     return gReadOnlyBackground; |     return gReadOnlyBackground; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "pc/lua/smlua.h" | #include "pc/lua/smlua.h" | ||||||
| #include "types.h" | #include "types.h" | ||||||
|  | #include "geo_commands.h" | ||||||
| 
 | 
 | ||||||
| #define C0(cmd, pos, width) (((cmd)->words.w0 >> (pos)) & ((1U << width) - 1)) | #define C0(cmd, pos, width) (((cmd)->words.w0 >> (pos)) & ((1U << width) - 1)) | ||||||
| #define GFX_OP(cmd) C0(cmd, 24, 8) | #define GFX_OP(cmd) C0(cmd, 24, 8) | ||||||
|  | @ -47,7 +48,7 @@ f32 get_fog_intensity(void); | ||||||
| void set_fog_intensity(f32 intensity); | void set_fog_intensity(f32 intensity); | ||||||
| 
 | 
 | ||||||
| /* |description|Gets the current skybox|descriptionEnd| */ | /* |description|Gets the current skybox|descriptionEnd| */ | ||||||
| s8 get_skybox(void); | enum SkyBackgroundParams get_skybox(void); | ||||||
| /* |description|Sets the override skybox|descriptionEnd| */ | /* |description|Sets the override skybox|descriptionEnd| */ | ||||||
| void set_override_skybox(s8 background); | void set_override_skybox(s8 background); | ||||||
| /* |description|Gets a value of the global skybox color|descriptionEnd| */ | /* |description|Gets a value of the global skybox color|descriptionEnd| */ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Agent X
						Agent X