Merge pull request #38 from Brawmario/feature/more-mario-funcs

Add some more mario functions
This commit is contained in:
Jeremy Burns 2023-02-21 09:07:34 -07:00 committed by GitHub
commit 14b5d501f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View file

@ -430,6 +430,20 @@ SM64_LIB_FN void sm64_set_mario_forward_velocity(int32_t marioId, float vel)
gMarioState->forwardVel = vel;
}
SM64_LIB_FN void sm64_set_mario_invincibility(int32_t marioId, int16_t timer)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )
{
DEBUG_PRINT("Tried to use non-existant Mario with ID: %d", marioId);
return;
}
struct GlobalState *globalState = ((struct MarioInstance *)s_mario_instance_pool.objects[ marioId ])->globalState;
global_state_bind( globalState );
gMarioState->invincTimer = timer;
}
SM64_LIB_FN void sm64_set_mario_water_level(int32_t marioId, signed int level)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )
@ -458,6 +472,22 @@ SM64_LIB_FN void sm64_set_mario_gas_level(int32_t marioId, signed int level)
gMarioState->gasLevel = level;
}
SM64_LIB_FN void sm64_set_mario_health(int32_t marioId, uint16_t health)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )
{
DEBUG_PRINT("Tried to use non-existant Mario with ID: %d", marioId);
return;
}
struct GlobalState *globalState = ((struct MarioInstance *)s_mario_instance_pool.objects[ marioId ])->globalState;
global_state_bind( globalState );
gMarioState->health = health;
gMarioState->hurtCounter = 0;
gMarioState->healCounter = 0;
}
SM64_LIB_FN void sm64_mario_take_damage(int32_t marioId, uint32_t damage, uint32_t subtype, float x, float y, float z)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )
@ -553,6 +583,20 @@ SM64_LIB_FN void sm64_mario_interact_cap(int32_t marioId, uint32_t capFlag, uint
}
}
SM64_LIB_FN void sm64_mario_extend_cap(int32_t marioId, uint16_t capTime)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )
{
DEBUG_PRINT("Tried to use non-existant Mario with ID: %d", marioId);
return;
}
struct GlobalState *globalState = ((struct MarioInstance *)s_mario_instance_pool.objects[ marioId ])->globalState;
global_state_bind( globalState );
gMarioState->capTimer += capTime;
}
SM64_LIB_FN bool sm64_mario_attack(int32_t marioId, float x, float y, float z, float hitboxHeight)
{
if( marioId >= s_mario_instance_pool.size || s_mario_instance_pool.objects[marioId] == NULL )

View file

@ -160,12 +160,15 @@ extern SM64_LIB_FN void sm64_set_mario_angle(int32_t marioId, float x, float y,
extern SM64_LIB_FN void sm64_set_mario_faceangle(int32_t marioId, float y);
extern SM64_LIB_FN void sm64_set_mario_velocity(int32_t marioId, float x, float y, float z);
extern SM64_LIB_FN void sm64_set_mario_forward_velocity(int32_t marioId, float vel);
extern SM64_LIB_FN void sm64_set_mario_invincibility(int32_t marioId, int16_t timer);
extern SM64_LIB_FN void sm64_set_mario_water_level(int32_t marioId, signed int level);
extern SM64_LIB_FN void sm64_set_mario_gas_level(int32_t marioId, signed int level);
extern SM64_LIB_FN void sm64_set_mario_health(int32_t marioId, uint16_t health);
extern SM64_LIB_FN void sm64_mario_take_damage(int32_t marioId, uint32_t damage, uint32_t subtype, float x, float y, float z);
extern SM64_LIB_FN void sm64_mario_heal(int32_t marioId, uint8_t healCounter);
extern SM64_LIB_FN void sm64_mario_kill(int32_t marioId);
extern SM64_LIB_FN void sm64_mario_interact_cap(int32_t marioId, uint32_t capFlag, uint16_t capTime, uint8_t playMusic);
extern SM64_LIB_FN void sm64_mario_extend_cap(int32_t marioId, uint16_t capTime);
extern SM64_LIB_FN bool sm64_mario_attack(int32_t marioId, float x, float y, float z, float hitboxHeight);
extern SM64_LIB_FN uint32_t sm64_surface_object_create( const struct SM64SurfaceObject *surfaceObject );