:(
This commit is contained in:
@@ -2093,10 +2093,11 @@ s32 execute_mario_action(UNUSED struct Object * o)
|
||||
* INITIALIZATION *
|
||||
**************************************************/
|
||||
|
||||
int init_mario(void)
|
||||
int init_mario(uint8_t isLocal)
|
||||
{
|
||||
//Vec3s capPos;
|
||||
//struct Object *capObject;
|
||||
gMarioState->isLocal = isLocal;
|
||||
|
||||
gMarioState->actionTimer = 0;
|
||||
gMarioState->framesSinceA = 0xFF;
|
||||
|
||||
@@ -90,7 +90,7 @@ s32 set_water_plunge_action(struct MarioState *m);
|
||||
|
||||
s32 execute_mario_action(UNUSED struct Object *o);
|
||||
|
||||
int init_mario(void);
|
||||
int init_mario(uint8_t isLocal);
|
||||
|
||||
void init_mario_from_save_file(void);
|
||||
|
||||
|
||||
@@ -34,38 +34,44 @@ static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
void add_tree_leaf_particles(struct MarioState *m)
|
||||
{
|
||||
// f32 leafHeight;
|
||||
f32 leafHeight;
|
||||
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||
|
||||
// if (m->usedObj->behavior == segmented_to_virtual(bhvTree)) {
|
||||
// // make leaf effect spawn higher on the Shifting Sand Land palm tree
|
||||
// if (gCurrLevelNum == LEVEL_SSL) {
|
||||
// leafHeight = 250.0f;
|
||||
// } else {
|
||||
// leafHeight = 100.0f;
|
||||
// }
|
||||
// if (m->pos[1] - m->floorHeight > leafHeight) {
|
||||
// m->particleFlags |= PARTICLE_LEAF;
|
||||
// }
|
||||
// }
|
||||
if (isOnTree) {
|
||||
// make leaf effect spawn higher on the Shifting Sand Land palm tree
|
||||
if (gCurrLevelNum == LEVEL_SSL) {
|
||||
leafHeight = 250.0f;
|
||||
} else {
|
||||
leafHeight = 100.0f;
|
||||
}
|
||||
if (m->pos[1] - m->floorHeight > leafHeight) {
|
||||
m->particleFlags |= PARTICLE_LEAF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void play_climbing_sounds(struct MarioState *m, s32 b)
|
||||
{
|
||||
// s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||
|
||||
// if (b == 1) {
|
||||
// if (is_anim_past_frame(m, 1)) {
|
||||
// play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
||||
// m->marioObj->header.gfx.cameraToObject);
|
||||
// }
|
||||
// } else {
|
||||
// play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
|
||||
// m->marioObj->header.gfx.cameraToObject);
|
||||
// }
|
||||
if (b == 1) {
|
||||
if (is_anim_past_frame(m, 1)) {
|
||||
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
} else {
|
||||
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
||||
{
|
||||
if (!m->isLocal && m->usedObj == NULL)
|
||||
{
|
||||
return POLE_NONE;
|
||||
}
|
||||
|
||||
UNUSED s32 unused1;
|
||||
UNUSED s32 unused2;
|
||||
UNUSED s32 unused3;
|
||||
@@ -95,6 +101,7 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
||||
}
|
||||
|
||||
f32 floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
||||
f32 floorHeight2 = find_floor(m->pos[0], m->pos[1] + 100, m->pos[2], &floor);
|
||||
if (m->pos[1] < floorHeight)
|
||||
{
|
||||
m->pos[1] = floorHeight;
|
||||
@@ -104,8 +111,17 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
||||
else if (marioObj->oMarioPolePos < -m->usedObj->hitboxDownOffset)
|
||||
{
|
||||
m->pos[1] = m->usedObj->oPosY - m->usedObj->hitboxDownOffset;
|
||||
set_mario_action(m, ACT_FREEFALL, 0);
|
||||
result = POLE_FELL_OFF;
|
||||
if (m->pos[1] < floorHeight2)
|
||||
{
|
||||
m->pos[1] = floorHeight2;
|
||||
set_mario_action(m, ACT_IDLE, 0);
|
||||
result = POLE_TOUCHED_FLOOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_action(m, ACT_FREEFALL, 0);
|
||||
result = POLE_FELL_OFF;
|
||||
}
|
||||
}
|
||||
else if (collided)
|
||||
{
|
||||
@@ -165,7 +181,12 @@ s32 act_holding_pole(struct MarioState *m)
|
||||
|
||||
if (poleStickY > 16.0f)
|
||||
{
|
||||
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
|
||||
f32 poleTop = m->pos[1] + 1000;
|
||||
|
||||
if (m->usedObj != NULL)
|
||||
{
|
||||
poleTop = m->usedObj->hitboxHeight - 100.0f;
|
||||
}
|
||||
// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
|
||||
|
||||
if (marioObj->oMarioPolePos < poleTop - 0.4f)
|
||||
|
||||
@@ -477,6 +477,7 @@ struct MarioState
|
||||
|
||||
u16 curTerrain; // libsm64: added field
|
||||
s32 gasLevel; // libsm64: added field
|
||||
uint8_t isLocal;
|
||||
};
|
||||
|
||||
#endif // TYPES_H
|
||||
|
||||
+2
-2
@@ -182,7 +182,7 @@ SM64_LIB_FN void sm64_static_surfaces_load(const struct SM64Surface *surfaceArra
|
||||
surfaces_load_static(surfaceArray, numSurfaces);
|
||||
}
|
||||
|
||||
SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z)
|
||||
SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z, uint8_t isLocal)
|
||||
{
|
||||
int32_t marioIndex = obj_pool_alloc_index(&s_mario_instance_pool, sizeof(struct MarioInstance));
|
||||
struct MarioInstance *newInstance = s_mario_instance_pool.objects[marioIndex];
|
||||
@@ -220,7 +220,7 @@ SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z)
|
||||
|
||||
init_mario_from_save_file();
|
||||
|
||||
if (init_mario() < 0)
|
||||
if (init_mario(isLocal) < 0)
|
||||
{
|
||||
sm64_mario_delete(marioIndex);
|
||||
return -1;
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ extern SM64_LIB_FN uint32_t sm64_audio_tick(uint32_t numQueuedSamples, uint32_t
|
||||
|
||||
extern SM64_LIB_FN void sm64_static_surfaces_load(const struct SM64Surface *surfaceArray, uint32_t numSurfaces);
|
||||
|
||||
extern SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z);
|
||||
extern SM64_LIB_FN int32_t sm64_mario_create(float x, float y, float z, uint8_t isLocal);
|
||||
|
||||
extern SM64_LIB_FN void sm64_mario_tick(int32_t marioId, const struct SM64MarioInputs *inputs, struct SM64MarioState *outState, struct SM64MarioGeometryBuffers *outBuffers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user