Fixed visual bug when both players are sliding

This commit is contained in:
MysterD 2020-08-12 19:14:35 -07:00
parent bdf269c262
commit 48f42d1873
8 changed files with 43 additions and 28 deletions

View file

@ -493,6 +493,9 @@
<ClCompile Include="..\actors\lakitu_enemy\model.inc.c" />
<ClCompile Include="..\actors\leaves\geo.inc.c" />
<ClCompile Include="..\actors\leaves\model.inc.c" />
<ClCompile Include="..\actors\luigi\geo.inc.c" />
<ClCompile Include="..\actors\luigi\geo2.inc.c" />
<ClCompile Include="..\actors\luigi\model.inc.c" />
<ClCompile Include="..\actors\mad_piano\anims\anim_05009A04.inc.c" />
<ClCompile Include="..\actors\mad_piano\anims\anim_05009AFC.inc.c" />
<ClCompile Include="..\actors\mad_piano\anims\data.inc.c" />

View file

@ -303,7 +303,7 @@ struct MarioAnimation
struct MarioState
{
/*0x00*/ u16 unk00;
/*0x00*/ u16 playerIndex;
/*0x02*/ u16 input;
/*0x04*/ u32 flags;
/*0x08*/ u32 particleFlags;

View file

@ -130,12 +130,14 @@ static s32 find_wall_collisions_from_list(struct SurfaceNode *surfaceNode,
}
// If Mario has a vanish cap, pass through the vanish cap wall.
if (gCurrentObject != NULL && gCurrentObject == gMarioObject
&& (gMarioState->flags & MARIO_VANISH_CAP)) {
for (int i = 0; i < MAX_PLAYERS; i++) {
if (gCurrentObject != NULL && gCurrentObject == gMarioStates[i].marioObj
&& (gMarioStates[i].flags & MARIO_VANISH_CAP)) {
continue;
}
}
}
}
//! (Wall Overlaps) Because this doesn't update the x and z local variables,
// multiple walls can push mario more than is required.

View file

@ -773,6 +773,7 @@ void load_object_collision_model(void) {
if (gCurrentObject->oDistanceToMario == 19000.0f) {
marioDist = dist_between_objects(gCurrentObject, gMarioObject);
}
// two-player hack
mario2Dist = dist_between_objects(gCurrentObject, gMario2Object);
// If the object collision is supposed to be loaded more than the

View file

@ -289,6 +289,7 @@ void mario_grab_used_object(struct MarioState *m) {
if (m->usedObj == NULL || m->usedObj->oHeldState == HELD_HELD) { return; }
if (m->heldObj == NULL) {
m->heldObj = m->usedObj;
// two-player hack
m->heldObj->heldByPlayerIndex = (m == &gMarioStates[0]) ? 0 : 1;
obj_set_held_state(m->heldObj, bhvCarrySomething3);
}
@ -709,6 +710,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
}
int get_invincibility_flag(struct MarioState *m) {
// two-player hack
return (m == &gMarioStates[0])
? INT_SUBTYPE_DELAY_INVINCIBILITY
: INT_SUBTYPE_DELAY_INVINCIBILITY_MARIO2;

View file

@ -1862,6 +1862,9 @@ void init_mario(void) {
if (isLocal && gMarioObject == NULL) { goto skippy; }
if (!isLocal && gMario2Object == NULL) { goto skippy; }
// two-player hack
gMarioState->playerIndex = isLocal ? 0 : 1;
Vec3s capPos;
struct Object *capObject;
@ -1898,6 +1901,7 @@ void init_mario(void) {
find_water_level(gMarioSpawnInfo->startPos[0], gMarioSpawnInfo->startPos[2]);
gMarioState->area = gCurrentArea;
// two-player hack
gMarioState->marioObj = isLocal ? gMarioObject : gMario2Object;
gMarioState->marioObj->header.gfx.unk38.animID = -1;
vec3s_copy(gMarioState->faceAngle, gMarioSpawnInfo->startAngle);
@ -1961,7 +1965,8 @@ skippy:
void init_mario_from_save_file(void) {
bool isLocal = (gMarioState == &gMarioStates[0]);
gMarioState->unk00 = isLocal ? 0 : 1;
// two-player hack
gMarioState->playerIndex = isLocal ? 0 : 1;
gMarioState->flags = 0;
gMarioState->action = 0;
int i = isLocal ? 0 : 1;

View file

@ -89,8 +89,8 @@ void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2) {
void align_with_floor(struct MarioState *m) {
m->pos[1] = m->floorHeight;
mtxf_align_terrain_triangle(sFloorAlignMatrix[m->unk00], m->pos, m->faceAngle[1], 40.0f);
m->marioObj->header.gfx.throwMatrix = &sFloorAlignMatrix[m->unk00];
mtxf_align_terrain_triangle(sFloorAlignMatrix[m->playerIndex], m->pos, m->faceAngle[1], 40.0f);
m->marioObj->header.gfx.throwMatrix = &sFloorAlignMatrix[m->playerIndex];
}
s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) {

View file

@ -30,6 +30,7 @@ void network_receive_player(struct Packet* p) {
u32 heldSyncID = NULL;
u32 heldBySyncID = NULL;
u16 playerIndex = gMarioStates[1].playerIndex;
packet_read(p, &gMarioStates[1], sizeof(u32) * 24);
packet_read(p, gMarioStates[1].controller, 20);
packet_read(p, &gMarioStates[1].marioObj->rawData.asU32, sizeof(u32) * 80);
@ -37,6 +38,7 @@ void network_receive_player(struct Packet* p) {
packet_read(p, &gMarioStates[1].marioObj->header.gfx.node.flags, sizeof(s16));
packet_read(p, &heldSyncID, sizeof(u32));
packet_read(p, &heldBySyncID, sizeof(u32));
gMarioStates[1].playerIndex = playerIndex;
if (heldSyncID != NULL && syncObjects[heldSyncID].o != NULL) {
// TODO: do we have to move graphics nodes around to make this visible?