Separated animations between players

This commit is contained in:
MysterD 2020-07-30 18:09:47 -07:00
parent 6b3ab5f115
commit 0737d2e03f
11 changed files with 1906 additions and 19 deletions

View file

@ -16,6 +16,57 @@ extern const Gfx burn_smoke_seg4_dl_04022028[];
extern const Gfx burn_smoke_seg4_dl_04022048[];
extern const Gfx burn_smoke_seg4_dl_04022070[];
// luigi
extern const GeoLayout luigi_geo_face_and_wings[];
extern const GeoLayout luigi_geo_left_hand[];
extern const GeoLayout luigi_geo_right_hand[];
extern const GeoLayout luigi_geo_body[];
extern const GeoLayout luigi_geo_medium_poly_left_hand[];
extern const GeoLayout luigi_geo_medium_poly_right_hand[];
extern const GeoLayout luigi_geo_medium_poly_body[];
extern const GeoLayout luigi_geo_low_poly_face_and_wings[];
extern const GeoLayout luigi_geo_low_poly_left_hand[];
extern const GeoLayout luigi_geo_low_poly_right_hand[];
extern const GeoLayout luigi_geo_low_poly_body[];
extern const GeoLayout luigi_vanish_geo_face_and_wings[];
extern const GeoLayout luigi_vanish_geo_left_hand[];
extern const GeoLayout luigi_vanish_geo_right_hand[];
extern const GeoLayout luigi_vanish_geo_body[];
extern const GeoLayout luigi_vanish_geo_medium_poly_left_hand[];
extern const GeoLayout luigi_vanish_geo_medium_poly_right_hand[];
extern const GeoLayout luigi_vanish_geo_medium_poly_body[];
extern const GeoLayout luigi_vanish_geo_low_poly_face_and_wings[];
extern const GeoLayout luigi_vanish_geo_low_poly_left_hand[];
extern const GeoLayout luigi_vanish_geo_low_poly_right_hand[];
extern const GeoLayout luigi_vanish_geo_low_poly_body[];
extern const GeoLayout luigi_metal_geo_face_and_wings[];
extern const GeoLayout luigi_metal_geo_left_hand[];
extern const GeoLayout luigi_metal_geo_right_hand[];
extern const GeoLayout luigi_metal_geo_body[];
extern const GeoLayout luigi_metal_geo_medium_poly_left_hand[];
extern const GeoLayout luigi_metal_geo_medium_poly_right_hand[];
extern const GeoLayout luigi_metal_geo_medium_poly_body[];
extern const GeoLayout luigi_metal_geo_low_poly_face_and_wings[];
extern const GeoLayout luigi_metal_geo_low_poly_left_hand[];
extern const GeoLayout luigi_metal_geo_low_poly_right_hand[];
extern const GeoLayout luigi_metal_geo_low_poly_body[];
extern const GeoLayout luigi_metal_vanish_geo_face_and_wings[];
extern const GeoLayout luigi_metal_vanish_geo_left_hand[];
extern const GeoLayout luigi_metal_vanish_geo_right_hand[];
extern const GeoLayout luigi_metal_vanish_geo_body[];
extern const GeoLayout luigi_metal_vanish_geo_medium_poly_left_hand[];
extern const GeoLayout luigi_metal_vanish_geo_medium_poly_right_hand[];
extern const GeoLayout luigi_metal_vanish_geo_medium_poly_body[];
extern const GeoLayout luigi_metal_vanish_geo_low_poly_face_and_wings[];
extern const GeoLayout luigi_metal_vanish_geo_low_poly_left_hand[];
extern const GeoLayout luigi_metal_vanish_geo_low_poly_right_hand[];
extern const GeoLayout luigi_metal_vanish_geo_low_poly_body[];
extern const GeoLayout luigi_geo_load_body[];
extern const GeoLayout luigi_geo_load_medium_poly_body[];
extern const GeoLayout luigi_geo_load_low_poly_body[];
extern const GeoLayout luigi_geo_render_body[];
extern const GeoLayout luigi_geo[];
// mario
extern const GeoLayout mario_geo_face_and_wings[];
extern const GeoLayout mario_geo_left_hand[];

View file

@ -16,3 +16,4 @@
#include "water_splash/geo.inc.c"
#include "sparkle_animation/geo.inc.c"
#include "mario/geo.inc.c"
#include "mario/geo2.inc.c"

1825
actors/mario/geo2.inc.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@
/* Global models that are loaded for every level */
#define MODEL_MARIO 0x01 // mario_geo
#define MODEL_LUIGI 0x02 // unused
#define MODEL_LUIGI 0x02 // luigi_geo
/* Various static level geometry, the geo layout differs but terrain object presets treat them the same.*/

View file

@ -105,7 +105,7 @@ const LevelScript level_castle_grounds_entry[] = {
LOAD_RAW( /*seg*/ 0x0F, _common0_geoSegmentRomStart, _common0_geoSegmentRomEnd),
ALLOC_LEVEL_POOL(),
MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario),
LUIGI(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi),
LUIGI(/*model*/ MODEL_LUIGI, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi),
JUMP_LINK(script_func_global_1),
JUMP_LINK(script_func_global_11),
JUMP_LINK(script_func_global_16),

View file

@ -227,7 +227,7 @@ const LevelScript level_castle_inside_entry[] = {
LOAD_RAW( /*seg*/ 0x0D, _group15_geoSegmentRomStart, _group15_geoSegmentRomEnd),
ALLOC_LEVEL_POOL(),
MARIO(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000001, /*beh*/ bhvMario),
LUIGI(/*model*/ MODEL_MARIO, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi),
LUIGI(/*model*/ MODEL_LUIGI, /*behParam*/ 0x00000002, /*beh*/ bhvLuigi),
JUMP_LINK(script_func_global_16),
LOAD_MODEL_FROM_GEO(MODEL_CASTLE_BOWSER_TRAP, castle_geo_000F18),
LOAD_MODEL_FROM_GEO(MODEL_CASTLE_WATER_LEVEL_PILLAR, castle_geo_001940),

View file

@ -66,6 +66,7 @@ const LevelScript level_main_scripts_entry[] = {
LOAD_RAW( /*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
ALLOC_LEVEL_POOL(),
LOAD_MODEL_FROM_GEO(MODEL_MARIO, mario_geo),
LOAD_MODEL_FROM_GEO(MODEL_LUIGI, luigi_geo),
LOAD_MODEL_FROM_GEO(MODEL_SMOKE, smoke_geo),
LOAD_MODEL_FROM_GEO(MODEL_SPARKLES, sparkles_geo),
LOAD_MODEL_FROM_GEO(MODEL_BUBBLE, bubble_geo),

View file

@ -43,9 +43,9 @@ OSMesg D_80339CD4;
struct VblankHandler gGameVblankHandler;
uintptr_t gPhysicalFrameBuffers[3];
uintptr_t gPhysicalZBuffer;
void *D_80339CF0;
void *D_80339CF0[2];
void *D_80339CF4;
struct MarioAnimation D_80339D10;
struct MarioAnimation D_80339D10[2];
struct MarioAnimation gDemo;
UNUSED u8 filler80339D30[0x90];
@ -547,9 +547,11 @@ void setup_game_memory(void) {
gPhysicalFrameBuffers[0] = VIRTUAL_TO_PHYSICAL(gFrameBuffer0);
gPhysicalFrameBuffers[1] = VIRTUAL_TO_PHYSICAL(gFrameBuffer1);
gPhysicalFrameBuffers[2] = VIRTUAL_TO_PHYSICAL(gFrameBuffer2);
D_80339CF0 = main_pool_alloc(0x4000, MEMORY_POOL_LEFT);
set_segment_base_addr(17, (void *) D_80339CF0);
func_80278A78(&D_80339D10, gMarioAnims, D_80339CF0);
for (int i = 0; i < 2; i++) {
D_80339CF0[i] = main_pool_alloc(0x4000, MEMORY_POOL_LEFT);
set_segment_base_addr(17, (void *)D_80339CF0[i]);
func_80278A78(&D_80339D10[i], gMarioAnims, D_80339CF0[i]);
}
D_80339CF4 = main_pool_alloc(2048, MEMORY_POOL_LEFT);
set_segment_base_addr(24, (void *) D_80339CF4);
func_80278A78(&gDemo, gDemoInputs, D_80339CF4);

View file

@ -32,7 +32,7 @@ extern OSMesg D_80339CD4;
extern struct VblankHandler gGameVblankHandler;
extern uintptr_t gPhysicalFrameBuffers[3];
extern uintptr_t gPhysicalZBuffer;
extern void *D_80339CF0;
extern void *D_80339CF0[2];
extern void *D_80339CF4;
extern struct SPTask *gGfxSPTask;
extern Gfx *gDisplayListHead;
@ -51,7 +51,7 @@ extern struct DemoInput gRecordedDemoInput;
// this area is the demo input + the header. when the demo is loaded in, there is a header the size
// of a single word next to the input list. this word is the current ID count.
extern struct MarioAnimation D_80339D10;
extern struct MarioAnimation D_80339D10[2];
extern struct MarioAnimation gDemo;
extern u8 gMarioAnims[];

View file

@ -1276,6 +1276,9 @@ void debug_print_speed_action_normal(struct MarioState *m) {
* Update the button inputs for Mario.
*/
void update_mario_button_inputs(struct MarioState *m) {
// disable Luigi inputs
if (m != &gMarioStates[1]) { return; }
if (m->controller->buttonPressed & A_BUTTON) {
m->input |= INPUT_A_PRESSED;
}
@ -1316,6 +1319,9 @@ void update_mario_button_inputs(struct MarioState *m) {
* Updates the joystick intended magnitude.
*/
void update_mario_joystick_inputs(struct MarioState *m) {
// disable Luigi inputs
if (m != &gMarioStates[1]) { return; }
struct Controller *controller = m->controller;
f32 mag = ((controller->stickMag / 64.0f) * (controller->stickMag / 64.0f)) * 64.0f;
@ -1934,15 +1940,16 @@ skippy:
}
void init_mario_from_save_file(void) {
bool isMario = (gMarioState == &gMarioStates[0]);
gMarioState->unk00 = 0;
gMarioState->flags = 0;
gMarioState->action = 0;
int i = (gMarioState == &gMarioStates[0]) ? 0 : 1;
int i = isMario ? 0 : 1;
gMarioState->spawnInfo = &gPlayerSpawnInfos[i];
gMarioState->statusForCamera = &gPlayerCameraState[0];
gMarioState->statusForCamera = &gPlayerCameraState[i];
gMarioState->marioBodyState = &gBodyStates[i];
gMarioState->controller = &gControllers[0];
gMarioState->animation = &D_80339D10;
gMarioState->animation = &D_80339D10[i];
gMarioState->numCoins = 0;
gMarioState->numStars =
@ -1958,7 +1965,7 @@ void init_mario_from_save_file(void) {
gHudDisplay.coins = 0;
gHudDisplay.wedges = 8;
if (gMarioState == &gMarioStates[0]) {
if (isMario) {
gMarioState = &gMarioStates[1];
init_mario_from_save_file();
gMarioState = &gMarioStates[0];

View file

@ -430,14 +430,14 @@ Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat
*/
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
struct MarioBodyState *bodyState = &gBodyStates[0];
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases >> 1];
if (callContext == GEO_CONTEXT_RENDER) {
if (bodyState->handState == MARIO_HAND_FISTS) {
// switch between fists (0) and open (1)
switchCase->selectedCase = ((bodyState->action & ACT_FLAG_SWIMMING_OR_FLYING) != 0);
} else {
if (switchCase->numCases == 0) {
if ((switchCase->numCases & 0x01) == 0) {
switchCase->selectedCase =
(bodyState->handState < 5) ? bodyState->handState : MARIO_HAND_OPEN;
} else {
@ -461,17 +461,17 @@ Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED
static s16 sMarioAttackAnimCounter = 0;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
struct GraphNodeScale *scaleNode = (struct GraphNodeScale *) node->next;
struct MarioBodyState *bodyState = &gBodyStates[0];
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter >> 2];
if (callContext == GEO_CONTEXT_RENDER) {
scaleNode->scale = 1.0f;
if (asGenerated->parameter == bodyState->punchState >> 6) {
if ((asGenerated->parameter & 0x03) == bodyState->punchState >> 6) {
if (sMarioAttackAnimCounter != gAreaUpdateCounter && (bodyState->punchState & 0x3F) > 0) {
bodyState->punchState -= 1;
sMarioAttackAnimCounter = gAreaUpdateCounter;
}
scaleNode->scale =
gMarioAttackScaleAnimation[asGenerated->parameter * 6 + (bodyState->punchState & 0x3F)]
gMarioAttackScaleAnimation[(asGenerated->parameter & 0x03) * 6 + (bodyState->punchState & 0x3F)]
/ 10.0f;
}
}