From a6d62b57345cdfea030d0aed0f06932f8c2ce35e Mon Sep 17 00:00:00 2001 From: gheskett Date: Wed, 6 Oct 2021 02:18:25 -0400 Subject: [PATCH] Game now boots, Floomba still not visible --- data/behavior_data.c | 15 +++++++++++++++ include/behavior_data.h | 3 +++ include/config.h | 3 --- levels/intro/script.c | 32 +++++++++++++++++++++++++++++++- src/game/obj_behaviors_2.c | 5 +++++ 5 files changed, 54 insertions(+), 4 deletions(-) diff --git a/data/behavior_data.c b/data/behavior_data.c index 3b8451c28..4154b98ce 100644 --- a/data/behavior_data.c +++ b/data/behavior_data.c @@ -5079,6 +5079,21 @@ const BehaviorScript bhvFloomba[] = { GOTO(bhvGoomba + 1), }; +#ifdef HD_INTRO_TEXTURES +const BehaviorScript bhvFloombaStartup[] = { + BEGIN(OBJ_LIST_PUSHABLE), + SET_INT(oIsFloomba, 1), + SET_FLOAT(oDrawingDistance, 20000), + OR_INT(oFlags, OBJ_FLAG_ACTIVE_FROM_AFAR), + LOAD_ANIMATIONS(oAnimations, goomba_seg8_anims_0801DA4C), + SET_HOME(), + CALL_NATIVE(bhv_goomba_init), + BEGIN_LOOP(), + CALL_NATIVE(bhv_goomba_update), + END_LOOP(), +}; +#endif + const BehaviorScript bhvFloombaTripletSpawner[] = { BEGIN(OBJ_LIST_PUSHABLE), SET_INT(oIsFloomba, 1), diff --git a/include/behavior_data.h b/include/behavior_data.h index 8ee7de331..056bc07d6 100644 --- a/include/behavior_data.h +++ b/include/behavior_data.h @@ -449,6 +449,9 @@ extern const BehaviorScript bhvGoomba[]; extern const BehaviorScript bhvGoombaTripletSpawner[]; #ifdef FLOOMBAS extern const BehaviorScript bhvFloomba[]; +#ifdef HD_INTRO_TEXTURES +extern const BehaviorScript bhvFloombaStartup[]; +#endif extern const BehaviorScript bhvFloombaTripletSpawner[]; #endif extern const BehaviorScript bhvChainChomp[]; diff --git a/include/config.h b/include/config.h index 78368fe44..2dcfec49e 100644 --- a/include/config.h +++ b/include/config.h @@ -279,6 +279,3 @@ #undef GODDARD_EASTER_EGG #define DISABLE_DEMO #endif -#if defined(HD_INTRO_TEXTURES) && !defined(FLOOMBAS) -#define FLOOMBAS -#endif diff --git a/levels/intro/script.c b/levels/intro/script.c index 0b41fb74b..74cf6105e 100644 --- a/levels/intro/script.c +++ b/levels/intro/script.c @@ -23,6 +23,8 @@ #include "config.h" #include "game/print.h" +#include "game/object_list_processor.h" + const LevelScript level_intro_splash_screen[] = { INIT_LEVEL(), #ifdef SKIP_TITLE_SCREEN @@ -31,12 +33,39 @@ const LevelScript level_intro_splash_screen[] = { FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), LOAD_YAY0(/*seg*/ 0x07, _intro_segment_7SegmentRomStart, _intro_segment_7SegmentRomEnd), +#if defined(HD_INTRO_TEXTURES) && defined(FLOOMBAS) + LOAD_YAY0( /*seg*/ 0x08, _common0_yay0SegmentRomStart, _common0_yay0SegmentRomEnd), + LOAD_RAW( /*seg*/ 0x0F, _common0_geoSegmentRomStart, _common0_geoSegmentRomEnd), // Load "Super Mario 64" logo ALLOC_LEVEL_POOL(), LOAD_MODEL_FROM_GEO(MODEL_GOOMBA, goomba_geo), AREA(/*index*/ 1, intro_geo_splash_screen), - OBJECT(/*model*/ MODEL_GOOMBA, /*pos*/ 0, 0, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00010000, /*beh*/ bhvFloomba), + OBJECT(/*model*/ MODEL_GOOMBA, /*pos*/ 0, 0, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00010000, /*beh*/ bhvFloombaStartup), + END_AREA(), + FREE_LEVEL_POOL(), + + // Start animation + LOAD_AREA(/*area*/ 1), + + CALL(/*arg*/ LVL_INTRO_PLAY_ITS_A_ME_MARIO, /*func*/ lvl_intro_update), + CALL(/*arg*/ 0, /*func*/ load_mario_area), + // CALL(/*arg*/ 0, /*func*/ lvl_init_or_update), + // CALL_LOOP(/*arg*/ 1, /*func*/ lvl_init_or_update), + + JUMP_LINK_PUSH_ARG(75), + CALL(/*arg*/ 0, /*func*/ update_objects), + SLEEP(/*frames*/ 1), + JUMP_N_TIMES(), + TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), + JUMP_LINK_PUSH_ARG(16), + CALL(/*arg*/ 0, /*func*/ update_objects), + SLEEP(/*frames*/ 1), + JUMP_N_TIMES(), +#else + // Load "Super Mario 64" logo + ALLOC_LEVEL_POOL(), + AREA(/*index*/ 1, intro_geo_splash_screen), END_AREA(), FREE_LEVEL_POOL(), @@ -47,6 +76,7 @@ const LevelScript level_intro_splash_screen[] = { SLEEP(/*frames*/ 75), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 16), +#endif CMD2A(/*unk2*/ 1), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), diff --git a/src/game/obj_behaviors_2.c b/src/game/obj_behaviors_2.c index 561aaa090..d4e64a5d5 100644 --- a/src/game/obj_behaviors_2.c +++ b/src/game/obj_behaviors_2.c @@ -787,6 +787,11 @@ static void treat_far_home_as_mario(f32 threshold) { o->oAngleToMario = atan2s(d[2], d[0]); o->oDistanceToMario = 25000.0f; } else { + if (!gMarioObject) { + o->oDistanceToMario = 20000.0f; + return; + } + vec3_diff(d, &o->oHomeVec, &gMarioObject->oPosVec); distance = vec3_sumsq(d);